From 55fa0532a2f45d7e3acdf79e8d2d7e6d5097a7b0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 23 Jun 2022 02:27:43 +0200 Subject: [PATCH] Add ESLint --- .eslintrc.json | 16 + node_modules/.bin/acorn | 1 + node_modules/.bin/eslint | 1 + node_modules/.bin/js-yaml | 1 + node_modules/.bin/json5 | 1 + node_modules/.bin/node-which | 1 + node_modules/.bin/resolve | 1 + node_modules/.bin/rimraf | 1 + node_modules/.bin/semver | 1 + node_modules/.package-lock.json | 1709 ++++ node_modules/@eslint/eslintrc/LICENSE | 19 + node_modules/@eslint/eslintrc/README.md | 61 + .../@eslint/eslintrc/conf/config-schema.js | 79 + .../@eslint/eslintrc/conf/environments.js | 203 + .../eslintrc/dist/eslintrc-universal.cjs | 1092 +++ .../eslintrc/dist/eslintrc-universal.cjs.map | 1 + .../@eslint/eslintrc/dist/eslintrc.cjs | 4295 ++++++++++ .../@eslint/eslintrc/dist/eslintrc.cjs.map | 1 + .../lib/cascading-config-array-factory.js | 533 ++ .../eslintrc/lib/config-array-factory.js | 1133 +++ .../eslintrc/lib/config-array/config-array.js | 523 ++ .../lib/config-array/config-dependency.js | 115 + .../lib/config-array/extracted-config.js | 145 + .../lib/config-array/ignore-pattern.js | 238 + .../eslintrc/lib/config-array/index.js | 19 + .../lib/config-array/override-tester.js | 225 + .../@eslint/eslintrc/lib/flat-compat.js | 307 + .../@eslint/eslintrc/lib/index-universal.js | 29 + node_modules/@eslint/eslintrc/lib/index.js | 56 + .../@eslint/eslintrc/lib/shared/ajv.js | 191 + .../@eslint/eslintrc/lib/shared/config-ops.js | 135 + .../eslintrc/lib/shared/config-validator.js | 325 + .../lib/shared/deprecation-warnings.js | 63 + .../@eslint/eslintrc/lib/shared/naming.js | 96 + .../lib/shared/relative-module-resolver.js | 42 + .../@eslint/eslintrc/lib/shared/types.js | 149 + .../eslintrc/node_modules/debug/LICENSE | 20 + .../eslintrc/node_modules/debug/README.md | 481 ++ .../eslintrc/node_modules/debug/package.json | 59 + .../node_modules/debug/src/browser.js | 269 + .../eslintrc/node_modules/debug/src/common.js | 274 + .../eslintrc/node_modules/debug/src/index.js | 10 + .../eslintrc/node_modules/debug/src/node.js | 263 + .../@eslint/eslintrc/node_modules/ms/index.js | 162 + .../eslintrc/node_modules/ms/license.md | 21 + .../eslintrc/node_modules/ms/package.json | 37 + .../eslintrc/node_modules/ms/readme.md | 60 + node_modules/@eslint/eslintrc/package.json | 81 + node_modules/@eslint/eslintrc/universal.js | 9 + .../@humanwhocodes/config-array/CHANGELOG.md | 71 + .../@humanwhocodes/config-array/LICENSE | 201 + .../@humanwhocodes/config-array/README.md | 301 + .../@humanwhocodes/config-array/api.js | 695 ++ .../config-array/node_modules/debug/LICENSE | 20 + .../config-array/node_modules/debug/README.md | 481 ++ .../node_modules/debug/package.json | 59 + .../node_modules/debug/src/browser.js | 269 + .../node_modules/debug/src/common.js | 274 + .../node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/node.js | 263 + .../config-array/node_modules/ms/index.js | 162 + .../config-array/node_modules/ms/license.md | 21 + .../config-array/node_modules/ms/package.json | 37 + .../config-array/node_modules/ms/readme.md | 60 + .../@humanwhocodes/config-array/package.json | 61 + .../@humanwhocodes/object-schema/.eslintrc.js | 29 + .../.github/workflows/nodejs-test.yml | 27 + .../.github/workflows/release-please.yml | 39 + .../@humanwhocodes/object-schema/CHANGELOG.md | 8 + .../@humanwhocodes/object-schema/LICENSE | 29 + .../@humanwhocodes/object-schema/README.md | 234 + .../@humanwhocodes/object-schema/package.json | 33 + .../@humanwhocodes/object-schema/src/index.js | 7 + .../object-schema/src/merge-strategy.js | 53 + .../object-schema/src/object-schema.js | 235 + .../object-schema/src/validation-strategy.js | 102 + .../object-schema/tests/merge-strategy.js | 66 + .../object-schema/tests/object-schema.js | 611 ++ .../tests/validation-strategy.js | 186 + node_modules/@types/json5/README.md | 18 + node_modules/@types/json5/index.d.ts | 44 + node_modules/@types/json5/package.json | 16 + node_modules/@types/json5/types-metadata.json | 25 + node_modules/acorn-jsx/LICENSE | 19 + node_modules/acorn-jsx/README.md | 40 + node_modules/acorn-jsx/index.d.ts | 12 + node_modules/acorn-jsx/index.js | 488 ++ node_modules/acorn-jsx/package.json | 27 + node_modules/acorn-jsx/xhtml.js | 255 + node_modules/acorn/CHANGELOG.md | 798 ++ node_modules/acorn/LICENSE | 21 + node_modules/acorn/README.md | 273 + node_modules/acorn/bin/acorn | 4 + node_modules/acorn/dist/acorn.d.ts | 252 + node_modules/acorn/dist/acorn.js | 5608 +++++++++++++ node_modules/acorn/dist/acorn.mjs | 5577 +++++++++++++ node_modules/acorn/dist/acorn.mjs.d.ts | 2 + node_modules/acorn/dist/bin.js | 91 + node_modules/acorn/package.json | 50 + node_modules/ajv/.tonic_example.js | 20 + node_modules/ajv/LICENSE | 22 + node_modules/ajv/README.md | 1497 ++++ node_modules/ajv/dist/ajv.bundle.js | 7189 +++++++++++++++++ node_modules/ajv/dist/ajv.min.js | 3 + node_modules/ajv/dist/ajv.min.js.map | 1 + node_modules/ajv/lib/ajv.d.ts | 397 + node_modules/ajv/lib/ajv.js | 506 ++ node_modules/ajv/lib/cache.js | 26 + node_modules/ajv/lib/compile/async.js | 90 + node_modules/ajv/lib/compile/equal.js | 5 + node_modules/ajv/lib/compile/error_classes.js | 34 + node_modules/ajv/lib/compile/formats.js | 142 + node_modules/ajv/lib/compile/index.js | 387 + node_modules/ajv/lib/compile/resolve.js | 270 + node_modules/ajv/lib/compile/rules.js | 66 + node_modules/ajv/lib/compile/schema_obj.js | 9 + node_modules/ajv/lib/compile/ucs2length.js | 20 + node_modules/ajv/lib/compile/util.js | 239 + node_modules/ajv/lib/data.js | 49 + node_modules/ajv/lib/definition_schema.js | 37 + node_modules/ajv/lib/dot/_limit.jst | 113 + node_modules/ajv/lib/dot/_limitItems.jst | 12 + node_modules/ajv/lib/dot/_limitLength.jst | 12 + node_modules/ajv/lib/dot/_limitProperties.jst | 12 + node_modules/ajv/lib/dot/allOf.jst | 32 + node_modules/ajv/lib/dot/anyOf.jst | 46 + node_modules/ajv/lib/dot/coerce.def | 51 + node_modules/ajv/lib/dot/comment.jst | 9 + node_modules/ajv/lib/dot/const.jst | 11 + node_modules/ajv/lib/dot/contains.jst | 55 + node_modules/ajv/lib/dot/custom.jst | 191 + node_modules/ajv/lib/dot/defaults.def | 47 + node_modules/ajv/lib/dot/definitions.def | 203 + node_modules/ajv/lib/dot/dependencies.jst | 79 + node_modules/ajv/lib/dot/enum.jst | 30 + node_modules/ajv/lib/dot/errors.def | 194 + node_modules/ajv/lib/dot/format.jst | 106 + node_modules/ajv/lib/dot/if.jst | 73 + node_modules/ajv/lib/dot/items.jst | 98 + node_modules/ajv/lib/dot/missing.def | 39 + node_modules/ajv/lib/dot/multipleOf.jst | 22 + node_modules/ajv/lib/dot/not.jst | 43 + node_modules/ajv/lib/dot/oneOf.jst | 54 + node_modules/ajv/lib/dot/pattern.jst | 14 + node_modules/ajv/lib/dot/properties.jst | 245 + node_modules/ajv/lib/dot/propertyNames.jst | 52 + node_modules/ajv/lib/dot/ref.jst | 85 + node_modules/ajv/lib/dot/required.jst | 108 + node_modules/ajv/lib/dot/uniqueItems.jst | 62 + node_modules/ajv/lib/dot/validate.jst | 276 + node_modules/ajv/lib/dotjs/README.md | 3 + node_modules/ajv/lib/dotjs/_limit.js | 163 + node_modules/ajv/lib/dotjs/_limitItems.js | 80 + node_modules/ajv/lib/dotjs/_limitLength.js | 85 + .../ajv/lib/dotjs/_limitProperties.js | 80 + node_modules/ajv/lib/dotjs/allOf.js | 42 + node_modules/ajv/lib/dotjs/anyOf.js | 73 + node_modules/ajv/lib/dotjs/comment.js | 14 + node_modules/ajv/lib/dotjs/const.js | 56 + node_modules/ajv/lib/dotjs/contains.js | 81 + node_modules/ajv/lib/dotjs/custom.js | 228 + node_modules/ajv/lib/dotjs/dependencies.js | 168 + node_modules/ajv/lib/dotjs/enum.js | 66 + node_modules/ajv/lib/dotjs/format.js | 150 + node_modules/ajv/lib/dotjs/if.js | 103 + node_modules/ajv/lib/dotjs/index.js | 33 + node_modules/ajv/lib/dotjs/items.js | 140 + node_modules/ajv/lib/dotjs/multipleOf.js | 80 + node_modules/ajv/lib/dotjs/not.js | 84 + node_modules/ajv/lib/dotjs/oneOf.js | 73 + node_modules/ajv/lib/dotjs/pattern.js | 75 + node_modules/ajv/lib/dotjs/properties.js | 335 + node_modules/ajv/lib/dotjs/propertyNames.js | 81 + node_modules/ajv/lib/dotjs/ref.js | 124 + node_modules/ajv/lib/dotjs/required.js | 270 + node_modules/ajv/lib/dotjs/uniqueItems.js | 86 + node_modules/ajv/lib/dotjs/validate.js | 482 ++ node_modules/ajv/lib/keyword.js | 146 + node_modules/ajv/lib/refs/data.json | 17 + .../ajv/lib/refs/json-schema-draft-04.json | 149 + .../ajv/lib/refs/json-schema-draft-06.json | 154 + .../ajv/lib/refs/json-schema-draft-07.json | 168 + .../ajv/lib/refs/json-schema-secure.json | 94 + node_modules/ajv/package.json | 106 + node_modules/ajv/scripts/.eslintrc.yml | 3 + node_modules/ajv/scripts/bundle.js | 61 + node_modules/ajv/scripts/compile-dots.js | 73 + node_modules/ajv/scripts/info | 10 + node_modules/ajv/scripts/prepare-tests | 12 + .../ajv/scripts/publish-built-version | 32 + node_modules/ajv/scripts/travis-gh-pages | 23 + node_modules/ansi-regex/index.d.ts | 37 + node_modules/ansi-regex/index.js | 10 + node_modules/ansi-regex/license | 9 + node_modules/ansi-regex/package.json | 55 + node_modules/ansi-regex/readme.md | 78 + node_modules/argparse/CHANGELOG.md | 216 + node_modules/argparse/LICENSE | 254 + node_modules/argparse/README.md | 84 + node_modules/argparse/argparse.js | 3707 +++++++++ node_modules/argparse/lib/sub.js | 67 + node_modules/argparse/lib/textwrap.js | 440 + node_modules/argparse/package.json | 31 + node_modules/array-includes/.editorconfig | 13 + node_modules/array-includes/.eslintrc | 29 + .../array-includes/.github/FUNDING.yml | 12 + node_modules/array-includes/.nycrc | 9 + node_modules/array-includes/CHANGELOG.md | 140 + node_modules/array-includes/LICENSE | 21 + node_modules/array-includes/README.md | 105 + node_modules/array-includes/auto.js | 3 + node_modules/array-includes/implementation.js | 36 + node_modules/array-includes/index.js | 27 + node_modules/array-includes/package.json | 95 + node_modules/array-includes/polyfill.js | 13 + node_modules/array-includes/shim.js | 14 + .../array-includes/test/implementation.js | 20 + node_modules/array-includes/test/index.js | 17 + node_modules/array-includes/test/shimmed.js | 36 + node_modules/array-includes/test/tests.js | 94 + .../array.prototype.flat/.editorconfig | 20 + node_modules/array.prototype.flat/.eslintrc | 36 + .../array.prototype.flat/.github/FUNDING.yml | 12 + node_modules/array.prototype.flat/.nycrc | 9 + .../array.prototype.flat/CHANGELOG.md | 83 + node_modules/array.prototype.flat/LICENSE | 21 + node_modules/array.prototype.flat/README.md | 75 + node_modules/array.prototype.flat/auto.js | 3 + .../array.prototype.flat/implementation.js | 22 + node_modules/array.prototype.flat/index.js | 19 + .../array.prototype.flat/package.json | 99 + node_modules/array.prototype.flat/polyfill.js | 7 + node_modules/array.prototype.flat/shim.js | 20 + .../test/implementation.js | 20 + .../array.prototype.flat/test/index.js | 17 + .../array.prototype.flat/test/shimmed.js | 36 + .../array.prototype.flat/test/tests.js | 30 + node_modules/builtins/License | 20 + node_modules/builtins/Readme.md | 39 + node_modules/builtins/index.js | 80 + node_modules/builtins/package.json | 20 + node_modules/callsites/index.d.ts | 96 + node_modules/callsites/index.js | 13 + node_modules/callsites/license | 9 + node_modules/callsites/package.json | 39 + node_modules/callsites/readme.md | 48 + node_modules/cross-spawn/CHANGELOG.md | 130 + node_modules/cross-spawn/LICENSE | 21 + node_modules/cross-spawn/README.md | 96 + node_modules/cross-spawn/index.js | 39 + node_modules/cross-spawn/lib/enoent.js | 59 + node_modules/cross-spawn/lib/parse.js | 91 + node_modules/cross-spawn/lib/util/escape.js | 45 + .../cross-spawn/lib/util/readShebang.js | 23 + .../cross-spawn/lib/util/resolveCommand.js | 52 + node_modules/cross-spawn/package.json | 73 + node_modules/deep-is/.travis.yml | 5 + node_modules/deep-is/LICENSE | 22 + node_modules/deep-is/README.markdown | 70 + node_modules/deep-is/example/cmp.js | 11 + node_modules/deep-is/index.js | 102 + node_modules/deep-is/package.json | 58 + node_modules/deep-is/test/NaN.js | 16 + node_modules/deep-is/test/cmp.js | 23 + node_modules/deep-is/test/neg-vs-pos-0.js | 15 + node_modules/define-properties/.editorconfig | 13 + node_modules/define-properties/.eslintrc | 19 + .../define-properties/.github/FUNDING.yml | 12 + node_modules/define-properties/.nycrc | 9 + node_modules/define-properties/CHANGELOG.md | 63 + node_modules/define-properties/LICENSE | 21 + node_modules/define-properties/README.md | 84 + node_modules/define-properties/index.js | 47 + node_modules/define-properties/package.json | 66 + node_modules/doctrine/CHANGELOG.md | 101 + node_modules/doctrine/LICENSE | 177 + .../doctrine/LICENSE.closure-compiler | 202 + node_modules/doctrine/LICENSE.esprima | 19 + node_modules/doctrine/README.md | 165 + node_modules/doctrine/lib/doctrine.js | 898 ++ node_modules/doctrine/lib/typed.js | 1305 +++ node_modules/doctrine/lib/utility.js | 35 + node_modules/doctrine/package.json | 58 + node_modules/es-abstract/.editorconfig | 15 + node_modules/es-abstract/.eslintrc | 67 + node_modules/es-abstract/.nycrc | 10 + .../2015/AbstractEqualityComparison.js | 37 + .../2015/AbstractRelationalComparison.js | 63 + .../es-abstract/2015/AdvanceStringIndex.js | 47 + node_modules/es-abstract/2015/ArrayCreate.js | 53 + .../es-abstract/2015/ArraySetLength.js | 85 + .../es-abstract/2015/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2015/Call.js | 20 + .../2015/CanonicalNumericIndexString.js | 22 + .../es-abstract/2015/CharacterRange.js | 31 + .../2015/CompletePropertyDescriptor.js | 39 + .../es-abstract/2015/CreateDataProperty.js | 45 + .../2015/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2015/CreateHTML.js | 30 + .../2015/CreateIterResultObject.js | 19 + .../2015/CreateListFromArrayLike.js | 43 + .../es-abstract/2015/CreateMethodProperty.js | 40 + node_modules/es-abstract/2015/DateFromTime.js | 54 + node_modules/es-abstract/2015/Day.js | 11 + node_modules/es-abstract/2015/DayFromYear.js | 10 + .../es-abstract/2015/DayWithinYear.js | 11 + node_modules/es-abstract/2015/DaysInYear.js | 18 + .../es-abstract/2015/DefinePropertyOrThrow.js | 50 + .../es-abstract/2015/DeletePropertyOrThrow.js | 27 + .../es-abstract/2015/EnumerableOwnNames.js | 19 + .../2015/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2015/Get.js | 25 + node_modules/es-abstract/2015/GetIterator.js | 34 + node_modules/es-abstract/2015/GetMethod.js | 34 + .../es-abstract/2015/GetOwnPropertyKeys.js | 31 + .../2015/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2015/GetSubstitution.js | 104 + node_modules/es-abstract/2015/GetV.js | 23 + .../es-abstract/2015/HasOwnProperty.js | 22 + node_modules/es-abstract/2015/HasProperty.js | 20 + node_modules/es-abstract/2015/HourFromTime.js | 14 + node_modules/es-abstract/2015/InLeapYear.js | 21 + .../es-abstract/2015/InstanceofOperator.js | 30 + node_modules/es-abstract/2015/Invoke.js | 24 + .../es-abstract/2015/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2015/IsArray.js | 4 + node_modules/es-abstract/2015/IsCallable.js | 5 + .../2015/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2015/IsConcatSpreadable.js | 25 + .../es-abstract/2015/IsConstructor.js | 40 + .../es-abstract/2015/IsDataDescriptor.js | 23 + node_modules/es-abstract/2015/IsExtensible.js | 18 + .../es-abstract/2015/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2015/IsInteger.js | 17 + node_modules/es-abstract/2015/IsPromise.js | 24 + .../es-abstract/2015/IsPropertyDescriptor.js | 19 + .../es-abstract/2015/IsPropertyKey.js | 7 + node_modules/es-abstract/2015/IsRegExp.js | 24 + .../es-abstract/2015/IteratorClose.js | 50 + .../es-abstract/2015/IteratorComplete.js | 18 + node_modules/es-abstract/2015/IteratorNext.js | 18 + node_modules/es-abstract/2015/IteratorStep.js | 13 + .../es-abstract/2015/IteratorValue.js | 18 + node_modules/es-abstract/2015/MakeDate.js | 13 + node_modules/es-abstract/2015/MakeDay.js | 33 + node_modules/es-abstract/2015/MakeTime.js | 23 + node_modules/es-abstract/2015/MinFromTime.js | 14 + .../es-abstract/2015/MonthFromTime.js | 47 + node_modules/es-abstract/2015/ObjectCreate.js | 37 + .../2015/ObjectDefineProperties.js | 40 + .../2015/OrdinaryCreateFromConstructor.js | 20 + .../2015/OrdinaryDefineOwnProperty.js | 61 + .../2015/OrdinaryGetOwnProperty.js | 44 + .../es-abstract/2015/OrdinaryHasInstance.js | 25 + .../es-abstract/2015/OrdinaryHasProperty.js | 20 + .../es-abstract/2015/QuoteJSONString.js | 52 + node_modules/es-abstract/2015/RegExpCreate.js | 21 + node_modules/es-abstract/2015/RegExpExec.js | 32 + .../2015/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2015/SameValue.js | 13 + .../es-abstract/2015/SameValueZero.js | 9 + node_modules/es-abstract/2015/SecFromTime.js | 14 + node_modules/es-abstract/2015/Set.js | 47 + .../es-abstract/2015/SetFunctionName.js | 44 + .../es-abstract/2015/SetIntegrityLevel.js | 57 + .../es-abstract/2015/SpeciesConstructor.js | 32 + node_modules/es-abstract/2015/SplitMatch.js | 38 + .../2015/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2015/StringCreate.js | 40 + .../2015/StringGetIndexProperty.js | 52 + .../2015/SymbolDescriptiveString.js | 20 + .../es-abstract/2015/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2015/TimeClip.js | 21 + node_modules/es-abstract/2015/TimeFromYear.js | 11 + .../es-abstract/2015/TimeWithinDay.js | 12 + node_modules/es-abstract/2015/ToBoolean.js | 5 + node_modules/es-abstract/2015/ToDateString.js | 22 + node_modules/es-abstract/2015/ToInt16.js | 10 + node_modules/es-abstract/2015/ToInt32.js | 9 + node_modules/es-abstract/2015/ToInt8.js | 10 + node_modules/es-abstract/2015/ToInteger.js | 12 + node_modules/es-abstract/2015/ToLength.js | 12 + node_modules/es-abstract/2015/ToNumber.js | 59 + node_modules/es-abstract/2015/ToObject.js | 14 + node_modules/es-abstract/2015/ToPrimitive.js | 12 + .../es-abstract/2015/ToPropertyDescriptor.js | 52 + .../es-abstract/2015/ToPropertyKey.js | 15 + node_modules/es-abstract/2015/ToString.js | 15 + node_modules/es-abstract/2015/ToUint16.js | 19 + node_modules/es-abstract/2015/ToUint32.js | 9 + node_modules/es-abstract/2015/ToUint8.js | 20 + node_modules/es-abstract/2015/ToUint8Clamp.js | 19 + node_modules/es-abstract/2015/Type.js | 12 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2015/WeekDay.js | 10 + node_modules/es-abstract/2015/YearFromTime.js | 16 + node_modules/es-abstract/2015/abs.js | 11 + node_modules/es-abstract/2015/floor.js | 11 + node_modules/es-abstract/2015/modulo.js | 9 + node_modules/es-abstract/2015/msFromTime.js | 11 + .../es-abstract/2015/thisBooleanValue.js | 15 + .../es-abstract/2015/thisNumberValue.js | 18 + .../es-abstract/2015/thisStringValue.js | 15 + .../es-abstract/2015/thisTimeValue.js | 9 + .../2016/AbstractEqualityComparison.js | 37 + .../2016/AbstractRelationalComparison.js | 63 + .../es-abstract/2016/AdvanceStringIndex.js | 47 + node_modules/es-abstract/2016/ArrayCreate.js | 53 + .../es-abstract/2016/ArraySetLength.js | 85 + .../es-abstract/2016/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2016/Call.js | 20 + .../2016/CanonicalNumericIndexString.js | 22 + .../es-abstract/2016/CharacterRange.js | 31 + .../2016/CompletePropertyDescriptor.js | 39 + .../es-abstract/2016/CreateDataProperty.js | 45 + .../2016/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2016/CreateHTML.js | 30 + .../2016/CreateIterResultObject.js | 19 + .../2016/CreateListFromArrayLike.js | 43 + .../es-abstract/2016/CreateMethodProperty.js | 40 + node_modules/es-abstract/2016/DateFromTime.js | 54 + node_modules/es-abstract/2016/Day.js | 11 + node_modules/es-abstract/2016/DayFromYear.js | 10 + .../es-abstract/2016/DayWithinYear.js | 11 + node_modules/es-abstract/2016/DaysInYear.js | 18 + .../es-abstract/2016/DefinePropertyOrThrow.js | 50 + .../es-abstract/2016/DeletePropertyOrThrow.js | 27 + .../es-abstract/2016/EnumerableOwnNames.js | 19 + .../2016/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2016/Get.js | 25 + node_modules/es-abstract/2016/GetIterator.js | 34 + node_modules/es-abstract/2016/GetMethod.js | 34 + .../es-abstract/2016/GetOwnPropertyKeys.js | 31 + .../2016/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2016/GetSubstitution.js | 104 + node_modules/es-abstract/2016/GetV.js | 23 + .../es-abstract/2016/HasOwnProperty.js | 22 + node_modules/es-abstract/2016/HasProperty.js | 20 + node_modules/es-abstract/2016/HourFromTime.js | 14 + node_modules/es-abstract/2016/InLeapYear.js | 21 + .../es-abstract/2016/InstanceofOperator.js | 30 + node_modules/es-abstract/2016/Invoke.js | 24 + .../es-abstract/2016/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2016/IsArray.js | 4 + node_modules/es-abstract/2016/IsCallable.js | 5 + .../2016/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2016/IsConcatSpreadable.js | 25 + .../es-abstract/2016/IsConstructor.js | 40 + .../es-abstract/2016/IsDataDescriptor.js | 23 + node_modules/es-abstract/2016/IsExtensible.js | 18 + .../es-abstract/2016/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2016/IsInteger.js | 17 + node_modules/es-abstract/2016/IsPromise.js | 24 + .../es-abstract/2016/IsPropertyDescriptor.js | 19 + .../es-abstract/2016/IsPropertyKey.js | 7 + node_modules/es-abstract/2016/IsRegExp.js | 24 + .../es-abstract/2016/IterableToArrayLike.js | 39 + .../es-abstract/2016/IteratorClose.js | 50 + .../es-abstract/2016/IteratorComplete.js | 18 + node_modules/es-abstract/2016/IteratorNext.js | 18 + node_modules/es-abstract/2016/IteratorStep.js | 13 + .../es-abstract/2016/IteratorValue.js | 18 + node_modules/es-abstract/2016/MakeDate.js | 13 + node_modules/es-abstract/2016/MakeDay.js | 33 + node_modules/es-abstract/2016/MakeTime.js | 23 + node_modules/es-abstract/2016/MinFromTime.js | 14 + .../es-abstract/2016/MonthFromTime.js | 47 + node_modules/es-abstract/2016/ObjectCreate.js | 37 + .../2016/ObjectDefineProperties.js | 40 + .../2016/OrdinaryCreateFromConstructor.js | 20 + .../2016/OrdinaryDefineOwnProperty.js | 61 + .../2016/OrdinaryGetOwnProperty.js | 44 + .../2016/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2016/OrdinaryHasInstance.js | 25 + .../es-abstract/2016/OrdinaryHasProperty.js | 20 + .../2016/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2016/QuoteJSONString.js | 52 + node_modules/es-abstract/2016/RegExpCreate.js | 21 + node_modules/es-abstract/2016/RegExpExec.js | 32 + .../2016/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2016/SameValue.js | 13 + .../es-abstract/2016/SameValueNonNumber.js | 16 + .../es-abstract/2016/SameValueZero.js | 9 + node_modules/es-abstract/2016/SecFromTime.js | 14 + node_modules/es-abstract/2016/Set.js | 47 + .../es-abstract/2016/SetFunctionName.js | 44 + .../es-abstract/2016/SetIntegrityLevel.js | 57 + .../es-abstract/2016/SpeciesConstructor.js | 32 + node_modules/es-abstract/2016/SplitMatch.js | 38 + .../2016/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2016/StringCreate.js | 40 + .../2016/SymbolDescriptiveString.js | 20 + .../es-abstract/2016/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2016/TimeClip.js | 21 + node_modules/es-abstract/2016/TimeFromYear.js | 11 + .../es-abstract/2016/TimeWithinDay.js | 12 + node_modules/es-abstract/2016/ToBoolean.js | 5 + node_modules/es-abstract/2016/ToDateString.js | 22 + node_modules/es-abstract/2016/ToInt16.js | 10 + node_modules/es-abstract/2016/ToInt32.js | 9 + node_modules/es-abstract/2016/ToInt8.js | 10 + node_modules/es-abstract/2016/ToInteger.js | 12 + node_modules/es-abstract/2016/ToLength.js | 12 + node_modules/es-abstract/2016/ToNumber.js | 59 + node_modules/es-abstract/2016/ToObject.js | 14 + node_modules/es-abstract/2016/ToPrimitive.js | 12 + .../es-abstract/2016/ToPropertyDescriptor.js | 52 + .../es-abstract/2016/ToPropertyKey.js | 15 + node_modules/es-abstract/2016/ToString.js | 15 + node_modules/es-abstract/2016/ToUint16.js | 19 + node_modules/es-abstract/2016/ToUint32.js | 9 + node_modules/es-abstract/2016/ToUint8.js | 20 + node_modules/es-abstract/2016/ToUint8Clamp.js | 19 + node_modules/es-abstract/2016/Type.js | 12 + node_modules/es-abstract/2016/UTF16Decode.js | 21 + .../es-abstract/2016/UTF16Encoding.js | 25 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2016/WeekDay.js | 10 + node_modules/es-abstract/2016/YearFromTime.js | 16 + node_modules/es-abstract/2016/abs.js | 11 + node_modules/es-abstract/2016/floor.js | 11 + node_modules/es-abstract/2016/modulo.js | 9 + node_modules/es-abstract/2016/msFromTime.js | 11 + .../es-abstract/2016/thisBooleanValue.js | 15 + .../es-abstract/2016/thisNumberValue.js | 18 + .../es-abstract/2016/thisStringValue.js | 15 + .../es-abstract/2016/thisTimeValue.js | 9 + .../2017/AbstractEqualityComparison.js | 37 + .../2017/AbstractRelationalComparison.js | 63 + .../es-abstract/2017/AdvanceStringIndex.js | 47 + node_modules/es-abstract/2017/ArrayCreate.js | 53 + .../es-abstract/2017/ArraySetLength.js | 85 + .../es-abstract/2017/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2017/Call.js | 20 + .../2017/CanonicalNumericIndexString.js | 22 + .../es-abstract/2017/CharacterRange.js | 31 + .../2017/CompletePropertyDescriptor.js | 39 + .../es-abstract/2017/CreateDataProperty.js | 45 + .../2017/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2017/CreateHTML.js | 30 + .../2017/CreateIterResultObject.js | 19 + .../2017/CreateListFromArrayLike.js | 43 + .../es-abstract/2017/CreateMethodProperty.js | 40 + node_modules/es-abstract/2017/DateFromTime.js | 54 + node_modules/es-abstract/2017/Day.js | 11 + node_modules/es-abstract/2017/DayFromYear.js | 10 + .../es-abstract/2017/DayWithinYear.js | 11 + node_modules/es-abstract/2017/DaysInYear.js | 18 + .../es-abstract/2017/DefinePropertyOrThrow.js | 50 + .../es-abstract/2017/DeletePropertyOrThrow.js | 27 + .../2017/EnumerableOwnProperties.js | 43 + .../2017/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2017/Get.js | 25 + node_modules/es-abstract/2017/GetIterator.js | 34 + node_modules/es-abstract/2017/GetMethod.js | 34 + .../es-abstract/2017/GetOwnPropertyKeys.js | 31 + .../2017/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2017/GetSubstitution.js | 104 + node_modules/es-abstract/2017/GetV.js | 23 + .../es-abstract/2017/HasOwnProperty.js | 22 + node_modules/es-abstract/2017/HasProperty.js | 20 + node_modules/es-abstract/2017/HourFromTime.js | 14 + node_modules/es-abstract/2017/InLeapYear.js | 21 + .../es-abstract/2017/InstanceofOperator.js | 30 + node_modules/es-abstract/2017/Invoke.js | 24 + .../es-abstract/2017/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2017/IsArray.js | 4 + node_modules/es-abstract/2017/IsCallable.js | 5 + .../2017/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2017/IsConcatSpreadable.js | 25 + .../es-abstract/2017/IsConstructor.js | 40 + .../es-abstract/2017/IsDataDescriptor.js | 23 + node_modules/es-abstract/2017/IsExtensible.js | 18 + .../es-abstract/2017/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2017/IsInteger.js | 17 + node_modules/es-abstract/2017/IsPromise.js | 24 + .../es-abstract/2017/IsPropertyDescriptor.js | 19 + .../es-abstract/2017/IsPropertyKey.js | 7 + node_modules/es-abstract/2017/IsRegExp.js | 24 + .../es-abstract/2017/IsSharedArrayBuffer.js | 19 + .../es-abstract/2017/IterableToList.js | 24 + .../es-abstract/2017/IteratorClose.js | 50 + .../es-abstract/2017/IteratorComplete.js | 18 + node_modules/es-abstract/2017/IteratorNext.js | 18 + node_modules/es-abstract/2017/IteratorStep.js | 13 + .../es-abstract/2017/IteratorValue.js | 18 + node_modules/es-abstract/2017/MakeDate.js | 13 + node_modules/es-abstract/2017/MakeDay.js | 33 + node_modules/es-abstract/2017/MakeTime.js | 23 + node_modules/es-abstract/2017/MinFromTime.js | 14 + .../es-abstract/2017/MonthFromTime.js | 47 + node_modules/es-abstract/2017/ObjectCreate.js | 37 + .../2017/ObjectDefineProperties.js | 40 + .../2017/OrdinaryCreateFromConstructor.js | 20 + .../2017/OrdinaryDefineOwnProperty.js | 61 + .../2017/OrdinaryGetOwnProperty.js | 44 + .../2017/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2017/OrdinaryHasInstance.js | 25 + .../es-abstract/2017/OrdinaryHasProperty.js | 20 + .../2017/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2017/OrdinaryToPrimitive.js | 38 + .../es-abstract/2017/QuoteJSONString.js | 52 + node_modules/es-abstract/2017/RegExpCreate.js | 21 + node_modules/es-abstract/2017/RegExpExec.js | 32 + .../2017/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2017/SameValue.js | 13 + .../es-abstract/2017/SameValueNonNumber.js | 16 + .../es-abstract/2017/SameValueZero.js | 9 + node_modules/es-abstract/2017/SecFromTime.js | 14 + node_modules/es-abstract/2017/Set.js | 47 + .../es-abstract/2017/SetFunctionName.js | 44 + .../es-abstract/2017/SetIntegrityLevel.js | 57 + .../es-abstract/2017/SpeciesConstructor.js | 32 + node_modules/es-abstract/2017/SplitMatch.js | 38 + .../2017/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2017/StringCreate.js | 40 + .../es-abstract/2017/StringGetOwnProperty.js | 48 + .../2017/SymbolDescriptiveString.js | 20 + .../es-abstract/2017/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2017/TimeClip.js | 21 + node_modules/es-abstract/2017/TimeFromYear.js | 11 + .../es-abstract/2017/TimeWithinDay.js | 12 + node_modules/es-abstract/2017/ToBoolean.js | 5 + node_modules/es-abstract/2017/ToDateString.js | 22 + node_modules/es-abstract/2017/ToIndex.js | 26 + node_modules/es-abstract/2017/ToInt16.js | 10 + node_modules/es-abstract/2017/ToInt32.js | 9 + node_modules/es-abstract/2017/ToInt8.js | 10 + node_modules/es-abstract/2017/ToInteger.js | 12 + node_modules/es-abstract/2017/ToLength.js | 12 + node_modules/es-abstract/2017/ToNumber.js | 59 + node_modules/es-abstract/2017/ToObject.js | 14 + node_modules/es-abstract/2017/ToPrimitive.js | 12 + .../es-abstract/2017/ToPropertyDescriptor.js | 52 + .../es-abstract/2017/ToPropertyKey.js | 15 + node_modules/es-abstract/2017/ToString.js | 15 + node_modules/es-abstract/2017/ToUint16.js | 19 + node_modules/es-abstract/2017/ToUint32.js | 9 + node_modules/es-abstract/2017/ToUint8.js | 20 + node_modules/es-abstract/2017/ToUint8Clamp.js | 19 + node_modules/es-abstract/2017/Type.js | 12 + node_modules/es-abstract/2017/UTF16Decode.js | 21 + .../es-abstract/2017/UTF16Encoding.js | 25 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2017/WeekDay.js | 10 + node_modules/es-abstract/2017/YearFromTime.js | 16 + node_modules/es-abstract/2017/abs.js | 11 + node_modules/es-abstract/2017/floor.js | 11 + node_modules/es-abstract/2017/modulo.js | 9 + node_modules/es-abstract/2017/msFromTime.js | 11 + .../es-abstract/2017/thisBooleanValue.js | 15 + .../es-abstract/2017/thisNumberValue.js | 18 + .../es-abstract/2017/thisStringValue.js | 15 + .../es-abstract/2017/thisTimeValue.js | 9 + .../2018/AbstractEqualityComparison.js | 37 + .../2018/AbstractRelationalComparison.js | 61 + .../es-abstract/2018/AdvanceStringIndex.js | 47 + node_modules/es-abstract/2018/ArrayCreate.js | 53 + .../es-abstract/2018/ArraySetLength.js | 85 + .../es-abstract/2018/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2018/Call.js | 20 + .../2018/CanonicalNumericIndexString.js | 22 + .../es-abstract/2018/CharacterRange.js | 31 + .../2018/CompletePropertyDescriptor.js | 39 + .../es-abstract/2018/CopyDataProperties.js | 68 + .../es-abstract/2018/CreateDataProperty.js | 45 + .../2018/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2018/CreateHTML.js | 30 + .../2018/CreateIterResultObject.js | 19 + .../2018/CreateListFromArrayLike.js | 43 + .../es-abstract/2018/CreateMethodProperty.js | 40 + node_modules/es-abstract/2018/DateFromTime.js | 54 + node_modules/es-abstract/2018/DateString.js | 30 + node_modules/es-abstract/2018/Day.js | 11 + node_modules/es-abstract/2018/DayFromYear.js | 10 + .../es-abstract/2018/DayWithinYear.js | 11 + node_modules/es-abstract/2018/DaysInYear.js | 18 + .../es-abstract/2018/DefinePropertyOrThrow.js | 50 + .../es-abstract/2018/DeletePropertyOrThrow.js | 27 + .../2018/EnumerableOwnPropertyNames.js | 43 + .../2018/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2018/Get.js | 25 + node_modules/es-abstract/2018/GetIterator.js | 34 + node_modules/es-abstract/2018/GetMethod.js | 34 + .../es-abstract/2018/GetOwnPropertyKeys.js | 31 + .../2018/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2018/GetSubstitution.js | 128 + node_modules/es-abstract/2018/GetV.js | 23 + .../es-abstract/2018/HasOwnProperty.js | 22 + node_modules/es-abstract/2018/HasProperty.js | 20 + node_modules/es-abstract/2018/HourFromTime.js | 14 + node_modules/es-abstract/2018/InLeapYear.js | 21 + .../es-abstract/2018/InstanceofOperator.js | 30 + node_modules/es-abstract/2018/Invoke.js | 24 + .../es-abstract/2018/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2018/IsArray.js | 4 + node_modules/es-abstract/2018/IsCallable.js | 5 + .../2018/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2018/IsConcatSpreadable.js | 25 + .../es-abstract/2018/IsConstructor.js | 40 + .../es-abstract/2018/IsDataDescriptor.js | 23 + node_modules/es-abstract/2018/IsExtensible.js | 18 + .../es-abstract/2018/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2018/IsInteger.js | 17 + node_modules/es-abstract/2018/IsPromise.js | 24 + .../es-abstract/2018/IsPropertyKey.js | 7 + node_modules/es-abstract/2018/IsRegExp.js | 24 + .../es-abstract/2018/IsSharedArrayBuffer.js | 19 + .../es-abstract/2018/IsStringPrefix.js | 47 + .../es-abstract/2018/IterableToList.js | 24 + .../es-abstract/2018/IteratorClose.js | 50 + .../es-abstract/2018/IteratorComplete.js | 18 + node_modules/es-abstract/2018/IteratorNext.js | 18 + node_modules/es-abstract/2018/IteratorStep.js | 13 + .../es-abstract/2018/IteratorValue.js | 18 + node_modules/es-abstract/2018/MakeDate.js | 13 + node_modules/es-abstract/2018/MakeDay.js | 33 + node_modules/es-abstract/2018/MakeTime.js | 23 + node_modules/es-abstract/2018/MinFromTime.js | 14 + .../es-abstract/2018/MonthFromTime.js | 47 + .../es-abstract/2018/NumberToString.js | 19 + node_modules/es-abstract/2018/ObjectCreate.js | 37 + .../2018/ObjectDefineProperties.js | 40 + .../2018/OrdinaryCreateFromConstructor.js | 20 + .../2018/OrdinaryDefineOwnProperty.js | 61 + .../2018/OrdinaryGetOwnProperty.js | 44 + .../2018/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2018/OrdinaryHasInstance.js | 25 + .../es-abstract/2018/OrdinaryHasProperty.js | 20 + .../2018/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2018/OrdinaryToPrimitive.js | 38 + .../es-abstract/2018/PromiseResolve.js | 17 + .../es-abstract/2018/QuoteJSONString.js | 48 + node_modules/es-abstract/2018/RegExpCreate.js | 21 + node_modules/es-abstract/2018/RegExpExec.js | 32 + .../2018/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2018/SameValue.js | 13 + .../es-abstract/2018/SameValueNonNumber.js | 16 + .../es-abstract/2018/SameValueZero.js | 9 + node_modules/es-abstract/2018/SecFromTime.js | 14 + node_modules/es-abstract/2018/Set.js | 47 + .../es-abstract/2018/SetFunctionLength.js | 31 + .../es-abstract/2018/SetFunctionName.js | 44 + .../es-abstract/2018/SetIntegrityLevel.js | 57 + .../es-abstract/2018/SpeciesConstructor.js | 32 + node_modules/es-abstract/2018/SplitMatch.js | 38 + .../2018/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2018/StringCreate.js | 40 + .../es-abstract/2018/StringGetOwnProperty.js | 48 + .../2018/SymbolDescriptiveString.js | 20 + .../es-abstract/2018/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2018/TimeClip.js | 21 + node_modules/es-abstract/2018/TimeFromYear.js | 11 + node_modules/es-abstract/2018/TimeString.js | 25 + .../es-abstract/2018/TimeWithinDay.js | 12 + node_modules/es-abstract/2018/ToBoolean.js | 5 + node_modules/es-abstract/2018/ToDateString.js | 22 + node_modules/es-abstract/2018/ToIndex.js | 26 + node_modules/es-abstract/2018/ToInt16.js | 10 + node_modules/es-abstract/2018/ToInt32.js | 9 + node_modules/es-abstract/2018/ToInt8.js | 10 + node_modules/es-abstract/2018/ToInteger.js | 12 + node_modules/es-abstract/2018/ToLength.js | 12 + node_modules/es-abstract/2018/ToNumber.js | 59 + node_modules/es-abstract/2018/ToObject.js | 14 + node_modules/es-abstract/2018/ToPrimitive.js | 12 + .../es-abstract/2018/ToPropertyDescriptor.js | 52 + .../es-abstract/2018/ToPropertyKey.js | 15 + node_modules/es-abstract/2018/ToString.js | 15 + node_modules/es-abstract/2018/ToUint16.js | 19 + node_modules/es-abstract/2018/ToUint32.js | 9 + node_modules/es-abstract/2018/ToUint8.js | 20 + node_modules/es-abstract/2018/ToUint8Clamp.js | 19 + node_modules/es-abstract/2018/Type.js | 12 + node_modules/es-abstract/2018/UTF16Decode.js | 21 + .../es-abstract/2018/UTF16Encoding.js | 25 + .../es-abstract/2018/UnicodeEscape.js | 26 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2018/WeekDay.js | 10 + node_modules/es-abstract/2018/YearFromTime.js | 16 + node_modules/es-abstract/2018/abs.js | 11 + node_modules/es-abstract/2018/floor.js | 11 + node_modules/es-abstract/2018/modulo.js | 9 + node_modules/es-abstract/2018/msFromTime.js | 11 + .../es-abstract/2018/thisBooleanValue.js | 15 + .../es-abstract/2018/thisNumberValue.js | 18 + .../es-abstract/2018/thisStringValue.js | 15 + .../es-abstract/2018/thisSymbolValue.js | 19 + .../es-abstract/2018/thisTimeValue.js | 9 + .../2019/AbstractEqualityComparison.js | 37 + .../2019/AbstractRelationalComparison.js | 61 + .../2019/AddEntriesFromIterable.js | 52 + .../es-abstract/2019/AdvanceStringIndex.js | 47 + node_modules/es-abstract/2019/ArrayCreate.js | 53 + .../es-abstract/2019/ArraySetLength.js | 85 + .../es-abstract/2019/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2019/Call.js | 20 + .../2019/CanonicalNumericIndexString.js | 22 + .../es-abstract/2019/CharacterRange.js | 31 + .../2019/CompletePropertyDescriptor.js | 39 + .../es-abstract/2019/CopyDataProperties.js | 68 + .../es-abstract/2019/CreateDataProperty.js | 45 + .../2019/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2019/CreateHTML.js | 30 + .../2019/CreateIterResultObject.js | 19 + .../2019/CreateListFromArrayLike.js | 43 + .../es-abstract/2019/CreateMethodProperty.js | 40 + node_modules/es-abstract/2019/DateFromTime.js | 54 + node_modules/es-abstract/2019/DateString.js | 30 + node_modules/es-abstract/2019/Day.js | 11 + node_modules/es-abstract/2019/DayFromYear.js | 10 + .../es-abstract/2019/DayWithinYear.js | 11 + node_modules/es-abstract/2019/DaysInYear.js | 18 + .../es-abstract/2019/DefinePropertyOrThrow.js | 50 + .../es-abstract/2019/DeletePropertyOrThrow.js | 27 + .../2019/EnumerableOwnPropertyNames.js | 43 + .../es-abstract/2019/FlattenIntoArray.js | 58 + .../2019/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2019/Get.js | 25 + node_modules/es-abstract/2019/GetIterator.js | 34 + node_modules/es-abstract/2019/GetMethod.js | 34 + .../es-abstract/2019/GetOwnPropertyKeys.js | 31 + .../2019/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2019/GetSubstitution.js | 128 + node_modules/es-abstract/2019/GetV.js | 23 + .../es-abstract/2019/HasOwnProperty.js | 22 + node_modules/es-abstract/2019/HasProperty.js | 20 + node_modules/es-abstract/2019/HourFromTime.js | 14 + node_modules/es-abstract/2019/InLeapYear.js | 21 + .../es-abstract/2019/InstanceofOperator.js | 30 + node_modules/es-abstract/2019/Invoke.js | 24 + .../es-abstract/2019/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2019/IsArray.js | 4 + node_modules/es-abstract/2019/IsCallable.js | 5 + .../2019/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2019/IsConcatSpreadable.js | 25 + .../es-abstract/2019/IsConstructor.js | 40 + .../es-abstract/2019/IsDataDescriptor.js | 23 + node_modules/es-abstract/2019/IsExtensible.js | 18 + .../es-abstract/2019/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2019/IsInteger.js | 17 + node_modules/es-abstract/2019/IsPromise.js | 24 + .../es-abstract/2019/IsPropertyKey.js | 7 + node_modules/es-abstract/2019/IsRegExp.js | 24 + .../es-abstract/2019/IsSharedArrayBuffer.js | 19 + .../es-abstract/2019/IsStringPrefix.js | 47 + .../es-abstract/2019/IterableToList.js | 24 + .../es-abstract/2019/IteratorClose.js | 50 + .../es-abstract/2019/IteratorComplete.js | 18 + node_modules/es-abstract/2019/IteratorNext.js | 18 + node_modules/es-abstract/2019/IteratorStep.js | 13 + .../es-abstract/2019/IteratorValue.js | 18 + node_modules/es-abstract/2019/MakeDate.js | 13 + node_modules/es-abstract/2019/MakeDay.js | 33 + node_modules/es-abstract/2019/MakeTime.js | 23 + node_modules/es-abstract/2019/MinFromTime.js | 14 + .../es-abstract/2019/MonthFromTime.js | 47 + .../es-abstract/2019/NumberToString.js | 19 + node_modules/es-abstract/2019/ObjectCreate.js | 37 + .../2019/ObjectDefineProperties.js | 40 + .../2019/OrdinaryCreateFromConstructor.js | 20 + .../2019/OrdinaryDefineOwnProperty.js | 61 + .../2019/OrdinaryGetOwnProperty.js | 44 + .../2019/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2019/OrdinaryHasInstance.js | 25 + .../es-abstract/2019/OrdinaryHasProperty.js | 20 + .../2019/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2019/OrdinaryToPrimitive.js | 38 + .../es-abstract/2019/PromiseResolve.js | 17 + .../es-abstract/2019/QuoteJSONString.js | 54 + node_modules/es-abstract/2019/RegExpCreate.js | 21 + node_modules/es-abstract/2019/RegExpExec.js | 32 + .../2019/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2019/SameValue.js | 13 + .../es-abstract/2019/SameValueNonNumber.js | 16 + .../es-abstract/2019/SameValueZero.js | 9 + node_modules/es-abstract/2019/SecFromTime.js | 14 + node_modules/es-abstract/2019/Set.js | 47 + .../es-abstract/2019/SetFunctionLength.js | 31 + .../es-abstract/2019/SetFunctionName.js | 44 + .../es-abstract/2019/SetIntegrityLevel.js | 57 + .../es-abstract/2019/SpeciesConstructor.js | 32 + node_modules/es-abstract/2019/SplitMatch.js | 38 + .../2019/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2019/StringCreate.js | 40 + .../es-abstract/2019/StringGetOwnProperty.js | 48 + .../2019/SymbolDescriptiveString.js | 20 + .../es-abstract/2019/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2019/TimeClip.js | 21 + node_modules/es-abstract/2019/TimeFromYear.js | 11 + node_modules/es-abstract/2019/TimeString.js | 25 + .../es-abstract/2019/TimeWithinDay.js | 12 + node_modules/es-abstract/2019/ToBoolean.js | 5 + node_modules/es-abstract/2019/ToDateString.js | 22 + node_modules/es-abstract/2019/ToIndex.js | 26 + node_modules/es-abstract/2019/ToInt16.js | 10 + node_modules/es-abstract/2019/ToInt32.js | 9 + node_modules/es-abstract/2019/ToInt8.js | 10 + node_modules/es-abstract/2019/ToInteger.js | 12 + node_modules/es-abstract/2019/ToLength.js | 12 + node_modules/es-abstract/2019/ToNumber.js | 59 + node_modules/es-abstract/2019/ToObject.js | 14 + node_modules/es-abstract/2019/ToPrimitive.js | 12 + .../es-abstract/2019/ToPropertyDescriptor.js | 52 + .../es-abstract/2019/ToPropertyKey.js | 15 + node_modules/es-abstract/2019/ToString.js | 15 + node_modules/es-abstract/2019/ToUint16.js | 19 + node_modules/es-abstract/2019/ToUint32.js | 9 + node_modules/es-abstract/2019/ToUint8.js | 20 + node_modules/es-abstract/2019/ToUint8Clamp.js | 19 + node_modules/es-abstract/2019/TrimString.js | 29 + node_modules/es-abstract/2019/Type.js | 12 + node_modules/es-abstract/2019/UTF16Decode.js | 21 + .../es-abstract/2019/UTF16Encoding.js | 25 + .../es-abstract/2019/UnicodeEscape.js | 26 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2019/WeekDay.js | 10 + node_modules/es-abstract/2019/YearFromTime.js | 16 + node_modules/es-abstract/2019/abs.js | 11 + node_modules/es-abstract/2019/floor.js | 11 + node_modules/es-abstract/2019/modulo.js | 9 + node_modules/es-abstract/2019/msFromTime.js | 11 + .../es-abstract/2019/thisBooleanValue.js | 15 + .../es-abstract/2019/thisNumberValue.js | 18 + .../es-abstract/2019/thisStringValue.js | 15 + .../es-abstract/2019/thisSymbolValue.js | 19 + .../es-abstract/2019/thisTimeValue.js | 3 + .../2020/AbstractEqualityComparison.js | 57 + .../2020/AbstractRelationalComparison.js | 82 + .../2020/AddEntriesFromIterable.js | 52 + .../es-abstract/2020/AdvanceStringIndex.js | 34 + node_modules/es-abstract/2020/ArrayCreate.js | 53 + .../es-abstract/2020/ArraySetLength.js | 85 + .../es-abstract/2020/ArraySpeciesCreate.js | 46 + node_modules/es-abstract/2020/BigInt/add.js | 18 + .../es-abstract/2020/BigInt/bitwiseAND.js | 17 + .../es-abstract/2020/BigInt/bitwiseNOT.js | 17 + .../es-abstract/2020/BigInt/bitwiseOR.js | 17 + .../es-abstract/2020/BigInt/bitwiseXOR.js | 17 + .../es-abstract/2020/BigInt/divide.js | 22 + node_modules/es-abstract/2020/BigInt/equal.js | 17 + .../es-abstract/2020/BigInt/exponentiate.js | 31 + node_modules/es-abstract/2020/BigInt/index.js | 43 + .../es-abstract/2020/BigInt/leftShift.js | 18 + .../es-abstract/2020/BigInt/lessThan.js | 18 + .../es-abstract/2020/BigInt/multiply.js | 18 + .../es-abstract/2020/BigInt/remainder.js | 30 + .../es-abstract/2020/BigInt/sameValue.js | 18 + .../es-abstract/2020/BigInt/sameValueZero.js | 18 + .../2020/BigInt/signedRightShift.js | 18 + .../es-abstract/2020/BigInt/subtract.js | 18 + .../es-abstract/2020/BigInt/toString.js | 18 + .../es-abstract/2020/BigInt/unaryMinus.js | 24 + .../2020/BigInt/unsignedRightShift.js | 17 + .../es-abstract/2020/BigIntBitwiseOp.js | 66 + node_modules/es-abstract/2020/BinaryAnd.js | 14 + node_modules/es-abstract/2020/BinaryOr.js | 14 + node_modules/es-abstract/2020/BinaryXor.js | 14 + node_modules/es-abstract/2020/Call.js | 20 + .../2020/CanonicalNumericIndexString.js | 22 + .../es-abstract/2020/CharacterRange.js | 31 + node_modules/es-abstract/2020/CodePointAt.js | 58 + .../2020/CompletePropertyDescriptor.js | 39 + .../es-abstract/2020/CopyDataProperties.js | 64 + .../es-abstract/2020/CreateDataProperty.js | 45 + .../2020/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2020/CreateHTML.js | 30 + .../2020/CreateIterResultObject.js | 19 + .../2020/CreateListFromArrayLike.js | 44 + .../es-abstract/2020/CreateMethodProperty.js | 40 + .../2020/CreateRegExpStringIterator.js | 111 + node_modules/es-abstract/2020/DateFromTime.js | 54 + node_modules/es-abstract/2020/DateString.js | 30 + node_modules/es-abstract/2020/Day.js | 11 + node_modules/es-abstract/2020/DayFromYear.js | 10 + .../es-abstract/2020/DayWithinYear.js | 11 + node_modules/es-abstract/2020/DaysInYear.js | 18 + .../es-abstract/2020/DefinePropertyOrThrow.js | 50 + .../es-abstract/2020/DeletePropertyOrThrow.js | 27 + .../2020/EnumerableOwnPropertyNames.js | 43 + .../es-abstract/2020/FlattenIntoArray.js | 58 + .../2020/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2020/Get.js | 25 + node_modules/es-abstract/2020/GetIterator.js | 64 + node_modules/es-abstract/2020/GetMethod.js | 34 + .../es-abstract/2020/GetOwnPropertyKeys.js | 31 + .../2020/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2020/GetSubstitution.js | 128 + node_modules/es-abstract/2020/GetV.js | 23 + .../es-abstract/2020/HasOwnProperty.js | 22 + node_modules/es-abstract/2020/HasProperty.js | 20 + node_modules/es-abstract/2020/HourFromTime.js | 14 + node_modules/es-abstract/2020/InLeapYear.js | 21 + .../es-abstract/2020/InstanceofOperator.js | 30 + node_modules/es-abstract/2020/Invoke.js | 24 + .../es-abstract/2020/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2020/IsArray.js | 4 + .../es-abstract/2020/IsBigIntElementType.js | 7 + node_modules/es-abstract/2020/IsCallable.js | 5 + .../2020/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2020/IsConcatSpreadable.js | 25 + .../es-abstract/2020/IsConstructor.js | 40 + .../es-abstract/2020/IsDataDescriptor.js | 23 + node_modules/es-abstract/2020/IsExtensible.js | 18 + .../es-abstract/2020/IsGenericDescriptor.js | 23 + node_modules/es-abstract/2020/IsInteger.js | 17 + .../es-abstract/2020/IsNoTearConfiguration.js | 16 + .../es-abstract/2020/IsNonNegativeInteger.js | 9 + node_modules/es-abstract/2020/IsPromise.js | 24 + .../es-abstract/2020/IsPropertyKey.js | 7 + node_modules/es-abstract/2020/IsRegExp.js | 24 + .../es-abstract/2020/IsSharedArrayBuffer.js | 19 + .../es-abstract/2020/IsStringPrefix.js | 47 + .../2020/IsUnclampedIntegerElementType.js | 12 + .../es-abstract/2020/IsUnsignedElementType.js | 11 + .../es-abstract/2020/IterableToList.js | 24 + .../es-abstract/2020/IteratorClose.js | 50 + .../es-abstract/2020/IteratorComplete.js | 18 + node_modules/es-abstract/2020/IteratorNext.js | 18 + node_modules/es-abstract/2020/IteratorStep.js | 13 + .../es-abstract/2020/IteratorValue.js | 18 + .../es-abstract/2020/LengthOfArrayLike.js | 20 + node_modules/es-abstract/2020/MakeDate.js | 13 + node_modules/es-abstract/2020/MakeDay.js | 33 + node_modules/es-abstract/2020/MakeTime.js | 23 + node_modules/es-abstract/2020/MinFromTime.js | 14 + .../es-abstract/2020/MonthFromTime.js | 47 + node_modules/es-abstract/2020/Number/add.js | 44 + .../es-abstract/2020/Number/bitwiseAND.js | 17 + .../es-abstract/2020/Number/bitwiseNOT.js | 19 + .../es-abstract/2020/Number/bitwiseOR.js | 17 + .../es-abstract/2020/Number/bitwiseXOR.js | 17 + .../es-abstract/2020/Number/divide.js | 22 + node_modules/es-abstract/2020/Number/equal.js | 21 + .../es-abstract/2020/Number/exponentiate.js | 77 + node_modules/es-abstract/2020/Number/index.js | 43 + .../es-abstract/2020/Number/leftShift.js | 24 + .../es-abstract/2020/Number/lessThan.js | 26 + .../es-abstract/2020/Number/multiply.js | 33 + .../es-abstract/2020/Number/remainder.js | 32 + .../es-abstract/2020/Number/sameValue.js | 21 + .../es-abstract/2020/Number/sameValueZero.js | 24 + .../2020/Number/signedRightShift.js | 24 + .../es-abstract/2020/Number/subtract.js | 16 + .../es-abstract/2020/Number/toString.js | 18 + .../es-abstract/2020/Number/unaryMinus.js | 21 + .../2020/Number/unsignedRightShift.js | 24 + .../es-abstract/2020/NumberBitwiseOp.js | 29 + .../es-abstract/2020/NumberToBigInt.js | 26 + .../2020/ObjectDefineProperties.js | 40 + .../2020/OrdinaryCreateFromConstructor.js | 20 + .../2020/OrdinaryDefineOwnProperty.js | 61 + .../2020/OrdinaryGetOwnProperty.js | 44 + .../2020/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2020/OrdinaryHasInstance.js | 25 + .../es-abstract/2020/OrdinaryHasProperty.js | 20 + .../es-abstract/2020/OrdinaryObjectCreate.js | 46 + .../2020/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2020/OrdinaryToPrimitive.js | 38 + .../es-abstract/2020/PromiseResolve.js | 17 + .../es-abstract/2020/QuoteJSONString.js | 54 + node_modules/es-abstract/2020/RegExpCreate.js | 21 + node_modules/es-abstract/2020/RegExpExec.js | 32 + .../2020/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2020/SameValue.js | 13 + .../es-abstract/2020/SameValueNonNumeric.js | 21 + .../es-abstract/2020/SameValueZero.js | 9 + node_modules/es-abstract/2020/SecFromTime.js | 14 + node_modules/es-abstract/2020/Set.js | 47 + .../es-abstract/2020/SetFunctionLength.js | 31 + .../es-abstract/2020/SetFunctionName.js | 44 + .../es-abstract/2020/SetIntegrityLevel.js | 57 + .../es-abstract/2020/SpeciesConstructor.js | 32 + node_modules/es-abstract/2020/SplitMatch.js | 38 + .../2020/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2020/StringCreate.js | 40 + .../es-abstract/2020/StringGetOwnProperty.js | 48 + node_modules/es-abstract/2020/StringPad.js | 43 + .../es-abstract/2020/StringToBigInt.js | 23 + .../2020/SymbolDescriptiveString.js | 20 + .../es-abstract/2020/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2020/TimeClip.js | 21 + node_modules/es-abstract/2020/TimeFromYear.js | 11 + node_modules/es-abstract/2020/TimeString.js | 25 + .../es-abstract/2020/TimeWithinDay.js | 12 + node_modules/es-abstract/2020/ToBigInt.js | 25 + node_modules/es-abstract/2020/ToBigInt64.js | 25 + node_modules/es-abstract/2020/ToBigUint64.js | 22 + node_modules/es-abstract/2020/ToBoolean.js | 5 + node_modules/es-abstract/2020/ToDateString.js | 22 + node_modules/es-abstract/2020/ToIndex.js | 26 + node_modules/es-abstract/2020/ToInt16.js | 10 + node_modules/es-abstract/2020/ToInt32.js | 9 + node_modules/es-abstract/2020/ToInt8.js | 10 + node_modules/es-abstract/2020/ToInteger.js | 15 + node_modules/es-abstract/2020/ToLength.js | 12 + node_modules/es-abstract/2020/ToNumber.js | 62 + node_modules/es-abstract/2020/ToNumeric.js | 21 + node_modules/es-abstract/2020/ToObject.js | 14 + node_modules/es-abstract/2020/ToPrimitive.js | 12 + .../es-abstract/2020/ToPropertyDescriptor.js | 52 + .../es-abstract/2020/ToPropertyKey.js | 15 + node_modules/es-abstract/2020/ToString.js | 15 + node_modules/es-abstract/2020/ToUint16.js | 19 + node_modules/es-abstract/2020/ToUint32.js | 9 + node_modules/es-abstract/2020/ToUint8.js | 20 + node_modules/es-abstract/2020/ToUint8Clamp.js | 19 + node_modules/es-abstract/2020/TrimString.js | 29 + node_modules/es-abstract/2020/Type.js | 15 + .../es-abstract/2020/UTF16DecodeString.js | 29 + .../2020/UTF16DecodeSurrogatePair.js | 19 + .../es-abstract/2020/UTF16Encoding.js | 25 + .../es-abstract/2020/UnicodeEscape.js | 27 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2020/WeekDay.js | 10 + node_modules/es-abstract/2020/YearFromTime.js | 16 + node_modules/es-abstract/2020/abs.js | 11 + node_modules/es-abstract/2020/floor.js | 11 + node_modules/es-abstract/2020/modulo.js | 9 + node_modules/es-abstract/2020/msFromTime.js | 11 + .../es-abstract/2020/thisBigIntValue.js | 22 + .../es-abstract/2020/thisBooleanValue.js | 15 + .../es-abstract/2020/thisNumberValue.js | 18 + .../es-abstract/2020/thisStringValue.js | 15 + .../es-abstract/2020/thisSymbolValue.js | 19 + .../es-abstract/2020/thisTimeValue.js | 3 + .../2021/AbstractEqualityComparison.js | 57 + .../2021/AbstractRelationalComparison.js | 82 + .../2021/AddEntriesFromIterable.js | 52 + .../es-abstract/2021/AddToKeptObjects.js | 21 + .../es-abstract/2021/AdvanceStringIndex.js | 34 + .../ApplyStringOrNumericBinaryOperator.js | 80 + node_modules/es-abstract/2021/ArrayCreate.js | 53 + .../es-abstract/2021/ArraySetLength.js | 85 + .../es-abstract/2021/ArraySpeciesCreate.js | 48 + node_modules/es-abstract/2021/BigInt/add.js | 18 + .../es-abstract/2021/BigInt/bitwiseAND.js | 17 + .../es-abstract/2021/BigInt/bitwiseNOT.js | 17 + .../es-abstract/2021/BigInt/bitwiseOR.js | 17 + .../es-abstract/2021/BigInt/bitwiseXOR.js | 17 + .../es-abstract/2021/BigInt/divide.js | 22 + node_modules/es-abstract/2021/BigInt/equal.js | 17 + .../es-abstract/2021/BigInt/exponentiate.js | 31 + node_modules/es-abstract/2021/BigInt/index.js | 43 + .../es-abstract/2021/BigInt/leftShift.js | 18 + .../es-abstract/2021/BigInt/lessThan.js | 18 + .../es-abstract/2021/BigInt/multiply.js | 18 + .../es-abstract/2021/BigInt/remainder.js | 30 + .../es-abstract/2021/BigInt/sameValue.js | 18 + .../es-abstract/2021/BigInt/sameValueZero.js | 18 + .../2021/BigInt/signedRightShift.js | 18 + .../es-abstract/2021/BigInt/subtract.js | 18 + .../es-abstract/2021/BigInt/toString.js | 18 + .../es-abstract/2021/BigInt/unaryMinus.js | 24 + .../2021/BigInt/unsignedRightShift.js | 17 + .../es-abstract/2021/BigIntBitwiseOp.js | 66 + node_modules/es-abstract/2021/BinaryAnd.js | 14 + node_modules/es-abstract/2021/BinaryOr.js | 14 + node_modules/es-abstract/2021/BinaryXor.js | 14 + .../es-abstract/2021/ByteListBitwiseOp.js | 44 + .../es-abstract/2021/ByteListEqual.js | 33 + node_modules/es-abstract/2021/Call.js | 20 + .../2021/CanonicalNumericIndexString.js | 22 + .../es-abstract/2021/CharacterRange.js | 31 + .../es-abstract/2021/ClearKeptObjects.js | 12 + node_modules/es-abstract/2021/CodePointAt.js | 58 + .../es-abstract/2021/CodePointsToString.js | 27 + .../2021/CompletePropertyDescriptor.js | 39 + .../es-abstract/2021/CopyDataProperties.js | 70 + .../es-abstract/2021/CreateDataProperty.js | 45 + .../2021/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2021/CreateHTML.js | 30 + .../2021/CreateIterResultObject.js | 19 + .../2021/CreateListFromArrayLike.js | 44 + .../es-abstract/2021/CreateMethodProperty.js | 40 + .../2021/CreateRegExpStringIterator.js | 111 + node_modules/es-abstract/2021/DateFromTime.js | 54 + node_modules/es-abstract/2021/DateString.js | 30 + node_modules/es-abstract/2021/Day.js | 11 + node_modules/es-abstract/2021/DayFromYear.js | 10 + .../es-abstract/2021/DayWithinYear.js | 11 + node_modules/es-abstract/2021/DaysInYear.js | 18 + .../es-abstract/2021/DefinePropertyOrThrow.js | 50 + .../es-abstract/2021/DeletePropertyOrThrow.js | 27 + .../2021/EnumerableOwnPropertyNames.js | 43 + .../es-abstract/2021/FlattenIntoArray.js | 58 + .../2021/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2021/Get.js | 25 + node_modules/es-abstract/2021/GetIterator.js | 64 + node_modules/es-abstract/2021/GetMethod.js | 34 + .../es-abstract/2021/GetOwnPropertyKeys.js | 31 + .../es-abstract/2021/GetPromiseResolve.js | 22 + .../2021/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2021/GetSubstitution.js | 128 + node_modules/es-abstract/2021/GetV.js | 23 + .../es-abstract/2021/HasOwnProperty.js | 22 + node_modules/es-abstract/2021/HasProperty.js | 20 + node_modules/es-abstract/2021/HourFromTime.js | 14 + node_modules/es-abstract/2021/InLeapYear.js | 21 + .../es-abstract/2021/InstanceofOperator.js | 30 + node_modules/es-abstract/2021/Invoke.js | 24 + .../es-abstract/2021/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2021/IsArray.js | 4 + .../es-abstract/2021/IsBigIntElementType.js | 7 + node_modules/es-abstract/2021/IsCallable.js | 5 + .../2021/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2021/IsConcatSpreadable.js | 25 + .../es-abstract/2021/IsConstructor.js | 40 + .../es-abstract/2021/IsDataDescriptor.js | 23 + node_modules/es-abstract/2021/IsExtensible.js | 18 + .../es-abstract/2021/IsGenericDescriptor.js | 23 + .../es-abstract/2021/IsIntegralNumber.js | 18 + .../es-abstract/2021/IsNoTearConfiguration.js | 16 + node_modules/es-abstract/2021/IsPromise.js | 24 + .../es-abstract/2021/IsPropertyKey.js | 7 + node_modules/es-abstract/2021/IsRegExp.js | 24 + .../es-abstract/2021/IsSharedArrayBuffer.js | 19 + .../es-abstract/2021/IsStringPrefix.js | 47 + .../2021/IsUnclampedIntegerElementType.js | 12 + .../es-abstract/2021/IsUnsignedElementType.js | 11 + .../es-abstract/2021/IterableToList.js | 29 + .../es-abstract/2021/IteratorClose.js | 50 + .../es-abstract/2021/IteratorComplete.js | 18 + node_modules/es-abstract/2021/IteratorNext.js | 18 + node_modules/es-abstract/2021/IteratorStep.js | 13 + .../es-abstract/2021/IteratorValue.js | 18 + .../es-abstract/2021/LengthOfArrayLike.js | 20 + node_modules/es-abstract/2021/MakeDate.js | 13 + node_modules/es-abstract/2021/MakeDay.js | 36 + node_modules/es-abstract/2021/MakeTime.js | 23 + node_modules/es-abstract/2021/MinFromTime.js | 14 + .../es-abstract/2021/MonthFromTime.js | 47 + node_modules/es-abstract/2021/Number/add.js | 36 + .../es-abstract/2021/Number/bitwiseAND.js | 17 + .../es-abstract/2021/Number/bitwiseNOT.js | 19 + .../es-abstract/2021/Number/bitwiseOR.js | 17 + .../es-abstract/2021/Number/bitwiseXOR.js | 17 + .../es-abstract/2021/Number/divide.js | 22 + node_modules/es-abstract/2021/Number/equal.js | 21 + .../es-abstract/2021/Number/exponentiate.js | 77 + node_modules/es-abstract/2021/Number/index.js | 43 + .../es-abstract/2021/Number/leftShift.js | 25 + .../es-abstract/2021/Number/lessThan.js | 26 + .../es-abstract/2021/Number/multiply.js | 33 + .../es-abstract/2021/Number/remainder.js | 32 + .../es-abstract/2021/Number/sameValue.js | 21 + .../es-abstract/2021/Number/sameValueZero.js | 24 + .../2021/Number/signedRightShift.js | 25 + .../es-abstract/2021/Number/subtract.js | 19 + .../es-abstract/2021/Number/toString.js | 18 + .../es-abstract/2021/Number/unaryMinus.js | 21 + .../2021/Number/unsignedRightShift.js | 25 + .../es-abstract/2021/NumberBitwiseOp.js | 29 + .../es-abstract/2021/NumberToBigInt.js | 22 + .../2021/ObjectDefineProperties.js | 40 + .../2021/OrdinaryCreateFromConstructor.js | 20 + .../2021/OrdinaryDefineOwnProperty.js | 61 + .../2021/OrdinaryGetOwnProperty.js | 44 + .../2021/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2021/OrdinaryHasInstance.js | 25 + .../es-abstract/2021/OrdinaryHasProperty.js | 20 + .../es-abstract/2021/OrdinaryObjectCreate.js | 46 + .../2021/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2021/OrdinaryToPrimitive.js | 38 + .../es-abstract/2021/PromiseResolve.js | 17 + .../es-abstract/2021/QuoteJSONString.js | 54 + node_modules/es-abstract/2021/RegExpCreate.js | 21 + node_modules/es-abstract/2021/RegExpExec.js | 32 + .../2021/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2021/SameValue.js | 13 + .../es-abstract/2021/SameValueNonNumeric.js | 21 + .../es-abstract/2021/SameValueZero.js | 9 + node_modules/es-abstract/2021/SecFromTime.js | 14 + node_modules/es-abstract/2021/Set.js | 47 + .../es-abstract/2021/SetFunctionLength.js | 31 + .../es-abstract/2021/SetFunctionName.js | 44 + .../es-abstract/2021/SetIntegrityLevel.js | 57 + .../es-abstract/2021/SpeciesConstructor.js | 32 + node_modules/es-abstract/2021/SplitMatch.js | 38 + .../2021/StrictEqualityComparison.js | 17 + node_modules/es-abstract/2021/StringCreate.js | 40 + .../es-abstract/2021/StringGetOwnProperty.js | 48 + .../es-abstract/2021/StringIndexOf.js | 39 + node_modules/es-abstract/2021/StringPad.js | 43 + .../es-abstract/2021/StringToBigInt.js | 23 + .../es-abstract/2021/StringToCodePoints.js | 29 + .../2021/SymbolDescriptiveString.js | 20 + .../es-abstract/2021/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2021/TimeClip.js | 21 + node_modules/es-abstract/2021/TimeFromYear.js | 11 + node_modules/es-abstract/2021/TimeString.js | 25 + .../es-abstract/2021/TimeWithinDay.js | 12 + node_modules/es-abstract/2021/ToBigInt.js | 25 + node_modules/es-abstract/2021/ToBigInt64.js | 25 + node_modules/es-abstract/2021/ToBigUint64.js | 22 + node_modules/es-abstract/2021/ToBoolean.js | 5 + node_modules/es-abstract/2021/ToDateString.js | 22 + node_modules/es-abstract/2021/ToIndex.js | 26 + node_modules/es-abstract/2021/ToInt16.js | 10 + node_modules/es-abstract/2021/ToInt32.js | 9 + node_modules/es-abstract/2021/ToInt8.js | 10 + .../es-abstract/2021/ToIntegerOrInfinity.js | 18 + node_modules/es-abstract/2021/ToLength.js | 12 + node_modules/es-abstract/2021/ToNumber.js | 62 + node_modules/es-abstract/2021/ToNumeric.js | 21 + node_modules/es-abstract/2021/ToObject.js | 14 + node_modules/es-abstract/2021/ToPrimitive.js | 12 + .../es-abstract/2021/ToPropertyDescriptor.js | 52 + .../es-abstract/2021/ToPropertyKey.js | 15 + node_modules/es-abstract/2021/ToString.js | 15 + node_modules/es-abstract/2021/ToUint16.js | 19 + node_modules/es-abstract/2021/ToUint32.js | 9 + node_modules/es-abstract/2021/ToUint8.js | 20 + node_modules/es-abstract/2021/ToUint8Clamp.js | 19 + node_modules/es-abstract/2021/TrimString.js | 29 + node_modules/es-abstract/2021/Type.js | 15 + .../es-abstract/2021/UTF16EncodeCodePoint.js | 25 + .../2021/UTF16SurrogatePairToCodePoint.js | 19 + .../es-abstract/2021/UnicodeEscape.js | 27 + .../ValidateAndApplyPropertyDescriptor.js | 170 + node_modules/es-abstract/2021/WeakRefDeref.js | 24 + node_modules/es-abstract/2021/WeekDay.js | 10 + node_modules/es-abstract/2021/YearFromTime.js | 16 + node_modules/es-abstract/2021/abs.js | 11 + node_modules/es-abstract/2021/clamp.js | 18 + node_modules/es-abstract/2021/floor.js | 11 + node_modules/es-abstract/2021/modulo.js | 9 + node_modules/es-abstract/2021/msFromTime.js | 11 + node_modules/es-abstract/2021/substring.js | 20 + .../es-abstract/2021/thisBigIntValue.js | 22 + .../es-abstract/2021/thisBooleanValue.js | 15 + .../es-abstract/2021/thisNumberValue.js | 18 + .../es-abstract/2021/thisStringValue.js | 15 + .../es-abstract/2021/thisSymbolValue.js | 19 + .../es-abstract/2021/thisTimeValue.js | 3 + .../2022/AddEntriesFromIterable.js | 52 + .../es-abstract/2022/AddToKeptObjects.js | 21 + .../es-abstract/2022/AdvanceStringIndex.js | 34 + .../ApplyStringOrNumericBinaryOperator.js | 80 + node_modules/es-abstract/2022/ArrayCreate.js | 53 + .../es-abstract/2022/ArraySetLength.js | 85 + .../es-abstract/2022/ArraySpeciesCreate.js | 48 + node_modules/es-abstract/2022/BigInt/add.js | 18 + .../es-abstract/2022/BigInt/bitwiseAND.js | 17 + .../es-abstract/2022/BigInt/bitwiseNOT.js | 17 + .../es-abstract/2022/BigInt/bitwiseOR.js | 17 + .../es-abstract/2022/BigInt/bitwiseXOR.js | 17 + .../es-abstract/2022/BigInt/divide.js | 22 + node_modules/es-abstract/2022/BigInt/equal.js | 17 + .../es-abstract/2022/BigInt/exponentiate.js | 31 + node_modules/es-abstract/2022/BigInt/index.js | 43 + .../es-abstract/2022/BigInt/leftShift.js | 18 + .../es-abstract/2022/BigInt/lessThan.js | 18 + .../es-abstract/2022/BigInt/multiply.js | 18 + .../es-abstract/2022/BigInt/remainder.js | 30 + .../es-abstract/2022/BigInt/sameValue.js | 18 + .../es-abstract/2022/BigInt/sameValueZero.js | 18 + .../2022/BigInt/signedRightShift.js | 18 + .../es-abstract/2022/BigInt/subtract.js | 18 + .../es-abstract/2022/BigInt/toString.js | 18 + .../es-abstract/2022/BigInt/unaryMinus.js | 24 + .../2022/BigInt/unsignedRightShift.js | 17 + .../es-abstract/2022/BigIntBitwiseOp.js | 66 + node_modules/es-abstract/2022/BinaryAnd.js | 14 + node_modules/es-abstract/2022/BinaryOr.js | 14 + node_modules/es-abstract/2022/BinaryXor.js | 14 + .../es-abstract/2022/ByteListBitwiseOp.js | 44 + .../es-abstract/2022/ByteListEqual.js | 33 + node_modules/es-abstract/2022/Call.js | 20 + .../2022/CanonicalNumericIndexString.js | 22 + .../es-abstract/2022/CharacterRange.js | 31 + .../es-abstract/2022/ClearKeptObjects.js | 12 + node_modules/es-abstract/2022/CodePointAt.js | 58 + .../es-abstract/2022/CodePointsToString.js | 27 + .../2022/CompletePropertyDescriptor.js | 39 + .../es-abstract/2022/CopyDataProperties.js | 70 + .../es-abstract/2022/CreateDataProperty.js | 45 + .../2022/CreateDataPropertyOrThrow.js | 25 + node_modules/es-abstract/2022/CreateHTML.js | 30 + .../2022/CreateIterResultObject.js | 19 + .../2022/CreateListFromArrayLike.js | 44 + .../es-abstract/2022/CreateMethodProperty.js | 40 + .../CreateNonEnumerableDataPropertyOrThrow.js | 29 + .../2022/CreateRegExpStringIterator.js | 111 + node_modules/es-abstract/2022/DateFromTime.js | 54 + node_modules/es-abstract/2022/DateString.js | 30 + node_modules/es-abstract/2022/Day.js | 11 + node_modules/es-abstract/2022/DayFromYear.js | 10 + .../es-abstract/2022/DayWithinYear.js | 11 + node_modules/es-abstract/2022/DaysInYear.js | 18 + .../es-abstract/2022/DefinePropertyOrThrow.js | 50 + .../es-abstract/2022/DeletePropertyOrThrow.js | 27 + .../2022/EnumerableOwnPropertyNames.js | 43 + .../es-abstract/2022/FlattenIntoArray.js | 58 + .../2022/FromPropertyDescriptor.js | 16 + node_modules/es-abstract/2022/Get.js | 25 + node_modules/es-abstract/2022/GetIterator.js | 64 + .../es-abstract/2022/GetMatchIndexPair.js | 26 + .../es-abstract/2022/GetMatchString.js | 27 + node_modules/es-abstract/2022/GetMethod.js | 34 + .../es-abstract/2022/GetOwnPropertyKeys.js | 31 + .../es-abstract/2022/GetPromiseResolve.js | 22 + .../2022/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2022/GetStringIndex.js | 30 + .../es-abstract/2022/GetSubstitution.js | 128 + node_modules/es-abstract/2022/GetV.js | 23 + .../es-abstract/2022/HasOwnProperty.js | 22 + node_modules/es-abstract/2022/HasProperty.js | 20 + node_modules/es-abstract/2022/HourFromTime.js | 14 + node_modules/es-abstract/2022/InLeapYear.js | 21 + .../es-abstract/2022/InstallErrorCause.js | 23 + .../es-abstract/2022/InstanceofOperator.js | 30 + node_modules/es-abstract/2022/Invoke.js | 24 + .../es-abstract/2022/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/2022/IsArray.js | 4 + .../es-abstract/2022/IsBigIntElementType.js | 7 + node_modules/es-abstract/2022/IsCallable.js | 5 + .../2022/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2022/IsConcatSpreadable.js | 25 + .../es-abstract/2022/IsConstructor.js | 40 + .../es-abstract/2022/IsDataDescriptor.js | 23 + node_modules/es-abstract/2022/IsExtensible.js | 18 + .../es-abstract/2022/IsGenericDescriptor.js | 23 + .../es-abstract/2022/IsIntegralNumber.js | 18 + node_modules/es-abstract/2022/IsLessThan.js | 90 + .../es-abstract/2022/IsLooselyEqual.js | 59 + .../es-abstract/2022/IsNoTearConfiguration.js | 16 + node_modules/es-abstract/2022/IsPromise.js | 24 + .../es-abstract/2022/IsPropertyKey.js | 7 + node_modules/es-abstract/2022/IsRegExp.js | 24 + .../es-abstract/2022/IsSharedArrayBuffer.js | 19 + .../es-abstract/2022/IsStrictlyEqual.js | 20 + .../es-abstract/2022/IsStringPrefix.js | 22 + .../2022/IsStringWellFormedUnicode.js | 26 + .../2022/IsUnclampedIntegerElementType.js | 12 + .../es-abstract/2022/IsUnsignedElementType.js | 11 + .../es-abstract/2022/IterableToList.js | 29 + .../es-abstract/2022/IteratorClose.js | 50 + .../es-abstract/2022/IteratorComplete.js | 18 + node_modules/es-abstract/2022/IteratorNext.js | 18 + node_modules/es-abstract/2022/IteratorStep.js | 13 + .../es-abstract/2022/IteratorValue.js | 18 + .../es-abstract/2022/LengthOfArrayLike.js | 20 + node_modules/es-abstract/2022/MakeDate.js | 13 + node_modules/es-abstract/2022/MakeDay.js | 36 + .../2022/MakeMatchIndicesIndexPairArray.js | 69 + node_modules/es-abstract/2022/MakeTime.js | 23 + node_modules/es-abstract/2022/MinFromTime.js | 14 + .../es-abstract/2022/MonthFromTime.js | 47 + node_modules/es-abstract/2022/Number/add.js | 36 + .../es-abstract/2022/Number/bitwiseAND.js | 17 + .../es-abstract/2022/Number/bitwiseNOT.js | 19 + .../es-abstract/2022/Number/bitwiseOR.js | 17 + .../es-abstract/2022/Number/bitwiseXOR.js | 17 + .../es-abstract/2022/Number/divide.js | 22 + node_modules/es-abstract/2022/Number/equal.js | 21 + .../es-abstract/2022/Number/exponentiate.js | 77 + node_modules/es-abstract/2022/Number/index.js | 43 + .../es-abstract/2022/Number/leftShift.js | 25 + .../es-abstract/2022/Number/lessThan.js | 26 + .../es-abstract/2022/Number/multiply.js | 33 + .../es-abstract/2022/Number/remainder.js | 32 + .../es-abstract/2022/Number/sameValue.js | 21 + .../es-abstract/2022/Number/sameValueZero.js | 24 + .../2022/Number/signedRightShift.js | 25 + .../es-abstract/2022/Number/subtract.js | 19 + .../es-abstract/2022/Number/toString.js | 18 + .../es-abstract/2022/Number/unaryMinus.js | 21 + .../2022/Number/unsignedRightShift.js | 25 + .../es-abstract/2022/NumberBitwiseOp.js | 29 + .../es-abstract/2022/NumberToBigInt.js | 22 + .../2022/ObjectDefineProperties.js | 40 + .../2022/OrdinaryCreateFromConstructor.js | 20 + .../2022/OrdinaryDefineOwnProperty.js | 61 + .../2022/OrdinaryGetOwnProperty.js | 44 + .../2022/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2022/OrdinaryHasInstance.js | 25 + .../es-abstract/2022/OrdinaryHasProperty.js | 20 + .../es-abstract/2022/OrdinaryObjectCreate.js | 46 + .../2022/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2022/OrdinaryToPrimitive.js | 38 + .../es-abstract/2022/PromiseResolve.js | 17 + .../es-abstract/2022/QuoteJSONString.js | 54 + node_modules/es-abstract/2022/RegExpCreate.js | 21 + node_modules/es-abstract/2022/RegExpExec.js | 32 + .../es-abstract/2022/RegExpHasFlag.js | 38 + .../2022/RequireObjectCoercible.js | 3 + node_modules/es-abstract/2022/SameValue.js | 13 + .../es-abstract/2022/SameValueNonNumeric.js | 21 + .../es-abstract/2022/SameValueZero.js | 9 + node_modules/es-abstract/2022/SecFromTime.js | 14 + node_modules/es-abstract/2022/Set.js | 47 + .../es-abstract/2022/SetFunctionLength.js | 31 + .../es-abstract/2022/SetFunctionName.js | 44 + .../es-abstract/2022/SetIntegrityLevel.js | 57 + .../es-abstract/2022/SortIndexedProperties.js | 64 + .../es-abstract/2022/SpeciesConstructor.js | 32 + node_modules/es-abstract/2022/StringCreate.js | 40 + .../es-abstract/2022/StringGetOwnProperty.js | 48 + .../es-abstract/2022/StringIndexOf.js | 39 + node_modules/es-abstract/2022/StringPad.js | 43 + .../es-abstract/2022/StringToBigInt.js | 23 + .../es-abstract/2022/StringToCodePoints.js | 29 + .../es-abstract/2022/StringToNumber.js | 56 + .../2022/SymbolDescriptiveString.js | 20 + .../es-abstract/2022/TestIntegrityLevel.js | 42 + node_modules/es-abstract/2022/TimeClip.js | 21 + node_modules/es-abstract/2022/TimeFromYear.js | 11 + node_modules/es-abstract/2022/TimeString.js | 25 + .../es-abstract/2022/TimeWithinDay.js | 12 + node_modules/es-abstract/2022/ToBigInt.js | 25 + node_modules/es-abstract/2022/ToBigInt64.js | 25 + node_modules/es-abstract/2022/ToBigUint64.js | 22 + node_modules/es-abstract/2022/ToBoolean.js | 5 + node_modules/es-abstract/2022/ToDateString.js | 22 + node_modules/es-abstract/2022/ToIndex.js | 26 + node_modules/es-abstract/2022/ToInt16.js | 10 + node_modules/es-abstract/2022/ToInt32.js | 9 + node_modules/es-abstract/2022/ToInt8.js | 10 + .../es-abstract/2022/ToIntegerOrInfinity.js | 18 + node_modules/es-abstract/2022/ToLength.js | 12 + node_modules/es-abstract/2022/ToNumber.js | 26 + node_modules/es-abstract/2022/ToNumeric.js | 21 + node_modules/es-abstract/2022/ToObject.js | 14 + node_modules/es-abstract/2022/ToPrimitive.js | 12 + .../es-abstract/2022/ToPropertyDescriptor.js | 52 + .../es-abstract/2022/ToPropertyKey.js | 15 + node_modules/es-abstract/2022/ToString.js | 15 + node_modules/es-abstract/2022/ToUint16.js | 19 + node_modules/es-abstract/2022/ToUint32.js | 9 + node_modules/es-abstract/2022/ToUint8.js | 20 + node_modules/es-abstract/2022/ToUint8Clamp.js | 19 + .../2022/ToZeroPaddedDecimalString.js | 19 + node_modules/es-abstract/2022/TrimString.js | 29 + node_modules/es-abstract/2022/Type.js | 15 + .../es-abstract/2022/UTF16EncodeCodePoint.js | 25 + .../2022/UTF16SurrogatePairToCodePoint.js | 19 + .../es-abstract/2022/UnicodeEscape.js | 27 + .../ValidateAndApplyPropertyDescriptor.js | 177 + node_modules/es-abstract/2022/WeakRefDeref.js | 24 + node_modules/es-abstract/2022/WeekDay.js | 10 + node_modules/es-abstract/2022/YearFromTime.js | 16 + node_modules/es-abstract/2022/abs.js | 11 + node_modules/es-abstract/2022/clamp.js | 18 + node_modules/es-abstract/2022/floor.js | 11 + node_modules/es-abstract/2022/modulo.js | 9 + node_modules/es-abstract/2022/msFromTime.js | 11 + node_modules/es-abstract/2022/substring.js | 20 + .../es-abstract/2022/thisBigIntValue.js | 22 + .../es-abstract/2022/thisBooleanValue.js | 15 + .../es-abstract/2022/thisNumberValue.js | 18 + .../es-abstract/2022/thisStringValue.js | 15 + .../es-abstract/2022/thisSymbolValue.js | 19 + .../es-abstract/2022/thisTimeValue.js | 3 + .../5/AbstractEqualityComparison.js | 37 + .../5/AbstractRelationalComparison.js | 63 + .../es-abstract/5/CheckObjectCoercible.js | 14 + node_modules/es-abstract/5/DateFromTime.js | 54 + node_modules/es-abstract/5/Day.js | 11 + node_modules/es-abstract/5/DayFromYear.js | 10 + node_modules/es-abstract/5/DayWithinYear.js | 11 + node_modules/es-abstract/5/DaysInYear.js | 18 + .../es-abstract/5/FromPropertyDescriptor.js | 39 + node_modules/es-abstract/5/HourFromTime.js | 14 + node_modules/es-abstract/5/InLeapYear.js | 21 + .../es-abstract/5/IsAccessorDescriptor.js | 23 + node_modules/es-abstract/5/IsCallable.js | 5 + .../es-abstract/5/IsDataDescriptor.js | 23 + .../es-abstract/5/IsGenericDescriptor.js | 23 + .../es-abstract/5/IsPropertyDescriptor.js | 19 + node_modules/es-abstract/5/MakeDate.js | 13 + node_modules/es-abstract/5/MakeDay.js | 33 + node_modules/es-abstract/5/MakeTime.js | 23 + node_modules/es-abstract/5/MinFromTime.js | 14 + node_modules/es-abstract/5/MonthFromTime.js | 47 + node_modules/es-abstract/5/SameValue.js | 13 + node_modules/es-abstract/5/SecFromTime.js | 14 + .../es-abstract/5/StrictEqualityComparison.js | 17 + node_modules/es-abstract/5/TimeClip.js | 21 + node_modules/es-abstract/5/TimeFromYear.js | 11 + node_modules/es-abstract/5/TimeWithinDay.js | 12 + node_modules/es-abstract/5/ToBoolean.js | 5 + node_modules/es-abstract/5/ToInt32.js | 9 + node_modules/es-abstract/5/ToInteger.js | 18 + node_modules/es-abstract/5/ToNumber.js | 20 + node_modules/es-abstract/5/ToObject.js | 14 + node_modules/es-abstract/5/ToPrimitive.js | 5 + .../es-abstract/5/ToPropertyDescriptor.js | 52 + node_modules/es-abstract/5/ToString.js | 12 + node_modules/es-abstract/5/ToUint16.js | 19 + node_modules/es-abstract/5/ToUint32.js | 9 + node_modules/es-abstract/5/Type.js | 24 + node_modules/es-abstract/5/WeekDay.js | 10 + node_modules/es-abstract/5/YearFromTime.js | 16 + node_modules/es-abstract/5/abs.js | 11 + node_modules/es-abstract/5/floor.js | 11 + node_modules/es-abstract/5/modulo.js | 9 + node_modules/es-abstract/5/msFromTime.js | 11 + node_modules/es-abstract/CHANGELOG.md | 594 ++ node_modules/es-abstract/GetIntrinsic.js | 5 + node_modules/es-abstract/LICENSE | 21 + node_modules/es-abstract/README.md | 43 + node_modules/es-abstract/es2015.js | 126 + node_modules/es-abstract/es2016.js | 131 + node_modules/es-abstract/es2017.js | 135 + node_modules/es-abstract/es2018.js | 143 + node_modules/es-abstract/es2019.js | 146 + node_modules/es-abstract/es2020.js | 169 + node_modules/es-abstract/es2021.js | 179 + node_modules/es-abstract/es2022.js | 189 + node_modules/es-abstract/es5.js | 51 + node_modules/es-abstract/es6.js | 3 + node_modules/es-abstract/es7.js | 3 + .../es-abstract/helpers/DefineOwnProperty.js | 55 + node_modules/es-abstract/helpers/IsArray.js | 12 + .../es-abstract/helpers/OwnPropertyKeys.js | 22 + .../es-abstract/helpers/assertRecord.js | 49 + node_modules/es-abstract/helpers/assign.js | 22 + node_modules/es-abstract/helpers/callBind.js | 5 + node_modules/es-abstract/helpers/callBound.js | 5 + node_modules/es-abstract/helpers/every.js | 10 + node_modules/es-abstract/helpers/forEach.js | 7 + .../helpers/fromPropertyDescriptor.js | 27 + .../es-abstract/helpers/getInferredName.js | 4 + .../es-abstract/helpers/getIteratorMethod.js | 47 + .../helpers/getOwnPropertyDescriptor.js | 15 + node_modules/es-abstract/helpers/getProto.js | 15 + .../helpers/getSymbolDescription.js | 4 + .../es-abstract/helpers/isAbstractClosure.js | 9 + .../es-abstract/helpers/isByteValue.js | 5 + .../es-abstract/helpers/isCodePoint.js | 5 + node_modules/es-abstract/helpers/isFinite.js | 5 + .../isFullyPopulatedPropertyDescriptor.js | 7 + .../es-abstract/helpers/isLeadingSurrogate.js | 5 + .../es-abstract/helpers/isMatchRecord.js | 16 + node_modules/es-abstract/helpers/isNaN.js | 5 + .../es-abstract/helpers/isPrefixOf.js | 13 + .../es-abstract/helpers/isPrimitive.js | 5 + .../helpers/isPropertyDescriptor.js | 31 + .../helpers/isSamePropertyDescriptor.js | 20 + .../helpers/isTrailingSurrogate.js | 5 + .../es-abstract/helpers/maxSafeInteger.js | 8 + node_modules/es-abstract/helpers/mod.js | 8 + node_modules/es-abstract/helpers/modBigInt.js | 6 + .../es-abstract/helpers/padTimeComponent.js | 9 + .../es-abstract/helpers/regexTester.js | 9 + node_modules/es-abstract/helpers/setProto.js | 16 + node_modules/es-abstract/helpers/sign.js | 5 + node_modules/es-abstract/helpers/some.js | 10 + .../es-abstract/helpers/timeConstants.js | 19 + node_modules/es-abstract/index.js | 32 + node_modules/es-abstract/operations/.eslintrc | 5 + node_modules/es-abstract/operations/2015.js | 741 ++ node_modules/es-abstract/operations/2016.js | 819 ++ node_modules/es-abstract/operations/2017.js | 963 +++ node_modules/es-abstract/operations/2018.js | 1042 +++ node_modules/es-abstract/operations/2019.js | 1057 +++ node_modules/es-abstract/operations/2020.js | 1246 +++ node_modules/es-abstract/operations/2021.js | 1309 +++ node_modules/es-abstract/operations/2022.js | 1399 ++++ node_modules/es-abstract/package.json | 141 + node_modules/es-shim-unscopables/.eslintrc | 37 + .../es-shim-unscopables/.github/FUNDING.yml | 12 + node_modules/es-shim-unscopables/.nycrc | 9 + node_modules/es-shim-unscopables/CHANGELOG.md | 13 + node_modules/es-shim-unscopables/LICENSE | 21 + node_modules/es-shim-unscopables/README.md | 57 + node_modules/es-shim-unscopables/index.js | 21 + node_modules/es-shim-unscopables/package.json | 49 + .../es-shim-unscopables/test/index.js | 67 + node_modules/es-shim-unscopables/test/with.js | 35 + node_modules/es-to-primitive/.eslintrc | 22 + .../es-to-primitive/.github/FUNDING.yml | 12 + node_modules/es-to-primitive/.travis.yml | 15 + node_modules/es-to-primitive/CHANGELOG.md | 49 + node_modules/es-to-primitive/LICENSE | 22 + node_modules/es-to-primitive/Makefile | 61 + node_modules/es-to-primitive/README.md | 49 + node_modules/es-to-primitive/es2015.js | 75 + node_modules/es-to-primitive/es5.js | 45 + node_modules/es-to-primitive/es6.js | 3 + .../es-to-primitive/helpers/isPrimitive.js | 5 + node_modules/es-to-primitive/index.js | 17 + node_modules/es-to-primitive/package.json | 81 + node_modules/es-to-primitive/test/es2015.js | 151 + node_modules/es-to-primitive/test/es5.js | 118 + node_modules/es-to-primitive/test/es6.js | 151 + node_modules/es-to-primitive/test/index.js | 20 + node_modules/escape-string-regexp/index.d.ts | 18 + node_modules/escape-string-regexp/index.js | 13 + node_modules/escape-string-regexp/license | 9 + .../escape-string-regexp/package.json | 38 + node_modules/escape-string-regexp/readme.md | 34 + .../eslint-config-standard/.eslintrc.json | 244 + .../eslint-config-standard/CHANGELOG.md | 10 + node_modules/eslint-config-standard/LICENSE | 20 + node_modules/eslint-config-standard/README.md | 91 + node_modules/eslint-config-standard/index.js | 2 + .../eslint-config-standard/package.json | 79 + .../eslint-import-resolver-node/LICENSE | 22 + .../eslint-import-resolver-node/README.md | 44 + .../eslint-import-resolver-node/index.js | 68 + .../node_modules/debug/CHANGELOG.md | 395 + .../node_modules/debug/LICENSE | 19 + .../node_modules/debug/README.md | 437 + .../node_modules/debug/node.js | 1 + .../node_modules/debug/package.json | 51 + .../node_modules/debug/src/browser.js | 180 + .../node_modules/debug/src/common.js | 249 + .../node_modules/debug/src/index.js | 12 + .../node_modules/debug/src/node.js | 177 + .../node_modules/ms/index.js | 162 + .../node_modules/ms/license.md | 21 + .../node_modules/ms/package.json | 38 + .../node_modules/ms/readme.md | 59 + .../eslint-import-resolver-node/package.json | 42 + node_modules/eslint-module-utils/.nycrc | 19 + node_modules/eslint-module-utils/CHANGELOG.md | 162 + node_modules/eslint-module-utils/LICENSE | 22 + .../eslint-module-utils/ModuleCache.js | 47 + .../eslint-module-utils/declaredScope.js | 9 + node_modules/eslint-module-utils/hash.js | 59 + node_modules/eslint-module-utils/ignore.js | 60 + .../eslint-module-utils/module-require.js | 30 + .../eslint-module-utils/moduleVisitor.js | 149 + .../node_modules/debug/CHANGELOG.md | 395 + .../node_modules/debug/LICENSE | 19 + .../node_modules/debug/README.md | 437 + .../node_modules/debug/node.js | 1 + .../node_modules/debug/package.json | 51 + .../node_modules/debug/src/browser.js | 180 + .../node_modules/debug/src/common.js | 249 + .../node_modules/debug/src/index.js | 12 + .../node_modules/debug/src/node.js | 177 + .../node_modules/ms/index.js | 162 + .../node_modules/ms/license.md | 21 + .../node_modules/ms/package.json | 38 + .../node_modules/ms/readme.md | 59 + node_modules/eslint-module-utils/package.json | 32 + node_modules/eslint-module-utils/parse.js | 121 + node_modules/eslint-module-utils/pkgDir.js | 11 + node_modules/eslint-module-utils/pkgUp.js | 8 + node_modules/eslint-module-utils/readPkgUp.js | 52 + node_modules/eslint-module-utils/resolve.js | 237 + .../eslint-module-utils/unambiguous.js | 29 + node_modules/eslint-module-utils/visit.js | 24 + node_modules/eslint-plugin-es/LICENSE | 21 + node_modules/eslint-plugin-es/README.md | 47 + .../lib/configs/no-new-in-es2015.js | 76 + .../lib/configs/no-new-in-es2016.js | 10 + .../lib/configs/no-new-in-es2017.js | 18 + .../lib/configs/no-new-in-es2018.js | 18 + .../lib/configs/no-new-in-es2019.js | 15 + .../lib/configs/no-new-in-es2020.js | 19 + .../lib/configs/no-new-in-es5.js | 29 + .../lib/configs/no-new-in-esnext.js | 15 + .../lib/configs/restrict-to-es2015.js | 15 + .../lib/configs/restrict-to-es2016.js | 14 + .../lib/configs/restrict-to-es2017.js | 13 + .../lib/configs/restrict-to-es2018.js | 12 + .../lib/configs/restrict-to-es2019.js | 7 + .../lib/configs/restrict-to-es3.js | 17 + .../lib/configs/restrict-to-es5.js | 16 + node_modules/eslint-plugin-es/lib/index.js | 167 + .../lib/rules/no-accessor-properties.js | 32 + .../lib/rules/no-array-from.js | 43 + .../lib/rules/no-array-isarray.js | 43 + .../eslint-plugin-es/lib/rules/no-array-of.js | 43 + .../lib/rules/no-arrow-functions.js | 129 + .../lib/rules/no-async-functions.js | 30 + .../lib/rules/no-async-iteration.js | 33 + .../eslint-plugin-es/lib/rules/no-atomics.js | 41 + .../eslint-plugin-es/lib/rules/no-bigint.js | 47 + .../lib/rules/no-binary-numeric-literals.js | 34 + .../lib/rules/no-block-scoped-functions.js | 30 + .../lib/rules/no-block-scoped-variables.js | 32 + .../eslint-plugin-es/lib/rules/no-classes.js | 30 + .../lib/rules/no-computed-properties.js | 30 + .../eslint-plugin-es/lib/rules/no-date-now.js | 43 + .../lib/rules/no-default-parameters.js | 30 + .../lib/rules/no-destructuring.js | 32 + .../lib/rules/no-dynamic-import.js | 30 + .../lib/rules/no-exponential-operators.js | 32 + .../lib/rules/no-export-ns-from.js | 30 + .../lib/rules/no-for-of-loops.js | 30 + .../lib/rules/no-generators.js | 30 + .../lib/rules/no-global-this.js | 41 + .../lib/rules/no-import-meta.js | 30 + .../lib/rules/no-json-superset.js | 55 + .../eslint-plugin-es/lib/rules/no-json.js | 41 + .../lib/rules/no-keyword-properties.js | 108 + .../rules/no-logical-assignment-operators.js | 60 + .../rules/no-malformed-template-literals.js | 37 + .../eslint-plugin-es/lib/rules/no-map.js | 41 + .../lib/rules/no-math-acosh.js | 43 + .../lib/rules/no-math-asinh.js | 43 + .../lib/rules/no-math-atanh.js | 43 + .../lib/rules/no-math-cbrt.js | 43 + .../lib/rules/no-math-clz32.js | 43 + .../lib/rules/no-math-cosh.js | 43 + .../lib/rules/no-math-expm1.js | 43 + .../lib/rules/no-math-fround.js | 43 + .../lib/rules/no-math-hypot.js | 43 + .../lib/rules/no-math-imul.js | 43 + .../lib/rules/no-math-log10.js | 43 + .../lib/rules/no-math-log1p.js | 43 + .../lib/rules/no-math-log2.js | 43 + .../lib/rules/no-math-sign.js | 43 + .../lib/rules/no-math-sinh.js | 43 + .../lib/rules/no-math-tanh.js | 43 + .../lib/rules/no-math-trunc.js | 43 + .../eslint-plugin-es/lib/rules/no-modules.js | 32 + .../lib/rules/no-new-target.js | 30 + .../rules/no-nullish-coalescing-operators.js | 44 + .../lib/rules/no-number-epsilon.js | 43 + .../lib/rules/no-number-isfinite.js | 43 + .../lib/rules/no-number-isinteger.js | 43 + .../lib/rules/no-number-isnan.js | 43 + .../lib/rules/no-number-issafeinteger.js | 43 + .../lib/rules/no-number-maxsafeinteger.js | 43 + .../lib/rules/no-number-minsafeinteger.js | 43 + .../lib/rules/no-number-parsefloat.js | 43 + .../lib/rules/no-number-parseint.js | 43 + .../lib/rules/no-numeric-separators.js | 52 + .../lib/rules/no-object-assign.js | 43 + .../lib/rules/no-object-defineproperties.js | 43 + .../lib/rules/no-object-defineproperty.js | 43 + .../lib/rules/no-object-entries.js | 43 + .../lib/rules/no-object-freeze.js | 43 + .../lib/rules/no-object-fromentries.js | 43 + .../no-object-getownpropertydescriptor.js | 44 + .../no-object-getownpropertydescriptors.js | 44 + .../rules/no-object-getownpropertynames.js | 43 + .../rules/no-object-getownpropertysymbols.js | 43 + .../lib/rules/no-object-getprototypeof.js | 43 + .../lib/rules/no-object-is.js | 43 + .../lib/rules/no-object-isextensible.js | 43 + .../lib/rules/no-object-isfrozen.js | 43 + .../lib/rules/no-object-issealed.js | 43 + .../lib/rules/no-object-keys.js | 43 + .../lib/rules/no-object-preventextensions.js | 43 + .../lib/rules/no-object-seal.js | 43 + .../lib/rules/no-object-setprototypeof.js | 43 + .../lib/rules/no-object-super-properties.js | 47 + .../lib/rules/no-object-values.js | 43 + .../lib/rules/no-octal-numeric-literals.js | 34 + .../lib/rules/no-optional-catch-binding.js | 30 + .../lib/rules/no-optional-chaining.js | 61 + .../lib/rules/no-promise-all-settled.js | 37 + .../lib/rules/no-promise-any.js | 45 + .../eslint-plugin-es/lib/rules/no-promise.js | 41 + .../lib/rules/no-property-shorthands.js | 78 + .../eslint-plugin-es/lib/rules/no-proxy.js | 41 + .../eslint-plugin-es/lib/rules/no-reflect.js | 41 + .../rules/no-regexp-lookbehind-assertions.js | 74 + .../rules/no-regexp-named-capture-groups.js | 79 + .../lib/rules/no-regexp-s-flag.js | 44 + .../lib/rules/no-regexp-u-flag.js | 44 + ...no-regexp-unicode-property-escapes-2019.js | 97 + .../no-regexp-unicode-property-escapes.js | 73 + .../lib/rules/no-regexp-y-flag.js | 44 + .../lib/rules/no-rest-parameters.js | 30 + .../lib/rules/no-rest-spread-properties.js | 33 + .../eslint-plugin-es/lib/rules/no-set.js | 41 + .../lib/rules/no-shared-array-buffer.js | 41 + .../lib/rules/no-spread-elements.js | 32 + .../lib/rules/no-string-fromcodepoint.js | 43 + .../lib/rules/no-string-raw.js | 43 + .../lib/rules/no-subclassing-builtins.js | 55 + .../eslint-plugin-es/lib/rules/no-symbol.js | 41 + .../lib/rules/no-template-literals.js | 85 + .../lib/rules/no-trailing-commas.js | 39 + .../lib/rules/no-trailing-function-commas.js | 62 + .../lib/rules/no-typed-arrays.js | 50 + .../lib/rules/no-unicode-codepoint-escapes.js | 100 + .../eslint-plugin-es/lib/rules/no-weak-map.js | 41 + .../eslint-plugin-es/lib/rules/no-weak-set.js | 41 + .../eslint-plugin-es/lib/rules/no-weakrefs.js | 43 + node_modules/eslint-plugin-es/lib/utils.js | 70 + .../node_modules/eslint-utils/LICENSE | 21 + .../node_modules/eslint-utils/README.md | 38 + .../node_modules/eslint-utils/index.js | 1880 +++++ .../node_modules/eslint-utils/index.js.map | 1 + .../node_modules/eslint-utils/index.mjs | 1838 +++++ .../node_modules/eslint-utils/index.mjs.map | 1 + .../node_modules/eslint-utils/package.json | 65 + .../eslint-visitor-keys/CHANGELOG.md | 25 + .../node_modules/eslint-visitor-keys/LICENSE | 201 + .../eslint-visitor-keys/README.md | 98 + .../eslint-visitor-keys/lib/index.js | 81 + .../eslint-visitor-keys/lib/visitor-keys.json | 284 + .../eslint-visitor-keys/package.json | 40 + node_modules/eslint-plugin-es/package.json | 76 + .../eslint-plugin-import/CHANGELOG.md | 1688 ++++ .../eslint-plugin-import/CONTRIBUTING.md | 116 + node_modules/eslint-plugin-import/LICENSE | 22 + node_modules/eslint-plugin-import/README.md | 521 ++ node_modules/eslint-plugin-import/RELEASE.md | 54 + node_modules/eslint-plugin-import/SECURITY.md | 11 + .../eslint-plugin-import/config/electron.js | 8 + .../eslint-plugin-import/config/errors.js | 14 + .../config/react-native.js | 13 + .../eslint-plugin-import/config/react.js | 18 + .../config/recommended.js | 28 + .../eslint-plugin-import/config/stage-0.js | 12 + .../eslint-plugin-import/config/typescript.js | 31 + .../eslint-plugin-import/config/warnings.js | 12 + .../docs/rules/default.md | 71 + .../docs/rules/dynamic-import-chunkname.md | 85 + .../eslint-plugin-import/docs/rules/export.md | 32 + .../docs/rules/exports-last.md | 50 + .../docs/rules/extensions.md | 169 + .../eslint-plugin-import/docs/rules/first.md | 70 + .../docs/rules/group-exports.md | 117 + .../docs/rules/imports-first.md | 3 + .../docs/rules/max-dependencies.md | 66 + .../eslint-plugin-import/docs/rules/named.md | 100 + .../docs/rules/namespace.md | 99 + .../docs/rules/newline-after-import.md | 87 + .../docs/rules/no-absolute-path.md | 48 + .../eslint-plugin-import/docs/rules/no-amd.md | 35 + .../docs/rules/no-anonymous-default-export.md | 73 + .../docs/rules/no-commonjs.md | 95 + .../docs/rules/no-cycle.md | 92 + .../docs/rules/no-default-export.md | 63 + .../docs/rules/no-deprecated.md | 61 + .../docs/rules/no-duplicates.md | 69 + .../docs/rules/no-dynamic-require.md | 23 + .../docs/rules/no-extraneous-dependencies.md | 124 + .../docs/rules/no-import-module-exports.md | 74 + .../docs/rules/no-internal-modules.md | 132 + .../docs/rules/no-mutable-exports.md | 52 + .../docs/rules/no-named-as-default-member.md | 47 + .../docs/rules/no-named-as-default.md | 46 + .../docs/rules/no-named-default.md | 31 + .../docs/rules/no-named-export.md | 77 + .../docs/rules/no-namespace.md | 41 + .../docs/rules/no-nodejs-modules.md | 40 + .../docs/rules/no-relative-packages.md | 67 + .../docs/rules/no-relative-parent-imports.md | 120 + .../docs/rules/no-restricted-paths.md | 126 + .../docs/rules/no-self-import.md | 30 + .../docs/rules/no-unassigned-import.md | 59 + .../docs/rules/no-unresolved.md | 106 + .../docs/rules/no-unused-modules.md | 107 + .../docs/rules/no-useless-path-segments.md | 79 + .../docs/rules/no-webpack-loader-syntax.md | 36 + .../eslint-plugin-import/docs/rules/order.md | 317 + .../docs/rules/prefer-default-export.md | 58 + .../docs/rules/unambiguous.md | 54 + .../eslint-plugin-import/lib/ExportMap.js | 844 ++ .../lib/core/importType.js | 129 + .../lib/core/packagePath.js | 23 + .../lib/core/staticRequire.js | 11 + .../eslint-plugin-import/lib/docsUrl.js | 8 + .../lib/importDeclaration.js | 5 + .../eslint-plugin-import/lib/index.js | 69 + .../eslint-plugin-import/lib/rules/default.js | 40 + .../lib/rules/dynamic-import-chunkname.js | 119 + .../eslint-plugin-import/lib/rules/export.js | 228 + .../lib/rules/exports-last.js | 41 + .../lib/rules/extensions.js | 190 + .../eslint-plugin-import/lib/rules/first.js | 141 + .../lib/rules/group-exports.js | 153 + .../lib/rules/imports-first.js | 13 + .../lib/rules/max-dependencies.js | 54 + .../eslint-plugin-import/lib/rules/named.js | 141 + .../lib/rules/namespace.js | 216 + .../lib/rules/newline-after-import.js | 184 + .../lib/rules/no-absolute-path.js | 24 + .../eslint-plugin-import/lib/rules/no-amd.js | 46 + .../lib/rules/no-anonymous-default-export.js | 104 + .../lib/rules/no-commonjs.js | 137 + .../lib/rules/no-cycle.js | 130 + .../lib/rules/no-default-export.js | 39 + .../lib/rules/no-deprecated.js | 139 + .../lib/rules/no-duplicates.js | 319 + .../lib/rules/no-dynamic-require.js | 75 + .../lib/rules/no-extraneous-dependencies.js | 270 + .../lib/rules/no-import-module-exports.js | 79 + .../lib/rules/no-internal-modules.js | 140 + .../lib/rules/no-mutable-exports.js | 57 + .../lib/rules/no-named-as-default-member.js | 107 + .../lib/rules/no-named-as-default.js | 43 + .../lib/rules/no-named-default.js | 29 + .../lib/rules/no-named-export.js | 35 + .../lib/rules/no-namespace.js | 177 + .../lib/rules/no-nodejs-modules.js | 42 + .../lib/rules/no-relative-packages.js | 69 + .../lib/rules/no-relative-parent-imports.js | 49 + .../lib/rules/no-restricted-paths.js | 180 + .../lib/rules/no-self-import.js | 38 + .../lib/rules/no-unassigned-import.js | 76 + .../lib/rules/no-unresolved.js | 58 + .../lib/rules/no-unused-modules.js | 955 +++ .../lib/rules/no-useless-path-segments.js | 145 + .../lib/rules/no-webpack-loader-syntax.js | 26 + .../eslint-plugin-import/lib/rules/order.js | 707 ++ .../lib/rules/prefer-default-export.js | 95 + .../lib/rules/unambiguous.js | 36 + .../eslint-plugin-import/memo-parser/LICENSE | 22 + .../memo-parser/README.md | 23 + .../eslint-plugin-import/memo-parser/index.js | 41 + .../node_modules/doctrine/CHANGELOG.md | 94 + .../node_modules/doctrine/LICENSE | 177 + .../doctrine/LICENSE.closure-compiler | 202 + .../node_modules/doctrine/LICENSE.esprima | 19 + .../node_modules/doctrine/README.md | 165 + .../node_modules/doctrine/lib/doctrine.js | 899 +++ .../node_modules/doctrine/lib/typed.js | 1305 +++ .../node_modules/doctrine/lib/utility.js | 35 + .../node_modules/doctrine/package.json | 57 + .../eslint-plugin-import/package.json | 116 + node_modules/eslint-plugin-n/LICENSE | 22 + node_modules/eslint-plugin-n/README.md | 182 + .../eslint-plugin-n/lib/configs/_commons.js | 76 + .../lib/configs/recommended-module.js | 27 + .../lib/configs/recommended-script.js | 24 + .../lib/configs/recommended.js | 18 + .../lib/converted-esm/import-meta-resolve.js | 761 ++ node_modules/eslint-plugin-n/lib/index.js | 55 + .../lib/rules/callback-return.js | 184 + .../lib/rules/exports-style.js | 383 + .../lib/rules/file-extension-in-import.js | 130 + .../lib/rules/global-require.js | 90 + .../lib/rules/handle-callback-err.js | 93 + .../lib/rules/no-callback-literal.js | 81 + .../lib/rules/no-deprecated-api.js | 778 ++ .../lib/rules/no-exports-assign.js | 74 + .../lib/rules/no-extraneous-import.js | 46 + .../lib/rules/no-extraneous-require.js | 48 + .../lib/rules/no-hide-core-modules.js | 169 + .../lib/rules/no-missing-import.js | 44 + .../lib/rules/no-missing-require.js | 46 + .../lib/rules/no-mixed-requires.js | 254 + .../lib/rules/no-new-require.js | 38 + .../lib/rules/no-path-concat.js | 211 + .../lib/rules/no-process-env.js | 44 + .../lib/rules/no-process-exit.js | 35 + .../lib/rules/no-restricted-import.js | 60 + .../lib/rules/no-restricted-require.js | 60 + .../eslint-plugin-n/lib/rules/no-sync.js | 52 + .../lib/rules/no-unpublished-bin.js | 96 + .../lib/rules/no-unpublished-import.js | 46 + .../lib/rules/no-unpublished-require.js | 48 + .../lib/rules/no-unsupported-features.js | 1542 ++++ .../no-unsupported-features/es-builtins.js | 180 + .../no-unsupported-features/es-syntax.js | 663 ++ .../no-unsupported-features/node-builtins.js | 415 + .../lib/rules/prefer-global/buffer.js | 48 + .../lib/rules/prefer-global/console.js | 45 + .../lib/rules/prefer-global/process.js | 45 + .../lib/rules/prefer-global/text-decoder.js | 48 + .../lib/rules/prefer-global/text-encoder.js | 48 + .../rules/prefer-global/url-search-params.js | 48 + .../lib/rules/prefer-global/url.js | 47 + .../lib/rules/prefer-promises/dns.js | 73 + .../lib/rules/prefer-promises/fs.js | 75 + .../lib/rules/process-exit-as-throw.js | 163 + .../eslint-plugin-n/lib/rules/shebang.js | 169 + .../eslint-plugin-n/lib/util/cache.js | 58 + .../lib/util/check-existence.js | 55 + .../lib/util/check-extraneous.js | 52 + .../lib/util/check-prefer-global.js | 63 + .../eslint-plugin-n/lib/util/check-publish.js | 71 + .../lib/util/check-restricted.js | 109 + .../lib/util/check-unsupported-builtins.js | 108 + .../lib/util/enumerate-property-names.js | 39 + .../eslint-plugin-n/lib/util/exists.js | 58 + .../lib/util/get-allow-modules.js | 49 + .../lib/util/get-configured-node-version.js | 39 + .../lib/util/get-convert-path.js | 191 + .../eslint-plugin-n/lib/util/get-npmignore.js | 185 + .../lib/util/get-package-json.js | 75 + .../lib/util/get-resolve-paths.js | 46 + .../lib/util/get-semver-range.js | 30 + .../lib/util/get-try-extensions.js | 49 + .../eslint-plugin-n/lib/util/import-target.js | 132 + .../eslint-plugin-n/lib/util/is-typescript.js | 16 + .../lib/util/map-typescript-extension.js | 50 + .../lib/util/merge-visitors-in-place.js | 46 + .../lib/util/strip-import-path-params.js | 10 + .../eslint-plugin-n/lib/util/visit-import.js | 68 + .../eslint-plugin-n/lib/util/visit-require.js | 62 + node_modules/eslint-plugin-n/package.json | 103 + .../eslint-plugin-promise/.editorconfig | 12 + .../eslint-plugin-promise/.husky/pre-commit | 4 + .../eslint-plugin-promise/.prettierignore | 1 + .../eslint-plugin-promise/CHANGELOG.md | 182 + node_modules/eslint-plugin-promise/LICENSE.md | 13 + node_modules/eslint-plugin-promise/README.md | 132 + node_modules/eslint-plugin-promise/index.js | 46 + .../eslint-plugin-promise/package.json | 89 + .../rules/always-return.js | 154 + .../eslint-plugin-promise/rules/avoid-new.js | 27 + .../rules/catch-or-return.js | 121 + .../rules/lib/get-docs-url.js | 17 + .../rules/lib/has-promise-callback.js | 17 + .../rules/lib/is-callback.js | 14 + .../rules/lib/is-inside-callback.js | 20 + .../rules/lib/is-inside-promise.js | 15 + .../rules/lib/is-named-callback.js | 14 + .../rules/lib/is-promise.js | 36 + .../rules/lib/promise-statics.js | 8 + .../rules/no-callback-in-promise.js | 71 + .../eslint-plugin-promise/rules/no-native.js | 66 + .../eslint-plugin-promise/rules/no-nesting.js | 30 + .../rules/no-new-statics.js | 38 + .../rules/no-promise-in-callback.js | 41 + .../rules/no-return-in-finally.js | 46 + .../rules/no-return-wrap.js | 94 + .../rules/param-names.js | 39 + .../rules/prefer-await-to-callbacks.js | 95 + .../rules/prefer-await-to-then.js | 58 + .../rules/valid-params.js | 69 + node_modules/eslint-scope/LICENSE | 22 + node_modules/eslint-scope/README.md | 66 + .../eslint-scope/dist/eslint-scope.cjs | 2240 +++++ node_modules/eslint-scope/lib/definition.js | 85 + node_modules/eslint-scope/lib/index.js | 172 + .../eslint-scope/lib/pattern-visitor.js | 153 + node_modules/eslint-scope/lib/reference.js | 166 + node_modules/eslint-scope/lib/referencer.js | 654 ++ .../eslint-scope/lib/scope-manager.js | 255 + node_modules/eslint-scope/lib/scope.js | 772 ++ node_modules/eslint-scope/lib/variable.js | 87 + node_modules/eslint-scope/lib/version.js | 3 + node_modules/eslint-scope/package.json | 62 + node_modules/eslint-utils/LICENSE | 21 + node_modules/eslint-utils/README.md | 38 + node_modules/eslint-utils/index.js | 1956 +++++ node_modules/eslint-utils/index.js.map | 1 + node_modules/eslint-utils/index.mjs | 1914 +++++ node_modules/eslint-utils/index.mjs.map | 1 + .../eslint-visitor-keys/CHANGELOG.md | 36 + .../node_modules/eslint-visitor-keys/LICENSE | 201 + .../eslint-visitor-keys/README.md | 98 + .../eslint-visitor-keys/lib/index.js | 81 + .../eslint-visitor-keys/lib/visitor-keys.json | 289 + .../eslint-visitor-keys/package.json | 39 + node_modules/eslint-utils/package.json | 78 + node_modules/eslint-visitor-keys/LICENSE | 201 + node_modules/eslint-visitor-keys/README.md | 107 + .../dist/eslint-visitor-keys.cjs | 382 + .../eslint-visitor-keys/dist/index.d.ts | 18 + .../dist/visitor-keys.d.ts | 10 + node_modules/eslint-visitor-keys/lib/index.js | 65 + .../eslint-visitor-keys/lib/visitor-keys.js | 312 + node_modules/eslint-visitor-keys/package.json | 62 + node_modules/eslint/LICENSE | 19 + node_modules/eslint/README.md | 304 + node_modules/eslint/bin/eslint.js | 142 + node_modules/eslint/conf/config-schema.js | 93 + .../eslint/conf/default-cli-options.js | 32 + node_modules/eslint/conf/eslint-all.js | 31 + .../eslint/conf/eslint-recommended.js | 76 + node_modules/eslint/conf/globals.js | 144 + node_modules/eslint/conf/replacements.json | 22 + node_modules/eslint/conf/rule-type-list.json | 36 + node_modules/eslint/lib/api.js | 26 + .../eslint/lib/cli-engine/cli-engine.js | 1067 +++ .../eslint/lib/cli-engine/file-enumerator.js | 543 ++ .../lib/cli-engine/formatters/checkstyle.js | 60 + .../lib/cli-engine/formatters/compact.js | 60 + .../eslint/lib/cli-engine/formatters/html.js | 326 + .../lib/cli-engine/formatters/jslint-xml.js | 41 + .../formatters/json-with-metadata.js | 16 + .../eslint/lib/cli-engine/formatters/json.js | 13 + .../eslint/lib/cli-engine/formatters/junit.js | 82 + .../lib/cli-engine/formatters/stylish.js | 101 + .../eslint/lib/cli-engine/formatters/tap.js | 95 + .../eslint/lib/cli-engine/formatters/unix.js | 58 + .../lib/cli-engine/formatters/visualstudio.js | 63 + node_modules/eslint/lib/cli-engine/hash.js | 35 + node_modules/eslint/lib/cli-engine/index.js | 7 + .../lib/cli-engine/lint-result-cache.js | 191 + .../eslint/lib/cli-engine/load-rules.js | 46 + .../eslint/lib/cli-engine/xml-escape.js | 34 + node_modules/eslint/lib/cli.js | 344 + .../eslint/lib/config/default-config.js | 61 + .../eslint/lib/config/flat-config-array.js | 134 + .../eslint/lib/config/flat-config-helpers.js | 103 + .../eslint/lib/config/flat-config-schema.js | 457 ++ .../eslint/lib/config/rule-validator.js | 157 + node_modules/eslint/lib/eslint/eslint.js | 697 ++ node_modules/eslint/lib/eslint/index.js | 7 + .../lib/linter/apply-disable-directives.js | 341 + .../code-path-analysis/code-path-analyzer.js | 844 ++ .../code-path-analysis/code-path-segment.js | 235 + .../code-path-analysis/code-path-state.js | 1483 ++++ .../linter/code-path-analysis/code-path.js | 247 + .../code-path-analysis/debug-helpers.js | 203 + .../linter/code-path-analysis/fork-context.js | 248 + .../linter/code-path-analysis/id-generator.js | 45 + .../lib/linter/config-comment-parser.js | 145 + node_modules/eslint/lib/linter/index.js | 13 + node_modules/eslint/lib/linter/interpolate.js | 28 + node_modules/eslint/lib/linter/linter.js | 2004 +++++ .../eslint/lib/linter/node-event-generator.js | 354 + .../eslint/lib/linter/report-translator.js | 368 + node_modules/eslint/lib/linter/rule-fixer.js | 140 + node_modules/eslint/lib/linter/rules.js | 80 + .../eslint/lib/linter/safe-emitter.js | 52 + .../eslint/lib/linter/source-code-fixer.js | 152 + node_modules/eslint/lib/linter/timing.js | 161 + node_modules/eslint/lib/options.js | 323 + .../lib/rule-tester/flat-rule-tester.js | 1039 +++ node_modules/eslint/lib/rule-tester/index.js | 5 + .../eslint/lib/rule-tester/rule-tester.js | 1008 +++ .../eslint/lib/rules/accessor-pairs.js | 354 + .../eslint/lib/rules/array-bracket-newline.js | 258 + .../eslint/lib/rules/array-bracket-spacing.js | 241 + .../eslint/lib/rules/array-callback-return.js | 296 + .../eslint/lib/rules/array-element-newline.js | 301 + .../eslint/lib/rules/arrow-body-style.js | 296 + node_modules/eslint/lib/rules/arrow-parens.js | 183 + .../eslint/lib/rules/arrow-spacing.js | 161 + .../eslint/lib/rules/block-scoped-var.js | 124 + .../eslint/lib/rules/block-spacing.js | 171 + node_modules/eslint/lib/rules/brace-style.js | 194 + .../eslint/lib/rules/callback-return.js | 187 + node_modules/eslint/lib/rules/camelcase.js | 398 + .../eslint/lib/rules/capitalized-comments.js | 300 + .../lib/rules/class-methods-use-this.js | 187 + node_modules/eslint/lib/rules/comma-dangle.js | 370 + .../eslint/lib/rules/comma-spacing.js | 195 + node_modules/eslint/lib/rules/comma-style.js | 311 + node_modules/eslint/lib/rules/complexity.js | 165 + .../lib/rules/computed-property-spacing.js | 205 + .../eslint/lib/rules/consistent-return.js | 185 + .../eslint/lib/rules/consistent-this.js | 151 + .../eslint/lib/rules/constructor-super.js | 423 + node_modules/eslint/lib/rules/curly.js | 486 ++ .../eslint/lib/rules/default-case-last.js | 44 + node_modules/eslint/lib/rules/default-case.js | 97 + .../eslint/lib/rules/default-param-last.js | 62 + node_modules/eslint/lib/rules/dot-location.js | 105 + node_modules/eslint/lib/rules/dot-notation.js | 177 + node_modules/eslint/lib/rules/eol-last.js | 112 + node_modules/eslint/lib/rules/eqeqeq.js | 174 + .../eslint/lib/rules/for-direction.js | 126 + .../eslint/lib/rules/func-call-spacing.js | 230 + .../eslint/lib/rules/func-name-matching.js | 253 + node_modules/eslint/lib/rules/func-names.js | 191 + node_modules/eslint/lib/rules/func-style.js | 98 + .../rules/function-call-argument-newline.js | 122 + .../lib/rules/function-paren-newline.js | 289 + .../lib/rules/generator-star-spacing.js | 206 + .../eslint/lib/rules/getter-return.js | 173 + .../eslint/lib/rules/global-require.js | 87 + .../lib/rules/grouped-accessor-pairs.js | 224 + node_modules/eslint/lib/rules/guard-for-in.js | 76 + .../eslint/lib/rules/handle-callback-err.js | 100 + node_modules/eslint/lib/rules/id-blacklist.js | 245 + node_modules/eslint/lib/rules/id-denylist.js | 227 + node_modules/eslint/lib/rules/id-length.js | 169 + node_modules/eslint/lib/rules/id-match.js | 298 + .../lib/rules/implicit-arrow-linebreak.js | 81 + .../eslint/lib/rules/indent-legacy.js | 1126 +++ node_modules/eslint/lib/rules/indent.js | 1796 ++++ node_modules/eslint/lib/rules/index.js | 302 + .../eslint/lib/rules/init-declarations.js | 139 + node_modules/eslint/lib/rules/jsx-quotes.js | 95 + node_modules/eslint/lib/rules/key-spacing.js | 675 ++ .../eslint/lib/rules/keyword-spacing.js | 637 ++ .../eslint/lib/rules/line-comment-position.js | 122 + .../eslint/lib/rules/linebreak-style.js | 105 + .../eslint/lib/rules/lines-around-comment.js | 450 ++ .../lib/rules/lines-around-directive.js | 201 + .../lib/rules/lines-between-class-members.js | 181 + .../eslint/lib/rules/max-classes-per-file.js | 89 + node_modules/eslint/lib/rules/max-depth.js | 156 + node_modules/eslint/lib/rules/max-len.js | 433 + .../lib/rules/max-lines-per-function.js | 213 + node_modules/eslint/lib/rules/max-lines.js | 193 + .../eslint/lib/rules/max-nested-callbacks.js | 117 + node_modules/eslint/lib/rules/max-params.js | 102 + .../lib/rules/max-statements-per-line.js | 196 + .../eslint/lib/rules/max-statements.js | 184 + .../lib/rules/multiline-comment-style.js | 435 + .../eslint/lib/rules/multiline-ternary.js | 171 + node_modules/eslint/lib/rules/new-cap.js | 276 + node_modules/eslint/lib/rules/new-parens.js | 99 + .../eslint/lib/rules/newline-after-var.js | 255 + .../eslint/lib/rules/newline-before-return.js | 217 + .../lib/rules/newline-per-chained-call.js | 123 + node_modules/eslint/lib/rules/no-alert.js | 136 + .../eslint/lib/rules/no-array-constructor.js | 54 + .../lib/rules/no-async-promise-executor.js | 39 + .../eslint/lib/rules/no-await-in-loop.js | 106 + node_modules/eslint/lib/rules/no-bitwise.js | 119 + .../eslint/lib/rules/no-buffer-constructor.js | 50 + node_modules/eslint/lib/rules/no-caller.js | 46 + .../eslint/lib/rules/no-case-declarations.js | 64 + .../eslint/lib/rules/no-catch-shadow.js | 80 + .../eslint/lib/rules/no-class-assign.js | 61 + .../eslint/lib/rules/no-compare-neg-zero.js | 60 + .../eslint/lib/rules/no-cond-assign.js | 159 + .../eslint/lib/rules/no-confusing-arrow.js | 89 + node_modules/eslint/lib/rules/no-console.js | 134 + .../eslint/lib/rules/no-const-assign.js | 54 + .../rules/no-constant-binary-expression.js | 500 ++ .../eslint/lib/rules/no-constant-condition.js | 149 + .../eslint/lib/rules/no-constructor-return.js | 62 + node_modules/eslint/lib/rules/no-continue.js | 39 + .../eslint/lib/rules/no-control-regex.js | 125 + node_modules/eslint/lib/rules/no-debugger.js | 43 + .../eslint/lib/rules/no-delete-var.js | 42 + node_modules/eslint/lib/rules/no-div-regex.js | 53 + node_modules/eslint/lib/rules/no-dupe-args.js | 80 + .../eslint/lib/rules/no-dupe-class-members.js | 104 + .../eslint/lib/rules/no-dupe-else-if.js | 122 + node_modules/eslint/lib/rules/no-dupe-keys.js | 142 + .../eslint/lib/rules/no-duplicate-case.js | 71 + .../eslint/lib/rules/no-duplicate-imports.js | 290 + .../eslint/lib/rules/no-else-return.js | 404 + .../lib/rules/no-empty-character-class.js | 55 + .../eslint/lib/rules/no-empty-function.js | 167 + .../eslint/lib/rules/no-empty-pattern.js | 43 + node_modules/eslint/lib/rules/no-empty.js | 86 + node_modules/eslint/lib/rules/no-eq-null.js | 46 + node_modules/eslint/lib/rules/no-eval.js | 286 + node_modules/eslint/lib/rules/no-ex-assign.js | 52 + .../eslint/lib/rules/no-extend-native.js | 178 + .../eslint/lib/rules/no-extra-bind.js | 213 + .../eslint/lib/rules/no-extra-boolean-cast.js | 317 + .../eslint/lib/rules/no-extra-label.js | 149 + .../eslint/lib/rules/no-extra-parens.js | 1235 +++ .../eslint/lib/rules/no-extra-semi.js | 126 + .../eslint/lib/rules/no-fallthrough.js | 147 + .../eslint/lib/rules/no-floating-decimal.js | 70 + .../eslint/lib/rules/no-func-assign.js | 76 + .../eslint/lib/rules/no-global-assign.js | 94 + .../eslint/lib/rules/no-implicit-coercion.js | 361 + .../eslint/lib/rules/no-implicit-globals.js | 140 + .../eslint/lib/rules/no-implied-eval.js | 131 + .../eslint/lib/rules/no-import-assign.js | 239 + .../eslint/lib/rules/no-inline-comments.js | 110 + .../eslint/lib/rules/no-inner-declarations.js | 110 + .../eslint/lib/rules/no-invalid-regexp.js | 157 + .../eslint/lib/rules/no-invalid-this.js | 150 + .../lib/rules/no-irregular-whitespace.js | 259 + node_modules/eslint/lib/rules/no-iterator.js | 52 + node_modules/eslint/lib/rules/no-label-var.js | 79 + node_modules/eslint/lib/rules/no-labels.js | 149 + .../eslint/lib/rules/no-lone-blocks.js | 134 + node_modules/eslint/lib/rules/no-lonely-if.js | 89 + node_modules/eslint/lib/rules/no-loop-func.js | 204 + .../eslint/lib/rules/no-loss-of-precision.js | 206 + .../eslint/lib/rules/no-magic-numbers.js | 226 + .../rules/no-misleading-character-class.js | 273 + .../eslint/lib/rules/no-mixed-operators.js | 226 + .../eslint/lib/rules/no-mixed-requires.js | 238 + .../lib/rules/no-mixed-spaces-and-tabs.js | 113 + .../eslint/lib/rules/no-multi-assign.js | 67 + .../eslint/lib/rules/no-multi-spaces.js | 138 + node_modules/eslint/lib/rules/no-multi-str.js | 65 + .../lib/rules/no-multiple-empty-lines.js | 151 + .../eslint/lib/rules/no-native-reassign.js | 97 + .../eslint/lib/rules/no-negated-condition.js | 95 + .../eslint/lib/rules/no-negated-in-lhs.js | 46 + .../eslint/lib/rules/no-nested-ternary.js | 44 + node_modules/eslint/lib/rules/no-new-func.js | 86 + .../eslint/lib/rules/no-new-object.js | 57 + .../eslint/lib/rules/no-new-require.js | 50 + .../eslint/lib/rules/no-new-symbol.js | 54 + .../eslint/lib/rules/no-new-wrappers.js | 48 + node_modules/eslint/lib/rules/no-new.js | 43 + .../lib/rules/no-nonoctal-decimal-escape.js | 148 + node_modules/eslint/lib/rules/no-obj-calls.js | 84 + .../eslint/lib/rules/no-octal-escape.js | 56 + node_modules/eslint/lib/rules/no-octal.js | 45 + .../eslint/lib/rules/no-param-reassign.js | 229 + .../eslint/lib/rules/no-path-concat.js | 64 + node_modules/eslint/lib/rules/no-plusplus.js | 105 + .../eslint/lib/rules/no-process-env.js | 51 + .../eslint/lib/rules/no-process-exit.js | 47 + .../lib/rules/no-promise-executor-return.js | 121 + node_modules/eslint/lib/rules/no-proto.js | 48 + .../eslint/lib/rules/no-prototype-builtins.js | 71 + node_modules/eslint/lib/rules/no-redeclare.js | 174 + .../eslint/lib/rules/no-regex-spaces.js | 180 + .../eslint/lib/rules/no-restricted-exports.js | 96 + .../eslint/lib/rules/no-restricted-globals.js | 122 + .../eslint/lib/rules/no-restricted-imports.js | 322 + .../eslint/lib/rules/no-restricted-modules.js | 216 + .../lib/rules/no-restricted-properties.js | 181 + .../eslint/lib/rules/no-restricted-syntax.js | 70 + .../eslint/lib/rules/no-return-assign.js | 80 + .../eslint/lib/rules/no-return-await.js | 103 + .../eslint/lib/rules/no-script-url.js | 61 + .../eslint/lib/rules/no-self-assign.js | 183 + .../eslint/lib/rules/no-self-compare.js | 60 + node_modules/eslint/lib/rules/no-sequences.js | 138 + .../eslint/lib/rules/no-setter-return.js | 225 + .../lib/rules/no-shadow-restricted-names.js | 64 + node_modules/eslint/lib/rules/no-shadow.js | 335 + .../eslint/lib/rules/no-spaced-func.js | 83 + .../eslint/lib/rules/no-sparse-arrays.js | 50 + node_modules/eslint/lib/rules/no-sync.js | 64 + node_modules/eslint/lib/rules/no-tabs.js | 78 + .../lib/rules/no-template-curly-in-string.js | 44 + node_modules/eslint/lib/rules/no-ternary.js | 41 + .../eslint/lib/rules/no-this-before-super.js | 304 + .../eslint/lib/rules/no-throw-literal.js | 51 + .../eslint/lib/rules/no-trailing-spaces.js | 190 + .../eslint/lib/rules/no-undef-init.js | 75 + node_modules/eslint/lib/rules/no-undef.js | 78 + node_modules/eslint/lib/rules/no-undefined.js | 84 + .../eslint/lib/rules/no-underscore-dangle.js | 309 + .../lib/rules/no-unexpected-multiline.js | 120 + .../lib/rules/no-unmodified-loop-condition.js | 360 + .../eslint/lib/rules/no-unneeded-ternary.js | 166 + .../eslint/lib/rules/no-unreachable-loop.js | 150 + .../eslint/lib/rules/no-unreachable.js | 264 + .../eslint/lib/rules/no-unsafe-finally.js | 111 + .../eslint/lib/rules/no-unsafe-negation.js | 128 + .../lib/rules/no-unsafe-optional-chaining.js | 205 + .../eslint/lib/rules/no-unused-expressions.js | 189 + .../eslint/lib/rules/no-unused-labels.js | 110 + .../rules/no-unused-private-class-members.js | 195 + .../eslint/lib/rules/no-unused-vars.js | 717 ++ .../eslint/lib/rules/no-use-before-define.js | 347 + .../lib/rules/no-useless-backreference.js | 192 + .../eslint/lib/rules/no-useless-call.js | 90 + .../eslint/lib/rules/no-useless-catch.js | 57 + .../lib/rules/no-useless-computed-key.js | 168 + .../eslint/lib/rules/no-useless-concat.js | 115 + .../lib/rules/no-useless-constructor.js | 189 + .../eslint/lib/rules/no-useless-escape.js | 254 + .../eslint/lib/rules/no-useless-rename.js | 172 + .../eslint/lib/rules/no-useless-return.js | 305 + node_modules/eslint/lib/rules/no-var.js | 334 + node_modules/eslint/lib/rules/no-void.js | 64 + .../eslint/lib/rules/no-warning-comments.js | 196 + .../rules/no-whitespace-before-property.js | 113 + node_modules/eslint/lib/rules/no-with.js | 39 + .../rules/nonblock-statement-body-position.js | 124 + .../eslint/lib/rules/object-curly-newline.js | 321 + .../eslint/lib/rules/object-curly-spacing.js | 308 + .../lib/rules/object-property-newline.js | 99 + .../eslint/lib/rules/object-shorthand.js | 504 ++ .../lib/rules/one-var-declaration-per-line.js | 92 + node_modules/eslint/lib/rules/one-var.js | 567 ++ .../eslint/lib/rules/operator-assignment.js | 209 + .../eslint/lib/rules/operator-linebreak.js | 250 + .../eslint/lib/rules/padded-blocks.js | 307 + .../rules/padding-line-between-statements.js | 632 ++ .../eslint/lib/rules/prefer-arrow-callback.js | 380 + node_modules/eslint/lib/rules/prefer-const.js | 489 ++ .../eslint/lib/rules/prefer-destructuring.js | 301 + .../rules/prefer-exponentiation-operator.js | 190 + .../lib/rules/prefer-named-capture-group.js | 110 + .../lib/rules/prefer-numeric-literals.js | 148 + .../eslint/lib/rules/prefer-object-has-own.js | 112 + .../eslint/lib/rules/prefer-object-spread.js | 299 + .../lib/rules/prefer-promise-reject-errors.js | 131 + .../eslint/lib/rules/prefer-reflect.js | 127 + .../eslint/lib/rules/prefer-regex-literals.js | 396 + .../eslint/lib/rules/prefer-rest-params.js | 115 + .../eslint/lib/rules/prefer-spread.js | 87 + .../eslint/lib/rules/prefer-template.js | 275 + node_modules/eslint/lib/rules/quote-props.js | 307 + node_modules/eslint/lib/rules/quotes.js | 347 + node_modules/eslint/lib/rules/radix.js | 198 + .../lib/rules/require-atomic-updates.js | 317 + .../eslint/lib/rules/require-await.js | 113 + .../eslint/lib/rules/require-jsdoc.js | 122 + .../lib/rules/require-unicode-regexp.js | 69 + .../eslint/lib/rules/require-yield.js | 78 + .../eslint/lib/rules/rest-spread-spacing.js | 120 + node_modules/eslint/lib/rules/semi-spacing.js | 245 + node_modules/eslint/lib/rules/semi-style.js | 155 + node_modules/eslint/lib/rules/semi.js | 410 + node_modules/eslint/lib/rules/sort-imports.js | 241 + node_modules/eslint/lib/rules/sort-keys.js | 187 + node_modules/eslint/lib/rules/sort-vars.js | 104 + .../eslint/lib/rules/space-before-blocks.js | 201 + .../lib/rules/space-before-function-paren.js | 164 + .../eslint/lib/rules/space-in-parens.js | 282 + .../eslint/lib/rules/space-infix-ops.js | 195 + .../eslint/lib/rules/space-unary-ops.js | 321 + .../eslint/lib/rules/spaced-comment.js | 382 + node_modules/eslint/lib/rules/strict.js | 277 + .../eslint/lib/rules/switch-colon-spacing.js | 129 + .../eslint/lib/rules/symbol-description.js | 71 + .../lib/rules/template-curly-spacing.js | 141 + .../eslint/lib/rules/template-tag-spacing.js | 90 + node_modules/eslint/lib/rules/unicode-bom.js | 73 + node_modules/eslint/lib/rules/use-isnan.js | 141 + .../eslint/lib/rules/utils/ast-utils.js | 2118 +++++ .../eslint/lib/rules/utils/fix-tracker.js | 114 + .../eslint/lib/rules/utils/keywords.js | 67 + .../lib/rules/utils/lazy-loading-rule-map.js | 115 + .../lib/rules/utils/patterns/letters.js | 36 + .../eslint/lib/rules/utils/unicode/index.js | 11 + .../utils/unicode/is-combining-character.js | 13 + .../rules/utils/unicode/is-emoji-modifier.js | 13 + .../unicode/is-regional-indicator-symbol.js | 13 + .../rules/utils/unicode/is-surrogate-pair.js | 14 + node_modules/eslint/lib/rules/valid-jsdoc.js | 516 ++ node_modules/eslint/lib/rules/valid-typeof.js | 121 + node_modules/eslint/lib/rules/vars-on-top.js | 157 + node_modules/eslint/lib/rules/wrap-iife.js | 204 + node_modules/eslint/lib/rules/wrap-regex.js | 59 + .../eslint/lib/rules/yield-star-spacing.js | 127 + node_modules/eslint/lib/rules/yoda.js | 362 + node_modules/eslint/lib/shared/ajv.js | 34 + node_modules/eslint/lib/shared/ast-utils.js | 29 + .../eslint/lib/shared/config-validator.js | 347 + .../eslint/lib/shared/deprecation-warnings.js | 58 + node_modules/eslint/lib/shared/logging.js | 30 + .../lib/shared/relative-module-resolver.js | 50 + .../eslint/lib/shared/runtime-info.js | 167 + .../eslint/lib/shared/string-utils.js | 22 + node_modules/eslint/lib/shared/traverser.js | 195 + node_modules/eslint/lib/shared/types.js | 199 + node_modules/eslint/lib/source-code/index.js | 5 + .../eslint/lib/source-code/source-code.js | 593 ++ .../backward-token-comment-cursor.js | 57 + .../token-store/backward-token-cursor.js | 58 + .../lib/source-code/token-store/cursor.js | 76 + .../lib/source-code/token-store/cursors.js | 90 + .../token-store/decorative-cursor.js | 39 + .../source-code/token-store/filter-cursor.js | 43 + .../forward-token-comment-cursor.js | 57 + .../token-store/forward-token-cursor.js | 63 + .../lib/source-code/token-store/index.js | 627 ++ .../source-code/token-store/limit-cursor.js | 40 + .../token-store/padded-token-cursor.js | 38 + .../source-code/token-store/skip-cursor.js | 42 + .../lib/source-code/token-store/utils.js | 92 + node_modules/eslint/lib/unsupported-api.js | 23 + .../eslint/messages/all-files-ignored.js | 16 + .../eslint/messages/extend-config-missing.js | 13 + .../eslint/messages/failed-to-read-json.js | 11 + .../eslint/messages/file-not-found.js | 10 + .../eslint/messages/no-config-found.js | 15 + .../eslint/messages/plugin-conflict.js | 22 + .../eslint/messages/plugin-invalid.js | 16 + .../eslint/messages/plugin-missing.js | 19 + .../print-config-with-directory-path.js | 8 + .../eslint/messages/whitespace-found.js | 11 + .../eslint/node_modules/debug/LICENSE | 20 + .../eslint/node_modules/debug/README.md | 481 ++ .../eslint/node_modules/debug/package.json | 59 + .../eslint/node_modules/debug/src/browser.js | 269 + .../eslint/node_modules/debug/src/common.js | 274 + .../eslint/node_modules/debug/src/index.js | 10 + .../eslint/node_modules/debug/src/node.js | 263 + node_modules/eslint/node_modules/ms/index.js | 162 + .../eslint/node_modules/ms/license.md | 21 + .../eslint/node_modules/ms/package.json | 37 + node_modules/eslint/node_modules/ms/readme.md | 60 + node_modules/eslint/package.json | 167 + node_modules/espree/LICENSE | 25 + node_modules/espree/README.md | 250 + node_modules/espree/dist/espree.cjs | 917 +++ node_modules/espree/espree.js | 173 + node_modules/espree/lib/espree.js | 328 + node_modules/espree/lib/features.js | 27 + node_modules/espree/lib/options.js | 121 + node_modules/espree/lib/token-translator.js | 265 + node_modules/espree/lib/version.js | 3 + node_modules/espree/package.json | 81 + node_modules/esquery/README.md | 27 + node_modules/esquery/dist/esquery.esm.js | 4793 +++++++++++ node_modules/esquery/dist/esquery.esm.min.js | 2 + .../esquery/dist/esquery.esm.min.js.map | 1 + node_modules/esquery/dist/esquery.js | 4801 +++++++++++ node_modules/esquery/dist/esquery.lite.js | 3995 +++++++++ node_modules/esquery/dist/esquery.lite.min.js | 2 + .../esquery/dist/esquery.lite.min.js.map | 1 + node_modules/esquery/dist/esquery.min.js | 2 + node_modules/esquery/dist/esquery.min.js.map | 1 + node_modules/esquery/license.txt | 24 + node_modules/esquery/package.json | 78 + node_modules/esquery/parser.js | 2602 ++++++ node_modules/esrecurse/.babelrc | 3 + node_modules/esrecurse/README.md | 171 + node_modules/esrecurse/esrecurse.js | 117 + node_modules/esrecurse/gulpfile.babel.js | 92 + node_modules/esrecurse/package.json | 52 + node_modules/estraverse/.jshintrc | 16 + node_modules/estraverse/LICENSE.BSD | 19 + node_modules/estraverse/README.md | 153 + node_modules/estraverse/estraverse.js | 805 ++ node_modules/estraverse/gulpfile.js | 70 + node_modules/estraverse/package.json | 40 + node_modules/esutils/LICENSE.BSD | 19 + node_modules/esutils/README.md | 174 + node_modules/esutils/lib/ast.js | 144 + node_modules/esutils/lib/code.js | 135 + node_modules/esutils/lib/keyword.js | 165 + node_modules/esutils/lib/utils.js | 33 + node_modules/esutils/package.json | 44 + node_modules/fast-deep-equal/LICENSE | 21 + node_modules/fast-deep-equal/README.md | 96 + node_modules/fast-deep-equal/es6/index.d.ts | 2 + node_modules/fast-deep-equal/es6/index.js | 72 + node_modules/fast-deep-equal/es6/react.d.ts | 2 + node_modules/fast-deep-equal/es6/react.js | 79 + node_modules/fast-deep-equal/index.d.ts | 4 + node_modules/fast-deep-equal/index.js | 46 + node_modules/fast-deep-equal/package.json | 61 + node_modules/fast-deep-equal/react.d.ts | 2 + node_modules/fast-deep-equal/react.js | 53 + .../fast-json-stable-stringify/.eslintrc.yml | 26 + .../.github/FUNDING.yml | 1 + .../fast-json-stable-stringify/.travis.yml | 8 + .../fast-json-stable-stringify/LICENSE | 21 + .../fast-json-stable-stringify/README.md | 131 + .../benchmark/index.js | 31 + .../benchmark/test.json | 137 + .../example/key_cmp.js | 7 + .../example/nested.js | 3 + .../fast-json-stable-stringify/example/str.js | 3 + .../example/value_cmp.js | 7 + .../fast-json-stable-stringify/index.d.ts | 4 + .../fast-json-stable-stringify/index.js | 59 + .../fast-json-stable-stringify/package.json | 52 + .../fast-json-stable-stringify/test/cmp.js | 13 + .../fast-json-stable-stringify/test/nested.js | 44 + .../fast-json-stable-stringify/test/str.js | 46 + .../test/to-json.js | 22 + node_modules/fast-levenshtein/LICENSE.md | 25 + node_modules/fast-levenshtein/README.md | 104 + node_modules/fast-levenshtein/levenshtein.js | 136 + node_modules/fast-levenshtein/package.json | 39 + node_modules/file-entry-cache/LICENSE | 22 + node_modules/file-entry-cache/README.md | 112 + node_modules/file-entry-cache/cache.js | 291 + node_modules/file-entry-cache/changelog.md | 163 + node_modules/file-entry-cache/package.json | 80 + node_modules/find-up/index.js | 48 + node_modules/find-up/license | 21 + node_modules/find-up/package.json | 53 + node_modules/find-up/readme.md | 85 + node_modules/flat-cache/LICENSE | 22 + node_modules/flat-cache/README.md | 73 + node_modules/flat-cache/changelog.md | 328 + node_modules/flat-cache/package.json | 84 + node_modules/flat-cache/src/cache.js | 197 + node_modules/flat-cache/src/del.js | 13 + node_modules/flat-cache/src/utils.js | 44 + node_modules/flatted/.github/FUNDING.yml | 8 + .../flatted/.github/workflows/node.js.yml | 31 + node_modules/flatted/LICENSE | 15 + node_modules/flatted/README.md | 111 + node_modules/flatted/SPECS.md | 94 + node_modules/flatted/cjs/index.js | 99 + node_modules/flatted/cjs/package.json | 1 + node_modules/flatted/es.js | 2 + node_modules/flatted/esm/index.js | 94 + node_modules/flatted/flatted.jpg | Bin 0 -> 48502 bytes node_modules/flatted/index.js | 127 + node_modules/flatted/min.js | 2 + node_modules/flatted/package.json | 61 + node_modules/flatted/php/flatted.php | 156 + node_modules/flatted/types.d.ts | 62 + node_modules/fs.realpath/LICENSE | 43 + node_modules/fs.realpath/README.md | 33 + node_modules/fs.realpath/index.js | 66 + node_modules/fs.realpath/old.js | 303 + node_modules/fs.realpath/package.json | 26 + .../function.prototype.name/.editorconfig | 20 + .../function.prototype.name/.eslintignore | 1 + .../function.prototype.name/.eslintrc | 9 + .../.github/FUNDING.yml | 12 + node_modules/function.prototype.name/.nycrc | 9 + .../function.prototype.name/CHANGELOG.md | 82 + node_modules/function.prototype.name/LICENSE | 21 + .../function.prototype.name/README.md | 42 + node_modules/function.prototype.name/auto.js | 3 + .../helpers/functionsHaveNames.js | 5 + .../function.prototype.name/implementation.js | 43 + node_modules/function.prototype.name/index.js | 18 + .../function.prototype.name/package.json | 80 + .../function.prototype.name/polyfill.js | 7 + node_modules/function.prototype.name/shim.js | 35 + .../test/implementation.js | 20 + .../function.prototype.name/test/index.js | 23 + .../function.prototype.name/test/shimmed.js | 21 + .../function.prototype.name/test/tests.js | 60 + .../function.prototype.name/test/uglified.js | 17 + .../functional-red-black-tree/.npmignore | 16 + .../functional-red-black-tree/LICENSE | 22 + .../functional-red-black-tree/README.md | 237 + .../functional-red-black-tree/bench/test.js | 11 + .../functional-red-black-tree/package.json | 40 + .../functional-red-black-tree/rbtree.js | 996 +++ .../functional-red-black-tree/test/test.js | 479 ++ .../functions-have-names/.editorconfig | 20 + node_modules/functions-have-names/.eslintrc | 19 + .../functions-have-names/.github/FUNDING.yml | 12 + node_modules/functions-have-names/.nycrc | 9 + .../functions-have-names/CHANGELOG.md | 89 + node_modules/functions-have-names/LICENSE | 21 + node_modules/functions-have-names/README.md | 40 + node_modules/functions-have-names/index.js | 31 + .../functions-have-names/package.json | 55 + .../functions-have-names/test/index.js | 65 + .../get-symbol-description/.eslintignore | 1 + node_modules/get-symbol-description/.eslintrc | 14 + .../.github/FUNDING.yml | 12 + node_modules/get-symbol-description/.nycrc | 9 + .../get-symbol-description/CHANGELOG.md | 16 + node_modules/get-symbol-description/LICENSE | 21 + node_modules/get-symbol-description/README.md | 43 + .../get-symbol-description/getInferredName.js | 10 + node_modules/get-symbol-description/index.js | 43 + .../get-symbol-description/package.json | 71 + .../get-symbol-description/test/index.js | 67 + node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 134 + node_modules/glob-parent/index.js | 75 + node_modules/glob-parent/package.json | 54 + node_modules/glob/LICENSE | 21 + node_modules/glob/README.md | 378 + node_modules/glob/common.js | 238 + node_modules/glob/glob.js | 790 ++ node_modules/glob/package.json | 55 + node_modules/glob/sync.js | 486 ++ node_modules/globals/globals.json | 1787 ++++ node_modules/globals/index.d.ts | 6 + node_modules/globals/index.js | 2 + node_modules/globals/license | 9 + node_modules/globals/package.json | 55 + node_modules/globals/readme.md | 56 + node_modules/has-bigints/.eslintrc | 5 + node_modules/has-bigints/.github/FUNDING.yml | 12 + node_modules/has-bigints/.nycrc | 9 + node_modules/has-bigints/CHANGELOG.md | 60 + node_modules/has-bigints/LICENSE | 21 + node_modules/has-bigints/README.md | 39 + node_modules/has-bigints/index.js | 10 + node_modules/has-bigints/package.json | 54 + node_modules/has-bigints/test/index.js | 44 + .../has-property-descriptors/.eslintrc | 13 + .../.github/FUNDING.yml | 12 + node_modules/has-property-descriptors/.nycrc | 9 + .../has-property-descriptors/CHANGELOG.md | 16 + node_modules/has-property-descriptors/LICENSE | 21 + .../has-property-descriptors/README.md | 43 + .../has-property-descriptors/index.js | 33 + .../has-property-descriptors/package.json | 70 + .../has-property-descriptors/test/index.js | 57 + node_modules/has-tostringtag/.eslintrc | 11 + .../has-tostringtag/.github/FUNDING.yml | 12 + node_modules/has-tostringtag/CHANGELOG.md | 20 + node_modules/has-tostringtag/LICENSE | 21 + node_modules/has-tostringtag/README.md | 46 + node_modules/has-tostringtag/index.js | 7 + node_modules/has-tostringtag/package.json | 84 + node_modules/has-tostringtag/shams.js | 7 + node_modules/has-tostringtag/test/index.js | 21 + .../has-tostringtag/test/shams/core-js.js | 28 + .../test/shams/get-own-property-symbols.js | 28 + node_modules/has-tostringtag/test/tests.js | 14 + node_modules/ignore/LICENSE-MIT | 21 + node_modules/ignore/README.md | 412 + node_modules/ignore/index.d.ts | 61 + node_modules/ignore/index.js | 603 ++ node_modules/ignore/legacy.js | 498 ++ node_modules/ignore/package.json | 71 + node_modules/import-fresh/index.d.ts | 30 + node_modules/import-fresh/index.js | 33 + node_modules/import-fresh/license | 9 + node_modules/import-fresh/package.json | 43 + node_modules/import-fresh/readme.md | 48 + node_modules/imurmurhash/README.md | 122 + node_modules/imurmurhash/imurmurhash.js | 138 + node_modules/imurmurhash/imurmurhash.min.js | 12 + node_modules/imurmurhash/package.json | 40 + node_modules/inflight/LICENSE | 15 + node_modules/inflight/README.md | 37 + node_modules/inflight/inflight.js | 54 + node_modules/inflight/package.json | 29 + node_modules/internal-slot/.editorconfig | 20 + node_modules/internal-slot/.eslintignore | 1 + node_modules/internal-slot/.eslintrc | 12 + .../internal-slot/.github/FUNDING.yml | 12 + node_modules/internal-slot/.nycrc | 13 + node_modules/internal-slot/CHANGELOG.md | 58 + node_modules/internal-slot/LICENSE | 21 + node_modules/internal-slot/README.md | 52 + node_modules/internal-slot/index.js | 59 + node_modules/internal-slot/package.json | 63 + node_modules/internal-slot/test/index.js | 120 + node_modules/is-bigint/.eslintignore | 1 + node_modules/is-bigint/.eslintrc | 10 + node_modules/is-bigint/.github/FUNDING.yml | 12 + node_modules/is-bigint/.nycrc | 9 + node_modules/is-bigint/CHANGELOG.md | 71 + node_modules/is-bigint/LICENSE | 21 + node_modules/is-bigint/README.md | 44 + node_modules/is-bigint/index.js | 38 + node_modules/is-bigint/package.json | 58 + node_modules/is-bigint/test/index.js | 81 + node_modules/is-boolean-object/.editorconfig | 22 + node_modules/is-boolean-object/.eslintignore | 1 + node_modules/is-boolean-object/.eslintrc | 22 + .../is-boolean-object/.github/FUNDING.yml | 12 + node_modules/is-boolean-object/.nycrc | 10 + node_modules/is-boolean-object/CHANGELOG.md | 107 + node_modules/is-boolean-object/LICENSE | 22 + node_modules/is-boolean-object/README.md | 57 + node_modules/is-boolean-object/index.js | 26 + node_modules/is-boolean-object/package.json | 87 + node_modules/is-boolean-object/test/index.js | 48 + node_modules/is-callable/.editorconfig | 26 + node_modules/is-callable/.eslintignore | 1 + node_modules/is-callable/.eslintrc | 21 + node_modules/is-callable/.github/FUNDING.yml | 12 + node_modules/is-callable/.istanbul.yml | 47 + node_modules/is-callable/.nycrc | 9 + node_modules/is-callable/CHANGELOG.md | 108 + node_modules/is-callable/LICENSE | 22 + node_modules/is-callable/README.md | 67 + node_modules/is-callable/index.js | 74 + node_modules/is-callable/package.json | 92 + node_modules/is-callable/test/index.js | 170 + node_modules/is-core-module/.eslintrc | 18 + node_modules/is-core-module/.nycrc | 9 + node_modules/is-core-module/CHANGELOG.md | 136 + node_modules/is-core-module/LICENSE | 20 + node_modules/is-core-module/README.md | 40 + node_modules/is-core-module/core.json | 153 + node_modules/is-core-module/index.js | 69 + node_modules/is-core-module/package.json | 65 + node_modules/is-core-module/test/index.js | 133 + node_modules/is-date-object/.editorconfig | 20 + node_modules/is-date-object/.eslintignore | 1 + node_modules/is-date-object/.eslintrc | 9 + .../is-date-object/.github/FUNDING.yml | 12 + node_modules/is-date-object/.nycrc | 10 + node_modules/is-date-object/CHANGELOG.md | 114 + node_modules/is-date-object/LICENSE | 22 + node_modules/is-date-object/README.md | 52 + node_modules/is-date-object/index.js | 22 + node_modules/is-date-object/package.json | 79 + node_modules/is-date-object/test/index.js | 36 + node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 107 + node_modules/is-extglob/index.js | 20 + node_modules/is-extglob/package.json | 69 + node_modules/is-glob/LICENSE | 21 + node_modules/is-glob/README.md | 206 + node_modules/is-glob/index.js | 150 + node_modules/is-glob/package.json | 81 + node_modules/is-negative-zero/.editorconfig | 8 + node_modules/is-negative-zero/.eslintignore | 1 + node_modules/is-negative-zero/.eslintrc | 9 + .../is-negative-zero/.github/FUNDING.yml | 12 + node_modules/is-negative-zero/.nycrc | 9 + node_modules/is-negative-zero/CHANGELOG.md | 136 + node_modules/is-negative-zero/LICENSE | 20 + node_modules/is-negative-zero/README.md | 54 + node_modules/is-negative-zero/index.js | 6 + node_modules/is-negative-zero/package.json | 79 + node_modules/is-negative-zero/test/index.js | 28 + node_modules/is-number-object/.editorconfig | 23 + node_modules/is-number-object/.eslintrc | 16 + .../is-number-object/.github/FUNDING.yml | 12 + node_modules/is-number-object/.nycrc | 10 + node_modules/is-number-object/CHANGELOG.md | 125 + node_modules/is-number-object/LICENSE | 22 + node_modules/is-number-object/README.md | 55 + node_modules/is-number-object/index.js | 24 + node_modules/is-number-object/package.json | 85 + node_modules/is-number-object/test/index.js | 38 + node_modules/is-regex/.editorconfig | 20 + node_modules/is-regex/.eslintignore | 1 + node_modules/is-regex/.eslintrc | 19 + node_modules/is-regex/.nycrc | 10 + node_modules/is-regex/CHANGELOG.md | 197 + node_modules/is-regex/LICENSE | 20 + node_modules/is-regex/README.md | 52 + node_modules/is-regex/index.js | 58 + node_modules/is-regex/package.json | 86 + node_modules/is-regex/test/index.js | 104 + .../is-shared-array-buffer/.eslintignore | 1 + node_modules/is-shared-array-buffer/.eslintrc | 5 + .../.github/FUNDING.yml | 12 + node_modules/is-shared-array-buffer/.nycrc | 9 + .../is-shared-array-buffer/CHANGELOG.md | 44 + node_modules/is-shared-array-buffer/LICENSE | 21 + node_modules/is-shared-array-buffer/README.md | 58 + node_modules/is-shared-array-buffer/index.js | 21 + .../is-shared-array-buffer/package.json | 70 + .../is-shared-array-buffer/test/index.js | 27 + node_modules/is-string/.eslintignore | 1 + node_modules/is-string/.eslintrc | 19 + node_modules/is-string/.github/FUNDING.yml | 12 + node_modules/is-string/.nycrc | 10 + node_modules/is-string/CHANGELOG.md | 114 + node_modules/is-string/LICENSE | 22 + node_modules/is-string/README.md | 56 + node_modules/is-string/index.js | 24 + node_modules/is-string/package.json | 81 + node_modules/is-string/test/index.js | 39 + node_modules/is-symbol/.editorconfig | 13 + node_modules/is-symbol/.eslintignore | 1 + node_modules/is-symbol/.eslintrc | 14 + node_modules/is-symbol/.github/FUNDING.yml | 12 + node_modules/is-symbol/.nycrc | 9 + node_modules/is-symbol/CHANGELOG.md | 113 + node_modules/is-symbol/LICENSE | 22 + node_modules/is-symbol/README.md | 45 + node_modules/is-symbol/index.js | 35 + node_modules/is-symbol/package.json | 77 + node_modules/is-symbol/test/index.js | 92 + node_modules/is-weakref/.eslintignore | 1 + node_modules/is-weakref/.eslintrc | 5 + node_modules/is-weakref/.github/FUNDING.yml | 12 + node_modules/is-weakref/.nycrc | 9 + node_modules/is-weakref/CHANGELOG.md | 54 + node_modules/is-weakref/LICENSE | 21 + node_modules/is-weakref/README.md | 52 + node_modules/is-weakref/index.js | 21 + node_modules/is-weakref/package.json | 63 + node_modules/is-weakref/test/index.js | 26 + node_modules/isexe/.npmignore | 2 + node_modules/isexe/LICENSE | 15 + node_modules/isexe/README.md | 51 + node_modules/isexe/index.js | 57 + node_modules/isexe/mode.js | 41 + node_modules/isexe/package.json | 31 + node_modules/isexe/test/basic.js | 221 + node_modules/isexe/windows.js | 42 + node_modules/js-yaml/CHANGELOG.md | 616 ++ node_modules/js-yaml/LICENSE | 21 + node_modules/js-yaml/README.md | 246 + node_modules/js-yaml/bin/js-yaml.js | 126 + node_modules/js-yaml/dist/js-yaml.js | 3874 +++++++++ node_modules/js-yaml/dist/js-yaml.min.js | 2 + node_modules/js-yaml/dist/js-yaml.mjs | 3851 +++++++++ node_modules/js-yaml/index.js | 47 + node_modules/js-yaml/lib/common.js | 59 + node_modules/js-yaml/lib/dumper.js | 965 +++ node_modules/js-yaml/lib/exception.js | 55 + node_modules/js-yaml/lib/loader.js | 1727 ++++ node_modules/js-yaml/lib/schema.js | 121 + node_modules/js-yaml/lib/schema/core.js | 11 + node_modules/js-yaml/lib/schema/default.js | 22 + node_modules/js-yaml/lib/schema/failsafe.js | 17 + node_modules/js-yaml/lib/schema/json.js | 19 + node_modules/js-yaml/lib/snippet.js | 101 + node_modules/js-yaml/lib/type.js | 66 + node_modules/js-yaml/lib/type/binary.js | 125 + node_modules/js-yaml/lib/type/bool.js | 35 + node_modules/js-yaml/lib/type/float.js | 97 + node_modules/js-yaml/lib/type/int.js | 156 + node_modules/js-yaml/lib/type/map.js | 8 + node_modules/js-yaml/lib/type/merge.js | 12 + node_modules/js-yaml/lib/type/null.js | 35 + node_modules/js-yaml/lib/type/omap.js | 44 + node_modules/js-yaml/lib/type/pairs.js | 53 + node_modules/js-yaml/lib/type/seq.js | 8 + node_modules/js-yaml/lib/type/set.js | 29 + node_modules/js-yaml/lib/type/str.js | 8 + node_modules/js-yaml/lib/type/timestamp.js | 88 + node_modules/js-yaml/package.json | 66 + .../json-schema-traverse/.eslintrc.yml | 27 + node_modules/json-schema-traverse/.travis.yml | 8 + node_modules/json-schema-traverse/LICENSE | 21 + node_modules/json-schema-traverse/README.md | 83 + node_modules/json-schema-traverse/index.js | 89 + .../json-schema-traverse/package.json | 43 + .../json-schema-traverse/spec/.eslintrc.yml | 6 + .../spec/fixtures/schema.js | 125 + .../json-schema-traverse/spec/index.spec.js | 171 + .../.npmignore | 1 + .../.travis.yml | 4 + .../LICENSE | 18 + .../example/key_cmp.js | 7 + .../example/nested.js | 3 + .../example/str.js | 3 + .../example/value_cmp.js | 7 + .../index.js | 82 + .../package.json | 43 + .../readme.markdown | 132 + .../test/cmp.js | 11 + .../test/nested.js | 42 + .../test/replacer.js | 74 + .../test/space.js | 59 + .../test/str.js | 32 + .../test/to-json.js | 20 + node_modules/json5/CHANGELOG.md | 274 + node_modules/json5/LICENSE.md | 23 + node_modules/json5/README.md | 234 + node_modules/json5/dist/index.js | 1 + node_modules/json5/lib/cli.js | 2 + node_modules/json5/lib/index.js | 1 + node_modules/json5/lib/parse.js | 1 + node_modules/json5/lib/register.js | 1 + node_modules/json5/lib/require.js | 1 + node_modules/json5/lib/stringify.js | 1 + node_modules/json5/lib/unicode.js | 1 + node_modules/json5/lib/util.js | 1 + node_modules/json5/package.json | 76 + node_modules/levn/LICENSE | 22 + node_modules/levn/README.md | 196 + node_modules/levn/lib/cast.js | 327 + node_modules/levn/lib/index.js | 22 + node_modules/levn/lib/parse-string.js | 113 + node_modules/levn/package.json | 46 + node_modules/locate-path/index.js | 24 + node_modules/locate-path/license | 21 + node_modules/locate-path/package.json | 47 + node_modules/locate-path/readme.md | 99 + node_modules/lodash.merge/LICENSE | 47 + node_modules/lodash.merge/README.md | 18 + node_modules/lodash.merge/index.js | 1977 +++++ node_modules/lodash.merge/package.json | 16 + node_modules/lru-cache/LICENSE | 15 + node_modules/lru-cache/README.md | 166 + node_modules/lru-cache/index.js | 334 + node_modules/lru-cache/package.json | 34 + node_modules/minimist/.travis.yml | 8 + node_modules/minimist/LICENSE | 18 + node_modules/minimist/example/parse.js | 2 + node_modules/minimist/index.js | 249 + node_modules/minimist/package.json | 45 + node_modules/minimist/readme.markdown | 98 + node_modules/minimist/test/all_bool.js | 32 + node_modules/minimist/test/bool.js | 178 + node_modules/minimist/test/dash.js | 31 + node_modules/minimist/test/default_bool.js | 35 + node_modules/minimist/test/dotted.js | 22 + node_modules/minimist/test/kv_short.js | 16 + node_modules/minimist/test/long.js | 31 + node_modules/minimist/test/num.js | 36 + node_modules/minimist/test/parse.js | 197 + node_modules/minimist/test/parse_modified.js | 9 + node_modules/minimist/test/proto.js | 60 + node_modules/minimist/test/short.js | 67 + node_modules/minimist/test/stop_early.js | 15 + node_modules/minimist/test/unknown.js | 102 + node_modules/minimist/test/whitespace.js | 8 + node_modules/natural-compare/README.md | 125 + node_modules/natural-compare/index.js | 57 + node_modules/natural-compare/package.json | 42 + node_modules/object-keys/.editorconfig | 13 + node_modules/object-keys/.eslintrc | 17 + node_modules/object-keys/.travis.yml | 277 + node_modules/object-keys/CHANGELOG.md | 232 + node_modules/object-keys/LICENSE | 21 + node_modules/object-keys/README.md | 76 + node_modules/object-keys/implementation.js | 122 + node_modules/object-keys/index.js | 32 + node_modules/object-keys/isArguments.js | 17 + node_modules/object-keys/package.json | 88 + node_modules/object-keys/test/index.js | 5 + node_modules/object.assign/.editorconfig | 20 + node_modules/object.assign/.eslintignore | 1 + node_modules/object.assign/.eslintrc | 26 + .../object.assign/.github/FUNDING.yml | 12 + .../.github/workflows/rebase.yml | 15 + .../.github/workflows/require-allow-edits.yml | 14 + node_modules/object.assign/.nycrc | 14 + node_modules/object.assign/CHANGELOG.md | 201 + node_modules/object.assign/LICENSE | 21 + node_modules/object.assign/README.md | 135 + node_modules/object.assign/auto.js | 3 + node_modules/object.assign/dist/browser.js | 865 ++ node_modules/object.assign/hasSymbols.js | 43 + node_modules/object.assign/implementation.js | 42 + node_modules/object.assign/index.js | 22 + node_modules/object.assign/package.json | 83 + node_modules/object.assign/polyfill.js | 55 + node_modules/object.assign/shim.js | 14 + node_modules/object.assign/test/index.js | 17 + node_modules/object.assign/test/native.js | 49 + node_modules/object.assign/test/ses-compat.js | 12 + node_modules/object.assign/test/shimmed.js | 52 + node_modules/object.assign/test/tests.js | 237 + node_modules/object.values/.editorconfig | 20 + node_modules/object.values/.eslintignore | 1 + node_modules/object.values/.eslintrc | 12 + node_modules/object.values/.nycrc | 9 + node_modules/object.values/CHANGELOG.md | 160 + node_modules/object.values/LICENSE | 22 + node_modules/object.values/README.md | 58 + node_modules/object.values/auto.js | 3 + node_modules/object.values/implementation.js | 18 + node_modules/object.values/index.js | 18 + node_modules/object.values/package.json | 90 + node_modules/object.values/polyfill.js | 7 + node_modules/object.values/shim.js | 14 + node_modules/object.values/test/.eslintrc | 11 + .../object.values/test/implementation.js | 20 + node_modules/object.values/test/index.js | 17 + node_modules/object.values/test/shimmed.js | 35 + node_modules/object.values/test/tests.js | 82 + node_modules/once/LICENSE | 15 + node_modules/once/README.md | 79 + node_modules/once/once.js | 42 + node_modules/once/package.json | 33 + node_modules/optionator/CHANGELOG.md | 59 + node_modules/optionator/LICENSE | 22 + node_modules/optionator/README.md | 238 + node_modules/optionator/lib/help.js | 260 + node_modules/optionator/lib/index.js | 465 ++ node_modules/optionator/lib/util.js | 54 + node_modules/optionator/package.json | 43 + node_modules/p-limit/index.js | 42 + node_modules/p-limit/license | 9 + node_modules/p-limit/package.json | 49 + node_modules/p-limit/readme.md | 69 + node_modules/p-locate/index.js | 31 + node_modules/p-locate/license | 21 + node_modules/p-locate/package.json | 54 + node_modules/p-locate/readme.md | 86 + node_modules/p-try/index.js | 4 + node_modules/p-try/license | 21 + node_modules/p-try/package.json | 43 + node_modules/p-try/readme.md | 38 + node_modules/parent-module/index.js | 37 + node_modules/parent-module/license | 9 + node_modules/parent-module/package.json | 46 + node_modules/parent-module/readme.md | 67 + node_modules/path-exists/index.js | 17 + node_modules/path-exists/license | 21 + node_modules/path-exists/package.json | 40 + node_modules/path-exists/readme.md | 50 + node_modules/path-is-absolute/index.js | 20 + node_modules/path-is-absolute/license | 21 + node_modules/path-is-absolute/package.json | 43 + node_modules/path-is-absolute/readme.md | 59 + node_modules/path-key/index.d.ts | 40 + node_modules/path-key/index.js | 16 + node_modules/path-key/license | 9 + node_modules/path-key/package.json | 39 + node_modules/path-key/readme.md | 61 + node_modules/path-parse/LICENSE | 21 + node_modules/path-parse/README.md | 42 + node_modules/path-parse/index.js | 75 + node_modules/path-parse/package.json | 33 + node_modules/prelude-ls/CHANGELOG.md | 108 + node_modules/prelude-ls/LICENSE | 22 + node_modules/prelude-ls/README.md | 15 + node_modules/prelude-ls/lib/Func.js | 69 + node_modules/prelude-ls/lib/List.js | 716 ++ node_modules/prelude-ls/lib/Num.js | 130 + node_modules/prelude-ls/lib/Obj.js | 154 + node_modules/prelude-ls/lib/Str.js | 92 + node_modules/prelude-ls/lib/index.js | 178 + node_modules/prelude-ls/package.json | 46 + node_modules/punycode/LICENSE-MIT.txt | 20 + node_modules/punycode/README.md | 122 + node_modules/punycode/package.json | 58 + node_modules/punycode/punycode.es6.js | 441 + node_modules/punycode/punycode.js | 440 + .../regexp.prototype.flags/.editorconfig | 13 + node_modules/regexp.prototype.flags/.eslintrc | 19 + node_modules/regexp.prototype.flags/.nycrc | 9 + .../regexp.prototype.flags/CHANGELOG.md | 190 + node_modules/regexp.prototype.flags/LICENSE | 22 + node_modules/regexp.prototype.flags/README.md | 54 + node_modules/regexp.prototype.flags/auto.js | 3 + .../regexp.prototype.flags/implementation.js | 39 + node_modules/regexp.prototype.flags/index.js | 18 + .../regexp.prototype.flags/package.json | 92 + .../regexp.prototype.flags/polyfill.js | 36 + node_modules/regexp.prototype.flags/shim.js | 26 + .../test/implementation.js | 20 + .../regexp.prototype.flags/test/index.js | 17 + .../regexp.prototype.flags/test/shimmed.js | 48 + .../regexp.prototype.flags/test/tests.js | 141 + node_modules/regexpp/LICENSE | 21 + node_modules/regexpp/README.md | 178 + node_modules/regexpp/index.d.ts | 248 + node_modules/regexpp/index.js | 2096 +++++ node_modules/regexpp/index.js.map | 1 + node_modules/regexpp/index.mjs | 2087 +++++ node_modules/regexpp/index.mjs.map | 1 + node_modules/regexpp/package.json | 91 + node_modules/resolve-from/index.js | 47 + node_modules/resolve-from/license | 9 + node_modules/resolve-from/package.json | 34 + node_modules/resolve-from/readme.md | 72 + node_modules/resolve/.editorconfig | 37 + node_modules/resolve/.eslintrc | 65 + node_modules/resolve/.github/FUNDING.yml | 12 + node_modules/resolve/LICENSE | 21 + node_modules/resolve/SECURITY.md | 3 + node_modules/resolve/async.js | 3 + node_modules/resolve/bin/resolve | 50 + node_modules/resolve/example/async.js | 5 + node_modules/resolve/example/sync.js | 3 + node_modules/resolve/index.js | 6 + node_modules/resolve/lib/async.js | 329 + node_modules/resolve/lib/caller.js | 8 + node_modules/resolve/lib/core.js | 52 + node_modules/resolve/lib/core.json | 153 + node_modules/resolve/lib/homedir.js | 24 + node_modules/resolve/lib/is-core.js | 5 + .../resolve/lib/node-modules-paths.js | 42 + node_modules/resolve/lib/normalize-options.js | 10 + node_modules/resolve/lib/sync.js | 208 + node_modules/resolve/package.json | 71 + node_modules/resolve/readme.markdown | 301 + node_modules/resolve/sync.js | 3 + node_modules/resolve/test/core.js | 88 + node_modules/resolve/test/dotdot.js | 29 + node_modules/resolve/test/dotdot/abc/index.js | 2 + node_modules/resolve/test/dotdot/index.js | 1 + node_modules/resolve/test/faulty_basedir.js | 29 + node_modules/resolve/test/filter.js | 34 + node_modules/resolve/test/filter_sync.js | 33 + node_modules/resolve/test/home_paths.js | 127 + node_modules/resolve/test/home_paths_sync.js | 114 + node_modules/resolve/test/mock.js | 315 + node_modules/resolve/test/mock_sync.js | 214 + node_modules/resolve/test/module_dir.js | 56 + .../test/module_dir/xmodules/aaa/index.js | 1 + .../test/module_dir/ymodules/aaa/index.js | 1 + .../test/module_dir/zmodules/bbb/main.js | 1 + .../test/module_dir/zmodules/bbb/package.json | 3 + .../resolve/test/node-modules-paths.js | 143 + node_modules/resolve/test/node_path.js | 70 + .../resolve/test/node_path/x/aaa/index.js | 1 + .../resolve/test/node_path/x/ccc/index.js | 1 + .../resolve/test/node_path/y/bbb/index.js | 1 + .../resolve/test/node_path/y/ccc/index.js | 1 + node_modules/resolve/test/nonstring.js | 9 + node_modules/resolve/test/pathfilter.js | 75 + .../resolve/test/pathfilter/deep_ref/main.js | 0 node_modules/resolve/test/precedence.js | 23 + node_modules/resolve/test/precedence/aaa.js | 1 + .../resolve/test/precedence/aaa/index.js | 1 + .../resolve/test/precedence/aaa/main.js | 1 + node_modules/resolve/test/precedence/bbb.js | 1 + .../resolve/test/precedence/bbb/main.js | 1 + node_modules/resolve/test/resolver.js | 595 ++ .../resolve/test/resolver/baz/doom.js | 0 .../resolve/test/resolver/baz/package.json | 4 + .../resolve/test/resolver/baz/quux.js | 1 + .../resolve/test/resolver/browser_field/a.js | 0 .../resolve/test/resolver/browser_field/b.js | 0 .../test/resolver/browser_field/package.json | 5 + node_modules/resolve/test/resolver/cup.coffee | 1 + .../resolve/test/resolver/dot_main/index.js | 1 + .../test/resolver/dot_main/package.json | 3 + .../test/resolver/dot_slash_main/index.js | 1 + .../test/resolver/dot_slash_main/package.json | 3 + .../resolve/test/resolver/false_main/index.js | 0 .../test/resolver/false_main/package.json | 4 + node_modules/resolve/test/resolver/foo.js | 1 + .../test/resolver/incorrect_main/index.js | 2 + .../test/resolver/incorrect_main/package.json | 3 + .../test/resolver/invalid_main/package.json | 7 + .../resolver/malformed_package_json/index.js | 0 .../malformed_package_json/package.json | 1 + node_modules/resolve/test/resolver/mug.coffee | 0 node_modules/resolve/test/resolver/mug.js | 0 .../test/resolver/multirepo/lerna.json | 6 + .../test/resolver/multirepo/package.json | 20 + .../multirepo/packages/package-a/index.js | 35 + .../multirepo/packages/package-a/package.json | 14 + .../multirepo/packages/package-b/index.js | 0 .../multirepo/packages/package-b/package.json | 14 + .../resolver/nested_symlinks/mylib/async.js | 26 + .../nested_symlinks/mylib/package.json | 15 + .../resolver/nested_symlinks/mylib/sync.js | 12 + .../test/resolver/other_path/lib/other-lib.js | 0 .../resolve/test/resolver/other_path/root.js | 0 .../resolve/test/resolver/quux/foo/index.js | 1 + .../resolve/test/resolver/same_names/foo.js | 1 + .../test/resolver/same_names/foo/index.js | 1 + .../resolver/symlinked/_/node_modules/foo.js | 0 .../symlinked/_/symlink_target/.gitkeep | 0 .../test/resolver/symlinked/package/bar.js | 1 + .../resolver/symlinked/package/package.json | 3 + .../test/resolver/without_basedir/main.js | 5 + node_modules/resolve/test/resolver_sync.js | 726 ++ node_modules/resolve/test/shadowed_core.js | 54 + .../shadowed_core/node_modules/util/index.js | 0 node_modules/resolve/test/subdirs.js | 13 + node_modules/resolve/test/symlinks.js | 176 + node_modules/rimraf/CHANGELOG.md | 65 + node_modules/rimraf/LICENSE | 15 + node_modules/rimraf/README.md | 101 + node_modules/rimraf/bin.js | 68 + node_modules/rimraf/package.json | 32 + node_modules/rimraf/rimraf.js | 360 + node_modules/semver/LICENSE | 15 + node_modules/semver/README.md | 568 ++ node_modules/semver/bin/semver.js | 183 + node_modules/semver/classes/comparator.js | 136 + node_modules/semver/classes/index.js | 5 + node_modules/semver/classes/range.js | 519 ++ node_modules/semver/classes/semver.js | 287 + node_modules/semver/functions/clean.js | 6 + node_modules/semver/functions/cmp.js | 52 + node_modules/semver/functions/coerce.js | 52 + .../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 | 18 + 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 | 33 + 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/parse-options.js | 11 + node_modules/semver/internal/re.js | 182 + node_modules/semver/package.json | 75 + node_modules/semver/preload.js | 2 + node_modules/semver/range.bnf | 16 + 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 | 61 + node_modules/semver/ranges/outside.js | 80 + node_modules/semver/ranges/simplify.js | 47 + node_modules/semver/ranges/subset.js | 244 + node_modules/semver/ranges/to-comparators.js | 8 + node_modules/semver/ranges/valid.js | 11 + node_modules/shebang-command/index.js | 19 + node_modules/shebang-command/license | 9 + node_modules/shebang-command/package.json | 34 + node_modules/shebang-command/readme.md | 34 + node_modules/shebang-regex/index.d.ts | 22 + node_modules/shebang-regex/index.js | 2 + node_modules/shebang-regex/license | 9 + node_modules/shebang-regex/package.json | 35 + node_modules/shebang-regex/readme.md | 33 + .../string.prototype.trimend/.editorconfig | 20 + .../string.prototype.trimend/.eslintrc | 24 + node_modules/string.prototype.trimend/.nycrc | 9 + .../string.prototype.trimend/CHANGELOG.md | 92 + node_modules/string.prototype.trimend/LICENSE | 21 + .../string.prototype.trimend/README.md | 46 + node_modules/string.prototype.trimend/auto.js | 3 + .../implementation.js | 15 + .../string.prototype.trimend/index.js | 23 + .../string.prototype.trimend/package.json | 71 + .../string.prototype.trimend/polyfill.js | 15 + node_modules/string.prototype.trimend/shim.js | 14 + .../test/implementation.js | 20 + .../string.prototype.trimend/test/index.js | 17 + .../string.prototype.trimend/test/shimmed.js | 36 + .../string.prototype.trimend/test/tests.js | 31 + .../string.prototype.trimstart/.editorconfig | 20 + .../string.prototype.trimstart/.eslintrc | 24 + .../string.prototype.trimstart/.nycrc | 9 + .../string.prototype.trimstart/CHANGELOG.md | 92 + .../string.prototype.trimstart/LICENSE | 21 + .../string.prototype.trimstart/README.md | 46 + .../string.prototype.trimstart/auto.js | 3 + .../implementation.js | 15 + .../string.prototype.trimstart/index.js | 23 + .../string.prototype.trimstart/package.json | 71 + .../string.prototype.trimstart/polyfill.js | 15 + .../string.prototype.trimstart/shim.js | 14 + .../test/implementation.js | 20 + .../string.prototype.trimstart/test/index.js | 18 + .../test/shimmed.js | 36 + .../string.prototype.trimstart/test/tests.js | 31 + node_modules/strip-ansi/index.d.ts | 17 + node_modules/strip-ansi/index.js | 4 + node_modules/strip-ansi/license | 9 + node_modules/strip-ansi/package.json | 54 + node_modules/strip-ansi/readme.md | 46 + node_modules/strip-bom/index.js | 14 + node_modules/strip-bom/license | 21 + node_modules/strip-bom/package.json | 40 + node_modules/strip-bom/readme.md | 36 + node_modules/strip-json-comments/index.d.ts | 36 + node_modules/strip-json-comments/index.js | 77 + node_modules/strip-json-comments/license | 9 + node_modules/strip-json-comments/package.json | 47 + node_modules/strip-json-comments/readme.md | 78 + .../supports-preserve-symlinks-flag/.eslintrc | 14 + .../.github/FUNDING.yml | 12 + .../supports-preserve-symlinks-flag/.nycrc | 9 + .../CHANGELOG.md | 22 + .../supports-preserve-symlinks-flag/LICENSE | 21 + .../supports-preserve-symlinks-flag/README.md | 42 + .../browser.js | 3 + .../supports-preserve-symlinks-flag/index.js | 9 + .../package.json | 70 + .../test/index.js | 29 + node_modules/text-table/.travis.yml | 4 + node_modules/text-table/LICENSE | 18 + node_modules/text-table/example/align.js | 8 + node_modules/text-table/example/center.js | 8 + node_modules/text-table/example/dotalign.js | 9 + node_modules/text-table/example/doubledot.js | 11 + node_modules/text-table/example/table.js | 6 + node_modules/text-table/index.js | 86 + node_modules/text-table/package.json | 44 + node_modules/text-table/readme.markdown | 134 + node_modules/text-table/test/align.js | 18 + node_modules/text-table/test/ansi-colors.js | 32 + node_modules/text-table/test/center.js | 18 + node_modules/text-table/test/dotalign.js | 20 + node_modules/text-table/test/doubledot.js | 24 + node_modules/text-table/test/table.js | 14 + node_modules/tsconfig-paths/CHANGELOG.md | 365 + node_modules/tsconfig-paths/LICENSE | 21 + node_modules/tsconfig-paths/README.md | 268 + .../lib/__tests__/config-loader.test.d.ts | 1 + .../lib/__tests__/config-loader.test.js | 88 + .../lib/__tests__/config-loader.test.js.map | 1 + .../lib/__tests__/data/match-path-data.d.ts | 17 + .../lib/__tests__/data/match-path-data.js | 205 + .../lib/__tests__/data/match-path-data.js.map | 1 + .../lib/__tests__/filesystem.test.d.ts | 1 + .../lib/__tests__/filesystem.test.js | 64 + .../lib/__tests__/filesystem.test.js.map | 1 + .../lib/__tests__/mapping-entry.test.d.ts | 1 + .../lib/__tests__/mapping-entry.test.js | 66 + .../lib/__tests__/mapping-entry.test.js.map | 1 + .../lib/__tests__/match-path-async.test.d.ts | 1 + .../lib/__tests__/match-path-async.test.js | 19 + .../__tests__/match-path-async.test.js.map | 1 + .../lib/__tests__/match-path-sync.test.d.ts | 1 + .../lib/__tests__/match-path-sync.test.js | 15 + .../lib/__tests__/match-path-sync.test.js.map | 1 + .../lib/__tests__/try-path.test.d.ts | 1 + .../lib/__tests__/try-path.test.js | 175 + .../lib/__tests__/try-path.test.js.map | 1 + .../lib/__tests__/tsconfig-loader.test.d.ts | 1 + .../lib/__tests__/tsconfig-loader.test.js | 246 + .../lib/__tests__/tsconfig-loader.test.js.map | 1 + .../tsconfig-paths/lib/config-loader.d.ts | 33 + .../tsconfig-paths/lib/config-loader.js | 57 + .../tsconfig-paths/lib/config-loader.js.map | 1 + .../tsconfig-paths/lib/filesystem.d.ts | 33 + node_modules/tsconfig-paths/lib/filesystem.js | 55 + .../tsconfig-paths/lib/filesystem.js.map | 1 + node_modules/tsconfig-paths/lib/index.d.ts | 5 + node_modules/tsconfig-paths/lib/index.js | 15 + node_modules/tsconfig-paths/lib/index.js.map | 1 + .../tsconfig-paths/lib/mapping-entry.d.ts | 17 + .../tsconfig-paths/lib/mapping-entry.js | 53 + .../tsconfig-paths/lib/mapping-entry.js.map | 1 + .../tsconfig-paths/lib/match-path-async.d.ts | 21 + .../tsconfig-paths/lib/match-path-async.js | 113 + .../lib/match-path-async.js.map | 1 + .../tsconfig-paths/lib/match-path-sync.d.ts | 30 + .../tsconfig-paths/lib/match-path-sync.js | 87 + .../tsconfig-paths/lib/match-path-sync.js.map | 1 + node_modules/tsconfig-paths/lib/options.d.ts | 4 + node_modules/tsconfig-paths/lib/options.js | 15 + .../tsconfig-paths/lib/options.js.map | 1 + node_modules/tsconfig-paths/lib/register.d.ts | 6 + node_modules/tsconfig-paths/lib/register.js | 93 + .../tsconfig-paths/lib/register.js.map | 1 + node_modules/tsconfig-paths/lib/try-path.d.ts | 15 + node_modules/tsconfig-paths/lib/try-path.js | 90 + .../tsconfig-paths/lib/try-path.js.map | 1 + .../tsconfig-paths/lib/tsconfig-loader.d.ts | 28 + .../tsconfig-paths/lib/tsconfig-loader.js | 111 + .../tsconfig-paths/lib/tsconfig-loader.js.map | 1 + node_modules/tsconfig-paths/package.json | 67 + node_modules/tsconfig-paths/register.js | 1 + .../src/__tests__/config-loader.test.ts | 100 + .../src/__tests__/data/match-path-data.ts | 219 + .../src/__tests__/filesystem.test.ts | 65 + .../src/__tests__/mapping-entry.test.ts | 70 + .../src/__tests__/match-path-async.test.ts | 27 + .../src/__tests__/match-path-sync.test.ts | 23 + .../src/__tests__/try-path.test.ts | 193 + .../src/__tests__/tsconfig-loader.test.ts | 312 + .../src/__tests__/tsconfig-named.json | 10 + .../tsconfig-paths/src/config-loader.ts | 97 + node_modules/tsconfig-paths/src/filesystem.ts | 87 + node_modules/tsconfig-paths/src/index.ts | 24 + .../tsconfig-paths/src/mapping-entry.ts | 64 + .../tsconfig-paths/src/match-path-async.ts | 218 + .../tsconfig-paths/src/match-path-sync.ts | 141 + node_modules/tsconfig-paths/src/options.ts | 18 + node_modules/tsconfig-paths/src/register.ts | 97 + node_modules/tsconfig-paths/src/try-path.ts | 102 + .../tsconfig-paths/src/tsconfig-loader.ts | 172 + node_modules/type-check/LICENSE | 22 + node_modules/type-check/README.md | 210 + node_modules/type-check/lib/check.js | 128 + node_modules/type-check/lib/index.js | 16 + node_modules/type-check/lib/parse-type.js | 198 + node_modules/type-check/package.json | 39 + node_modules/type-fest/base.d.ts | 38 + node_modules/type-fest/index.d.ts | 2 + node_modules/type-fest/license | 9 + node_modules/type-fest/package.json | 58 + node_modules/type-fest/readme.md | 658 ++ .../type-fest/source/async-return-type.d.ts | 23 + node_modules/type-fest/source/asyncify.d.ts | 31 + node_modules/type-fest/source/basic.d.ts | 67 + .../type-fest/source/conditional-except.d.ts | 43 + .../type-fest/source/conditional-keys.d.ts | 43 + .../type-fest/source/conditional-pick.d.ts | 42 + node_modules/type-fest/source/entries.d.ts | 57 + node_modules/type-fest/source/entry.d.ts | 60 + node_modules/type-fest/source/except.d.ts | 22 + .../type-fest/source/fixed-length-array.d.ts | 38 + .../type-fest/source/iterable-element.d.ts | 46 + .../type-fest/source/literal-union.d.ts | 33 + .../type-fest/source/merge-exclusive.d.ts | 39 + node_modules/type-fest/source/merge.d.ts | 22 + node_modules/type-fest/source/mutable.d.ts | 22 + node_modules/type-fest/source/opaque.d.ts | 65 + .../type-fest/source/package-json.d.ts | 611 ++ .../type-fest/source/partial-deep.d.ts | 72 + node_modules/type-fest/source/promisable.d.ts | 23 + .../type-fest/source/promise-value.d.ts | 27 + .../type-fest/source/readonly-deep.d.ts | 59 + .../source/require-at-least-one.d.ts | 33 + .../type-fest/source/require-exactly-one.d.ts | 35 + .../type-fest/source/set-optional.d.ts | 34 + .../type-fest/source/set-required.d.ts | 34 + .../type-fest/source/set-return-type.d.ts | 29 + .../type-fest/source/stringified.d.ts | 21 + .../type-fest/source/tsconfig-json.d.ts | 870 ++ .../source/union-to-intersection.d.ts | 58 + node_modules/type-fest/source/utilities.d.ts | 3 + node_modules/type-fest/source/value-of.d.ts | 40 + node_modules/type-fest/ts41/camel-case.d.ts | 72 + .../type-fest/ts41/delimiter-case.d.ts | 85 + node_modules/type-fest/ts41/index.d.ts | 9 + node_modules/type-fest/ts41/kebab-case.d.ts | 36 + node_modules/type-fest/ts41/pascal-case.d.ts | 36 + node_modules/type-fest/ts41/snake-case.d.ts | 35 + node_modules/unbox-primitive/.editorconfig | 20 + node_modules/unbox-primitive/.eslintrc | 5 + .../unbox-primitive/.github/FUNDING.yml | 12 + node_modules/unbox-primitive/.nycrc | 13 + node_modules/unbox-primitive/CHANGELOG.md | 60 + node_modules/unbox-primitive/LICENSE | 21 + node_modules/unbox-primitive/README.md | 47 + node_modules/unbox-primitive/index.js | 39 + node_modules/unbox-primitive/package.json | 65 + node_modules/unbox-primitive/test/index.js | 59 + node_modules/uri-js/LICENSE | 11 + node_modules/uri-js/README.md | 203 + node_modules/uri-js/dist/es5/uri.all.d.ts | 59 + node_modules/uri-js/dist/es5/uri.all.js | 1443 ++++ node_modules/uri-js/dist/es5/uri.all.js.map | 1 + node_modules/uri-js/dist/es5/uri.all.min.d.ts | 59 + node_modules/uri-js/dist/es5/uri.all.min.js | 3 + .../uri-js/dist/es5/uri.all.min.js.map | 1 + node_modules/uri-js/dist/esnext/index.d.ts | 1 + node_modules/uri-js/dist/esnext/index.js | 17 + node_modules/uri-js/dist/esnext/index.js.map | 1 + .../uri-js/dist/esnext/regexps-iri.d.ts | 3 + .../uri-js/dist/esnext/regexps-iri.js | 3 + .../uri-js/dist/esnext/regexps-iri.js.map | 1 + .../uri-js/dist/esnext/regexps-uri.d.ts | 4 + .../uri-js/dist/esnext/regexps-uri.js | 42 + .../uri-js/dist/esnext/regexps-uri.js.map | 1 + .../uri-js/dist/esnext/schemes/http.d.ts | 3 + .../uri-js/dist/esnext/schemes/http.js | 28 + .../uri-js/dist/esnext/schemes/http.js.map | 1 + .../uri-js/dist/esnext/schemes/https.d.ts | 3 + .../uri-js/dist/esnext/schemes/https.js | 9 + .../uri-js/dist/esnext/schemes/https.js.map | 1 + .../uri-js/dist/esnext/schemes/mailto.d.ts | 12 + .../uri-js/dist/esnext/schemes/mailto.js | 148 + .../uri-js/dist/esnext/schemes/mailto.js.map | 1 + .../uri-js/dist/esnext/schemes/urn-uuid.d.ts | 7 + .../uri-js/dist/esnext/schemes/urn-uuid.js | 23 + .../dist/esnext/schemes/urn-uuid.js.map | 1 + .../uri-js/dist/esnext/schemes/urn.d.ts | 10 + .../uri-js/dist/esnext/schemes/urn.js | 49 + .../uri-js/dist/esnext/schemes/urn.js.map | 1 + .../uri-js/dist/esnext/schemes/ws.d.ts | 7 + node_modules/uri-js/dist/esnext/schemes/ws.js | 41 + .../uri-js/dist/esnext/schemes/ws.js.map | 1 + .../uri-js/dist/esnext/schemes/wss.d.ts | 3 + .../uri-js/dist/esnext/schemes/wss.js | 9 + .../uri-js/dist/esnext/schemes/wss.js.map | 1 + node_modules/uri-js/dist/esnext/uri.d.ts | 59 + node_modules/uri-js/dist/esnext/uri.js | 480 ++ node_modules/uri-js/dist/esnext/uri.js.map | 1 + node_modules/uri-js/dist/esnext/util.d.ts | 6 + node_modules/uri-js/dist/esnext/util.js | 36 + node_modules/uri-js/dist/esnext/util.js.map | 1 + node_modules/uri-js/package.json | 77 + node_modules/uri-js/yarn.lock | 2558 ++++++ node_modules/v8-compile-cache/CHANGELOG.md | 53 + node_modules/v8-compile-cache/LICENSE | 21 + node_modules/v8-compile-cache/README.md | 55 + node_modules/v8-compile-cache/package.json | 34 + .../v8-compile-cache/v8-compile-cache.js | 371 + .../which-boxed-primitive/.editorconfig | 20 + .../which-boxed-primitive/.eslintignore | 1 + node_modules/which-boxed-primitive/.eslintrc | 9 + .../which-boxed-primitive/.github/FUNDING.yml | 12 + node_modules/which-boxed-primitive/.nycrc | 13 + .../which-boxed-primitive/CHANGELOG.md | 54 + node_modules/which-boxed-primitive/LICENSE | 21 + node_modules/which-boxed-primitive/README.md | 73 + node_modules/which-boxed-primitive/index.js | 30 + .../which-boxed-primitive/package.json | 65 + .../which-boxed-primitive/test/index.js | 66 + node_modules/which/CHANGELOG.md | 166 + node_modules/which/LICENSE | 15 + node_modules/which/README.md | 54 + node_modules/which/bin/node-which | 52 + node_modules/which/package.json | 43 + node_modules/which/which.js | 125 + node_modules/word-wrap/LICENSE | 21 + node_modules/word-wrap/README.md | 182 + node_modules/word-wrap/index.d.ts | 50 + node_modules/word-wrap/index.js | 46 + node_modules/word-wrap/package.json | 77 + node_modules/wrappy/LICENSE | 15 + node_modules/wrappy/README.md | 36 + node_modules/wrappy/package.json | 29 + node_modules/wrappy/wrappy.js | 33 + node_modules/yallist/LICENSE | 15 + node_modules/yallist/README.md | 204 + node_modules/yallist/iterator.js | 8 + node_modules/yallist/package.json | 29 + node_modules/yallist/yallist.js | 426 + package-lock.json | 2967 +++++++ package.json | 7 + 3639 files changed, 346484 insertions(+) create mode 100644 .eslintrc.json create mode 120000 node_modules/.bin/acorn create mode 120000 node_modules/.bin/eslint create mode 120000 node_modules/.bin/js-yaml create mode 120000 node_modules/.bin/json5 create mode 120000 node_modules/.bin/node-which create mode 120000 node_modules/.bin/resolve create mode 120000 node_modules/.bin/rimraf create mode 120000 node_modules/.bin/semver create mode 100644 node_modules/@eslint/eslintrc/LICENSE create mode 100644 node_modules/@eslint/eslintrc/README.md create mode 100644 node_modules/@eslint/eslintrc/conf/config-schema.js create mode 100644 node_modules/@eslint/eslintrc/conf/environments.js create mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs create mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map create mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc.cjs create mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map create mode 100644 node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array-factory.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/config-array.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/index.js create mode 100644 node_modules/@eslint/eslintrc/lib/config-array/override-tester.js create mode 100644 node_modules/@eslint/eslintrc/lib/flat-compat.js create mode 100644 node_modules/@eslint/eslintrc/lib/index-universal.js create mode 100644 node_modules/@eslint/eslintrc/lib/index.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/ajv.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/config-ops.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/config-validator.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/naming.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js create mode 100644 node_modules/@eslint/eslintrc/lib/shared/types.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/LICENSE create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/README.md create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/package.json create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/src/browser.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/src/common.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/src/index.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/debug/src/node.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/ms/index.js create mode 100644 node_modules/@eslint/eslintrc/node_modules/ms/license.md create mode 100644 node_modules/@eslint/eslintrc/node_modules/ms/package.json create mode 100644 node_modules/@eslint/eslintrc/node_modules/ms/readme.md create mode 100644 node_modules/@eslint/eslintrc/package.json create mode 100644 node_modules/@eslint/eslintrc/universal.js create mode 100644 node_modules/@humanwhocodes/config-array/CHANGELOG.md create mode 100644 node_modules/@humanwhocodes/config-array/LICENSE create mode 100644 node_modules/@humanwhocodes/config-array/README.md create mode 100644 node_modules/@humanwhocodes/config-array/api.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/LICENSE create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/README.md create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/package.json create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/src/browser.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/src/common.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/src/index.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/debug/src/node.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/ms/index.js create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/ms/license.md create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/ms/package.json create mode 100644 node_modules/@humanwhocodes/config-array/node_modules/ms/readme.md create mode 100644 node_modules/@humanwhocodes/config-array/package.json create mode 100644 node_modules/@humanwhocodes/object-schema/.eslintrc.js create mode 100644 node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml create mode 100644 node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml create mode 100644 node_modules/@humanwhocodes/object-schema/CHANGELOG.md create mode 100644 node_modules/@humanwhocodes/object-schema/LICENSE create mode 100644 node_modules/@humanwhocodes/object-schema/README.md create mode 100644 node_modules/@humanwhocodes/object-schema/package.json create mode 100644 node_modules/@humanwhocodes/object-schema/src/index.js create mode 100644 node_modules/@humanwhocodes/object-schema/src/merge-strategy.js create mode 100644 node_modules/@humanwhocodes/object-schema/src/object-schema.js create mode 100644 node_modules/@humanwhocodes/object-schema/src/validation-strategy.js create mode 100644 node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js create mode 100644 node_modules/@humanwhocodes/object-schema/tests/object-schema.js create mode 100644 node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js create mode 100644 node_modules/@types/json5/README.md create mode 100644 node_modules/@types/json5/index.d.ts create mode 100644 node_modules/@types/json5/package.json create mode 100644 node_modules/@types/json5/types-metadata.json create mode 100644 node_modules/acorn-jsx/LICENSE create mode 100644 node_modules/acorn-jsx/README.md create mode 100644 node_modules/acorn-jsx/index.d.ts create mode 100644 node_modules/acorn-jsx/index.js create mode 100644 node_modules/acorn-jsx/package.json create mode 100644 node_modules/acorn-jsx/xhtml.js create mode 100644 node_modules/acorn/CHANGELOG.md create mode 100644 node_modules/acorn/LICENSE create mode 100644 node_modules/acorn/README.md create mode 100755 node_modules/acorn/bin/acorn create mode 100644 node_modules/acorn/dist/acorn.d.ts create mode 100644 node_modules/acorn/dist/acorn.js create mode 100644 node_modules/acorn/dist/acorn.mjs create mode 100644 node_modules/acorn/dist/acorn.mjs.d.ts create mode 100644 node_modules/acorn/dist/bin.js create mode 100644 node_modules/acorn/package.json create mode 100644 node_modules/ajv/.tonic_example.js create mode 100644 node_modules/ajv/LICENSE create mode 100644 node_modules/ajv/README.md create mode 100644 node_modules/ajv/dist/ajv.bundle.js create mode 100644 node_modules/ajv/dist/ajv.min.js create mode 100644 node_modules/ajv/dist/ajv.min.js.map create mode 100644 node_modules/ajv/lib/ajv.d.ts create mode 100644 node_modules/ajv/lib/ajv.js create mode 100644 node_modules/ajv/lib/cache.js create mode 100644 node_modules/ajv/lib/compile/async.js create mode 100644 node_modules/ajv/lib/compile/equal.js create mode 100644 node_modules/ajv/lib/compile/error_classes.js create mode 100644 node_modules/ajv/lib/compile/formats.js create mode 100644 node_modules/ajv/lib/compile/index.js create mode 100644 node_modules/ajv/lib/compile/resolve.js create mode 100644 node_modules/ajv/lib/compile/rules.js create mode 100644 node_modules/ajv/lib/compile/schema_obj.js create mode 100644 node_modules/ajv/lib/compile/ucs2length.js create mode 100644 node_modules/ajv/lib/compile/util.js create mode 100644 node_modules/ajv/lib/data.js create mode 100644 node_modules/ajv/lib/definition_schema.js create mode 100644 node_modules/ajv/lib/dot/_limit.jst create mode 100644 node_modules/ajv/lib/dot/_limitItems.jst create mode 100644 node_modules/ajv/lib/dot/_limitLength.jst create mode 100644 node_modules/ajv/lib/dot/_limitProperties.jst create mode 100644 node_modules/ajv/lib/dot/allOf.jst create mode 100644 node_modules/ajv/lib/dot/anyOf.jst create mode 100644 node_modules/ajv/lib/dot/coerce.def create mode 100644 node_modules/ajv/lib/dot/comment.jst create mode 100644 node_modules/ajv/lib/dot/const.jst create mode 100644 node_modules/ajv/lib/dot/contains.jst create mode 100644 node_modules/ajv/lib/dot/custom.jst create mode 100644 node_modules/ajv/lib/dot/defaults.def create mode 100644 node_modules/ajv/lib/dot/definitions.def create mode 100644 node_modules/ajv/lib/dot/dependencies.jst create mode 100644 node_modules/ajv/lib/dot/enum.jst create mode 100644 node_modules/ajv/lib/dot/errors.def create mode 100644 node_modules/ajv/lib/dot/format.jst create mode 100644 node_modules/ajv/lib/dot/if.jst create mode 100644 node_modules/ajv/lib/dot/items.jst create mode 100644 node_modules/ajv/lib/dot/missing.def create mode 100644 node_modules/ajv/lib/dot/multipleOf.jst create mode 100644 node_modules/ajv/lib/dot/not.jst create mode 100644 node_modules/ajv/lib/dot/oneOf.jst create mode 100644 node_modules/ajv/lib/dot/pattern.jst create mode 100644 node_modules/ajv/lib/dot/properties.jst create mode 100644 node_modules/ajv/lib/dot/propertyNames.jst create mode 100644 node_modules/ajv/lib/dot/ref.jst create mode 100644 node_modules/ajv/lib/dot/required.jst create mode 100644 node_modules/ajv/lib/dot/uniqueItems.jst create mode 100644 node_modules/ajv/lib/dot/validate.jst create mode 100644 node_modules/ajv/lib/dotjs/README.md create mode 100644 node_modules/ajv/lib/dotjs/_limit.js create mode 100644 node_modules/ajv/lib/dotjs/_limitItems.js create mode 100644 node_modules/ajv/lib/dotjs/_limitLength.js create mode 100644 node_modules/ajv/lib/dotjs/_limitProperties.js create mode 100644 node_modules/ajv/lib/dotjs/allOf.js create mode 100644 node_modules/ajv/lib/dotjs/anyOf.js create mode 100644 node_modules/ajv/lib/dotjs/comment.js create mode 100644 node_modules/ajv/lib/dotjs/const.js create mode 100644 node_modules/ajv/lib/dotjs/contains.js create mode 100644 node_modules/ajv/lib/dotjs/custom.js create mode 100644 node_modules/ajv/lib/dotjs/dependencies.js create mode 100644 node_modules/ajv/lib/dotjs/enum.js create mode 100644 node_modules/ajv/lib/dotjs/format.js create mode 100644 node_modules/ajv/lib/dotjs/if.js create mode 100644 node_modules/ajv/lib/dotjs/index.js create mode 100644 node_modules/ajv/lib/dotjs/items.js create mode 100644 node_modules/ajv/lib/dotjs/multipleOf.js create mode 100644 node_modules/ajv/lib/dotjs/not.js create mode 100644 node_modules/ajv/lib/dotjs/oneOf.js create mode 100644 node_modules/ajv/lib/dotjs/pattern.js create mode 100644 node_modules/ajv/lib/dotjs/properties.js create mode 100644 node_modules/ajv/lib/dotjs/propertyNames.js create mode 100644 node_modules/ajv/lib/dotjs/ref.js create mode 100644 node_modules/ajv/lib/dotjs/required.js create mode 100644 node_modules/ajv/lib/dotjs/uniqueItems.js create mode 100644 node_modules/ajv/lib/dotjs/validate.js create mode 100644 node_modules/ajv/lib/keyword.js create mode 100644 node_modules/ajv/lib/refs/data.json create mode 100644 node_modules/ajv/lib/refs/json-schema-draft-04.json create mode 100644 node_modules/ajv/lib/refs/json-schema-draft-06.json create mode 100644 node_modules/ajv/lib/refs/json-schema-draft-07.json create mode 100644 node_modules/ajv/lib/refs/json-schema-secure.json create mode 100644 node_modules/ajv/package.json create mode 100644 node_modules/ajv/scripts/.eslintrc.yml create mode 100644 node_modules/ajv/scripts/bundle.js create mode 100644 node_modules/ajv/scripts/compile-dots.js create mode 100644 node_modules/ajv/scripts/info create mode 100644 node_modules/ajv/scripts/prepare-tests create mode 100644 node_modules/ajv/scripts/publish-built-version create mode 100644 node_modules/ajv/scripts/travis-gh-pages create mode 100644 node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/ansi-regex/index.js create mode 100644 node_modules/ansi-regex/license create mode 100644 node_modules/ansi-regex/package.json create mode 100644 node_modules/ansi-regex/readme.md create mode 100644 node_modules/argparse/CHANGELOG.md create mode 100644 node_modules/argparse/LICENSE create mode 100644 node_modules/argparse/README.md create mode 100644 node_modules/argparse/argparse.js create mode 100644 node_modules/argparse/lib/sub.js create mode 100644 node_modules/argparse/lib/textwrap.js create mode 100644 node_modules/argparse/package.json create mode 100644 node_modules/array-includes/.editorconfig create mode 100644 node_modules/array-includes/.eslintrc create mode 100644 node_modules/array-includes/.github/FUNDING.yml create mode 100644 node_modules/array-includes/.nycrc create mode 100644 node_modules/array-includes/CHANGELOG.md create mode 100644 node_modules/array-includes/LICENSE create mode 100644 node_modules/array-includes/README.md create mode 100644 node_modules/array-includes/auto.js create mode 100644 node_modules/array-includes/implementation.js create mode 100644 node_modules/array-includes/index.js create mode 100644 node_modules/array-includes/package.json create mode 100644 node_modules/array-includes/polyfill.js create mode 100644 node_modules/array-includes/shim.js create mode 100644 node_modules/array-includes/test/implementation.js create mode 100644 node_modules/array-includes/test/index.js create mode 100644 node_modules/array-includes/test/shimmed.js create mode 100644 node_modules/array-includes/test/tests.js create mode 100644 node_modules/array.prototype.flat/.editorconfig create mode 100644 node_modules/array.prototype.flat/.eslintrc create mode 100644 node_modules/array.prototype.flat/.github/FUNDING.yml create mode 100644 node_modules/array.prototype.flat/.nycrc create mode 100644 node_modules/array.prototype.flat/CHANGELOG.md create mode 100644 node_modules/array.prototype.flat/LICENSE create mode 100644 node_modules/array.prototype.flat/README.md create mode 100644 node_modules/array.prototype.flat/auto.js create mode 100644 node_modules/array.prototype.flat/implementation.js create mode 100644 node_modules/array.prototype.flat/index.js create mode 100644 node_modules/array.prototype.flat/package.json create mode 100644 node_modules/array.prototype.flat/polyfill.js create mode 100644 node_modules/array.prototype.flat/shim.js create mode 100644 node_modules/array.prototype.flat/test/implementation.js create mode 100644 node_modules/array.prototype.flat/test/index.js create mode 100644 node_modules/array.prototype.flat/test/shimmed.js create mode 100644 node_modules/array.prototype.flat/test/tests.js create mode 100644 node_modules/builtins/License create mode 100644 node_modules/builtins/Readme.md create mode 100644 node_modules/builtins/index.js create mode 100644 node_modules/builtins/package.json create mode 100644 node_modules/callsites/index.d.ts create mode 100644 node_modules/callsites/index.js create mode 100644 node_modules/callsites/license create mode 100644 node_modules/callsites/package.json create mode 100644 node_modules/callsites/readme.md create mode 100644 node_modules/cross-spawn/CHANGELOG.md create mode 100644 node_modules/cross-spawn/LICENSE create mode 100644 node_modules/cross-spawn/README.md create mode 100644 node_modules/cross-spawn/index.js create mode 100644 node_modules/cross-spawn/lib/enoent.js create mode 100644 node_modules/cross-spawn/lib/parse.js create mode 100644 node_modules/cross-spawn/lib/util/escape.js create mode 100644 node_modules/cross-spawn/lib/util/readShebang.js create mode 100644 node_modules/cross-spawn/lib/util/resolveCommand.js create mode 100644 node_modules/cross-spawn/package.json create mode 100644 node_modules/deep-is/.travis.yml create mode 100644 node_modules/deep-is/LICENSE create mode 100644 node_modules/deep-is/README.markdown create mode 100644 node_modules/deep-is/example/cmp.js create mode 100644 node_modules/deep-is/index.js create mode 100644 node_modules/deep-is/package.json create mode 100644 node_modules/deep-is/test/NaN.js create mode 100644 node_modules/deep-is/test/cmp.js create mode 100644 node_modules/deep-is/test/neg-vs-pos-0.js create mode 100644 node_modules/define-properties/.editorconfig create mode 100644 node_modules/define-properties/.eslintrc create mode 100644 node_modules/define-properties/.github/FUNDING.yml create mode 100644 node_modules/define-properties/.nycrc create mode 100644 node_modules/define-properties/CHANGELOG.md create mode 100644 node_modules/define-properties/LICENSE create mode 100644 node_modules/define-properties/README.md create mode 100644 node_modules/define-properties/index.js create mode 100644 node_modules/define-properties/package.json create mode 100644 node_modules/doctrine/CHANGELOG.md create mode 100644 node_modules/doctrine/LICENSE create mode 100644 node_modules/doctrine/LICENSE.closure-compiler create mode 100644 node_modules/doctrine/LICENSE.esprima create mode 100644 node_modules/doctrine/README.md create mode 100644 node_modules/doctrine/lib/doctrine.js create mode 100644 node_modules/doctrine/lib/typed.js create mode 100644 node_modules/doctrine/lib/utility.js create mode 100644 node_modules/doctrine/package.json create mode 100644 node_modules/es-abstract/.editorconfig create mode 100644 node_modules/es-abstract/.eslintrc create mode 100644 node_modules/es-abstract/.nycrc create mode 100644 node_modules/es-abstract/2015/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2015/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2015/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2015/ArrayCreate.js create mode 100644 node_modules/es-abstract/2015/ArraySetLength.js create mode 100644 node_modules/es-abstract/2015/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2015/Call.js create mode 100644 node_modules/es-abstract/2015/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2015/CharacterRange.js create mode 100644 node_modules/es-abstract/2015/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2015/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2015/CreateHTML.js create mode 100644 node_modules/es-abstract/2015/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2015/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2015/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2015/DateFromTime.js create mode 100644 node_modules/es-abstract/2015/Day.js create mode 100644 node_modules/es-abstract/2015/DayFromYear.js create mode 100644 node_modules/es-abstract/2015/DayWithinYear.js create mode 100644 node_modules/es-abstract/2015/DaysInYear.js create mode 100644 node_modules/es-abstract/2015/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2015/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2015/EnumerableOwnNames.js create mode 100644 node_modules/es-abstract/2015/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/Get.js create mode 100644 node_modules/es-abstract/2015/GetIterator.js create mode 100644 node_modules/es-abstract/2015/GetMethod.js create mode 100644 node_modules/es-abstract/2015/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2015/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2015/GetSubstitution.js create mode 100644 node_modules/es-abstract/2015/GetV.js create mode 100644 node_modules/es-abstract/2015/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2015/HasProperty.js create mode 100644 node_modules/es-abstract/2015/HourFromTime.js create mode 100644 node_modules/es-abstract/2015/InLeapYear.js create mode 100644 node_modules/es-abstract/2015/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2015/Invoke.js create mode 100644 node_modules/es-abstract/2015/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2015/IsArray.js create mode 100644 node_modules/es-abstract/2015/IsCallable.js create mode 100644 node_modules/es-abstract/2015/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2015/IsConstructor.js create mode 100644 node_modules/es-abstract/2015/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2015/IsExtensible.js create mode 100644 node_modules/es-abstract/2015/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2015/IsInteger.js create mode 100644 node_modules/es-abstract/2015/IsPromise.js create mode 100644 node_modules/es-abstract/2015/IsPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2015/IsRegExp.js create mode 100644 node_modules/es-abstract/2015/IteratorClose.js create mode 100644 node_modules/es-abstract/2015/IteratorComplete.js create mode 100644 node_modules/es-abstract/2015/IteratorNext.js create mode 100644 node_modules/es-abstract/2015/IteratorStep.js create mode 100644 node_modules/es-abstract/2015/IteratorValue.js create mode 100644 node_modules/es-abstract/2015/MakeDate.js create mode 100644 node_modules/es-abstract/2015/MakeDay.js create mode 100644 node_modules/es-abstract/2015/MakeTime.js create mode 100644 node_modules/es-abstract/2015/MinFromTime.js create mode 100644 node_modules/es-abstract/2015/MonthFromTime.js create mode 100644 node_modules/es-abstract/2015/ObjectCreate.js create mode 100644 node_modules/es-abstract/2015/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2015/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2015/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2015/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2015/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2015/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2015/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2015/RegExpCreate.js create mode 100644 node_modules/es-abstract/2015/RegExpExec.js create mode 100644 node_modules/es-abstract/2015/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2015/SameValue.js create mode 100644 node_modules/es-abstract/2015/SameValueZero.js create mode 100644 node_modules/es-abstract/2015/SecFromTime.js create mode 100644 node_modules/es-abstract/2015/Set.js create mode 100644 node_modules/es-abstract/2015/SetFunctionName.js create mode 100644 node_modules/es-abstract/2015/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2015/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2015/SplitMatch.js create mode 100644 node_modules/es-abstract/2015/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2015/StringCreate.js create mode 100644 node_modules/es-abstract/2015/StringGetIndexProperty.js create mode 100644 node_modules/es-abstract/2015/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2015/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2015/TimeClip.js create mode 100644 node_modules/es-abstract/2015/TimeFromYear.js create mode 100644 node_modules/es-abstract/2015/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2015/ToBoolean.js create mode 100644 node_modules/es-abstract/2015/ToDateString.js create mode 100644 node_modules/es-abstract/2015/ToInt16.js create mode 100644 node_modules/es-abstract/2015/ToInt32.js create mode 100644 node_modules/es-abstract/2015/ToInt8.js create mode 100644 node_modules/es-abstract/2015/ToInteger.js create mode 100644 node_modules/es-abstract/2015/ToLength.js create mode 100644 node_modules/es-abstract/2015/ToNumber.js create mode 100644 node_modules/es-abstract/2015/ToObject.js create mode 100644 node_modules/es-abstract/2015/ToPrimitive.js create mode 100644 node_modules/es-abstract/2015/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2015/ToString.js create mode 100644 node_modules/es-abstract/2015/ToUint16.js create mode 100644 node_modules/es-abstract/2015/ToUint32.js create mode 100644 node_modules/es-abstract/2015/ToUint8.js create mode 100644 node_modules/es-abstract/2015/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2015/Type.js create mode 100644 node_modules/es-abstract/2015/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2015/WeekDay.js create mode 100644 node_modules/es-abstract/2015/YearFromTime.js create mode 100644 node_modules/es-abstract/2015/abs.js create mode 100644 node_modules/es-abstract/2015/floor.js create mode 100644 node_modules/es-abstract/2015/modulo.js create mode 100644 node_modules/es-abstract/2015/msFromTime.js create mode 100644 node_modules/es-abstract/2015/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2015/thisNumberValue.js create mode 100644 node_modules/es-abstract/2015/thisStringValue.js create mode 100644 node_modules/es-abstract/2015/thisTimeValue.js create mode 100644 node_modules/es-abstract/2016/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2016/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2016/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2016/ArrayCreate.js create mode 100644 node_modules/es-abstract/2016/ArraySetLength.js create mode 100644 node_modules/es-abstract/2016/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2016/Call.js create mode 100644 node_modules/es-abstract/2016/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2016/CharacterRange.js create mode 100644 node_modules/es-abstract/2016/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2016/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2016/CreateHTML.js create mode 100644 node_modules/es-abstract/2016/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2016/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2016/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2016/DateFromTime.js create mode 100644 node_modules/es-abstract/2016/Day.js create mode 100644 node_modules/es-abstract/2016/DayFromYear.js create mode 100644 node_modules/es-abstract/2016/DayWithinYear.js create mode 100644 node_modules/es-abstract/2016/DaysInYear.js create mode 100644 node_modules/es-abstract/2016/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2016/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2016/EnumerableOwnNames.js create mode 100644 node_modules/es-abstract/2016/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/Get.js create mode 100644 node_modules/es-abstract/2016/GetIterator.js create mode 100644 node_modules/es-abstract/2016/GetMethod.js create mode 100644 node_modules/es-abstract/2016/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2016/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2016/GetSubstitution.js create mode 100644 node_modules/es-abstract/2016/GetV.js create mode 100644 node_modules/es-abstract/2016/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2016/HasProperty.js create mode 100644 node_modules/es-abstract/2016/HourFromTime.js create mode 100644 node_modules/es-abstract/2016/InLeapYear.js create mode 100644 node_modules/es-abstract/2016/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2016/Invoke.js create mode 100644 node_modules/es-abstract/2016/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2016/IsArray.js create mode 100644 node_modules/es-abstract/2016/IsCallable.js create mode 100644 node_modules/es-abstract/2016/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2016/IsConstructor.js create mode 100644 node_modules/es-abstract/2016/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2016/IsExtensible.js create mode 100644 node_modules/es-abstract/2016/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2016/IsInteger.js create mode 100644 node_modules/es-abstract/2016/IsPromise.js create mode 100644 node_modules/es-abstract/2016/IsPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2016/IsRegExp.js create mode 100644 node_modules/es-abstract/2016/IterableToArrayLike.js create mode 100644 node_modules/es-abstract/2016/IteratorClose.js create mode 100644 node_modules/es-abstract/2016/IteratorComplete.js create mode 100644 node_modules/es-abstract/2016/IteratorNext.js create mode 100644 node_modules/es-abstract/2016/IteratorStep.js create mode 100644 node_modules/es-abstract/2016/IteratorValue.js create mode 100644 node_modules/es-abstract/2016/MakeDate.js create mode 100644 node_modules/es-abstract/2016/MakeDay.js create mode 100644 node_modules/es-abstract/2016/MakeTime.js create mode 100644 node_modules/es-abstract/2016/MinFromTime.js create mode 100644 node_modules/es-abstract/2016/MonthFromTime.js create mode 100644 node_modules/es-abstract/2016/ObjectCreate.js create mode 100644 node_modules/es-abstract/2016/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2016/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2016/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2016/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2016/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2016/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2016/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2016/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2016/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2016/RegExpCreate.js create mode 100644 node_modules/es-abstract/2016/RegExpExec.js create mode 100644 node_modules/es-abstract/2016/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2016/SameValue.js create mode 100644 node_modules/es-abstract/2016/SameValueNonNumber.js create mode 100644 node_modules/es-abstract/2016/SameValueZero.js create mode 100644 node_modules/es-abstract/2016/SecFromTime.js create mode 100644 node_modules/es-abstract/2016/Set.js create mode 100644 node_modules/es-abstract/2016/SetFunctionName.js create mode 100644 node_modules/es-abstract/2016/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2016/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2016/SplitMatch.js create mode 100644 node_modules/es-abstract/2016/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2016/StringCreate.js create mode 100644 node_modules/es-abstract/2016/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2016/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2016/TimeClip.js create mode 100644 node_modules/es-abstract/2016/TimeFromYear.js create mode 100644 node_modules/es-abstract/2016/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2016/ToBoolean.js create mode 100644 node_modules/es-abstract/2016/ToDateString.js create mode 100644 node_modules/es-abstract/2016/ToInt16.js create mode 100644 node_modules/es-abstract/2016/ToInt32.js create mode 100644 node_modules/es-abstract/2016/ToInt8.js create mode 100644 node_modules/es-abstract/2016/ToInteger.js create mode 100644 node_modules/es-abstract/2016/ToLength.js create mode 100644 node_modules/es-abstract/2016/ToNumber.js create mode 100644 node_modules/es-abstract/2016/ToObject.js create mode 100644 node_modules/es-abstract/2016/ToPrimitive.js create mode 100644 node_modules/es-abstract/2016/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2016/ToString.js create mode 100644 node_modules/es-abstract/2016/ToUint16.js create mode 100644 node_modules/es-abstract/2016/ToUint32.js create mode 100644 node_modules/es-abstract/2016/ToUint8.js create mode 100644 node_modules/es-abstract/2016/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2016/Type.js create mode 100644 node_modules/es-abstract/2016/UTF16Decode.js create mode 100644 node_modules/es-abstract/2016/UTF16Encoding.js create mode 100644 node_modules/es-abstract/2016/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2016/WeekDay.js create mode 100644 node_modules/es-abstract/2016/YearFromTime.js create mode 100644 node_modules/es-abstract/2016/abs.js create mode 100644 node_modules/es-abstract/2016/floor.js create mode 100644 node_modules/es-abstract/2016/modulo.js create mode 100644 node_modules/es-abstract/2016/msFromTime.js create mode 100644 node_modules/es-abstract/2016/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2016/thisNumberValue.js create mode 100644 node_modules/es-abstract/2016/thisStringValue.js create mode 100644 node_modules/es-abstract/2016/thisTimeValue.js create mode 100644 node_modules/es-abstract/2017/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2017/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2017/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2017/ArrayCreate.js create mode 100644 node_modules/es-abstract/2017/ArraySetLength.js create mode 100644 node_modules/es-abstract/2017/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2017/Call.js create mode 100644 node_modules/es-abstract/2017/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2017/CharacterRange.js create mode 100644 node_modules/es-abstract/2017/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2017/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2017/CreateHTML.js create mode 100644 node_modules/es-abstract/2017/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2017/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2017/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2017/DateFromTime.js create mode 100644 node_modules/es-abstract/2017/Day.js create mode 100644 node_modules/es-abstract/2017/DayFromYear.js create mode 100644 node_modules/es-abstract/2017/DayWithinYear.js create mode 100644 node_modules/es-abstract/2017/DaysInYear.js create mode 100644 node_modules/es-abstract/2017/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2017/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2017/EnumerableOwnProperties.js create mode 100644 node_modules/es-abstract/2017/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/Get.js create mode 100644 node_modules/es-abstract/2017/GetIterator.js create mode 100644 node_modules/es-abstract/2017/GetMethod.js create mode 100644 node_modules/es-abstract/2017/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2017/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2017/GetSubstitution.js create mode 100644 node_modules/es-abstract/2017/GetV.js create mode 100644 node_modules/es-abstract/2017/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2017/HasProperty.js create mode 100644 node_modules/es-abstract/2017/HourFromTime.js create mode 100644 node_modules/es-abstract/2017/InLeapYear.js create mode 100644 node_modules/es-abstract/2017/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2017/Invoke.js create mode 100644 node_modules/es-abstract/2017/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2017/IsArray.js create mode 100644 node_modules/es-abstract/2017/IsCallable.js create mode 100644 node_modules/es-abstract/2017/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2017/IsConstructor.js create mode 100644 node_modules/es-abstract/2017/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2017/IsExtensible.js create mode 100644 node_modules/es-abstract/2017/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2017/IsInteger.js create mode 100644 node_modules/es-abstract/2017/IsPromise.js create mode 100644 node_modules/es-abstract/2017/IsPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2017/IsRegExp.js create mode 100644 node_modules/es-abstract/2017/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2017/IterableToList.js create mode 100644 node_modules/es-abstract/2017/IteratorClose.js create mode 100644 node_modules/es-abstract/2017/IteratorComplete.js create mode 100644 node_modules/es-abstract/2017/IteratorNext.js create mode 100644 node_modules/es-abstract/2017/IteratorStep.js create mode 100644 node_modules/es-abstract/2017/IteratorValue.js create mode 100644 node_modules/es-abstract/2017/MakeDate.js create mode 100644 node_modules/es-abstract/2017/MakeDay.js create mode 100644 node_modules/es-abstract/2017/MakeTime.js create mode 100644 node_modules/es-abstract/2017/MinFromTime.js create mode 100644 node_modules/es-abstract/2017/MonthFromTime.js create mode 100644 node_modules/es-abstract/2017/ObjectCreate.js create mode 100644 node_modules/es-abstract/2017/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2017/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2017/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2017/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2017/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2017/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2017/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2017/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2017/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2017/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2017/RegExpCreate.js create mode 100644 node_modules/es-abstract/2017/RegExpExec.js create mode 100644 node_modules/es-abstract/2017/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2017/SameValue.js create mode 100644 node_modules/es-abstract/2017/SameValueNonNumber.js create mode 100644 node_modules/es-abstract/2017/SameValueZero.js create mode 100644 node_modules/es-abstract/2017/SecFromTime.js create mode 100644 node_modules/es-abstract/2017/Set.js create mode 100644 node_modules/es-abstract/2017/SetFunctionName.js create mode 100644 node_modules/es-abstract/2017/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2017/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2017/SplitMatch.js create mode 100644 node_modules/es-abstract/2017/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2017/StringCreate.js create mode 100644 node_modules/es-abstract/2017/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2017/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2017/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2017/TimeClip.js create mode 100644 node_modules/es-abstract/2017/TimeFromYear.js create mode 100644 node_modules/es-abstract/2017/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2017/ToBoolean.js create mode 100644 node_modules/es-abstract/2017/ToDateString.js create mode 100644 node_modules/es-abstract/2017/ToIndex.js create mode 100644 node_modules/es-abstract/2017/ToInt16.js create mode 100644 node_modules/es-abstract/2017/ToInt32.js create mode 100644 node_modules/es-abstract/2017/ToInt8.js create mode 100644 node_modules/es-abstract/2017/ToInteger.js create mode 100644 node_modules/es-abstract/2017/ToLength.js create mode 100644 node_modules/es-abstract/2017/ToNumber.js create mode 100644 node_modules/es-abstract/2017/ToObject.js create mode 100644 node_modules/es-abstract/2017/ToPrimitive.js create mode 100644 node_modules/es-abstract/2017/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2017/ToString.js create mode 100644 node_modules/es-abstract/2017/ToUint16.js create mode 100644 node_modules/es-abstract/2017/ToUint32.js create mode 100644 node_modules/es-abstract/2017/ToUint8.js create mode 100644 node_modules/es-abstract/2017/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2017/Type.js create mode 100644 node_modules/es-abstract/2017/UTF16Decode.js create mode 100644 node_modules/es-abstract/2017/UTF16Encoding.js create mode 100644 node_modules/es-abstract/2017/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2017/WeekDay.js create mode 100644 node_modules/es-abstract/2017/YearFromTime.js create mode 100644 node_modules/es-abstract/2017/abs.js create mode 100644 node_modules/es-abstract/2017/floor.js create mode 100644 node_modules/es-abstract/2017/modulo.js create mode 100644 node_modules/es-abstract/2017/msFromTime.js create mode 100644 node_modules/es-abstract/2017/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2017/thisNumberValue.js create mode 100644 node_modules/es-abstract/2017/thisStringValue.js create mode 100644 node_modules/es-abstract/2017/thisTimeValue.js create mode 100644 node_modules/es-abstract/2018/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2018/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2018/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2018/ArrayCreate.js create mode 100644 node_modules/es-abstract/2018/ArraySetLength.js create mode 100644 node_modules/es-abstract/2018/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2018/Call.js create mode 100644 node_modules/es-abstract/2018/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2018/CharacterRange.js create mode 100644 node_modules/es-abstract/2018/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2018/CopyDataProperties.js create mode 100644 node_modules/es-abstract/2018/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2018/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2018/CreateHTML.js create mode 100644 node_modules/es-abstract/2018/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2018/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2018/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2018/DateFromTime.js create mode 100644 node_modules/es-abstract/2018/DateString.js create mode 100644 node_modules/es-abstract/2018/Day.js create mode 100644 node_modules/es-abstract/2018/DayFromYear.js create mode 100644 node_modules/es-abstract/2018/DayWithinYear.js create mode 100644 node_modules/es-abstract/2018/DaysInYear.js create mode 100644 node_modules/es-abstract/2018/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2018/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2018/EnumerableOwnPropertyNames.js create mode 100644 node_modules/es-abstract/2018/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2018/Get.js create mode 100644 node_modules/es-abstract/2018/GetIterator.js create mode 100644 node_modules/es-abstract/2018/GetMethod.js create mode 100644 node_modules/es-abstract/2018/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2018/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2018/GetSubstitution.js create mode 100644 node_modules/es-abstract/2018/GetV.js create mode 100644 node_modules/es-abstract/2018/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2018/HasProperty.js create mode 100644 node_modules/es-abstract/2018/HourFromTime.js create mode 100644 node_modules/es-abstract/2018/InLeapYear.js create mode 100644 node_modules/es-abstract/2018/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2018/Invoke.js create mode 100644 node_modules/es-abstract/2018/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2018/IsArray.js create mode 100644 node_modules/es-abstract/2018/IsCallable.js create mode 100644 node_modules/es-abstract/2018/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2018/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2018/IsConstructor.js create mode 100644 node_modules/es-abstract/2018/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2018/IsExtensible.js create mode 100644 node_modules/es-abstract/2018/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2018/IsInteger.js create mode 100644 node_modules/es-abstract/2018/IsPromise.js create mode 100644 node_modules/es-abstract/2018/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2018/IsRegExp.js create mode 100644 node_modules/es-abstract/2018/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2018/IsStringPrefix.js create mode 100644 node_modules/es-abstract/2018/IterableToList.js create mode 100644 node_modules/es-abstract/2018/IteratorClose.js create mode 100644 node_modules/es-abstract/2018/IteratorComplete.js create mode 100644 node_modules/es-abstract/2018/IteratorNext.js create mode 100644 node_modules/es-abstract/2018/IteratorStep.js create mode 100644 node_modules/es-abstract/2018/IteratorValue.js create mode 100644 node_modules/es-abstract/2018/MakeDate.js create mode 100644 node_modules/es-abstract/2018/MakeDay.js create mode 100644 node_modules/es-abstract/2018/MakeTime.js create mode 100644 node_modules/es-abstract/2018/MinFromTime.js create mode 100644 node_modules/es-abstract/2018/MonthFromTime.js create mode 100644 node_modules/es-abstract/2018/NumberToString.js create mode 100644 node_modules/es-abstract/2018/ObjectCreate.js create mode 100644 node_modules/es-abstract/2018/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2018/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2018/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2018/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2018/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2018/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2018/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2018/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2018/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2018/PromiseResolve.js create mode 100644 node_modules/es-abstract/2018/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2018/RegExpCreate.js create mode 100644 node_modules/es-abstract/2018/RegExpExec.js create mode 100644 node_modules/es-abstract/2018/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2018/SameValue.js create mode 100644 node_modules/es-abstract/2018/SameValueNonNumber.js create mode 100644 node_modules/es-abstract/2018/SameValueZero.js create mode 100644 node_modules/es-abstract/2018/SecFromTime.js create mode 100644 node_modules/es-abstract/2018/Set.js create mode 100644 node_modules/es-abstract/2018/SetFunctionLength.js create mode 100644 node_modules/es-abstract/2018/SetFunctionName.js create mode 100644 node_modules/es-abstract/2018/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2018/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2018/SplitMatch.js create mode 100644 node_modules/es-abstract/2018/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2018/StringCreate.js create mode 100644 node_modules/es-abstract/2018/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2018/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2018/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2018/TimeClip.js create mode 100644 node_modules/es-abstract/2018/TimeFromYear.js create mode 100644 node_modules/es-abstract/2018/TimeString.js create mode 100644 node_modules/es-abstract/2018/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2018/ToBoolean.js create mode 100644 node_modules/es-abstract/2018/ToDateString.js create mode 100644 node_modules/es-abstract/2018/ToIndex.js create mode 100644 node_modules/es-abstract/2018/ToInt16.js create mode 100644 node_modules/es-abstract/2018/ToInt32.js create mode 100644 node_modules/es-abstract/2018/ToInt8.js create mode 100644 node_modules/es-abstract/2018/ToInteger.js create mode 100644 node_modules/es-abstract/2018/ToLength.js create mode 100644 node_modules/es-abstract/2018/ToNumber.js create mode 100644 node_modules/es-abstract/2018/ToObject.js create mode 100644 node_modules/es-abstract/2018/ToPrimitive.js create mode 100644 node_modules/es-abstract/2018/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2018/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2018/ToString.js create mode 100644 node_modules/es-abstract/2018/ToUint16.js create mode 100644 node_modules/es-abstract/2018/ToUint32.js create mode 100644 node_modules/es-abstract/2018/ToUint8.js create mode 100644 node_modules/es-abstract/2018/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2018/Type.js create mode 100644 node_modules/es-abstract/2018/UTF16Decode.js create mode 100644 node_modules/es-abstract/2018/UTF16Encoding.js create mode 100644 node_modules/es-abstract/2018/UnicodeEscape.js create mode 100644 node_modules/es-abstract/2018/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2018/WeekDay.js create mode 100644 node_modules/es-abstract/2018/YearFromTime.js create mode 100644 node_modules/es-abstract/2018/abs.js create mode 100644 node_modules/es-abstract/2018/floor.js create mode 100644 node_modules/es-abstract/2018/modulo.js create mode 100644 node_modules/es-abstract/2018/msFromTime.js create mode 100644 node_modules/es-abstract/2018/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2018/thisNumberValue.js create mode 100644 node_modules/es-abstract/2018/thisStringValue.js create mode 100644 node_modules/es-abstract/2018/thisSymbolValue.js create mode 100644 node_modules/es-abstract/2018/thisTimeValue.js create mode 100644 node_modules/es-abstract/2019/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2019/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2019/AddEntriesFromIterable.js create mode 100644 node_modules/es-abstract/2019/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2019/ArrayCreate.js create mode 100644 node_modules/es-abstract/2019/ArraySetLength.js create mode 100644 node_modules/es-abstract/2019/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2019/Call.js create mode 100644 node_modules/es-abstract/2019/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2019/CharacterRange.js create mode 100644 node_modules/es-abstract/2019/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2019/CopyDataProperties.js create mode 100644 node_modules/es-abstract/2019/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2019/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2019/CreateHTML.js create mode 100644 node_modules/es-abstract/2019/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2019/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2019/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2019/DateFromTime.js create mode 100644 node_modules/es-abstract/2019/DateString.js create mode 100644 node_modules/es-abstract/2019/Day.js create mode 100644 node_modules/es-abstract/2019/DayFromYear.js create mode 100644 node_modules/es-abstract/2019/DayWithinYear.js create mode 100644 node_modules/es-abstract/2019/DaysInYear.js create mode 100644 node_modules/es-abstract/2019/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2019/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2019/EnumerableOwnPropertyNames.js create mode 100644 node_modules/es-abstract/2019/FlattenIntoArray.js create mode 100644 node_modules/es-abstract/2019/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2019/Get.js create mode 100644 node_modules/es-abstract/2019/GetIterator.js create mode 100644 node_modules/es-abstract/2019/GetMethod.js create mode 100644 node_modules/es-abstract/2019/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2019/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2019/GetSubstitution.js create mode 100644 node_modules/es-abstract/2019/GetV.js create mode 100644 node_modules/es-abstract/2019/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2019/HasProperty.js create mode 100644 node_modules/es-abstract/2019/HourFromTime.js create mode 100644 node_modules/es-abstract/2019/InLeapYear.js create mode 100644 node_modules/es-abstract/2019/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2019/Invoke.js create mode 100644 node_modules/es-abstract/2019/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2019/IsArray.js create mode 100644 node_modules/es-abstract/2019/IsCallable.js create mode 100644 node_modules/es-abstract/2019/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2019/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2019/IsConstructor.js create mode 100644 node_modules/es-abstract/2019/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2019/IsExtensible.js create mode 100644 node_modules/es-abstract/2019/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2019/IsInteger.js create mode 100644 node_modules/es-abstract/2019/IsPromise.js create mode 100644 node_modules/es-abstract/2019/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2019/IsRegExp.js create mode 100644 node_modules/es-abstract/2019/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2019/IsStringPrefix.js create mode 100644 node_modules/es-abstract/2019/IterableToList.js create mode 100644 node_modules/es-abstract/2019/IteratorClose.js create mode 100644 node_modules/es-abstract/2019/IteratorComplete.js create mode 100644 node_modules/es-abstract/2019/IteratorNext.js create mode 100644 node_modules/es-abstract/2019/IteratorStep.js create mode 100644 node_modules/es-abstract/2019/IteratorValue.js create mode 100644 node_modules/es-abstract/2019/MakeDate.js create mode 100644 node_modules/es-abstract/2019/MakeDay.js create mode 100644 node_modules/es-abstract/2019/MakeTime.js create mode 100644 node_modules/es-abstract/2019/MinFromTime.js create mode 100644 node_modules/es-abstract/2019/MonthFromTime.js create mode 100644 node_modules/es-abstract/2019/NumberToString.js create mode 100644 node_modules/es-abstract/2019/ObjectCreate.js create mode 100644 node_modules/es-abstract/2019/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2019/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2019/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2019/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2019/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2019/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2019/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2019/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2019/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2019/PromiseResolve.js create mode 100644 node_modules/es-abstract/2019/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2019/RegExpCreate.js create mode 100644 node_modules/es-abstract/2019/RegExpExec.js create mode 100644 node_modules/es-abstract/2019/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2019/SameValue.js create mode 100644 node_modules/es-abstract/2019/SameValueNonNumber.js create mode 100644 node_modules/es-abstract/2019/SameValueZero.js create mode 100644 node_modules/es-abstract/2019/SecFromTime.js create mode 100644 node_modules/es-abstract/2019/Set.js create mode 100644 node_modules/es-abstract/2019/SetFunctionLength.js create mode 100644 node_modules/es-abstract/2019/SetFunctionName.js create mode 100644 node_modules/es-abstract/2019/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2019/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2019/SplitMatch.js create mode 100644 node_modules/es-abstract/2019/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2019/StringCreate.js create mode 100644 node_modules/es-abstract/2019/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2019/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2019/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2019/TimeClip.js create mode 100644 node_modules/es-abstract/2019/TimeFromYear.js create mode 100644 node_modules/es-abstract/2019/TimeString.js create mode 100644 node_modules/es-abstract/2019/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2019/ToBoolean.js create mode 100644 node_modules/es-abstract/2019/ToDateString.js create mode 100644 node_modules/es-abstract/2019/ToIndex.js create mode 100644 node_modules/es-abstract/2019/ToInt16.js create mode 100644 node_modules/es-abstract/2019/ToInt32.js create mode 100644 node_modules/es-abstract/2019/ToInt8.js create mode 100644 node_modules/es-abstract/2019/ToInteger.js create mode 100644 node_modules/es-abstract/2019/ToLength.js create mode 100644 node_modules/es-abstract/2019/ToNumber.js create mode 100644 node_modules/es-abstract/2019/ToObject.js create mode 100644 node_modules/es-abstract/2019/ToPrimitive.js create mode 100644 node_modules/es-abstract/2019/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2019/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2019/ToString.js create mode 100644 node_modules/es-abstract/2019/ToUint16.js create mode 100644 node_modules/es-abstract/2019/ToUint32.js create mode 100644 node_modules/es-abstract/2019/ToUint8.js create mode 100644 node_modules/es-abstract/2019/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2019/TrimString.js create mode 100644 node_modules/es-abstract/2019/Type.js create mode 100644 node_modules/es-abstract/2019/UTF16Decode.js create mode 100644 node_modules/es-abstract/2019/UTF16Encoding.js create mode 100644 node_modules/es-abstract/2019/UnicodeEscape.js create mode 100644 node_modules/es-abstract/2019/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2019/WeekDay.js create mode 100644 node_modules/es-abstract/2019/YearFromTime.js create mode 100644 node_modules/es-abstract/2019/abs.js create mode 100644 node_modules/es-abstract/2019/floor.js create mode 100644 node_modules/es-abstract/2019/modulo.js create mode 100644 node_modules/es-abstract/2019/msFromTime.js create mode 100644 node_modules/es-abstract/2019/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2019/thisNumberValue.js create mode 100644 node_modules/es-abstract/2019/thisStringValue.js create mode 100644 node_modules/es-abstract/2019/thisSymbolValue.js create mode 100644 node_modules/es-abstract/2019/thisTimeValue.js create mode 100644 node_modules/es-abstract/2020/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2020/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2020/AddEntriesFromIterable.js create mode 100644 node_modules/es-abstract/2020/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2020/ArrayCreate.js create mode 100644 node_modules/es-abstract/2020/ArraySetLength.js create mode 100644 node_modules/es-abstract/2020/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2020/BigInt/add.js create mode 100644 node_modules/es-abstract/2020/BigInt/bitwiseAND.js create mode 100644 node_modules/es-abstract/2020/BigInt/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2020/BigInt/bitwiseOR.js create mode 100644 node_modules/es-abstract/2020/BigInt/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2020/BigInt/divide.js create mode 100644 node_modules/es-abstract/2020/BigInt/equal.js create mode 100644 node_modules/es-abstract/2020/BigInt/exponentiate.js create mode 100644 node_modules/es-abstract/2020/BigInt/index.js create mode 100644 node_modules/es-abstract/2020/BigInt/leftShift.js create mode 100644 node_modules/es-abstract/2020/BigInt/lessThan.js create mode 100644 node_modules/es-abstract/2020/BigInt/multiply.js create mode 100644 node_modules/es-abstract/2020/BigInt/remainder.js create mode 100644 node_modules/es-abstract/2020/BigInt/sameValue.js create mode 100644 node_modules/es-abstract/2020/BigInt/sameValueZero.js create mode 100644 node_modules/es-abstract/2020/BigInt/signedRightShift.js create mode 100644 node_modules/es-abstract/2020/BigInt/subtract.js create mode 100644 node_modules/es-abstract/2020/BigInt/toString.js create mode 100644 node_modules/es-abstract/2020/BigInt/unaryMinus.js create mode 100644 node_modules/es-abstract/2020/BigInt/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2020/BigIntBitwiseOp.js create mode 100644 node_modules/es-abstract/2020/BinaryAnd.js create mode 100644 node_modules/es-abstract/2020/BinaryOr.js create mode 100644 node_modules/es-abstract/2020/BinaryXor.js create mode 100644 node_modules/es-abstract/2020/Call.js create mode 100644 node_modules/es-abstract/2020/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2020/CharacterRange.js create mode 100644 node_modules/es-abstract/2020/CodePointAt.js create mode 100644 node_modules/es-abstract/2020/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2020/CopyDataProperties.js create mode 100644 node_modules/es-abstract/2020/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2020/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2020/CreateHTML.js create mode 100644 node_modules/es-abstract/2020/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2020/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2020/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2020/CreateRegExpStringIterator.js create mode 100644 node_modules/es-abstract/2020/DateFromTime.js create mode 100644 node_modules/es-abstract/2020/DateString.js create mode 100644 node_modules/es-abstract/2020/Day.js create mode 100644 node_modules/es-abstract/2020/DayFromYear.js create mode 100644 node_modules/es-abstract/2020/DayWithinYear.js create mode 100644 node_modules/es-abstract/2020/DaysInYear.js create mode 100644 node_modules/es-abstract/2020/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2020/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2020/EnumerableOwnPropertyNames.js create mode 100644 node_modules/es-abstract/2020/FlattenIntoArray.js create mode 100644 node_modules/es-abstract/2020/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2020/Get.js create mode 100644 node_modules/es-abstract/2020/GetIterator.js create mode 100644 node_modules/es-abstract/2020/GetMethod.js create mode 100644 node_modules/es-abstract/2020/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2020/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2020/GetSubstitution.js create mode 100644 node_modules/es-abstract/2020/GetV.js create mode 100644 node_modules/es-abstract/2020/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2020/HasProperty.js create mode 100644 node_modules/es-abstract/2020/HourFromTime.js create mode 100644 node_modules/es-abstract/2020/InLeapYear.js create mode 100644 node_modules/es-abstract/2020/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2020/Invoke.js create mode 100644 node_modules/es-abstract/2020/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2020/IsArray.js create mode 100644 node_modules/es-abstract/2020/IsBigIntElementType.js create mode 100644 node_modules/es-abstract/2020/IsCallable.js create mode 100644 node_modules/es-abstract/2020/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2020/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2020/IsConstructor.js create mode 100644 node_modules/es-abstract/2020/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2020/IsExtensible.js create mode 100644 node_modules/es-abstract/2020/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2020/IsInteger.js create mode 100644 node_modules/es-abstract/2020/IsNoTearConfiguration.js create mode 100644 node_modules/es-abstract/2020/IsNonNegativeInteger.js create mode 100644 node_modules/es-abstract/2020/IsPromise.js create mode 100644 node_modules/es-abstract/2020/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2020/IsRegExp.js create mode 100644 node_modules/es-abstract/2020/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2020/IsStringPrefix.js create mode 100644 node_modules/es-abstract/2020/IsUnclampedIntegerElementType.js create mode 100644 node_modules/es-abstract/2020/IsUnsignedElementType.js create mode 100644 node_modules/es-abstract/2020/IterableToList.js create mode 100644 node_modules/es-abstract/2020/IteratorClose.js create mode 100644 node_modules/es-abstract/2020/IteratorComplete.js create mode 100644 node_modules/es-abstract/2020/IteratorNext.js create mode 100644 node_modules/es-abstract/2020/IteratorStep.js create mode 100644 node_modules/es-abstract/2020/IteratorValue.js create mode 100644 node_modules/es-abstract/2020/LengthOfArrayLike.js create mode 100644 node_modules/es-abstract/2020/MakeDate.js create mode 100644 node_modules/es-abstract/2020/MakeDay.js create mode 100644 node_modules/es-abstract/2020/MakeTime.js create mode 100644 node_modules/es-abstract/2020/MinFromTime.js create mode 100644 node_modules/es-abstract/2020/MonthFromTime.js create mode 100644 node_modules/es-abstract/2020/Number/add.js create mode 100644 node_modules/es-abstract/2020/Number/bitwiseAND.js create mode 100644 node_modules/es-abstract/2020/Number/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2020/Number/bitwiseOR.js create mode 100644 node_modules/es-abstract/2020/Number/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2020/Number/divide.js create mode 100644 node_modules/es-abstract/2020/Number/equal.js create mode 100644 node_modules/es-abstract/2020/Number/exponentiate.js create mode 100644 node_modules/es-abstract/2020/Number/index.js create mode 100644 node_modules/es-abstract/2020/Number/leftShift.js create mode 100644 node_modules/es-abstract/2020/Number/lessThan.js create mode 100644 node_modules/es-abstract/2020/Number/multiply.js create mode 100644 node_modules/es-abstract/2020/Number/remainder.js create mode 100644 node_modules/es-abstract/2020/Number/sameValue.js create mode 100644 node_modules/es-abstract/2020/Number/sameValueZero.js create mode 100644 node_modules/es-abstract/2020/Number/signedRightShift.js create mode 100644 node_modules/es-abstract/2020/Number/subtract.js create mode 100644 node_modules/es-abstract/2020/Number/toString.js create mode 100644 node_modules/es-abstract/2020/Number/unaryMinus.js create mode 100644 node_modules/es-abstract/2020/Number/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2020/NumberBitwiseOp.js create mode 100644 node_modules/es-abstract/2020/NumberToBigInt.js create mode 100644 node_modules/es-abstract/2020/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2020/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2020/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2020/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2020/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2020/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2020/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2020/OrdinaryObjectCreate.js create mode 100644 node_modules/es-abstract/2020/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2020/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2020/PromiseResolve.js create mode 100644 node_modules/es-abstract/2020/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2020/RegExpCreate.js create mode 100644 node_modules/es-abstract/2020/RegExpExec.js create mode 100644 node_modules/es-abstract/2020/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2020/SameValue.js create mode 100644 node_modules/es-abstract/2020/SameValueNonNumeric.js create mode 100644 node_modules/es-abstract/2020/SameValueZero.js create mode 100644 node_modules/es-abstract/2020/SecFromTime.js create mode 100644 node_modules/es-abstract/2020/Set.js create mode 100644 node_modules/es-abstract/2020/SetFunctionLength.js create mode 100644 node_modules/es-abstract/2020/SetFunctionName.js create mode 100644 node_modules/es-abstract/2020/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2020/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2020/SplitMatch.js create mode 100644 node_modules/es-abstract/2020/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2020/StringCreate.js create mode 100644 node_modules/es-abstract/2020/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2020/StringPad.js create mode 100644 node_modules/es-abstract/2020/StringToBigInt.js create mode 100644 node_modules/es-abstract/2020/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2020/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2020/TimeClip.js create mode 100644 node_modules/es-abstract/2020/TimeFromYear.js create mode 100644 node_modules/es-abstract/2020/TimeString.js create mode 100644 node_modules/es-abstract/2020/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2020/ToBigInt.js create mode 100644 node_modules/es-abstract/2020/ToBigInt64.js create mode 100644 node_modules/es-abstract/2020/ToBigUint64.js create mode 100644 node_modules/es-abstract/2020/ToBoolean.js create mode 100644 node_modules/es-abstract/2020/ToDateString.js create mode 100644 node_modules/es-abstract/2020/ToIndex.js create mode 100644 node_modules/es-abstract/2020/ToInt16.js create mode 100644 node_modules/es-abstract/2020/ToInt32.js create mode 100644 node_modules/es-abstract/2020/ToInt8.js create mode 100644 node_modules/es-abstract/2020/ToInteger.js create mode 100644 node_modules/es-abstract/2020/ToLength.js create mode 100644 node_modules/es-abstract/2020/ToNumber.js create mode 100644 node_modules/es-abstract/2020/ToNumeric.js create mode 100644 node_modules/es-abstract/2020/ToObject.js create mode 100644 node_modules/es-abstract/2020/ToPrimitive.js create mode 100644 node_modules/es-abstract/2020/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2020/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2020/ToString.js create mode 100644 node_modules/es-abstract/2020/ToUint16.js create mode 100644 node_modules/es-abstract/2020/ToUint32.js create mode 100644 node_modules/es-abstract/2020/ToUint8.js create mode 100644 node_modules/es-abstract/2020/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2020/TrimString.js create mode 100644 node_modules/es-abstract/2020/Type.js create mode 100644 node_modules/es-abstract/2020/UTF16DecodeString.js create mode 100644 node_modules/es-abstract/2020/UTF16DecodeSurrogatePair.js create mode 100644 node_modules/es-abstract/2020/UTF16Encoding.js create mode 100644 node_modules/es-abstract/2020/UnicodeEscape.js create mode 100644 node_modules/es-abstract/2020/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2020/WeekDay.js create mode 100644 node_modules/es-abstract/2020/YearFromTime.js create mode 100644 node_modules/es-abstract/2020/abs.js create mode 100644 node_modules/es-abstract/2020/floor.js create mode 100644 node_modules/es-abstract/2020/modulo.js create mode 100644 node_modules/es-abstract/2020/msFromTime.js create mode 100644 node_modules/es-abstract/2020/thisBigIntValue.js create mode 100644 node_modules/es-abstract/2020/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2020/thisNumberValue.js create mode 100644 node_modules/es-abstract/2020/thisStringValue.js create mode 100644 node_modules/es-abstract/2020/thisSymbolValue.js create mode 100644 node_modules/es-abstract/2020/thisTimeValue.js create mode 100644 node_modules/es-abstract/2021/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/2021/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/2021/AddEntriesFromIterable.js create mode 100644 node_modules/es-abstract/2021/AddToKeptObjects.js create mode 100644 node_modules/es-abstract/2021/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2021/ApplyStringOrNumericBinaryOperator.js create mode 100644 node_modules/es-abstract/2021/ArrayCreate.js create mode 100644 node_modules/es-abstract/2021/ArraySetLength.js create mode 100644 node_modules/es-abstract/2021/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2021/BigInt/add.js create mode 100644 node_modules/es-abstract/2021/BigInt/bitwiseAND.js create mode 100644 node_modules/es-abstract/2021/BigInt/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2021/BigInt/bitwiseOR.js create mode 100644 node_modules/es-abstract/2021/BigInt/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2021/BigInt/divide.js create mode 100644 node_modules/es-abstract/2021/BigInt/equal.js create mode 100644 node_modules/es-abstract/2021/BigInt/exponentiate.js create mode 100644 node_modules/es-abstract/2021/BigInt/index.js create mode 100644 node_modules/es-abstract/2021/BigInt/leftShift.js create mode 100644 node_modules/es-abstract/2021/BigInt/lessThan.js create mode 100644 node_modules/es-abstract/2021/BigInt/multiply.js create mode 100644 node_modules/es-abstract/2021/BigInt/remainder.js create mode 100644 node_modules/es-abstract/2021/BigInt/sameValue.js create mode 100644 node_modules/es-abstract/2021/BigInt/sameValueZero.js create mode 100644 node_modules/es-abstract/2021/BigInt/signedRightShift.js create mode 100644 node_modules/es-abstract/2021/BigInt/subtract.js create mode 100644 node_modules/es-abstract/2021/BigInt/toString.js create mode 100644 node_modules/es-abstract/2021/BigInt/unaryMinus.js create mode 100644 node_modules/es-abstract/2021/BigInt/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2021/BigIntBitwiseOp.js create mode 100644 node_modules/es-abstract/2021/BinaryAnd.js create mode 100644 node_modules/es-abstract/2021/BinaryOr.js create mode 100644 node_modules/es-abstract/2021/BinaryXor.js create mode 100644 node_modules/es-abstract/2021/ByteListBitwiseOp.js create mode 100644 node_modules/es-abstract/2021/ByteListEqual.js create mode 100644 node_modules/es-abstract/2021/Call.js create mode 100644 node_modules/es-abstract/2021/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2021/CharacterRange.js create mode 100644 node_modules/es-abstract/2021/ClearKeptObjects.js create mode 100644 node_modules/es-abstract/2021/CodePointAt.js create mode 100644 node_modules/es-abstract/2021/CodePointsToString.js create mode 100644 node_modules/es-abstract/2021/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2021/CopyDataProperties.js create mode 100644 node_modules/es-abstract/2021/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2021/CreateHTML.js create mode 100644 node_modules/es-abstract/2021/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2021/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2021/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2021/CreateRegExpStringIterator.js create mode 100644 node_modules/es-abstract/2021/DateFromTime.js create mode 100644 node_modules/es-abstract/2021/DateString.js create mode 100644 node_modules/es-abstract/2021/Day.js create mode 100644 node_modules/es-abstract/2021/DayFromYear.js create mode 100644 node_modules/es-abstract/2021/DayWithinYear.js create mode 100644 node_modules/es-abstract/2021/DaysInYear.js create mode 100644 node_modules/es-abstract/2021/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2021/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2021/EnumerableOwnPropertyNames.js create mode 100644 node_modules/es-abstract/2021/FlattenIntoArray.js create mode 100644 node_modules/es-abstract/2021/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2021/Get.js create mode 100644 node_modules/es-abstract/2021/GetIterator.js create mode 100644 node_modules/es-abstract/2021/GetMethod.js create mode 100644 node_modules/es-abstract/2021/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2021/GetPromiseResolve.js create mode 100644 node_modules/es-abstract/2021/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2021/GetSubstitution.js create mode 100644 node_modules/es-abstract/2021/GetV.js create mode 100644 node_modules/es-abstract/2021/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2021/HasProperty.js create mode 100644 node_modules/es-abstract/2021/HourFromTime.js create mode 100644 node_modules/es-abstract/2021/InLeapYear.js create mode 100644 node_modules/es-abstract/2021/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2021/Invoke.js create mode 100644 node_modules/es-abstract/2021/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2021/IsArray.js create mode 100644 node_modules/es-abstract/2021/IsBigIntElementType.js create mode 100644 node_modules/es-abstract/2021/IsCallable.js create mode 100644 node_modules/es-abstract/2021/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2021/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2021/IsConstructor.js create mode 100644 node_modules/es-abstract/2021/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2021/IsExtensible.js create mode 100644 node_modules/es-abstract/2021/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2021/IsIntegralNumber.js create mode 100644 node_modules/es-abstract/2021/IsNoTearConfiguration.js create mode 100644 node_modules/es-abstract/2021/IsPromise.js create mode 100644 node_modules/es-abstract/2021/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2021/IsRegExp.js create mode 100644 node_modules/es-abstract/2021/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2021/IsStringPrefix.js create mode 100644 node_modules/es-abstract/2021/IsUnclampedIntegerElementType.js create mode 100644 node_modules/es-abstract/2021/IsUnsignedElementType.js create mode 100644 node_modules/es-abstract/2021/IterableToList.js create mode 100644 node_modules/es-abstract/2021/IteratorClose.js create mode 100644 node_modules/es-abstract/2021/IteratorComplete.js create mode 100644 node_modules/es-abstract/2021/IteratorNext.js create mode 100644 node_modules/es-abstract/2021/IteratorStep.js create mode 100644 node_modules/es-abstract/2021/IteratorValue.js create mode 100644 node_modules/es-abstract/2021/LengthOfArrayLike.js create mode 100644 node_modules/es-abstract/2021/MakeDate.js create mode 100644 node_modules/es-abstract/2021/MakeDay.js create mode 100644 node_modules/es-abstract/2021/MakeTime.js create mode 100644 node_modules/es-abstract/2021/MinFromTime.js create mode 100644 node_modules/es-abstract/2021/MonthFromTime.js create mode 100644 node_modules/es-abstract/2021/Number/add.js create mode 100644 node_modules/es-abstract/2021/Number/bitwiseAND.js create mode 100644 node_modules/es-abstract/2021/Number/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2021/Number/bitwiseOR.js create mode 100644 node_modules/es-abstract/2021/Number/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2021/Number/divide.js create mode 100644 node_modules/es-abstract/2021/Number/equal.js create mode 100644 node_modules/es-abstract/2021/Number/exponentiate.js create mode 100644 node_modules/es-abstract/2021/Number/index.js create mode 100644 node_modules/es-abstract/2021/Number/leftShift.js create mode 100644 node_modules/es-abstract/2021/Number/lessThan.js create mode 100644 node_modules/es-abstract/2021/Number/multiply.js create mode 100644 node_modules/es-abstract/2021/Number/remainder.js create mode 100644 node_modules/es-abstract/2021/Number/sameValue.js create mode 100644 node_modules/es-abstract/2021/Number/sameValueZero.js create mode 100644 node_modules/es-abstract/2021/Number/signedRightShift.js create mode 100644 node_modules/es-abstract/2021/Number/subtract.js create mode 100644 node_modules/es-abstract/2021/Number/toString.js create mode 100644 node_modules/es-abstract/2021/Number/unaryMinus.js create mode 100644 node_modules/es-abstract/2021/Number/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2021/NumberBitwiseOp.js create mode 100644 node_modules/es-abstract/2021/NumberToBigInt.js create mode 100644 node_modules/es-abstract/2021/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2021/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2021/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2021/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2021/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2021/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2021/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2021/OrdinaryObjectCreate.js create mode 100644 node_modules/es-abstract/2021/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2021/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2021/PromiseResolve.js create mode 100644 node_modules/es-abstract/2021/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2021/RegExpCreate.js create mode 100644 node_modules/es-abstract/2021/RegExpExec.js create mode 100644 node_modules/es-abstract/2021/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2021/SameValue.js create mode 100644 node_modules/es-abstract/2021/SameValueNonNumeric.js create mode 100644 node_modules/es-abstract/2021/SameValueZero.js create mode 100644 node_modules/es-abstract/2021/SecFromTime.js create mode 100644 node_modules/es-abstract/2021/Set.js create mode 100644 node_modules/es-abstract/2021/SetFunctionLength.js create mode 100644 node_modules/es-abstract/2021/SetFunctionName.js create mode 100644 node_modules/es-abstract/2021/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2021/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2021/SplitMatch.js create mode 100644 node_modules/es-abstract/2021/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/2021/StringCreate.js create mode 100644 node_modules/es-abstract/2021/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2021/StringIndexOf.js create mode 100644 node_modules/es-abstract/2021/StringPad.js create mode 100644 node_modules/es-abstract/2021/StringToBigInt.js create mode 100644 node_modules/es-abstract/2021/StringToCodePoints.js create mode 100644 node_modules/es-abstract/2021/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2021/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2021/TimeClip.js create mode 100644 node_modules/es-abstract/2021/TimeFromYear.js create mode 100644 node_modules/es-abstract/2021/TimeString.js create mode 100644 node_modules/es-abstract/2021/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2021/ToBigInt.js create mode 100644 node_modules/es-abstract/2021/ToBigInt64.js create mode 100644 node_modules/es-abstract/2021/ToBigUint64.js create mode 100644 node_modules/es-abstract/2021/ToBoolean.js create mode 100644 node_modules/es-abstract/2021/ToDateString.js create mode 100644 node_modules/es-abstract/2021/ToIndex.js create mode 100644 node_modules/es-abstract/2021/ToInt16.js create mode 100644 node_modules/es-abstract/2021/ToInt32.js create mode 100644 node_modules/es-abstract/2021/ToInt8.js create mode 100644 node_modules/es-abstract/2021/ToIntegerOrInfinity.js create mode 100644 node_modules/es-abstract/2021/ToLength.js create mode 100644 node_modules/es-abstract/2021/ToNumber.js create mode 100644 node_modules/es-abstract/2021/ToNumeric.js create mode 100644 node_modules/es-abstract/2021/ToObject.js create mode 100644 node_modules/es-abstract/2021/ToPrimitive.js create mode 100644 node_modules/es-abstract/2021/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2021/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2021/ToString.js create mode 100644 node_modules/es-abstract/2021/ToUint16.js create mode 100644 node_modules/es-abstract/2021/ToUint32.js create mode 100644 node_modules/es-abstract/2021/ToUint8.js create mode 100644 node_modules/es-abstract/2021/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2021/TrimString.js create mode 100644 node_modules/es-abstract/2021/Type.js create mode 100644 node_modules/es-abstract/2021/UTF16EncodeCodePoint.js create mode 100644 node_modules/es-abstract/2021/UTF16SurrogatePairToCodePoint.js create mode 100644 node_modules/es-abstract/2021/UnicodeEscape.js create mode 100644 node_modules/es-abstract/2021/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2021/WeakRefDeref.js create mode 100644 node_modules/es-abstract/2021/WeekDay.js create mode 100644 node_modules/es-abstract/2021/YearFromTime.js create mode 100644 node_modules/es-abstract/2021/abs.js create mode 100644 node_modules/es-abstract/2021/clamp.js create mode 100644 node_modules/es-abstract/2021/floor.js create mode 100644 node_modules/es-abstract/2021/modulo.js create mode 100644 node_modules/es-abstract/2021/msFromTime.js create mode 100644 node_modules/es-abstract/2021/substring.js create mode 100644 node_modules/es-abstract/2021/thisBigIntValue.js create mode 100644 node_modules/es-abstract/2021/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2021/thisNumberValue.js create mode 100644 node_modules/es-abstract/2021/thisStringValue.js create mode 100644 node_modules/es-abstract/2021/thisSymbolValue.js create mode 100644 node_modules/es-abstract/2021/thisTimeValue.js create mode 100644 node_modules/es-abstract/2022/AddEntriesFromIterable.js create mode 100644 node_modules/es-abstract/2022/AddToKeptObjects.js create mode 100644 node_modules/es-abstract/2022/AdvanceStringIndex.js create mode 100644 node_modules/es-abstract/2022/ApplyStringOrNumericBinaryOperator.js create mode 100644 node_modules/es-abstract/2022/ArrayCreate.js create mode 100644 node_modules/es-abstract/2022/ArraySetLength.js create mode 100644 node_modules/es-abstract/2022/ArraySpeciesCreate.js create mode 100644 node_modules/es-abstract/2022/BigInt/add.js create mode 100644 node_modules/es-abstract/2022/BigInt/bitwiseAND.js create mode 100644 node_modules/es-abstract/2022/BigInt/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2022/BigInt/bitwiseOR.js create mode 100644 node_modules/es-abstract/2022/BigInt/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2022/BigInt/divide.js create mode 100644 node_modules/es-abstract/2022/BigInt/equal.js create mode 100644 node_modules/es-abstract/2022/BigInt/exponentiate.js create mode 100644 node_modules/es-abstract/2022/BigInt/index.js create mode 100644 node_modules/es-abstract/2022/BigInt/leftShift.js create mode 100644 node_modules/es-abstract/2022/BigInt/lessThan.js create mode 100644 node_modules/es-abstract/2022/BigInt/multiply.js create mode 100644 node_modules/es-abstract/2022/BigInt/remainder.js create mode 100644 node_modules/es-abstract/2022/BigInt/sameValue.js create mode 100644 node_modules/es-abstract/2022/BigInt/sameValueZero.js create mode 100644 node_modules/es-abstract/2022/BigInt/signedRightShift.js create mode 100644 node_modules/es-abstract/2022/BigInt/subtract.js create mode 100644 node_modules/es-abstract/2022/BigInt/toString.js create mode 100644 node_modules/es-abstract/2022/BigInt/unaryMinus.js create mode 100644 node_modules/es-abstract/2022/BigInt/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2022/BigIntBitwiseOp.js create mode 100644 node_modules/es-abstract/2022/BinaryAnd.js create mode 100644 node_modules/es-abstract/2022/BinaryOr.js create mode 100644 node_modules/es-abstract/2022/BinaryXor.js create mode 100644 node_modules/es-abstract/2022/ByteListBitwiseOp.js create mode 100644 node_modules/es-abstract/2022/ByteListEqual.js create mode 100644 node_modules/es-abstract/2022/Call.js create mode 100644 node_modules/es-abstract/2022/CanonicalNumericIndexString.js create mode 100644 node_modules/es-abstract/2022/CharacterRange.js create mode 100644 node_modules/es-abstract/2022/ClearKeptObjects.js create mode 100644 node_modules/es-abstract/2022/CodePointAt.js create mode 100644 node_modules/es-abstract/2022/CodePointsToString.js create mode 100644 node_modules/es-abstract/2022/CompletePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2022/CopyDataProperties.js create mode 100644 node_modules/es-abstract/2022/CreateDataProperty.js create mode 100644 node_modules/es-abstract/2022/CreateDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2022/CreateHTML.js create mode 100644 node_modules/es-abstract/2022/CreateIterResultObject.js create mode 100644 node_modules/es-abstract/2022/CreateListFromArrayLike.js create mode 100644 node_modules/es-abstract/2022/CreateMethodProperty.js create mode 100644 node_modules/es-abstract/2022/CreateNonEnumerableDataPropertyOrThrow.js create mode 100644 node_modules/es-abstract/2022/CreateRegExpStringIterator.js create mode 100644 node_modules/es-abstract/2022/DateFromTime.js create mode 100644 node_modules/es-abstract/2022/DateString.js create mode 100644 node_modules/es-abstract/2022/Day.js create mode 100644 node_modules/es-abstract/2022/DayFromYear.js create mode 100644 node_modules/es-abstract/2022/DayWithinYear.js create mode 100644 node_modules/es-abstract/2022/DaysInYear.js create mode 100644 node_modules/es-abstract/2022/DefinePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2022/DeletePropertyOrThrow.js create mode 100644 node_modules/es-abstract/2022/EnumerableOwnPropertyNames.js create mode 100644 node_modules/es-abstract/2022/FlattenIntoArray.js create mode 100644 node_modules/es-abstract/2022/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2022/Get.js create mode 100644 node_modules/es-abstract/2022/GetIterator.js create mode 100644 node_modules/es-abstract/2022/GetMatchIndexPair.js create mode 100644 node_modules/es-abstract/2022/GetMatchString.js create mode 100644 node_modules/es-abstract/2022/GetMethod.js create mode 100644 node_modules/es-abstract/2022/GetOwnPropertyKeys.js create mode 100644 node_modules/es-abstract/2022/GetPromiseResolve.js create mode 100644 node_modules/es-abstract/2022/GetPrototypeFromConstructor.js create mode 100644 node_modules/es-abstract/2022/GetStringIndex.js create mode 100644 node_modules/es-abstract/2022/GetSubstitution.js create mode 100644 node_modules/es-abstract/2022/GetV.js create mode 100644 node_modules/es-abstract/2022/HasOwnProperty.js create mode 100644 node_modules/es-abstract/2022/HasProperty.js create mode 100644 node_modules/es-abstract/2022/HourFromTime.js create mode 100644 node_modules/es-abstract/2022/InLeapYear.js create mode 100644 node_modules/es-abstract/2022/InstallErrorCause.js create mode 100644 node_modules/es-abstract/2022/InstanceofOperator.js create mode 100644 node_modules/es-abstract/2022/Invoke.js create mode 100644 node_modules/es-abstract/2022/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/2022/IsArray.js create mode 100644 node_modules/es-abstract/2022/IsBigIntElementType.js create mode 100644 node_modules/es-abstract/2022/IsCallable.js create mode 100644 node_modules/es-abstract/2022/IsCompatiblePropertyDescriptor.js create mode 100644 node_modules/es-abstract/2022/IsConcatSpreadable.js create mode 100644 node_modules/es-abstract/2022/IsConstructor.js create mode 100644 node_modules/es-abstract/2022/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/2022/IsExtensible.js create mode 100644 node_modules/es-abstract/2022/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/2022/IsIntegralNumber.js create mode 100644 node_modules/es-abstract/2022/IsLessThan.js create mode 100644 node_modules/es-abstract/2022/IsLooselyEqual.js create mode 100644 node_modules/es-abstract/2022/IsNoTearConfiguration.js create mode 100644 node_modules/es-abstract/2022/IsPromise.js create mode 100644 node_modules/es-abstract/2022/IsPropertyKey.js create mode 100644 node_modules/es-abstract/2022/IsRegExp.js create mode 100644 node_modules/es-abstract/2022/IsSharedArrayBuffer.js create mode 100644 node_modules/es-abstract/2022/IsStrictlyEqual.js create mode 100644 node_modules/es-abstract/2022/IsStringPrefix.js create mode 100644 node_modules/es-abstract/2022/IsStringWellFormedUnicode.js create mode 100644 node_modules/es-abstract/2022/IsUnclampedIntegerElementType.js create mode 100644 node_modules/es-abstract/2022/IsUnsignedElementType.js create mode 100644 node_modules/es-abstract/2022/IterableToList.js create mode 100644 node_modules/es-abstract/2022/IteratorClose.js create mode 100644 node_modules/es-abstract/2022/IteratorComplete.js create mode 100644 node_modules/es-abstract/2022/IteratorNext.js create mode 100644 node_modules/es-abstract/2022/IteratorStep.js create mode 100644 node_modules/es-abstract/2022/IteratorValue.js create mode 100644 node_modules/es-abstract/2022/LengthOfArrayLike.js create mode 100644 node_modules/es-abstract/2022/MakeDate.js create mode 100644 node_modules/es-abstract/2022/MakeDay.js create mode 100644 node_modules/es-abstract/2022/MakeMatchIndicesIndexPairArray.js create mode 100644 node_modules/es-abstract/2022/MakeTime.js create mode 100644 node_modules/es-abstract/2022/MinFromTime.js create mode 100644 node_modules/es-abstract/2022/MonthFromTime.js create mode 100644 node_modules/es-abstract/2022/Number/add.js create mode 100644 node_modules/es-abstract/2022/Number/bitwiseAND.js create mode 100644 node_modules/es-abstract/2022/Number/bitwiseNOT.js create mode 100644 node_modules/es-abstract/2022/Number/bitwiseOR.js create mode 100644 node_modules/es-abstract/2022/Number/bitwiseXOR.js create mode 100644 node_modules/es-abstract/2022/Number/divide.js create mode 100644 node_modules/es-abstract/2022/Number/equal.js create mode 100644 node_modules/es-abstract/2022/Number/exponentiate.js create mode 100644 node_modules/es-abstract/2022/Number/index.js create mode 100644 node_modules/es-abstract/2022/Number/leftShift.js create mode 100644 node_modules/es-abstract/2022/Number/lessThan.js create mode 100644 node_modules/es-abstract/2022/Number/multiply.js create mode 100644 node_modules/es-abstract/2022/Number/remainder.js create mode 100644 node_modules/es-abstract/2022/Number/sameValue.js create mode 100644 node_modules/es-abstract/2022/Number/sameValueZero.js create mode 100644 node_modules/es-abstract/2022/Number/signedRightShift.js create mode 100644 node_modules/es-abstract/2022/Number/subtract.js create mode 100644 node_modules/es-abstract/2022/Number/toString.js create mode 100644 node_modules/es-abstract/2022/Number/unaryMinus.js create mode 100644 node_modules/es-abstract/2022/Number/unsignedRightShift.js create mode 100644 node_modules/es-abstract/2022/NumberBitwiseOp.js create mode 100644 node_modules/es-abstract/2022/NumberToBigInt.js create mode 100644 node_modules/es-abstract/2022/ObjectDefineProperties.js create mode 100644 node_modules/es-abstract/2022/OrdinaryCreateFromConstructor.js create mode 100644 node_modules/es-abstract/2022/OrdinaryDefineOwnProperty.js create mode 100644 node_modules/es-abstract/2022/OrdinaryGetOwnProperty.js create mode 100644 node_modules/es-abstract/2022/OrdinaryGetPrototypeOf.js create mode 100644 node_modules/es-abstract/2022/OrdinaryHasInstance.js create mode 100644 node_modules/es-abstract/2022/OrdinaryHasProperty.js create mode 100644 node_modules/es-abstract/2022/OrdinaryObjectCreate.js create mode 100644 node_modules/es-abstract/2022/OrdinarySetPrototypeOf.js create mode 100644 node_modules/es-abstract/2022/OrdinaryToPrimitive.js create mode 100644 node_modules/es-abstract/2022/PromiseResolve.js create mode 100644 node_modules/es-abstract/2022/QuoteJSONString.js create mode 100644 node_modules/es-abstract/2022/RegExpCreate.js create mode 100644 node_modules/es-abstract/2022/RegExpExec.js create mode 100644 node_modules/es-abstract/2022/RegExpHasFlag.js create mode 100644 node_modules/es-abstract/2022/RequireObjectCoercible.js create mode 100644 node_modules/es-abstract/2022/SameValue.js create mode 100644 node_modules/es-abstract/2022/SameValueNonNumeric.js create mode 100644 node_modules/es-abstract/2022/SameValueZero.js create mode 100644 node_modules/es-abstract/2022/SecFromTime.js create mode 100644 node_modules/es-abstract/2022/Set.js create mode 100644 node_modules/es-abstract/2022/SetFunctionLength.js create mode 100644 node_modules/es-abstract/2022/SetFunctionName.js create mode 100644 node_modules/es-abstract/2022/SetIntegrityLevel.js create mode 100644 node_modules/es-abstract/2022/SortIndexedProperties.js create mode 100644 node_modules/es-abstract/2022/SpeciesConstructor.js create mode 100644 node_modules/es-abstract/2022/StringCreate.js create mode 100644 node_modules/es-abstract/2022/StringGetOwnProperty.js create mode 100644 node_modules/es-abstract/2022/StringIndexOf.js create mode 100644 node_modules/es-abstract/2022/StringPad.js create mode 100644 node_modules/es-abstract/2022/StringToBigInt.js create mode 100644 node_modules/es-abstract/2022/StringToCodePoints.js create mode 100644 node_modules/es-abstract/2022/StringToNumber.js create mode 100644 node_modules/es-abstract/2022/SymbolDescriptiveString.js create mode 100644 node_modules/es-abstract/2022/TestIntegrityLevel.js create mode 100644 node_modules/es-abstract/2022/TimeClip.js create mode 100644 node_modules/es-abstract/2022/TimeFromYear.js create mode 100644 node_modules/es-abstract/2022/TimeString.js create mode 100644 node_modules/es-abstract/2022/TimeWithinDay.js create mode 100644 node_modules/es-abstract/2022/ToBigInt.js create mode 100644 node_modules/es-abstract/2022/ToBigInt64.js create mode 100644 node_modules/es-abstract/2022/ToBigUint64.js create mode 100644 node_modules/es-abstract/2022/ToBoolean.js create mode 100644 node_modules/es-abstract/2022/ToDateString.js create mode 100644 node_modules/es-abstract/2022/ToIndex.js create mode 100644 node_modules/es-abstract/2022/ToInt16.js create mode 100644 node_modules/es-abstract/2022/ToInt32.js create mode 100644 node_modules/es-abstract/2022/ToInt8.js create mode 100644 node_modules/es-abstract/2022/ToIntegerOrInfinity.js create mode 100644 node_modules/es-abstract/2022/ToLength.js create mode 100644 node_modules/es-abstract/2022/ToNumber.js create mode 100644 node_modules/es-abstract/2022/ToNumeric.js create mode 100644 node_modules/es-abstract/2022/ToObject.js create mode 100644 node_modules/es-abstract/2022/ToPrimitive.js create mode 100644 node_modules/es-abstract/2022/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2022/ToPropertyKey.js create mode 100644 node_modules/es-abstract/2022/ToString.js create mode 100644 node_modules/es-abstract/2022/ToUint16.js create mode 100644 node_modules/es-abstract/2022/ToUint32.js create mode 100644 node_modules/es-abstract/2022/ToUint8.js create mode 100644 node_modules/es-abstract/2022/ToUint8Clamp.js create mode 100644 node_modules/es-abstract/2022/ToZeroPaddedDecimalString.js create mode 100644 node_modules/es-abstract/2022/TrimString.js create mode 100644 node_modules/es-abstract/2022/Type.js create mode 100644 node_modules/es-abstract/2022/UTF16EncodeCodePoint.js create mode 100644 node_modules/es-abstract/2022/UTF16SurrogatePairToCodePoint.js create mode 100644 node_modules/es-abstract/2022/UnicodeEscape.js create mode 100644 node_modules/es-abstract/2022/ValidateAndApplyPropertyDescriptor.js create mode 100644 node_modules/es-abstract/2022/WeakRefDeref.js create mode 100644 node_modules/es-abstract/2022/WeekDay.js create mode 100644 node_modules/es-abstract/2022/YearFromTime.js create mode 100644 node_modules/es-abstract/2022/abs.js create mode 100644 node_modules/es-abstract/2022/clamp.js create mode 100644 node_modules/es-abstract/2022/floor.js create mode 100644 node_modules/es-abstract/2022/modulo.js create mode 100644 node_modules/es-abstract/2022/msFromTime.js create mode 100644 node_modules/es-abstract/2022/substring.js create mode 100644 node_modules/es-abstract/2022/thisBigIntValue.js create mode 100644 node_modules/es-abstract/2022/thisBooleanValue.js create mode 100644 node_modules/es-abstract/2022/thisNumberValue.js create mode 100644 node_modules/es-abstract/2022/thisStringValue.js create mode 100644 node_modules/es-abstract/2022/thisSymbolValue.js create mode 100644 node_modules/es-abstract/2022/thisTimeValue.js create mode 100644 node_modules/es-abstract/5/AbstractEqualityComparison.js create mode 100644 node_modules/es-abstract/5/AbstractRelationalComparison.js create mode 100644 node_modules/es-abstract/5/CheckObjectCoercible.js create mode 100644 node_modules/es-abstract/5/DateFromTime.js create mode 100644 node_modules/es-abstract/5/Day.js create mode 100644 node_modules/es-abstract/5/DayFromYear.js create mode 100644 node_modules/es-abstract/5/DayWithinYear.js create mode 100644 node_modules/es-abstract/5/DaysInYear.js create mode 100644 node_modules/es-abstract/5/FromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/5/HourFromTime.js create mode 100644 node_modules/es-abstract/5/InLeapYear.js create mode 100644 node_modules/es-abstract/5/IsAccessorDescriptor.js create mode 100644 node_modules/es-abstract/5/IsCallable.js create mode 100644 node_modules/es-abstract/5/IsDataDescriptor.js create mode 100644 node_modules/es-abstract/5/IsGenericDescriptor.js create mode 100644 node_modules/es-abstract/5/IsPropertyDescriptor.js create mode 100644 node_modules/es-abstract/5/MakeDate.js create mode 100644 node_modules/es-abstract/5/MakeDay.js create mode 100644 node_modules/es-abstract/5/MakeTime.js create mode 100644 node_modules/es-abstract/5/MinFromTime.js create mode 100644 node_modules/es-abstract/5/MonthFromTime.js create mode 100644 node_modules/es-abstract/5/SameValue.js create mode 100644 node_modules/es-abstract/5/SecFromTime.js create mode 100644 node_modules/es-abstract/5/StrictEqualityComparison.js create mode 100644 node_modules/es-abstract/5/TimeClip.js create mode 100644 node_modules/es-abstract/5/TimeFromYear.js create mode 100644 node_modules/es-abstract/5/TimeWithinDay.js create mode 100644 node_modules/es-abstract/5/ToBoolean.js create mode 100644 node_modules/es-abstract/5/ToInt32.js create mode 100644 node_modules/es-abstract/5/ToInteger.js create mode 100644 node_modules/es-abstract/5/ToNumber.js create mode 100644 node_modules/es-abstract/5/ToObject.js create mode 100644 node_modules/es-abstract/5/ToPrimitive.js create mode 100644 node_modules/es-abstract/5/ToPropertyDescriptor.js create mode 100644 node_modules/es-abstract/5/ToString.js create mode 100644 node_modules/es-abstract/5/ToUint16.js create mode 100644 node_modules/es-abstract/5/ToUint32.js create mode 100644 node_modules/es-abstract/5/Type.js create mode 100644 node_modules/es-abstract/5/WeekDay.js create mode 100644 node_modules/es-abstract/5/YearFromTime.js create mode 100644 node_modules/es-abstract/5/abs.js create mode 100644 node_modules/es-abstract/5/floor.js create mode 100644 node_modules/es-abstract/5/modulo.js create mode 100644 node_modules/es-abstract/5/msFromTime.js create mode 100644 node_modules/es-abstract/CHANGELOG.md create mode 100644 node_modules/es-abstract/GetIntrinsic.js create mode 100644 node_modules/es-abstract/LICENSE create mode 100644 node_modules/es-abstract/README.md create mode 100644 node_modules/es-abstract/es2015.js create mode 100644 node_modules/es-abstract/es2016.js create mode 100644 node_modules/es-abstract/es2017.js create mode 100644 node_modules/es-abstract/es2018.js create mode 100644 node_modules/es-abstract/es2019.js create mode 100644 node_modules/es-abstract/es2020.js create mode 100644 node_modules/es-abstract/es2021.js create mode 100644 node_modules/es-abstract/es2022.js create mode 100644 node_modules/es-abstract/es5.js create mode 100644 node_modules/es-abstract/es6.js create mode 100644 node_modules/es-abstract/es7.js create mode 100644 node_modules/es-abstract/helpers/DefineOwnProperty.js create mode 100644 node_modules/es-abstract/helpers/IsArray.js create mode 100644 node_modules/es-abstract/helpers/OwnPropertyKeys.js create mode 100644 node_modules/es-abstract/helpers/assertRecord.js create mode 100644 node_modules/es-abstract/helpers/assign.js create mode 100644 node_modules/es-abstract/helpers/callBind.js create mode 100644 node_modules/es-abstract/helpers/callBound.js create mode 100644 node_modules/es-abstract/helpers/every.js create mode 100644 node_modules/es-abstract/helpers/forEach.js create mode 100644 node_modules/es-abstract/helpers/fromPropertyDescriptor.js create mode 100644 node_modules/es-abstract/helpers/getInferredName.js create mode 100644 node_modules/es-abstract/helpers/getIteratorMethod.js create mode 100644 node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js create mode 100644 node_modules/es-abstract/helpers/getProto.js create mode 100644 node_modules/es-abstract/helpers/getSymbolDescription.js create mode 100644 node_modules/es-abstract/helpers/isAbstractClosure.js create mode 100644 node_modules/es-abstract/helpers/isByteValue.js create mode 100644 node_modules/es-abstract/helpers/isCodePoint.js create mode 100644 node_modules/es-abstract/helpers/isFinite.js create mode 100644 node_modules/es-abstract/helpers/isFullyPopulatedPropertyDescriptor.js create mode 100644 node_modules/es-abstract/helpers/isLeadingSurrogate.js create mode 100644 node_modules/es-abstract/helpers/isMatchRecord.js create mode 100644 node_modules/es-abstract/helpers/isNaN.js create mode 100644 node_modules/es-abstract/helpers/isPrefixOf.js create mode 100644 node_modules/es-abstract/helpers/isPrimitive.js create mode 100644 node_modules/es-abstract/helpers/isPropertyDescriptor.js create mode 100644 node_modules/es-abstract/helpers/isSamePropertyDescriptor.js create mode 100644 node_modules/es-abstract/helpers/isTrailingSurrogate.js create mode 100644 node_modules/es-abstract/helpers/maxSafeInteger.js create mode 100644 node_modules/es-abstract/helpers/mod.js create mode 100644 node_modules/es-abstract/helpers/modBigInt.js create mode 100644 node_modules/es-abstract/helpers/padTimeComponent.js create mode 100644 node_modules/es-abstract/helpers/regexTester.js create mode 100644 node_modules/es-abstract/helpers/setProto.js create mode 100644 node_modules/es-abstract/helpers/sign.js create mode 100644 node_modules/es-abstract/helpers/some.js create mode 100644 node_modules/es-abstract/helpers/timeConstants.js create mode 100644 node_modules/es-abstract/index.js create mode 100644 node_modules/es-abstract/operations/.eslintrc create mode 100644 node_modules/es-abstract/operations/2015.js create mode 100644 node_modules/es-abstract/operations/2016.js create mode 100644 node_modules/es-abstract/operations/2017.js create mode 100644 node_modules/es-abstract/operations/2018.js create mode 100644 node_modules/es-abstract/operations/2019.js create mode 100644 node_modules/es-abstract/operations/2020.js create mode 100644 node_modules/es-abstract/operations/2021.js create mode 100644 node_modules/es-abstract/operations/2022.js create mode 100644 node_modules/es-abstract/package.json create mode 100644 node_modules/es-shim-unscopables/.eslintrc create mode 100644 node_modules/es-shim-unscopables/.github/FUNDING.yml create mode 100644 node_modules/es-shim-unscopables/.nycrc create mode 100644 node_modules/es-shim-unscopables/CHANGELOG.md create mode 100644 node_modules/es-shim-unscopables/LICENSE create mode 100644 node_modules/es-shim-unscopables/README.md create mode 100644 node_modules/es-shim-unscopables/index.js create mode 100644 node_modules/es-shim-unscopables/package.json create mode 100644 node_modules/es-shim-unscopables/test/index.js create mode 100644 node_modules/es-shim-unscopables/test/with.js create mode 100644 node_modules/es-to-primitive/.eslintrc create mode 100644 node_modules/es-to-primitive/.github/FUNDING.yml create mode 100644 node_modules/es-to-primitive/.travis.yml create mode 100644 node_modules/es-to-primitive/CHANGELOG.md create mode 100644 node_modules/es-to-primitive/LICENSE create mode 100644 node_modules/es-to-primitive/Makefile create mode 100644 node_modules/es-to-primitive/README.md create mode 100644 node_modules/es-to-primitive/es2015.js create mode 100644 node_modules/es-to-primitive/es5.js create mode 100644 node_modules/es-to-primitive/es6.js create mode 100644 node_modules/es-to-primitive/helpers/isPrimitive.js create mode 100644 node_modules/es-to-primitive/index.js create mode 100644 node_modules/es-to-primitive/package.json create mode 100644 node_modules/es-to-primitive/test/es2015.js create mode 100644 node_modules/es-to-primitive/test/es5.js create mode 100644 node_modules/es-to-primitive/test/es6.js create mode 100644 node_modules/es-to-primitive/test/index.js create mode 100644 node_modules/escape-string-regexp/index.d.ts create mode 100644 node_modules/escape-string-regexp/index.js create mode 100644 node_modules/escape-string-regexp/license create mode 100644 node_modules/escape-string-regexp/package.json create mode 100644 node_modules/escape-string-regexp/readme.md create mode 100644 node_modules/eslint-config-standard/.eslintrc.json create mode 100644 node_modules/eslint-config-standard/CHANGELOG.md create mode 100644 node_modules/eslint-config-standard/LICENSE create mode 100644 node_modules/eslint-config-standard/README.md create mode 100644 node_modules/eslint-config-standard/index.js create mode 100644 node_modules/eslint-config-standard/package.json create mode 100644 node_modules/eslint-import-resolver-node/LICENSE create mode 100644 node_modules/eslint-import-resolver-node/README.md create mode 100644 node_modules/eslint-import-resolver-node/index.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/LICENSE create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/README.md create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/node.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/package.json create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/src/browser.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/src/common.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/src/index.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/debug/src/node.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/ms/index.js create mode 100644 node_modules/eslint-import-resolver-node/node_modules/ms/license.md create mode 100644 node_modules/eslint-import-resolver-node/node_modules/ms/package.json create mode 100644 node_modules/eslint-import-resolver-node/node_modules/ms/readme.md create mode 100644 node_modules/eslint-import-resolver-node/package.json create mode 100644 node_modules/eslint-module-utils/.nycrc create mode 100644 node_modules/eslint-module-utils/CHANGELOG.md create mode 100644 node_modules/eslint-module-utils/LICENSE create mode 100644 node_modules/eslint-module-utils/ModuleCache.js create mode 100644 node_modules/eslint-module-utils/declaredScope.js create mode 100644 node_modules/eslint-module-utils/hash.js create mode 100644 node_modules/eslint-module-utils/ignore.js create mode 100644 node_modules/eslint-module-utils/module-require.js create mode 100644 node_modules/eslint-module-utils/moduleVisitor.js create mode 100644 node_modules/eslint-module-utils/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/eslint-module-utils/node_modules/debug/LICENSE create mode 100644 node_modules/eslint-module-utils/node_modules/debug/README.md create mode 100644 node_modules/eslint-module-utils/node_modules/debug/node.js create mode 100644 node_modules/eslint-module-utils/node_modules/debug/package.json create mode 100644 node_modules/eslint-module-utils/node_modules/debug/src/browser.js create mode 100644 node_modules/eslint-module-utils/node_modules/debug/src/common.js create mode 100644 node_modules/eslint-module-utils/node_modules/debug/src/index.js create mode 100644 node_modules/eslint-module-utils/node_modules/debug/src/node.js create mode 100644 node_modules/eslint-module-utils/node_modules/ms/index.js create mode 100644 node_modules/eslint-module-utils/node_modules/ms/license.md create mode 100644 node_modules/eslint-module-utils/node_modules/ms/package.json create mode 100644 node_modules/eslint-module-utils/node_modules/ms/readme.md create mode 100644 node_modules/eslint-module-utils/package.json create mode 100644 node_modules/eslint-module-utils/parse.js create mode 100644 node_modules/eslint-module-utils/pkgDir.js create mode 100644 node_modules/eslint-module-utils/pkgUp.js create mode 100644 node_modules/eslint-module-utils/readPkgUp.js create mode 100644 node_modules/eslint-module-utils/resolve.js create mode 100644 node_modules/eslint-module-utils/unambiguous.js create mode 100644 node_modules/eslint-module-utils/visit.js create mode 100644 node_modules/eslint-plugin-es/LICENSE create mode 100644 node_modules/eslint-plugin-es/README.md create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2015.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2016.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2017.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2018.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2019.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es2020.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-es5.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/no-new-in-esnext.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es2015.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es2016.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es2017.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es2018.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es2019.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es3.js create mode 100644 node_modules/eslint-plugin-es/lib/configs/restrict-to-es5.js create mode 100644 node_modules/eslint-plugin-es/lib/index.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-accessor-properties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-array-from.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-array-isarray.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-array-of.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-arrow-functions.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-async-functions.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-async-iteration.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-atomics.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-bigint.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-binary-numeric-literals.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-block-scoped-functions.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-block-scoped-variables.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-classes.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-computed-properties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-date-now.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-default-parameters.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-destructuring.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-dynamic-import.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-exponential-operators.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-export-ns-from.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-for-of-loops.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-generators.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-global-this.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-import-meta.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-json-superset.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-json.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-keyword-properties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-logical-assignment-operators.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-malformed-template-literals.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-map.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-acosh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-asinh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-atanh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-cbrt.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-clz32.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-cosh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-expm1.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-fround.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-hypot.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-imul.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-log10.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-log1p.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-log2.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-sign.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-sinh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-tanh.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-math-trunc.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-modules.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-new-target.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-nullish-coalescing-operators.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-epsilon.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-isfinite.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-isinteger.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-isnan.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-issafeinteger.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-maxsafeinteger.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-minsafeinteger.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-parsefloat.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-number-parseint.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-numeric-separators.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-assign.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-defineproperties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-defineproperty.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-entries.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-freeze.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-fromentries.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-getownpropertydescriptor.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-getownpropertydescriptors.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-getownpropertynames.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-getownpropertysymbols.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-getprototypeof.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-is.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-isextensible.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-isfrozen.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-issealed.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-keys.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-preventextensions.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-seal.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-setprototypeof.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-super-properties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-object-values.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-octal-numeric-literals.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-optional-catch-binding.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-optional-chaining.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-promise-all-settled.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-promise-any.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-promise.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-property-shorthands.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-proxy.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-reflect.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-lookbehind-assertions.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-named-capture-groups.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-s-flag.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-u-flag.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-unicode-property-escapes-2019.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-unicode-property-escapes.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-regexp-y-flag.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-rest-parameters.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-rest-spread-properties.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-set.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-shared-array-buffer.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-spread-elements.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-string-fromcodepoint.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-string-raw.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-subclassing-builtins.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-symbol.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-template-literals.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-trailing-commas.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-trailing-function-commas.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-typed-arrays.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-unicode-codepoint-escapes.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-weak-map.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-weak-set.js create mode 100644 node_modules/eslint-plugin-es/lib/rules/no-weakrefs.js create mode 100644 node_modules/eslint-plugin-es/lib/utils.js create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/LICENSE create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/README.md create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/index.js create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/index.js.map create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/index.mjs create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/index.mjs.map create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-utils/package.json create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/CHANGELOG.md create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/LICENSE create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/README.md create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/lib/index.js create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/lib/visitor-keys.json create mode 100644 node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys/package.json create mode 100644 node_modules/eslint-plugin-es/package.json create mode 100644 node_modules/eslint-plugin-import/CHANGELOG.md create mode 100644 node_modules/eslint-plugin-import/CONTRIBUTING.md create mode 100644 node_modules/eslint-plugin-import/LICENSE create mode 100644 node_modules/eslint-plugin-import/README.md create mode 100644 node_modules/eslint-plugin-import/RELEASE.md create mode 100644 node_modules/eslint-plugin-import/SECURITY.md create mode 100644 node_modules/eslint-plugin-import/config/electron.js create mode 100644 node_modules/eslint-plugin-import/config/errors.js create mode 100644 node_modules/eslint-plugin-import/config/react-native.js create mode 100644 node_modules/eslint-plugin-import/config/react.js create mode 100644 node_modules/eslint-plugin-import/config/recommended.js create mode 100644 node_modules/eslint-plugin-import/config/stage-0.js create mode 100644 node_modules/eslint-plugin-import/config/typescript.js create mode 100644 node_modules/eslint-plugin-import/config/warnings.js create mode 100644 node_modules/eslint-plugin-import/docs/rules/default.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/export.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/exports-last.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/extensions.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/first.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/group-exports.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/imports-first.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/max-dependencies.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/named.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/namespace.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/newline-after-import.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-amd.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-commonjs.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-cycle.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-default-export.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-deprecated.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-duplicates.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-named-default.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-named-export.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-namespace.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-self-import.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-unresolved.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/order.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md create mode 100644 node_modules/eslint-plugin-import/docs/rules/unambiguous.md create mode 100644 node_modules/eslint-plugin-import/lib/ExportMap.js create mode 100644 node_modules/eslint-plugin-import/lib/core/importType.js create mode 100644 node_modules/eslint-plugin-import/lib/core/packagePath.js create mode 100644 node_modules/eslint-plugin-import/lib/core/staticRequire.js create mode 100644 node_modules/eslint-plugin-import/lib/docsUrl.js create mode 100644 node_modules/eslint-plugin-import/lib/importDeclaration.js create mode 100644 node_modules/eslint-plugin-import/lib/index.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/default.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/export.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/exports-last.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/extensions.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/first.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/group-exports.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/imports-first.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/max-dependencies.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/named.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/namespace.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/newline-after-import.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-amd.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-commonjs.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-cycle.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-default-export.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-deprecated.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-duplicates.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-named-default.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-named-export.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-namespace.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-self-import.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-unresolved.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/order.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js create mode 100644 node_modules/eslint-plugin-import/lib/rules/unambiguous.js create mode 100644 node_modules/eslint-plugin-import/memo-parser/LICENSE create mode 100644 node_modules/eslint-plugin-import/memo-parser/README.md create mode 100644 node_modules/eslint-plugin-import/memo-parser/index.js create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/README.md create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js create mode 100644 node_modules/eslint-plugin-import/node_modules/doctrine/package.json create mode 100644 node_modules/eslint-plugin-import/package.json create mode 100644 node_modules/eslint-plugin-n/LICENSE create mode 100644 node_modules/eslint-plugin-n/README.md create mode 100644 node_modules/eslint-plugin-n/lib/configs/_commons.js create mode 100644 node_modules/eslint-plugin-n/lib/configs/recommended-module.js create mode 100644 node_modules/eslint-plugin-n/lib/configs/recommended-script.js create mode 100644 node_modules/eslint-plugin-n/lib/configs/recommended.js create mode 100644 node_modules/eslint-plugin-n/lib/converted-esm/import-meta-resolve.js create mode 100644 node_modules/eslint-plugin-n/lib/index.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/callback-return.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/exports-style.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/file-extension-in-import.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/global-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/handle-callback-err.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-callback-literal.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-deprecated-api.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-exports-assign.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-extraneous-import.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-extraneous-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-hide-core-modules.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-missing-import.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-missing-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-mixed-requires.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-new-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-path-concat.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-process-env.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-process-exit.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-restricted-import.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-restricted-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-sync.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unpublished-bin.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unpublished-import.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unpublished-require.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unsupported-features.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/buffer.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/console.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/process.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/text-decoder.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/text-encoder.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/url-search-params.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-global/url.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-promises/dns.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/prefer-promises/fs.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/process-exit-as-throw.js create mode 100644 node_modules/eslint-plugin-n/lib/rules/shebang.js create mode 100644 node_modules/eslint-plugin-n/lib/util/cache.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-existence.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-extraneous.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-prefer-global.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-publish.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-restricted.js create mode 100644 node_modules/eslint-plugin-n/lib/util/check-unsupported-builtins.js create mode 100644 node_modules/eslint-plugin-n/lib/util/enumerate-property-names.js create mode 100644 node_modules/eslint-plugin-n/lib/util/exists.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-allow-modules.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-configured-node-version.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-convert-path.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-npmignore.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-package-json.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-resolve-paths.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-semver-range.js create mode 100644 node_modules/eslint-plugin-n/lib/util/get-try-extensions.js create mode 100644 node_modules/eslint-plugin-n/lib/util/import-target.js create mode 100644 node_modules/eslint-plugin-n/lib/util/is-typescript.js create mode 100644 node_modules/eslint-plugin-n/lib/util/map-typescript-extension.js create mode 100644 node_modules/eslint-plugin-n/lib/util/merge-visitors-in-place.js create mode 100644 node_modules/eslint-plugin-n/lib/util/strip-import-path-params.js create mode 100644 node_modules/eslint-plugin-n/lib/util/visit-import.js create mode 100644 node_modules/eslint-plugin-n/lib/util/visit-require.js create mode 100644 node_modules/eslint-plugin-n/package.json create mode 100644 node_modules/eslint-plugin-promise/.editorconfig create mode 100755 node_modules/eslint-plugin-promise/.husky/pre-commit create mode 100644 node_modules/eslint-plugin-promise/.prettierignore create mode 100644 node_modules/eslint-plugin-promise/CHANGELOG.md create mode 100644 node_modules/eslint-plugin-promise/LICENSE.md create mode 100644 node_modules/eslint-plugin-promise/README.md create mode 100644 node_modules/eslint-plugin-promise/index.js create mode 100644 node_modules/eslint-plugin-promise/package.json create mode 100644 node_modules/eslint-plugin-promise/rules/always-return.js create mode 100644 node_modules/eslint-plugin-promise/rules/avoid-new.js create mode 100644 node_modules/eslint-plugin-promise/rules/catch-or-return.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/get-docs-url.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/has-promise-callback.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/is-callback.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/is-inside-callback.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/is-promise.js create mode 100644 node_modules/eslint-plugin-promise/rules/lib/promise-statics.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-callback-in-promise.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-native.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-nesting.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-new-statics.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-promise-in-callback.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-return-in-finally.js create mode 100644 node_modules/eslint-plugin-promise/rules/no-return-wrap.js create mode 100644 node_modules/eslint-plugin-promise/rules/param-names.js create mode 100644 node_modules/eslint-plugin-promise/rules/prefer-await-to-callbacks.js create mode 100644 node_modules/eslint-plugin-promise/rules/prefer-await-to-then.js create mode 100644 node_modules/eslint-plugin-promise/rules/valid-params.js create mode 100644 node_modules/eslint-scope/LICENSE create mode 100644 node_modules/eslint-scope/README.md create mode 100644 node_modules/eslint-scope/dist/eslint-scope.cjs create mode 100644 node_modules/eslint-scope/lib/definition.js create mode 100644 node_modules/eslint-scope/lib/index.js create mode 100644 node_modules/eslint-scope/lib/pattern-visitor.js create mode 100644 node_modules/eslint-scope/lib/reference.js create mode 100644 node_modules/eslint-scope/lib/referencer.js create mode 100644 node_modules/eslint-scope/lib/scope-manager.js create mode 100644 node_modules/eslint-scope/lib/scope.js create mode 100644 node_modules/eslint-scope/lib/variable.js create mode 100644 node_modules/eslint-scope/lib/version.js create mode 100644 node_modules/eslint-scope/package.json create mode 100644 node_modules/eslint-utils/LICENSE create mode 100644 node_modules/eslint-utils/README.md create mode 100644 node_modules/eslint-utils/index.js create mode 100644 node_modules/eslint-utils/index.js.map create mode 100644 node_modules/eslint-utils/index.mjs create mode 100644 node_modules/eslint-utils/index.mjs.map create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/CHANGELOG.md create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json create mode 100644 node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json create mode 100644 node_modules/eslint-utils/package.json create mode 100644 node_modules/eslint-visitor-keys/LICENSE create mode 100644 node_modules/eslint-visitor-keys/README.md create mode 100644 node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs create mode 100644 node_modules/eslint-visitor-keys/dist/index.d.ts create mode 100644 node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts create mode 100644 node_modules/eslint-visitor-keys/lib/index.js create mode 100644 node_modules/eslint-visitor-keys/lib/visitor-keys.js create mode 100644 node_modules/eslint-visitor-keys/package.json create mode 100644 node_modules/eslint/LICENSE create mode 100644 node_modules/eslint/README.md create mode 100755 node_modules/eslint/bin/eslint.js create mode 100644 node_modules/eslint/conf/config-schema.js create mode 100644 node_modules/eslint/conf/default-cli-options.js create mode 100644 node_modules/eslint/conf/eslint-all.js create mode 100644 node_modules/eslint/conf/eslint-recommended.js create mode 100644 node_modules/eslint/conf/globals.js create mode 100644 node_modules/eslint/conf/replacements.json create mode 100644 node_modules/eslint/conf/rule-type-list.json create mode 100644 node_modules/eslint/lib/api.js create mode 100644 node_modules/eslint/lib/cli-engine/cli-engine.js create mode 100644 node_modules/eslint/lib/cli-engine/file-enumerator.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/checkstyle.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/compact.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/html.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/json.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/junit.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/stylish.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/tap.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/unix.js create mode 100644 node_modules/eslint/lib/cli-engine/formatters/visualstudio.js create mode 100644 node_modules/eslint/lib/cli-engine/hash.js create mode 100644 node_modules/eslint/lib/cli-engine/index.js create mode 100644 node_modules/eslint/lib/cli-engine/lint-result-cache.js create mode 100644 node_modules/eslint/lib/cli-engine/load-rules.js create mode 100644 node_modules/eslint/lib/cli-engine/xml-escape.js create mode 100644 node_modules/eslint/lib/cli.js create mode 100644 node_modules/eslint/lib/config/default-config.js create mode 100644 node_modules/eslint/lib/config/flat-config-array.js create mode 100644 node_modules/eslint/lib/config/flat-config-helpers.js create mode 100644 node_modules/eslint/lib/config/flat-config-schema.js create mode 100644 node_modules/eslint/lib/config/rule-validator.js create mode 100644 node_modules/eslint/lib/eslint/eslint.js create mode 100644 node_modules/eslint/lib/eslint/index.js create mode 100644 node_modules/eslint/lib/linter/apply-disable-directives.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/fork-context.js create mode 100644 node_modules/eslint/lib/linter/code-path-analysis/id-generator.js create mode 100644 node_modules/eslint/lib/linter/config-comment-parser.js create mode 100644 node_modules/eslint/lib/linter/index.js create mode 100644 node_modules/eslint/lib/linter/interpolate.js create mode 100644 node_modules/eslint/lib/linter/linter.js create mode 100644 node_modules/eslint/lib/linter/node-event-generator.js create mode 100644 node_modules/eslint/lib/linter/report-translator.js create mode 100644 node_modules/eslint/lib/linter/rule-fixer.js create mode 100644 node_modules/eslint/lib/linter/rules.js create mode 100644 node_modules/eslint/lib/linter/safe-emitter.js create mode 100644 node_modules/eslint/lib/linter/source-code-fixer.js create mode 100644 node_modules/eslint/lib/linter/timing.js create mode 100644 node_modules/eslint/lib/options.js create mode 100644 node_modules/eslint/lib/rule-tester/flat-rule-tester.js create mode 100644 node_modules/eslint/lib/rule-tester/index.js create mode 100644 node_modules/eslint/lib/rule-tester/rule-tester.js create mode 100644 node_modules/eslint/lib/rules/accessor-pairs.js create mode 100644 node_modules/eslint/lib/rules/array-bracket-newline.js create mode 100644 node_modules/eslint/lib/rules/array-bracket-spacing.js create mode 100644 node_modules/eslint/lib/rules/array-callback-return.js create mode 100644 node_modules/eslint/lib/rules/array-element-newline.js create mode 100644 node_modules/eslint/lib/rules/arrow-body-style.js create mode 100644 node_modules/eslint/lib/rules/arrow-parens.js create mode 100644 node_modules/eslint/lib/rules/arrow-spacing.js create mode 100644 node_modules/eslint/lib/rules/block-scoped-var.js create mode 100644 node_modules/eslint/lib/rules/block-spacing.js create mode 100644 node_modules/eslint/lib/rules/brace-style.js create mode 100644 node_modules/eslint/lib/rules/callback-return.js create mode 100644 node_modules/eslint/lib/rules/camelcase.js create mode 100644 node_modules/eslint/lib/rules/capitalized-comments.js create mode 100644 node_modules/eslint/lib/rules/class-methods-use-this.js create mode 100644 node_modules/eslint/lib/rules/comma-dangle.js create mode 100644 node_modules/eslint/lib/rules/comma-spacing.js create mode 100644 node_modules/eslint/lib/rules/comma-style.js create mode 100644 node_modules/eslint/lib/rules/complexity.js create mode 100644 node_modules/eslint/lib/rules/computed-property-spacing.js create mode 100644 node_modules/eslint/lib/rules/consistent-return.js create mode 100644 node_modules/eslint/lib/rules/consistent-this.js create mode 100644 node_modules/eslint/lib/rules/constructor-super.js create mode 100644 node_modules/eslint/lib/rules/curly.js create mode 100644 node_modules/eslint/lib/rules/default-case-last.js create mode 100644 node_modules/eslint/lib/rules/default-case.js create mode 100644 node_modules/eslint/lib/rules/default-param-last.js create mode 100644 node_modules/eslint/lib/rules/dot-location.js create mode 100644 node_modules/eslint/lib/rules/dot-notation.js create mode 100644 node_modules/eslint/lib/rules/eol-last.js create mode 100644 node_modules/eslint/lib/rules/eqeqeq.js create mode 100644 node_modules/eslint/lib/rules/for-direction.js create mode 100644 node_modules/eslint/lib/rules/func-call-spacing.js create mode 100644 node_modules/eslint/lib/rules/func-name-matching.js create mode 100644 node_modules/eslint/lib/rules/func-names.js create mode 100644 node_modules/eslint/lib/rules/func-style.js create mode 100644 node_modules/eslint/lib/rules/function-call-argument-newline.js create mode 100644 node_modules/eslint/lib/rules/function-paren-newline.js create mode 100644 node_modules/eslint/lib/rules/generator-star-spacing.js create mode 100644 node_modules/eslint/lib/rules/getter-return.js create mode 100644 node_modules/eslint/lib/rules/global-require.js create mode 100644 node_modules/eslint/lib/rules/grouped-accessor-pairs.js create mode 100644 node_modules/eslint/lib/rules/guard-for-in.js create mode 100644 node_modules/eslint/lib/rules/handle-callback-err.js create mode 100644 node_modules/eslint/lib/rules/id-blacklist.js create mode 100644 node_modules/eslint/lib/rules/id-denylist.js create mode 100644 node_modules/eslint/lib/rules/id-length.js create mode 100644 node_modules/eslint/lib/rules/id-match.js create mode 100644 node_modules/eslint/lib/rules/implicit-arrow-linebreak.js create mode 100644 node_modules/eslint/lib/rules/indent-legacy.js create mode 100644 node_modules/eslint/lib/rules/indent.js create mode 100644 node_modules/eslint/lib/rules/index.js create mode 100644 node_modules/eslint/lib/rules/init-declarations.js create mode 100644 node_modules/eslint/lib/rules/jsx-quotes.js create mode 100644 node_modules/eslint/lib/rules/key-spacing.js create mode 100644 node_modules/eslint/lib/rules/keyword-spacing.js create mode 100644 node_modules/eslint/lib/rules/line-comment-position.js create mode 100644 node_modules/eslint/lib/rules/linebreak-style.js create mode 100644 node_modules/eslint/lib/rules/lines-around-comment.js create mode 100644 node_modules/eslint/lib/rules/lines-around-directive.js create mode 100644 node_modules/eslint/lib/rules/lines-between-class-members.js create mode 100644 node_modules/eslint/lib/rules/max-classes-per-file.js create mode 100644 node_modules/eslint/lib/rules/max-depth.js create mode 100644 node_modules/eslint/lib/rules/max-len.js create mode 100644 node_modules/eslint/lib/rules/max-lines-per-function.js create mode 100644 node_modules/eslint/lib/rules/max-lines.js create mode 100644 node_modules/eslint/lib/rules/max-nested-callbacks.js create mode 100644 node_modules/eslint/lib/rules/max-params.js create mode 100644 node_modules/eslint/lib/rules/max-statements-per-line.js create mode 100644 node_modules/eslint/lib/rules/max-statements.js create mode 100644 node_modules/eslint/lib/rules/multiline-comment-style.js create mode 100644 node_modules/eslint/lib/rules/multiline-ternary.js create mode 100644 node_modules/eslint/lib/rules/new-cap.js create mode 100644 node_modules/eslint/lib/rules/new-parens.js create mode 100644 node_modules/eslint/lib/rules/newline-after-var.js create mode 100644 node_modules/eslint/lib/rules/newline-before-return.js create mode 100644 node_modules/eslint/lib/rules/newline-per-chained-call.js create mode 100644 node_modules/eslint/lib/rules/no-alert.js create mode 100644 node_modules/eslint/lib/rules/no-array-constructor.js create mode 100644 node_modules/eslint/lib/rules/no-async-promise-executor.js create mode 100644 node_modules/eslint/lib/rules/no-await-in-loop.js create mode 100644 node_modules/eslint/lib/rules/no-bitwise.js create mode 100644 node_modules/eslint/lib/rules/no-buffer-constructor.js create mode 100644 node_modules/eslint/lib/rules/no-caller.js create mode 100644 node_modules/eslint/lib/rules/no-case-declarations.js create mode 100644 node_modules/eslint/lib/rules/no-catch-shadow.js create mode 100644 node_modules/eslint/lib/rules/no-class-assign.js create mode 100644 node_modules/eslint/lib/rules/no-compare-neg-zero.js create mode 100644 node_modules/eslint/lib/rules/no-cond-assign.js create mode 100644 node_modules/eslint/lib/rules/no-confusing-arrow.js create mode 100644 node_modules/eslint/lib/rules/no-console.js create mode 100644 node_modules/eslint/lib/rules/no-const-assign.js create mode 100644 node_modules/eslint/lib/rules/no-constant-binary-expression.js create mode 100644 node_modules/eslint/lib/rules/no-constant-condition.js create mode 100644 node_modules/eslint/lib/rules/no-constructor-return.js create mode 100644 node_modules/eslint/lib/rules/no-continue.js create mode 100644 node_modules/eslint/lib/rules/no-control-regex.js create mode 100644 node_modules/eslint/lib/rules/no-debugger.js create mode 100644 node_modules/eslint/lib/rules/no-delete-var.js create mode 100644 node_modules/eslint/lib/rules/no-div-regex.js create mode 100644 node_modules/eslint/lib/rules/no-dupe-args.js create mode 100644 node_modules/eslint/lib/rules/no-dupe-class-members.js create mode 100644 node_modules/eslint/lib/rules/no-dupe-else-if.js create mode 100644 node_modules/eslint/lib/rules/no-dupe-keys.js create mode 100644 node_modules/eslint/lib/rules/no-duplicate-case.js create mode 100644 node_modules/eslint/lib/rules/no-duplicate-imports.js create mode 100644 node_modules/eslint/lib/rules/no-else-return.js create mode 100644 node_modules/eslint/lib/rules/no-empty-character-class.js create mode 100644 node_modules/eslint/lib/rules/no-empty-function.js create mode 100644 node_modules/eslint/lib/rules/no-empty-pattern.js create mode 100644 node_modules/eslint/lib/rules/no-empty.js create mode 100644 node_modules/eslint/lib/rules/no-eq-null.js create mode 100644 node_modules/eslint/lib/rules/no-eval.js create mode 100644 node_modules/eslint/lib/rules/no-ex-assign.js create mode 100644 node_modules/eslint/lib/rules/no-extend-native.js create mode 100644 node_modules/eslint/lib/rules/no-extra-bind.js create mode 100644 node_modules/eslint/lib/rules/no-extra-boolean-cast.js create mode 100644 node_modules/eslint/lib/rules/no-extra-label.js create mode 100644 node_modules/eslint/lib/rules/no-extra-parens.js create mode 100644 node_modules/eslint/lib/rules/no-extra-semi.js create mode 100644 node_modules/eslint/lib/rules/no-fallthrough.js create mode 100644 node_modules/eslint/lib/rules/no-floating-decimal.js create mode 100644 node_modules/eslint/lib/rules/no-func-assign.js create mode 100644 node_modules/eslint/lib/rules/no-global-assign.js create mode 100644 node_modules/eslint/lib/rules/no-implicit-coercion.js create mode 100644 node_modules/eslint/lib/rules/no-implicit-globals.js create mode 100644 node_modules/eslint/lib/rules/no-implied-eval.js create mode 100644 node_modules/eslint/lib/rules/no-import-assign.js create mode 100644 node_modules/eslint/lib/rules/no-inline-comments.js create mode 100644 node_modules/eslint/lib/rules/no-inner-declarations.js create mode 100644 node_modules/eslint/lib/rules/no-invalid-regexp.js create mode 100644 node_modules/eslint/lib/rules/no-invalid-this.js create mode 100644 node_modules/eslint/lib/rules/no-irregular-whitespace.js create mode 100644 node_modules/eslint/lib/rules/no-iterator.js create mode 100644 node_modules/eslint/lib/rules/no-label-var.js create mode 100644 node_modules/eslint/lib/rules/no-labels.js create mode 100644 node_modules/eslint/lib/rules/no-lone-blocks.js create mode 100644 node_modules/eslint/lib/rules/no-lonely-if.js create mode 100644 node_modules/eslint/lib/rules/no-loop-func.js create mode 100644 node_modules/eslint/lib/rules/no-loss-of-precision.js create mode 100644 node_modules/eslint/lib/rules/no-magic-numbers.js create mode 100644 node_modules/eslint/lib/rules/no-misleading-character-class.js create mode 100644 node_modules/eslint/lib/rules/no-mixed-operators.js create mode 100644 node_modules/eslint/lib/rules/no-mixed-requires.js create mode 100644 node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js create mode 100644 node_modules/eslint/lib/rules/no-multi-assign.js create mode 100644 node_modules/eslint/lib/rules/no-multi-spaces.js create mode 100644 node_modules/eslint/lib/rules/no-multi-str.js create mode 100644 node_modules/eslint/lib/rules/no-multiple-empty-lines.js create mode 100644 node_modules/eslint/lib/rules/no-native-reassign.js create mode 100644 node_modules/eslint/lib/rules/no-negated-condition.js create mode 100644 node_modules/eslint/lib/rules/no-negated-in-lhs.js create mode 100644 node_modules/eslint/lib/rules/no-nested-ternary.js create mode 100644 node_modules/eslint/lib/rules/no-new-func.js create mode 100644 node_modules/eslint/lib/rules/no-new-object.js create mode 100644 node_modules/eslint/lib/rules/no-new-require.js create mode 100644 node_modules/eslint/lib/rules/no-new-symbol.js create mode 100644 node_modules/eslint/lib/rules/no-new-wrappers.js create mode 100644 node_modules/eslint/lib/rules/no-new.js create mode 100644 node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js create mode 100644 node_modules/eslint/lib/rules/no-obj-calls.js create mode 100644 node_modules/eslint/lib/rules/no-octal-escape.js create mode 100644 node_modules/eslint/lib/rules/no-octal.js create mode 100644 node_modules/eslint/lib/rules/no-param-reassign.js create mode 100644 node_modules/eslint/lib/rules/no-path-concat.js create mode 100644 node_modules/eslint/lib/rules/no-plusplus.js create mode 100644 node_modules/eslint/lib/rules/no-process-env.js create mode 100644 node_modules/eslint/lib/rules/no-process-exit.js create mode 100644 node_modules/eslint/lib/rules/no-promise-executor-return.js create mode 100644 node_modules/eslint/lib/rules/no-proto.js create mode 100644 node_modules/eslint/lib/rules/no-prototype-builtins.js create mode 100644 node_modules/eslint/lib/rules/no-redeclare.js create mode 100644 node_modules/eslint/lib/rules/no-regex-spaces.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-exports.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-globals.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-imports.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-modules.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-properties.js create mode 100644 node_modules/eslint/lib/rules/no-restricted-syntax.js create mode 100644 node_modules/eslint/lib/rules/no-return-assign.js create mode 100644 node_modules/eslint/lib/rules/no-return-await.js create mode 100644 node_modules/eslint/lib/rules/no-script-url.js create mode 100644 node_modules/eslint/lib/rules/no-self-assign.js create mode 100644 node_modules/eslint/lib/rules/no-self-compare.js create mode 100644 node_modules/eslint/lib/rules/no-sequences.js create mode 100644 node_modules/eslint/lib/rules/no-setter-return.js create mode 100644 node_modules/eslint/lib/rules/no-shadow-restricted-names.js create mode 100644 node_modules/eslint/lib/rules/no-shadow.js create mode 100644 node_modules/eslint/lib/rules/no-spaced-func.js create mode 100644 node_modules/eslint/lib/rules/no-sparse-arrays.js create mode 100644 node_modules/eslint/lib/rules/no-sync.js create mode 100644 node_modules/eslint/lib/rules/no-tabs.js create mode 100644 node_modules/eslint/lib/rules/no-template-curly-in-string.js create mode 100644 node_modules/eslint/lib/rules/no-ternary.js create mode 100644 node_modules/eslint/lib/rules/no-this-before-super.js create mode 100644 node_modules/eslint/lib/rules/no-throw-literal.js create mode 100644 node_modules/eslint/lib/rules/no-trailing-spaces.js create mode 100644 node_modules/eslint/lib/rules/no-undef-init.js create mode 100644 node_modules/eslint/lib/rules/no-undef.js create mode 100644 node_modules/eslint/lib/rules/no-undefined.js create mode 100644 node_modules/eslint/lib/rules/no-underscore-dangle.js create mode 100644 node_modules/eslint/lib/rules/no-unexpected-multiline.js create mode 100644 node_modules/eslint/lib/rules/no-unmodified-loop-condition.js create mode 100644 node_modules/eslint/lib/rules/no-unneeded-ternary.js create mode 100644 node_modules/eslint/lib/rules/no-unreachable-loop.js create mode 100644 node_modules/eslint/lib/rules/no-unreachable.js create mode 100644 node_modules/eslint/lib/rules/no-unsafe-finally.js create mode 100644 node_modules/eslint/lib/rules/no-unsafe-negation.js create mode 100644 node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js create mode 100644 node_modules/eslint/lib/rules/no-unused-expressions.js create mode 100644 node_modules/eslint/lib/rules/no-unused-labels.js create mode 100644 node_modules/eslint/lib/rules/no-unused-private-class-members.js create mode 100644 node_modules/eslint/lib/rules/no-unused-vars.js create mode 100644 node_modules/eslint/lib/rules/no-use-before-define.js create mode 100644 node_modules/eslint/lib/rules/no-useless-backreference.js create mode 100644 node_modules/eslint/lib/rules/no-useless-call.js create mode 100644 node_modules/eslint/lib/rules/no-useless-catch.js create mode 100644 node_modules/eslint/lib/rules/no-useless-computed-key.js create mode 100644 node_modules/eslint/lib/rules/no-useless-concat.js create mode 100644 node_modules/eslint/lib/rules/no-useless-constructor.js create mode 100644 node_modules/eslint/lib/rules/no-useless-escape.js create mode 100644 node_modules/eslint/lib/rules/no-useless-rename.js create mode 100644 node_modules/eslint/lib/rules/no-useless-return.js create mode 100644 node_modules/eslint/lib/rules/no-var.js create mode 100644 node_modules/eslint/lib/rules/no-void.js create mode 100644 node_modules/eslint/lib/rules/no-warning-comments.js create mode 100644 node_modules/eslint/lib/rules/no-whitespace-before-property.js create mode 100644 node_modules/eslint/lib/rules/no-with.js create mode 100644 node_modules/eslint/lib/rules/nonblock-statement-body-position.js create mode 100644 node_modules/eslint/lib/rules/object-curly-newline.js create mode 100644 node_modules/eslint/lib/rules/object-curly-spacing.js create mode 100644 node_modules/eslint/lib/rules/object-property-newline.js create mode 100644 node_modules/eslint/lib/rules/object-shorthand.js create mode 100644 node_modules/eslint/lib/rules/one-var-declaration-per-line.js create mode 100644 node_modules/eslint/lib/rules/one-var.js create mode 100644 node_modules/eslint/lib/rules/operator-assignment.js create mode 100644 node_modules/eslint/lib/rules/operator-linebreak.js create mode 100644 node_modules/eslint/lib/rules/padded-blocks.js create mode 100644 node_modules/eslint/lib/rules/padding-line-between-statements.js create mode 100644 node_modules/eslint/lib/rules/prefer-arrow-callback.js create mode 100644 node_modules/eslint/lib/rules/prefer-const.js create mode 100644 node_modules/eslint/lib/rules/prefer-destructuring.js create mode 100644 node_modules/eslint/lib/rules/prefer-exponentiation-operator.js create mode 100644 node_modules/eslint/lib/rules/prefer-named-capture-group.js create mode 100644 node_modules/eslint/lib/rules/prefer-numeric-literals.js create mode 100644 node_modules/eslint/lib/rules/prefer-object-has-own.js create mode 100644 node_modules/eslint/lib/rules/prefer-object-spread.js create mode 100644 node_modules/eslint/lib/rules/prefer-promise-reject-errors.js create mode 100644 node_modules/eslint/lib/rules/prefer-reflect.js create mode 100644 node_modules/eslint/lib/rules/prefer-regex-literals.js create mode 100644 node_modules/eslint/lib/rules/prefer-rest-params.js create mode 100644 node_modules/eslint/lib/rules/prefer-spread.js create mode 100644 node_modules/eslint/lib/rules/prefer-template.js create mode 100644 node_modules/eslint/lib/rules/quote-props.js create mode 100644 node_modules/eslint/lib/rules/quotes.js create mode 100644 node_modules/eslint/lib/rules/radix.js create mode 100644 node_modules/eslint/lib/rules/require-atomic-updates.js create mode 100644 node_modules/eslint/lib/rules/require-await.js create mode 100644 node_modules/eslint/lib/rules/require-jsdoc.js create mode 100644 node_modules/eslint/lib/rules/require-unicode-regexp.js create mode 100644 node_modules/eslint/lib/rules/require-yield.js create mode 100644 node_modules/eslint/lib/rules/rest-spread-spacing.js create mode 100644 node_modules/eslint/lib/rules/semi-spacing.js create mode 100644 node_modules/eslint/lib/rules/semi-style.js create mode 100644 node_modules/eslint/lib/rules/semi.js create mode 100644 node_modules/eslint/lib/rules/sort-imports.js create mode 100644 node_modules/eslint/lib/rules/sort-keys.js create mode 100644 node_modules/eslint/lib/rules/sort-vars.js create mode 100644 node_modules/eslint/lib/rules/space-before-blocks.js create mode 100644 node_modules/eslint/lib/rules/space-before-function-paren.js create mode 100644 node_modules/eslint/lib/rules/space-in-parens.js create mode 100644 node_modules/eslint/lib/rules/space-infix-ops.js create mode 100644 node_modules/eslint/lib/rules/space-unary-ops.js create mode 100644 node_modules/eslint/lib/rules/spaced-comment.js create mode 100644 node_modules/eslint/lib/rules/strict.js create mode 100644 node_modules/eslint/lib/rules/switch-colon-spacing.js create mode 100644 node_modules/eslint/lib/rules/symbol-description.js create mode 100644 node_modules/eslint/lib/rules/template-curly-spacing.js create mode 100644 node_modules/eslint/lib/rules/template-tag-spacing.js create mode 100644 node_modules/eslint/lib/rules/unicode-bom.js create mode 100644 node_modules/eslint/lib/rules/use-isnan.js create mode 100644 node_modules/eslint/lib/rules/utils/ast-utils.js create mode 100644 node_modules/eslint/lib/rules/utils/fix-tracker.js create mode 100644 node_modules/eslint/lib/rules/utils/keywords.js create mode 100644 node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js create mode 100644 node_modules/eslint/lib/rules/utils/patterns/letters.js create mode 100644 node_modules/eslint/lib/rules/utils/unicode/index.js create mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js create mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js create mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js create mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js create mode 100644 node_modules/eslint/lib/rules/valid-jsdoc.js create mode 100644 node_modules/eslint/lib/rules/valid-typeof.js create mode 100644 node_modules/eslint/lib/rules/vars-on-top.js create mode 100644 node_modules/eslint/lib/rules/wrap-iife.js create mode 100644 node_modules/eslint/lib/rules/wrap-regex.js create mode 100644 node_modules/eslint/lib/rules/yield-star-spacing.js create mode 100644 node_modules/eslint/lib/rules/yoda.js create mode 100644 node_modules/eslint/lib/shared/ajv.js create mode 100644 node_modules/eslint/lib/shared/ast-utils.js create mode 100644 node_modules/eslint/lib/shared/config-validator.js create mode 100644 node_modules/eslint/lib/shared/deprecation-warnings.js create mode 100644 node_modules/eslint/lib/shared/logging.js create mode 100644 node_modules/eslint/lib/shared/relative-module-resolver.js create mode 100644 node_modules/eslint/lib/shared/runtime-info.js create mode 100644 node_modules/eslint/lib/shared/string-utils.js create mode 100644 node_modules/eslint/lib/shared/traverser.js create mode 100644 node_modules/eslint/lib/shared/types.js create mode 100644 node_modules/eslint/lib/source-code/index.js create mode 100644 node_modules/eslint/lib/source-code/source-code.js create mode 100644 node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/cursors.js create mode 100644 node_modules/eslint/lib/source-code/token-store/decorative-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/filter-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/index.js create mode 100644 node_modules/eslint/lib/source-code/token-store/limit-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/skip-cursor.js create mode 100644 node_modules/eslint/lib/source-code/token-store/utils.js create mode 100644 node_modules/eslint/lib/unsupported-api.js create mode 100644 node_modules/eslint/messages/all-files-ignored.js create mode 100644 node_modules/eslint/messages/extend-config-missing.js create mode 100644 node_modules/eslint/messages/failed-to-read-json.js create mode 100644 node_modules/eslint/messages/file-not-found.js create mode 100644 node_modules/eslint/messages/no-config-found.js create mode 100644 node_modules/eslint/messages/plugin-conflict.js create mode 100644 node_modules/eslint/messages/plugin-invalid.js create mode 100644 node_modules/eslint/messages/plugin-missing.js create mode 100644 node_modules/eslint/messages/print-config-with-directory-path.js create mode 100644 node_modules/eslint/messages/whitespace-found.js create mode 100644 node_modules/eslint/node_modules/debug/LICENSE create mode 100644 node_modules/eslint/node_modules/debug/README.md create mode 100644 node_modules/eslint/node_modules/debug/package.json create mode 100644 node_modules/eslint/node_modules/debug/src/browser.js create mode 100644 node_modules/eslint/node_modules/debug/src/common.js create mode 100644 node_modules/eslint/node_modules/debug/src/index.js create mode 100644 node_modules/eslint/node_modules/debug/src/node.js create mode 100644 node_modules/eslint/node_modules/ms/index.js create mode 100644 node_modules/eslint/node_modules/ms/license.md create mode 100644 node_modules/eslint/node_modules/ms/package.json create mode 100644 node_modules/eslint/node_modules/ms/readme.md create mode 100644 node_modules/eslint/package.json create mode 100644 node_modules/espree/LICENSE create mode 100644 node_modules/espree/README.md create mode 100644 node_modules/espree/dist/espree.cjs create mode 100644 node_modules/espree/espree.js create mode 100644 node_modules/espree/lib/espree.js create mode 100644 node_modules/espree/lib/features.js create mode 100644 node_modules/espree/lib/options.js create mode 100644 node_modules/espree/lib/token-translator.js create mode 100644 node_modules/espree/lib/version.js create mode 100644 node_modules/espree/package.json create mode 100644 node_modules/esquery/README.md create mode 100644 node_modules/esquery/dist/esquery.esm.js create mode 100644 node_modules/esquery/dist/esquery.esm.min.js create mode 100644 node_modules/esquery/dist/esquery.esm.min.js.map create mode 100644 node_modules/esquery/dist/esquery.js create mode 100644 node_modules/esquery/dist/esquery.lite.js create mode 100644 node_modules/esquery/dist/esquery.lite.min.js create mode 100644 node_modules/esquery/dist/esquery.lite.min.js.map create mode 100644 node_modules/esquery/dist/esquery.min.js create mode 100644 node_modules/esquery/dist/esquery.min.js.map create mode 100644 node_modules/esquery/license.txt create mode 100644 node_modules/esquery/package.json create mode 100644 node_modules/esquery/parser.js create mode 100644 node_modules/esrecurse/.babelrc create mode 100644 node_modules/esrecurse/README.md create mode 100644 node_modules/esrecurse/esrecurse.js create mode 100644 node_modules/esrecurse/gulpfile.babel.js create mode 100755 node_modules/esrecurse/package.json create mode 100644 node_modules/estraverse/.jshintrc create mode 100644 node_modules/estraverse/LICENSE.BSD create mode 100644 node_modules/estraverse/README.md create mode 100644 node_modules/estraverse/estraverse.js create mode 100644 node_modules/estraverse/gulpfile.js create mode 100644 node_modules/estraverse/package.json create mode 100644 node_modules/esutils/LICENSE.BSD create mode 100644 node_modules/esutils/README.md create mode 100644 node_modules/esutils/lib/ast.js create mode 100644 node_modules/esutils/lib/code.js create mode 100644 node_modules/esutils/lib/keyword.js create mode 100644 node_modules/esutils/lib/utils.js create mode 100644 node_modules/esutils/package.json create mode 100644 node_modules/fast-deep-equal/LICENSE create mode 100644 node_modules/fast-deep-equal/README.md create mode 100644 node_modules/fast-deep-equal/es6/index.d.ts create mode 100644 node_modules/fast-deep-equal/es6/index.js create mode 100644 node_modules/fast-deep-equal/es6/react.d.ts create mode 100644 node_modules/fast-deep-equal/es6/react.js create mode 100644 node_modules/fast-deep-equal/index.d.ts create mode 100644 node_modules/fast-deep-equal/index.js create mode 100644 node_modules/fast-deep-equal/package.json create mode 100644 node_modules/fast-deep-equal/react.d.ts create mode 100644 node_modules/fast-deep-equal/react.js create mode 100644 node_modules/fast-json-stable-stringify/.eslintrc.yml create mode 100644 node_modules/fast-json-stable-stringify/.github/FUNDING.yml create mode 100644 node_modules/fast-json-stable-stringify/.travis.yml create mode 100644 node_modules/fast-json-stable-stringify/LICENSE create mode 100644 node_modules/fast-json-stable-stringify/README.md create mode 100644 node_modules/fast-json-stable-stringify/benchmark/index.js create mode 100644 node_modules/fast-json-stable-stringify/benchmark/test.json create mode 100644 node_modules/fast-json-stable-stringify/example/key_cmp.js create mode 100644 node_modules/fast-json-stable-stringify/example/nested.js create mode 100644 node_modules/fast-json-stable-stringify/example/str.js create mode 100644 node_modules/fast-json-stable-stringify/example/value_cmp.js create mode 100644 node_modules/fast-json-stable-stringify/index.d.ts create mode 100644 node_modules/fast-json-stable-stringify/index.js create mode 100644 node_modules/fast-json-stable-stringify/package.json create mode 100644 node_modules/fast-json-stable-stringify/test/cmp.js create mode 100644 node_modules/fast-json-stable-stringify/test/nested.js create mode 100644 node_modules/fast-json-stable-stringify/test/str.js create mode 100644 node_modules/fast-json-stable-stringify/test/to-json.js create mode 100644 node_modules/fast-levenshtein/LICENSE.md create mode 100644 node_modules/fast-levenshtein/README.md create mode 100644 node_modules/fast-levenshtein/levenshtein.js create mode 100644 node_modules/fast-levenshtein/package.json create mode 100644 node_modules/file-entry-cache/LICENSE create mode 100644 node_modules/file-entry-cache/README.md create mode 100644 node_modules/file-entry-cache/cache.js create mode 100644 node_modules/file-entry-cache/changelog.md create mode 100644 node_modules/file-entry-cache/package.json create mode 100644 node_modules/find-up/index.js create mode 100644 node_modules/find-up/license create mode 100644 node_modules/find-up/package.json create mode 100644 node_modules/find-up/readme.md create mode 100644 node_modules/flat-cache/LICENSE create mode 100644 node_modules/flat-cache/README.md create mode 100644 node_modules/flat-cache/changelog.md create mode 100644 node_modules/flat-cache/package.json create mode 100644 node_modules/flat-cache/src/cache.js create mode 100644 node_modules/flat-cache/src/del.js create mode 100644 node_modules/flat-cache/src/utils.js create mode 100644 node_modules/flatted/.github/FUNDING.yml create mode 100644 node_modules/flatted/.github/workflows/node.js.yml create mode 100644 node_modules/flatted/LICENSE create mode 100644 node_modules/flatted/README.md create mode 100644 node_modules/flatted/SPECS.md create mode 100644 node_modules/flatted/cjs/index.js create mode 100644 node_modules/flatted/cjs/package.json create mode 100644 node_modules/flatted/es.js create mode 100644 node_modules/flatted/esm/index.js create mode 100644 node_modules/flatted/flatted.jpg create mode 100644 node_modules/flatted/index.js create mode 100644 node_modules/flatted/min.js create mode 100644 node_modules/flatted/package.json create mode 100644 node_modules/flatted/php/flatted.php create mode 100644 node_modules/flatted/types.d.ts create mode 100644 node_modules/fs.realpath/LICENSE create mode 100644 node_modules/fs.realpath/README.md create mode 100644 node_modules/fs.realpath/index.js create mode 100644 node_modules/fs.realpath/old.js create mode 100644 node_modules/fs.realpath/package.json create mode 100644 node_modules/function.prototype.name/.editorconfig create mode 100644 node_modules/function.prototype.name/.eslintignore create mode 100644 node_modules/function.prototype.name/.eslintrc create mode 100644 node_modules/function.prototype.name/.github/FUNDING.yml create mode 100644 node_modules/function.prototype.name/.nycrc create mode 100644 node_modules/function.prototype.name/CHANGELOG.md create mode 100644 node_modules/function.prototype.name/LICENSE create mode 100644 node_modules/function.prototype.name/README.md create mode 100644 node_modules/function.prototype.name/auto.js create mode 100644 node_modules/function.prototype.name/helpers/functionsHaveNames.js create mode 100644 node_modules/function.prototype.name/implementation.js create mode 100644 node_modules/function.prototype.name/index.js create mode 100644 node_modules/function.prototype.name/package.json create mode 100644 node_modules/function.prototype.name/polyfill.js create mode 100644 node_modules/function.prototype.name/shim.js create mode 100644 node_modules/function.prototype.name/test/implementation.js create mode 100644 node_modules/function.prototype.name/test/index.js create mode 100644 node_modules/function.prototype.name/test/shimmed.js create mode 100644 node_modules/function.prototype.name/test/tests.js create mode 100644 node_modules/function.prototype.name/test/uglified.js create mode 100644 node_modules/functional-red-black-tree/.npmignore create mode 100644 node_modules/functional-red-black-tree/LICENSE create mode 100644 node_modules/functional-red-black-tree/README.md create mode 100644 node_modules/functional-red-black-tree/bench/test.js create mode 100644 node_modules/functional-red-black-tree/package.json create mode 100644 node_modules/functional-red-black-tree/rbtree.js create mode 100644 node_modules/functional-red-black-tree/test/test.js create mode 100644 node_modules/functions-have-names/.editorconfig create mode 100644 node_modules/functions-have-names/.eslintrc create mode 100644 node_modules/functions-have-names/.github/FUNDING.yml create mode 100644 node_modules/functions-have-names/.nycrc create mode 100644 node_modules/functions-have-names/CHANGELOG.md create mode 100644 node_modules/functions-have-names/LICENSE create mode 100644 node_modules/functions-have-names/README.md create mode 100644 node_modules/functions-have-names/index.js create mode 100644 node_modules/functions-have-names/package.json create mode 100644 node_modules/functions-have-names/test/index.js create mode 100644 node_modules/get-symbol-description/.eslintignore create mode 100644 node_modules/get-symbol-description/.eslintrc create mode 100644 node_modules/get-symbol-description/.github/FUNDING.yml create mode 100644 node_modules/get-symbol-description/.nycrc create mode 100644 node_modules/get-symbol-description/CHANGELOG.md create mode 100644 node_modules/get-symbol-description/LICENSE create mode 100644 node_modules/get-symbol-description/README.md create mode 100644 node_modules/get-symbol-description/getInferredName.js create mode 100644 node_modules/get-symbol-description/index.js create mode 100644 node_modules/get-symbol-description/package.json create mode 100644 node_modules/get-symbol-description/test/index.js create mode 100644 node_modules/glob-parent/LICENSE create mode 100644 node_modules/glob-parent/README.md create mode 100644 node_modules/glob-parent/index.js create mode 100644 node_modules/glob-parent/package.json create mode 100644 node_modules/glob/LICENSE create mode 100644 node_modules/glob/README.md create mode 100644 node_modules/glob/common.js create mode 100644 node_modules/glob/glob.js create mode 100644 node_modules/glob/package.json create mode 100644 node_modules/glob/sync.js create mode 100644 node_modules/globals/globals.json create mode 100644 node_modules/globals/index.d.ts create mode 100644 node_modules/globals/index.js create mode 100644 node_modules/globals/license create mode 100644 node_modules/globals/package.json create mode 100644 node_modules/globals/readme.md create mode 100644 node_modules/has-bigints/.eslintrc create mode 100644 node_modules/has-bigints/.github/FUNDING.yml create mode 100644 node_modules/has-bigints/.nycrc create mode 100644 node_modules/has-bigints/CHANGELOG.md create mode 100644 node_modules/has-bigints/LICENSE create mode 100644 node_modules/has-bigints/README.md create mode 100644 node_modules/has-bigints/index.js create mode 100644 node_modules/has-bigints/package.json create mode 100644 node_modules/has-bigints/test/index.js create mode 100644 node_modules/has-property-descriptors/.eslintrc create mode 100644 node_modules/has-property-descriptors/.github/FUNDING.yml create mode 100644 node_modules/has-property-descriptors/.nycrc create mode 100644 node_modules/has-property-descriptors/CHANGELOG.md create mode 100644 node_modules/has-property-descriptors/LICENSE create mode 100644 node_modules/has-property-descriptors/README.md create mode 100644 node_modules/has-property-descriptors/index.js create mode 100644 node_modules/has-property-descriptors/package.json create mode 100644 node_modules/has-property-descriptors/test/index.js create mode 100644 node_modules/has-tostringtag/.eslintrc create mode 100644 node_modules/has-tostringtag/.github/FUNDING.yml create mode 100644 node_modules/has-tostringtag/CHANGELOG.md create mode 100644 node_modules/has-tostringtag/LICENSE create mode 100644 node_modules/has-tostringtag/README.md create mode 100644 node_modules/has-tostringtag/index.js create mode 100644 node_modules/has-tostringtag/package.json create mode 100644 node_modules/has-tostringtag/shams.js create mode 100644 node_modules/has-tostringtag/test/index.js create mode 100644 node_modules/has-tostringtag/test/shams/core-js.js create mode 100644 node_modules/has-tostringtag/test/shams/get-own-property-symbols.js create mode 100644 node_modules/has-tostringtag/test/tests.js create mode 100644 node_modules/ignore/LICENSE-MIT create mode 100644 node_modules/ignore/README.md create mode 100644 node_modules/ignore/index.d.ts create mode 100644 node_modules/ignore/index.js create mode 100644 node_modules/ignore/legacy.js create mode 100644 node_modules/ignore/package.json create mode 100644 node_modules/import-fresh/index.d.ts create mode 100644 node_modules/import-fresh/index.js create mode 100644 node_modules/import-fresh/license create mode 100644 node_modules/import-fresh/package.json create mode 100644 node_modules/import-fresh/readme.md create mode 100644 node_modules/imurmurhash/README.md create mode 100644 node_modules/imurmurhash/imurmurhash.js create mode 100644 node_modules/imurmurhash/imurmurhash.min.js create mode 100644 node_modules/imurmurhash/package.json create mode 100644 node_modules/inflight/LICENSE create mode 100644 node_modules/inflight/README.md create mode 100644 node_modules/inflight/inflight.js create mode 100644 node_modules/inflight/package.json create mode 100644 node_modules/internal-slot/.editorconfig create mode 100644 node_modules/internal-slot/.eslintignore create mode 100644 node_modules/internal-slot/.eslintrc create mode 100644 node_modules/internal-slot/.github/FUNDING.yml create mode 100644 node_modules/internal-slot/.nycrc create mode 100644 node_modules/internal-slot/CHANGELOG.md create mode 100644 node_modules/internal-slot/LICENSE create mode 100644 node_modules/internal-slot/README.md create mode 100644 node_modules/internal-slot/index.js create mode 100644 node_modules/internal-slot/package.json create mode 100644 node_modules/internal-slot/test/index.js create mode 100644 node_modules/is-bigint/.eslintignore create mode 100644 node_modules/is-bigint/.eslintrc create mode 100644 node_modules/is-bigint/.github/FUNDING.yml create mode 100644 node_modules/is-bigint/.nycrc create mode 100644 node_modules/is-bigint/CHANGELOG.md create mode 100644 node_modules/is-bigint/LICENSE create mode 100644 node_modules/is-bigint/README.md create mode 100644 node_modules/is-bigint/index.js create mode 100644 node_modules/is-bigint/package.json create mode 100644 node_modules/is-bigint/test/index.js create mode 100644 node_modules/is-boolean-object/.editorconfig create mode 100644 node_modules/is-boolean-object/.eslintignore create mode 100644 node_modules/is-boolean-object/.eslintrc create mode 100644 node_modules/is-boolean-object/.github/FUNDING.yml create mode 100644 node_modules/is-boolean-object/.nycrc create mode 100644 node_modules/is-boolean-object/CHANGELOG.md create mode 100644 node_modules/is-boolean-object/LICENSE create mode 100644 node_modules/is-boolean-object/README.md create mode 100644 node_modules/is-boolean-object/index.js create mode 100644 node_modules/is-boolean-object/package.json create mode 100644 node_modules/is-boolean-object/test/index.js create mode 100644 node_modules/is-callable/.editorconfig create mode 100644 node_modules/is-callable/.eslintignore create mode 100644 node_modules/is-callable/.eslintrc create mode 100644 node_modules/is-callable/.github/FUNDING.yml create mode 100644 node_modules/is-callable/.istanbul.yml create mode 100644 node_modules/is-callable/.nycrc create mode 100644 node_modules/is-callable/CHANGELOG.md create mode 100644 node_modules/is-callable/LICENSE create mode 100644 node_modules/is-callable/README.md create mode 100644 node_modules/is-callable/index.js create mode 100644 node_modules/is-callable/package.json create mode 100644 node_modules/is-callable/test/index.js create mode 100644 node_modules/is-core-module/.eslintrc create mode 100644 node_modules/is-core-module/.nycrc 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-date-object/.editorconfig create mode 100644 node_modules/is-date-object/.eslintignore create mode 100644 node_modules/is-date-object/.eslintrc create mode 100644 node_modules/is-date-object/.github/FUNDING.yml create mode 100644 node_modules/is-date-object/.nycrc create mode 100644 node_modules/is-date-object/CHANGELOG.md create mode 100644 node_modules/is-date-object/LICENSE create mode 100644 node_modules/is-date-object/README.md create mode 100644 node_modules/is-date-object/index.js create mode 100644 node_modules/is-date-object/package.json create mode 100644 node_modules/is-date-object/test/index.js create mode 100644 node_modules/is-extglob/LICENSE create mode 100644 node_modules/is-extglob/README.md create mode 100644 node_modules/is-extglob/index.js create mode 100644 node_modules/is-extglob/package.json create mode 100644 node_modules/is-glob/LICENSE create mode 100644 node_modules/is-glob/README.md create mode 100644 node_modules/is-glob/index.js create mode 100644 node_modules/is-glob/package.json create mode 100644 node_modules/is-negative-zero/.editorconfig create mode 100644 node_modules/is-negative-zero/.eslintignore create mode 100644 node_modules/is-negative-zero/.eslintrc create mode 100644 node_modules/is-negative-zero/.github/FUNDING.yml create mode 100644 node_modules/is-negative-zero/.nycrc create mode 100644 node_modules/is-negative-zero/CHANGELOG.md create mode 100644 node_modules/is-negative-zero/LICENSE create mode 100644 node_modules/is-negative-zero/README.md create mode 100644 node_modules/is-negative-zero/index.js create mode 100644 node_modules/is-negative-zero/package.json create mode 100644 node_modules/is-negative-zero/test/index.js create mode 100644 node_modules/is-number-object/.editorconfig create mode 100644 node_modules/is-number-object/.eslintrc create mode 100644 node_modules/is-number-object/.github/FUNDING.yml create mode 100644 node_modules/is-number-object/.nycrc create mode 100644 node_modules/is-number-object/CHANGELOG.md create mode 100644 node_modules/is-number-object/LICENSE create mode 100644 node_modules/is-number-object/README.md create mode 100644 node_modules/is-number-object/index.js create mode 100644 node_modules/is-number-object/package.json create mode 100644 node_modules/is-number-object/test/index.js create mode 100644 node_modules/is-regex/.editorconfig create mode 100644 node_modules/is-regex/.eslintignore create mode 100644 node_modules/is-regex/.eslintrc create mode 100644 node_modules/is-regex/.nycrc create mode 100644 node_modules/is-regex/CHANGELOG.md create mode 100644 node_modules/is-regex/LICENSE create mode 100644 node_modules/is-regex/README.md create mode 100644 node_modules/is-regex/index.js create mode 100644 node_modules/is-regex/package.json create mode 100644 node_modules/is-regex/test/index.js create mode 100644 node_modules/is-shared-array-buffer/.eslintignore create mode 100644 node_modules/is-shared-array-buffer/.eslintrc create mode 100644 node_modules/is-shared-array-buffer/.github/FUNDING.yml create mode 100644 node_modules/is-shared-array-buffer/.nycrc create mode 100644 node_modules/is-shared-array-buffer/CHANGELOG.md create mode 100644 node_modules/is-shared-array-buffer/LICENSE create mode 100644 node_modules/is-shared-array-buffer/README.md create mode 100644 node_modules/is-shared-array-buffer/index.js create mode 100644 node_modules/is-shared-array-buffer/package.json create mode 100644 node_modules/is-shared-array-buffer/test/index.js create mode 100644 node_modules/is-string/.eslintignore create mode 100644 node_modules/is-string/.eslintrc create mode 100644 node_modules/is-string/.github/FUNDING.yml create mode 100644 node_modules/is-string/.nycrc create mode 100644 node_modules/is-string/CHANGELOG.md create mode 100644 node_modules/is-string/LICENSE create mode 100644 node_modules/is-string/README.md create mode 100644 node_modules/is-string/index.js create mode 100644 node_modules/is-string/package.json create mode 100644 node_modules/is-string/test/index.js create mode 100644 node_modules/is-symbol/.editorconfig create mode 100644 node_modules/is-symbol/.eslintignore create mode 100644 node_modules/is-symbol/.eslintrc create mode 100644 node_modules/is-symbol/.github/FUNDING.yml create mode 100644 node_modules/is-symbol/.nycrc create mode 100644 node_modules/is-symbol/CHANGELOG.md create mode 100644 node_modules/is-symbol/LICENSE create mode 100644 node_modules/is-symbol/README.md create mode 100644 node_modules/is-symbol/index.js create mode 100644 node_modules/is-symbol/package.json create mode 100644 node_modules/is-symbol/test/index.js create mode 100644 node_modules/is-weakref/.eslintignore create mode 100644 node_modules/is-weakref/.eslintrc create mode 100644 node_modules/is-weakref/.github/FUNDING.yml create mode 100644 node_modules/is-weakref/.nycrc create mode 100644 node_modules/is-weakref/CHANGELOG.md create mode 100644 node_modules/is-weakref/LICENSE create mode 100644 node_modules/is-weakref/README.md create mode 100644 node_modules/is-weakref/index.js create mode 100644 node_modules/is-weakref/package.json create mode 100644 node_modules/is-weakref/test/index.js create mode 100644 node_modules/isexe/.npmignore create mode 100644 node_modules/isexe/LICENSE create mode 100644 node_modules/isexe/README.md create mode 100644 node_modules/isexe/index.js create mode 100644 node_modules/isexe/mode.js create mode 100644 node_modules/isexe/package.json create mode 100644 node_modules/isexe/test/basic.js create mode 100644 node_modules/isexe/windows.js create mode 100644 node_modules/js-yaml/CHANGELOG.md create mode 100644 node_modules/js-yaml/LICENSE create mode 100644 node_modules/js-yaml/README.md create mode 100755 node_modules/js-yaml/bin/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 node_modules/js-yaml/dist/js-yaml.mjs create mode 100644 node_modules/js-yaml/index.js create mode 100644 node_modules/js-yaml/lib/common.js create mode 100644 node_modules/js-yaml/lib/dumper.js create mode 100644 node_modules/js-yaml/lib/exception.js create mode 100644 node_modules/js-yaml/lib/loader.js create mode 100644 node_modules/js-yaml/lib/schema.js create mode 100644 node_modules/js-yaml/lib/schema/core.js create mode 100644 node_modules/js-yaml/lib/schema/default.js create mode 100644 node_modules/js-yaml/lib/schema/failsafe.js create mode 100644 node_modules/js-yaml/lib/schema/json.js create mode 100644 node_modules/js-yaml/lib/snippet.js create mode 100644 node_modules/js-yaml/lib/type.js create mode 100644 node_modules/js-yaml/lib/type/binary.js create mode 100644 node_modules/js-yaml/lib/type/bool.js create mode 100644 node_modules/js-yaml/lib/type/float.js create mode 100644 node_modules/js-yaml/lib/type/int.js create mode 100644 node_modules/js-yaml/lib/type/map.js create mode 100644 node_modules/js-yaml/lib/type/merge.js create mode 100644 node_modules/js-yaml/lib/type/null.js create mode 100644 node_modules/js-yaml/lib/type/omap.js create mode 100644 node_modules/js-yaml/lib/type/pairs.js create mode 100644 node_modules/js-yaml/lib/type/seq.js create mode 100644 node_modules/js-yaml/lib/type/set.js create mode 100644 node_modules/js-yaml/lib/type/str.js create mode 100644 node_modules/js-yaml/lib/type/timestamp.js create mode 100644 node_modules/js-yaml/package.json create mode 100644 node_modules/json-schema-traverse/.eslintrc.yml create mode 100644 node_modules/json-schema-traverse/.travis.yml create mode 100644 node_modules/json-schema-traverse/LICENSE create mode 100644 node_modules/json-schema-traverse/README.md create mode 100644 node_modules/json-schema-traverse/index.js create mode 100644 node_modules/json-schema-traverse/package.json create mode 100644 node_modules/json-schema-traverse/spec/.eslintrc.yml create mode 100644 node_modules/json-schema-traverse/spec/fixtures/schema.js create mode 100644 node_modules/json-schema-traverse/spec/index.spec.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/.npmignore create mode 100644 node_modules/json-stable-stringify-without-jsonify/.travis.yml create mode 100644 node_modules/json-stable-stringify-without-jsonify/LICENSE create mode 100644 node_modules/json-stable-stringify-without-jsonify/example/key_cmp.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/example/nested.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/example/str.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/example/value_cmp.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/index.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/package.json create mode 100644 node_modules/json-stable-stringify-without-jsonify/readme.markdown create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/cmp.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/nested.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/replacer.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/space.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/str.js create mode 100644 node_modules/json-stable-stringify-without-jsonify/test/to-json.js create mode 100644 node_modules/json5/CHANGELOG.md create mode 100644 node_modules/json5/LICENSE.md create mode 100644 node_modules/json5/README.md create mode 100644 node_modules/json5/dist/index.js create mode 100755 node_modules/json5/lib/cli.js create mode 100644 node_modules/json5/lib/index.js create mode 100644 node_modules/json5/lib/parse.js create mode 100644 node_modules/json5/lib/register.js create mode 100644 node_modules/json5/lib/require.js create mode 100644 node_modules/json5/lib/stringify.js create mode 100644 node_modules/json5/lib/unicode.js create mode 100644 node_modules/json5/lib/util.js create mode 100644 node_modules/json5/package.json create mode 100644 node_modules/levn/LICENSE create mode 100644 node_modules/levn/README.md create mode 100644 node_modules/levn/lib/cast.js create mode 100644 node_modules/levn/lib/index.js create mode 100644 node_modules/levn/lib/parse-string.js create mode 100644 node_modules/levn/package.json create mode 100644 node_modules/locate-path/index.js create mode 100644 node_modules/locate-path/license create mode 100644 node_modules/locate-path/package.json create mode 100644 node_modules/locate-path/readme.md create mode 100644 node_modules/lodash.merge/LICENSE create mode 100644 node_modules/lodash.merge/README.md create mode 100644 node_modules/lodash.merge/index.js create mode 100644 node_modules/lodash.merge/package.json create mode 100644 node_modules/lru-cache/LICENSE create mode 100644 node_modules/lru-cache/README.md create mode 100644 node_modules/lru-cache/index.js create mode 100644 node_modules/lru-cache/package.json create mode 100644 node_modules/minimist/.travis.yml create mode 100644 node_modules/minimist/LICENSE create mode 100644 node_modules/minimist/example/parse.js create mode 100644 node_modules/minimist/index.js create mode 100644 node_modules/minimist/package.json create mode 100644 node_modules/minimist/readme.markdown create mode 100644 node_modules/minimist/test/all_bool.js create mode 100644 node_modules/minimist/test/bool.js create mode 100644 node_modules/minimist/test/dash.js create mode 100644 node_modules/minimist/test/default_bool.js create mode 100644 node_modules/minimist/test/dotted.js create mode 100644 node_modules/minimist/test/kv_short.js create mode 100644 node_modules/minimist/test/long.js create mode 100644 node_modules/minimist/test/num.js create mode 100644 node_modules/minimist/test/parse.js create mode 100644 node_modules/minimist/test/parse_modified.js create mode 100644 node_modules/minimist/test/proto.js create mode 100644 node_modules/minimist/test/short.js create mode 100644 node_modules/minimist/test/stop_early.js create mode 100644 node_modules/minimist/test/unknown.js create mode 100644 node_modules/minimist/test/whitespace.js create mode 100644 node_modules/natural-compare/README.md create mode 100644 node_modules/natural-compare/index.js create mode 100644 node_modules/natural-compare/package.json create mode 100644 node_modules/object-keys/.editorconfig create mode 100644 node_modules/object-keys/.eslintrc create mode 100644 node_modules/object-keys/.travis.yml create mode 100644 node_modules/object-keys/CHANGELOG.md create mode 100644 node_modules/object-keys/LICENSE create mode 100644 node_modules/object-keys/README.md create mode 100644 node_modules/object-keys/implementation.js create mode 100644 node_modules/object-keys/index.js create mode 100644 node_modules/object-keys/isArguments.js create mode 100644 node_modules/object-keys/package.json create mode 100644 node_modules/object-keys/test/index.js create mode 100644 node_modules/object.assign/.editorconfig create mode 100644 node_modules/object.assign/.eslintignore create mode 100644 node_modules/object.assign/.eslintrc create mode 100644 node_modules/object.assign/.github/FUNDING.yml create mode 100644 node_modules/object.assign/.github/workflows/rebase.yml create mode 100644 node_modules/object.assign/.github/workflows/require-allow-edits.yml create mode 100644 node_modules/object.assign/.nycrc create mode 100644 node_modules/object.assign/CHANGELOG.md create mode 100644 node_modules/object.assign/LICENSE create mode 100644 node_modules/object.assign/README.md create mode 100644 node_modules/object.assign/auto.js create mode 100644 node_modules/object.assign/dist/browser.js create mode 100644 node_modules/object.assign/hasSymbols.js create mode 100644 node_modules/object.assign/implementation.js create mode 100644 node_modules/object.assign/index.js create mode 100644 node_modules/object.assign/package.json create mode 100644 node_modules/object.assign/polyfill.js create mode 100644 node_modules/object.assign/shim.js create mode 100644 node_modules/object.assign/test/index.js create mode 100644 node_modules/object.assign/test/native.js create mode 100644 node_modules/object.assign/test/ses-compat.js create mode 100644 node_modules/object.assign/test/shimmed.js create mode 100644 node_modules/object.assign/test/tests.js create mode 100644 node_modules/object.values/.editorconfig create mode 100644 node_modules/object.values/.eslintignore create mode 100644 node_modules/object.values/.eslintrc create mode 100644 node_modules/object.values/.nycrc create mode 100644 node_modules/object.values/CHANGELOG.md create mode 100644 node_modules/object.values/LICENSE create mode 100644 node_modules/object.values/README.md create mode 100644 node_modules/object.values/auto.js create mode 100644 node_modules/object.values/implementation.js create mode 100644 node_modules/object.values/index.js create mode 100644 node_modules/object.values/package.json create mode 100644 node_modules/object.values/polyfill.js create mode 100644 node_modules/object.values/shim.js create mode 100644 node_modules/object.values/test/.eslintrc create mode 100644 node_modules/object.values/test/implementation.js create mode 100644 node_modules/object.values/test/index.js create mode 100644 node_modules/object.values/test/shimmed.js create mode 100644 node_modules/object.values/test/tests.js create mode 100644 node_modules/once/LICENSE create mode 100644 node_modules/once/README.md create mode 100644 node_modules/once/once.js create mode 100644 node_modules/once/package.json create mode 100644 node_modules/optionator/CHANGELOG.md create mode 100644 node_modules/optionator/LICENSE create mode 100644 node_modules/optionator/README.md create mode 100644 node_modules/optionator/lib/help.js create mode 100644 node_modules/optionator/lib/index.js create mode 100644 node_modules/optionator/lib/util.js create mode 100644 node_modules/optionator/package.json create mode 100644 node_modules/p-limit/index.js create mode 100644 node_modules/p-limit/license create mode 100644 node_modules/p-limit/package.json create mode 100644 node_modules/p-limit/readme.md create mode 100644 node_modules/p-locate/index.js create mode 100644 node_modules/p-locate/license create mode 100644 node_modules/p-locate/package.json create mode 100644 node_modules/p-locate/readme.md create mode 100644 node_modules/p-try/index.js create mode 100644 node_modules/p-try/license create mode 100644 node_modules/p-try/package.json create mode 100644 node_modules/p-try/readme.md create mode 100644 node_modules/parent-module/index.js create mode 100644 node_modules/parent-module/license create mode 100644 node_modules/parent-module/package.json create mode 100644 node_modules/parent-module/readme.md create mode 100644 node_modules/path-exists/index.js create mode 100644 node_modules/path-exists/license create mode 100644 node_modules/path-exists/package.json create mode 100644 node_modules/path-exists/readme.md create mode 100644 node_modules/path-is-absolute/index.js create mode 100644 node_modules/path-is-absolute/license create mode 100644 node_modules/path-is-absolute/package.json create mode 100644 node_modules/path-is-absolute/readme.md create mode 100644 node_modules/path-key/index.d.ts create mode 100644 node_modules/path-key/index.js create mode 100644 node_modules/path-key/license create mode 100644 node_modules/path-key/package.json create mode 100644 node_modules/path-key/readme.md create mode 100644 node_modules/path-parse/LICENSE create mode 100644 node_modules/path-parse/README.md create mode 100644 node_modules/path-parse/index.js create mode 100644 node_modules/path-parse/package.json create mode 100644 node_modules/prelude-ls/CHANGELOG.md create mode 100644 node_modules/prelude-ls/LICENSE create mode 100644 node_modules/prelude-ls/README.md create mode 100644 node_modules/prelude-ls/lib/Func.js create mode 100644 node_modules/prelude-ls/lib/List.js create mode 100644 node_modules/prelude-ls/lib/Num.js create mode 100644 node_modules/prelude-ls/lib/Obj.js create mode 100644 node_modules/prelude-ls/lib/Str.js create mode 100644 node_modules/prelude-ls/lib/index.js create mode 100644 node_modules/prelude-ls/package.json create mode 100644 node_modules/punycode/LICENSE-MIT.txt create mode 100644 node_modules/punycode/README.md create mode 100644 node_modules/punycode/package.json create mode 100644 node_modules/punycode/punycode.es6.js create mode 100644 node_modules/punycode/punycode.js create mode 100644 node_modules/regexp.prototype.flags/.editorconfig create mode 100644 node_modules/regexp.prototype.flags/.eslintrc create mode 100644 node_modules/regexp.prototype.flags/.nycrc create mode 100644 node_modules/regexp.prototype.flags/CHANGELOG.md create mode 100644 node_modules/regexp.prototype.flags/LICENSE create mode 100644 node_modules/regexp.prototype.flags/README.md create mode 100644 node_modules/regexp.prototype.flags/auto.js create mode 100644 node_modules/regexp.prototype.flags/implementation.js create mode 100644 node_modules/regexp.prototype.flags/index.js create mode 100644 node_modules/regexp.prototype.flags/package.json create mode 100644 node_modules/regexp.prototype.flags/polyfill.js create mode 100644 node_modules/regexp.prototype.flags/shim.js create mode 100644 node_modules/regexp.prototype.flags/test/implementation.js create mode 100644 node_modules/regexp.prototype.flags/test/index.js create mode 100644 node_modules/regexp.prototype.flags/test/shimmed.js create mode 100644 node_modules/regexp.prototype.flags/test/tests.js create mode 100644 node_modules/regexpp/LICENSE create mode 100644 node_modules/regexpp/README.md create mode 100644 node_modules/regexpp/index.d.ts create mode 100644 node_modules/regexpp/index.js create mode 100644 node_modules/regexpp/index.js.map create mode 100644 node_modules/regexpp/index.mjs create mode 100644 node_modules/regexpp/index.mjs.map create mode 100644 node_modules/regexpp/package.json create mode 100644 node_modules/resolve-from/index.js create mode 100644 node_modules/resolve-from/license create mode 100644 node_modules/resolve-from/package.json create mode 100644 node_modules/resolve-from/readme.md create mode 100644 node_modules/resolve/.editorconfig create mode 100644 node_modules/resolve/.eslintrc create mode 100644 node_modules/resolve/.github/FUNDING.yml create mode 100644 node_modules/resolve/LICENSE create mode 100644 node_modules/resolve/SECURITY.md create mode 100644 node_modules/resolve/async.js create mode 100755 node_modules/resolve/bin/resolve create mode 100644 node_modules/resolve/example/async.js create mode 100644 node_modules/resolve/example/sync.js create mode 100644 node_modules/resolve/index.js create mode 100644 node_modules/resolve/lib/async.js create mode 100644 node_modules/resolve/lib/caller.js create mode 100644 node_modules/resolve/lib/core.js create mode 100644 node_modules/resolve/lib/core.json create mode 100644 node_modules/resolve/lib/homedir.js create mode 100644 node_modules/resolve/lib/is-core.js create mode 100644 node_modules/resolve/lib/node-modules-paths.js create mode 100644 node_modules/resolve/lib/normalize-options.js create mode 100644 node_modules/resolve/lib/sync.js create mode 100644 node_modules/resolve/package.json create mode 100644 node_modules/resolve/readme.markdown create mode 100644 node_modules/resolve/sync.js create mode 100644 node_modules/resolve/test/core.js create mode 100644 node_modules/resolve/test/dotdot.js create mode 100644 node_modules/resolve/test/dotdot/abc/index.js create mode 100644 node_modules/resolve/test/dotdot/index.js create mode 100644 node_modules/resolve/test/faulty_basedir.js create mode 100644 node_modules/resolve/test/filter.js create mode 100644 node_modules/resolve/test/filter_sync.js create mode 100644 node_modules/resolve/test/home_paths.js create mode 100644 node_modules/resolve/test/home_paths_sync.js create mode 100644 node_modules/resolve/test/mock.js create mode 100644 node_modules/resolve/test/mock_sync.js create mode 100644 node_modules/resolve/test/module_dir.js create mode 100644 node_modules/resolve/test/module_dir/xmodules/aaa/index.js create mode 100644 node_modules/resolve/test/module_dir/ymodules/aaa/index.js create mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/main.js create mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/package.json create mode 100644 node_modules/resolve/test/node-modules-paths.js create mode 100644 node_modules/resolve/test/node_path.js create mode 100644 node_modules/resolve/test/node_path/x/aaa/index.js create mode 100644 node_modules/resolve/test/node_path/x/ccc/index.js create mode 100644 node_modules/resolve/test/node_path/y/bbb/index.js create mode 100644 node_modules/resolve/test/node_path/y/ccc/index.js create mode 100644 node_modules/resolve/test/nonstring.js create mode 100644 node_modules/resolve/test/pathfilter.js create mode 100644 node_modules/resolve/test/pathfilter/deep_ref/main.js create mode 100644 node_modules/resolve/test/precedence.js create mode 100644 node_modules/resolve/test/precedence/aaa.js create mode 100644 node_modules/resolve/test/precedence/aaa/index.js create mode 100644 node_modules/resolve/test/precedence/aaa/main.js create mode 100644 node_modules/resolve/test/precedence/bbb.js create mode 100644 node_modules/resolve/test/precedence/bbb/main.js create mode 100644 node_modules/resolve/test/resolver.js create mode 100644 node_modules/resolve/test/resolver/baz/doom.js create mode 100644 node_modules/resolve/test/resolver/baz/package.json create mode 100644 node_modules/resolve/test/resolver/baz/quux.js create mode 100644 node_modules/resolve/test/resolver/browser_field/a.js create mode 100644 node_modules/resolve/test/resolver/browser_field/b.js create mode 100644 node_modules/resolve/test/resolver/browser_field/package.json create mode 100644 node_modules/resolve/test/resolver/cup.coffee create mode 100644 node_modules/resolve/test/resolver/dot_main/index.js create mode 100644 node_modules/resolve/test/resolver/dot_main/package.json create mode 100644 node_modules/resolve/test/resolver/dot_slash_main/index.js create mode 100644 node_modules/resolve/test/resolver/dot_slash_main/package.json create mode 100644 node_modules/resolve/test/resolver/false_main/index.js create mode 100644 node_modules/resolve/test/resolver/false_main/package.json create mode 100644 node_modules/resolve/test/resolver/foo.js create mode 100644 node_modules/resolve/test/resolver/incorrect_main/index.js create mode 100644 node_modules/resolve/test/resolver/incorrect_main/package.json create mode 100644 node_modules/resolve/test/resolver/invalid_main/package.json create mode 100644 node_modules/resolve/test/resolver/malformed_package_json/index.js create mode 100644 node_modules/resolve/test/resolver/malformed_package_json/package.json create mode 100644 node_modules/resolve/test/resolver/mug.coffee create mode 100644 node_modules/resolve/test/resolver/mug.js create mode 100644 node_modules/resolve/test/resolver/multirepo/lerna.json create mode 100644 node_modules/resolve/test/resolver/multirepo/package.json create mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js create mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json create mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js create mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json create mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js create mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json create mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js create mode 100644 node_modules/resolve/test/resolver/other_path/lib/other-lib.js create mode 100644 node_modules/resolve/test/resolver/other_path/root.js create mode 100644 node_modules/resolve/test/resolver/quux/foo/index.js create mode 100644 node_modules/resolve/test/resolver/same_names/foo.js create mode 100644 node_modules/resolve/test/resolver/same_names/foo/index.js create mode 100644 node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js create mode 100644 node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep create mode 100644 node_modules/resolve/test/resolver/symlinked/package/bar.js create mode 100644 node_modules/resolve/test/resolver/symlinked/package/package.json create mode 100644 node_modules/resolve/test/resolver/without_basedir/main.js create mode 100644 node_modules/resolve/test/resolver_sync.js create mode 100644 node_modules/resolve/test/shadowed_core.js create mode 100644 node_modules/resolve/test/shadowed_core/node_modules/util/index.js create mode 100644 node_modules/resolve/test/subdirs.js create mode 100644 node_modules/resolve/test/symlinks.js create mode 100644 node_modules/rimraf/CHANGELOG.md create mode 100644 node_modules/rimraf/LICENSE create mode 100644 node_modules/rimraf/README.md create mode 100755 node_modules/rimraf/bin.js create mode 100644 node_modules/rimraf/package.json create mode 100644 node_modules/rimraf/rimraf.js create mode 100644 node_modules/semver/LICENSE create mode 100644 node_modules/semver/README.md create mode 100755 node_modules/semver/bin/semver.js 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/parse-options.js create mode 100644 node_modules/semver/internal/re.js create mode 100644 node_modules/semver/package.json create mode 100644 node_modules/semver/preload.js create mode 100644 node_modules/semver/range.bnf 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/shebang-command/index.js create mode 100644 node_modules/shebang-command/license create mode 100644 node_modules/shebang-command/package.json create mode 100644 node_modules/shebang-command/readme.md create mode 100644 node_modules/shebang-regex/index.d.ts create mode 100644 node_modules/shebang-regex/index.js create mode 100644 node_modules/shebang-regex/license create mode 100644 node_modules/shebang-regex/package.json create mode 100644 node_modules/shebang-regex/readme.md create mode 100644 node_modules/string.prototype.trimend/.editorconfig create mode 100644 node_modules/string.prototype.trimend/.eslintrc create mode 100644 node_modules/string.prototype.trimend/.nycrc create mode 100644 node_modules/string.prototype.trimend/CHANGELOG.md create mode 100644 node_modules/string.prototype.trimend/LICENSE create mode 100644 node_modules/string.prototype.trimend/README.md create mode 100644 node_modules/string.prototype.trimend/auto.js create mode 100644 node_modules/string.prototype.trimend/implementation.js create mode 100644 node_modules/string.prototype.trimend/index.js create mode 100644 node_modules/string.prototype.trimend/package.json create mode 100644 node_modules/string.prototype.trimend/polyfill.js create mode 100644 node_modules/string.prototype.trimend/shim.js create mode 100644 node_modules/string.prototype.trimend/test/implementation.js create mode 100644 node_modules/string.prototype.trimend/test/index.js create mode 100644 node_modules/string.prototype.trimend/test/shimmed.js create mode 100644 node_modules/string.prototype.trimend/test/tests.js create mode 100644 node_modules/string.prototype.trimstart/.editorconfig create mode 100644 node_modules/string.prototype.trimstart/.eslintrc create mode 100644 node_modules/string.prototype.trimstart/.nycrc create mode 100644 node_modules/string.prototype.trimstart/CHANGELOG.md create mode 100644 node_modules/string.prototype.trimstart/LICENSE create mode 100644 node_modules/string.prototype.trimstart/README.md create mode 100644 node_modules/string.prototype.trimstart/auto.js create mode 100644 node_modules/string.prototype.trimstart/implementation.js create mode 100644 node_modules/string.prototype.trimstart/index.js create mode 100644 node_modules/string.prototype.trimstart/package.json create mode 100644 node_modules/string.prototype.trimstart/polyfill.js create mode 100644 node_modules/string.prototype.trimstart/shim.js create mode 100644 node_modules/string.prototype.trimstart/test/implementation.js create mode 100644 node_modules/string.prototype.trimstart/test/index.js create mode 100644 node_modules/string.prototype.trimstart/test/shimmed.js create mode 100644 node_modules/string.prototype.trimstart/test/tests.js create mode 100644 node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/strip-ansi/index.js create mode 100644 node_modules/strip-ansi/license create mode 100644 node_modules/strip-ansi/package.json create mode 100644 node_modules/strip-ansi/readme.md create mode 100644 node_modules/strip-bom/index.js create mode 100644 node_modules/strip-bom/license create mode 100644 node_modules/strip-bom/package.json create mode 100644 node_modules/strip-bom/readme.md create mode 100644 node_modules/strip-json-comments/index.d.ts create mode 100644 node_modules/strip-json-comments/index.js create mode 100644 node_modules/strip-json-comments/license create mode 100644 node_modules/strip-json-comments/package.json create mode 100644 node_modules/strip-json-comments/readme.md create mode 100644 node_modules/supports-preserve-symlinks-flag/.eslintrc create mode 100644 node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml create mode 100644 node_modules/supports-preserve-symlinks-flag/.nycrc create mode 100644 node_modules/supports-preserve-symlinks-flag/CHANGELOG.md create mode 100644 node_modules/supports-preserve-symlinks-flag/LICENSE create mode 100644 node_modules/supports-preserve-symlinks-flag/README.md create mode 100644 node_modules/supports-preserve-symlinks-flag/browser.js create mode 100644 node_modules/supports-preserve-symlinks-flag/index.js create mode 100644 node_modules/supports-preserve-symlinks-flag/package.json create mode 100644 node_modules/supports-preserve-symlinks-flag/test/index.js create mode 100644 node_modules/text-table/.travis.yml create mode 100644 node_modules/text-table/LICENSE create mode 100644 node_modules/text-table/example/align.js create mode 100644 node_modules/text-table/example/center.js create mode 100644 node_modules/text-table/example/dotalign.js create mode 100644 node_modules/text-table/example/doubledot.js create mode 100644 node_modules/text-table/example/table.js create mode 100644 node_modules/text-table/index.js create mode 100644 node_modules/text-table/package.json create mode 100644 node_modules/text-table/readme.markdown create mode 100644 node_modules/text-table/test/align.js create mode 100644 node_modules/text-table/test/ansi-colors.js create mode 100644 node_modules/text-table/test/center.js create mode 100644 node_modules/text-table/test/dotalign.js create mode 100644 node_modules/text-table/test/doubledot.js create mode 100644 node_modules/text-table/test/table.js create mode 100644 node_modules/tsconfig-paths/CHANGELOG.md create mode 100644 node_modules/tsconfig-paths/LICENSE create mode 100644 node_modules/tsconfig-paths/README.md create mode 100644 node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/try-path.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts create mode 100644 node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js create mode 100644 node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map create mode 100644 node_modules/tsconfig-paths/lib/config-loader.d.ts create mode 100644 node_modules/tsconfig-paths/lib/config-loader.js create mode 100644 node_modules/tsconfig-paths/lib/config-loader.js.map create mode 100644 node_modules/tsconfig-paths/lib/filesystem.d.ts create mode 100644 node_modules/tsconfig-paths/lib/filesystem.js create mode 100644 node_modules/tsconfig-paths/lib/filesystem.js.map create mode 100644 node_modules/tsconfig-paths/lib/index.d.ts create mode 100644 node_modules/tsconfig-paths/lib/index.js create mode 100644 node_modules/tsconfig-paths/lib/index.js.map create mode 100644 node_modules/tsconfig-paths/lib/mapping-entry.d.ts create mode 100644 node_modules/tsconfig-paths/lib/mapping-entry.js create mode 100644 node_modules/tsconfig-paths/lib/mapping-entry.js.map create mode 100644 node_modules/tsconfig-paths/lib/match-path-async.d.ts create mode 100644 node_modules/tsconfig-paths/lib/match-path-async.js create mode 100644 node_modules/tsconfig-paths/lib/match-path-async.js.map create mode 100644 node_modules/tsconfig-paths/lib/match-path-sync.d.ts create mode 100644 node_modules/tsconfig-paths/lib/match-path-sync.js create mode 100644 node_modules/tsconfig-paths/lib/match-path-sync.js.map create mode 100644 node_modules/tsconfig-paths/lib/options.d.ts create mode 100644 node_modules/tsconfig-paths/lib/options.js create mode 100644 node_modules/tsconfig-paths/lib/options.js.map create mode 100644 node_modules/tsconfig-paths/lib/register.d.ts create mode 100644 node_modules/tsconfig-paths/lib/register.js create mode 100644 node_modules/tsconfig-paths/lib/register.js.map create mode 100644 node_modules/tsconfig-paths/lib/try-path.d.ts create mode 100644 node_modules/tsconfig-paths/lib/try-path.js create mode 100644 node_modules/tsconfig-paths/lib/try-path.js.map create mode 100644 node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts create mode 100644 node_modules/tsconfig-paths/lib/tsconfig-loader.js create mode 100644 node_modules/tsconfig-paths/lib/tsconfig-loader.js.map create mode 100644 node_modules/tsconfig-paths/package.json create mode 100644 node_modules/tsconfig-paths/register.js create mode 100644 node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/try-path.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts create mode 100644 node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json create mode 100644 node_modules/tsconfig-paths/src/config-loader.ts create mode 100644 node_modules/tsconfig-paths/src/filesystem.ts create mode 100644 node_modules/tsconfig-paths/src/index.ts create mode 100644 node_modules/tsconfig-paths/src/mapping-entry.ts create mode 100644 node_modules/tsconfig-paths/src/match-path-async.ts create mode 100644 node_modules/tsconfig-paths/src/match-path-sync.ts create mode 100644 node_modules/tsconfig-paths/src/options.ts create mode 100644 node_modules/tsconfig-paths/src/register.ts create mode 100644 node_modules/tsconfig-paths/src/try-path.ts create mode 100644 node_modules/tsconfig-paths/src/tsconfig-loader.ts create mode 100644 node_modules/type-check/LICENSE create mode 100644 node_modules/type-check/README.md create mode 100644 node_modules/type-check/lib/check.js create mode 100644 node_modules/type-check/lib/index.js create mode 100644 node_modules/type-check/lib/parse-type.js create mode 100644 node_modules/type-check/package.json create mode 100644 node_modules/type-fest/base.d.ts create mode 100644 node_modules/type-fest/index.d.ts create mode 100644 node_modules/type-fest/license create mode 100644 node_modules/type-fest/package.json create mode 100644 node_modules/type-fest/readme.md create mode 100644 node_modules/type-fest/source/async-return-type.d.ts create mode 100644 node_modules/type-fest/source/asyncify.d.ts create mode 100644 node_modules/type-fest/source/basic.d.ts create mode 100644 node_modules/type-fest/source/conditional-except.d.ts create mode 100644 node_modules/type-fest/source/conditional-keys.d.ts create mode 100644 node_modules/type-fest/source/conditional-pick.d.ts create mode 100644 node_modules/type-fest/source/entries.d.ts create mode 100644 node_modules/type-fest/source/entry.d.ts create mode 100644 node_modules/type-fest/source/except.d.ts create mode 100644 node_modules/type-fest/source/fixed-length-array.d.ts create mode 100644 node_modules/type-fest/source/iterable-element.d.ts create mode 100644 node_modules/type-fest/source/literal-union.d.ts create mode 100644 node_modules/type-fest/source/merge-exclusive.d.ts create mode 100644 node_modules/type-fest/source/merge.d.ts create mode 100644 node_modules/type-fest/source/mutable.d.ts create mode 100644 node_modules/type-fest/source/opaque.d.ts create mode 100644 node_modules/type-fest/source/package-json.d.ts create mode 100644 node_modules/type-fest/source/partial-deep.d.ts create mode 100644 node_modules/type-fest/source/promisable.d.ts create mode 100644 node_modules/type-fest/source/promise-value.d.ts create mode 100644 node_modules/type-fest/source/readonly-deep.d.ts create mode 100644 node_modules/type-fest/source/require-at-least-one.d.ts create mode 100644 node_modules/type-fest/source/require-exactly-one.d.ts create mode 100644 node_modules/type-fest/source/set-optional.d.ts create mode 100644 node_modules/type-fest/source/set-required.d.ts create mode 100644 node_modules/type-fest/source/set-return-type.d.ts create mode 100644 node_modules/type-fest/source/stringified.d.ts create mode 100644 node_modules/type-fest/source/tsconfig-json.d.ts create mode 100644 node_modules/type-fest/source/union-to-intersection.d.ts create mode 100644 node_modules/type-fest/source/utilities.d.ts create mode 100644 node_modules/type-fest/source/value-of.d.ts create mode 100644 node_modules/type-fest/ts41/camel-case.d.ts create mode 100644 node_modules/type-fest/ts41/delimiter-case.d.ts create mode 100644 node_modules/type-fest/ts41/index.d.ts create mode 100644 node_modules/type-fest/ts41/kebab-case.d.ts create mode 100644 node_modules/type-fest/ts41/pascal-case.d.ts create mode 100644 node_modules/type-fest/ts41/snake-case.d.ts create mode 100644 node_modules/unbox-primitive/.editorconfig create mode 100644 node_modules/unbox-primitive/.eslintrc create mode 100644 node_modules/unbox-primitive/.github/FUNDING.yml create mode 100644 node_modules/unbox-primitive/.nycrc create mode 100644 node_modules/unbox-primitive/CHANGELOG.md create mode 100644 node_modules/unbox-primitive/LICENSE create mode 100644 node_modules/unbox-primitive/README.md create mode 100644 node_modules/unbox-primitive/index.js create mode 100644 node_modules/unbox-primitive/package.json create mode 100644 node_modules/unbox-primitive/test/index.js create mode 100755 node_modules/uri-js/LICENSE create mode 100755 node_modules/uri-js/README.md create mode 100755 node_modules/uri-js/dist/es5/uri.all.d.ts create mode 100755 node_modules/uri-js/dist/es5/uri.all.js create mode 100755 node_modules/uri-js/dist/es5/uri.all.js.map create mode 100755 node_modules/uri-js/dist/es5/uri.all.min.d.ts create mode 100755 node_modules/uri-js/dist/es5/uri.all.min.js create mode 100755 node_modules/uri-js/dist/es5/uri.all.min.js.map create mode 100755 node_modules/uri-js/dist/esnext/index.d.ts create mode 100755 node_modules/uri-js/dist/esnext/index.js create mode 100755 node_modules/uri-js/dist/esnext/index.js.map create mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.d.ts create mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.js create mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.js.map create mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.d.ts create mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.js create mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/http.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/http.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/http.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/https.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/https.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/https.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.js.map create mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.d.ts create mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.js create mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.js.map create mode 100755 node_modules/uri-js/dist/esnext/uri.d.ts create mode 100755 node_modules/uri-js/dist/esnext/uri.js create mode 100755 node_modules/uri-js/dist/esnext/uri.js.map create mode 100755 node_modules/uri-js/dist/esnext/util.d.ts create mode 100755 node_modules/uri-js/dist/esnext/util.js create mode 100755 node_modules/uri-js/dist/esnext/util.js.map create mode 100755 node_modules/uri-js/package.json create mode 100755 node_modules/uri-js/yarn.lock create mode 100644 node_modules/v8-compile-cache/CHANGELOG.md create mode 100644 node_modules/v8-compile-cache/LICENSE create mode 100644 node_modules/v8-compile-cache/README.md create mode 100644 node_modules/v8-compile-cache/package.json create mode 100644 node_modules/v8-compile-cache/v8-compile-cache.js create mode 100644 node_modules/which-boxed-primitive/.editorconfig create mode 100644 node_modules/which-boxed-primitive/.eslintignore create mode 100644 node_modules/which-boxed-primitive/.eslintrc create mode 100644 node_modules/which-boxed-primitive/.github/FUNDING.yml create mode 100644 node_modules/which-boxed-primitive/.nycrc create mode 100644 node_modules/which-boxed-primitive/CHANGELOG.md create mode 100644 node_modules/which-boxed-primitive/LICENSE create mode 100644 node_modules/which-boxed-primitive/README.md create mode 100644 node_modules/which-boxed-primitive/index.js create mode 100644 node_modules/which-boxed-primitive/package.json create mode 100644 node_modules/which-boxed-primitive/test/index.js create mode 100644 node_modules/which/CHANGELOG.md create mode 100644 node_modules/which/LICENSE create mode 100644 node_modules/which/README.md create mode 100755 node_modules/which/bin/node-which create mode 100644 node_modules/which/package.json create mode 100644 node_modules/which/which.js create mode 100644 node_modules/word-wrap/LICENSE create mode 100644 node_modules/word-wrap/README.md create mode 100644 node_modules/word-wrap/index.d.ts create mode 100644 node_modules/word-wrap/index.js create mode 100644 node_modules/word-wrap/package.json create mode 100644 node_modules/wrappy/LICENSE create mode 100644 node_modules/wrappy/README.md create mode 100644 node_modules/wrappy/package.json create mode 100644 node_modules/wrappy/wrappy.js create mode 100644 node_modules/yallist/LICENSE create mode 100644 node_modules/yallist/README.md create mode 100644 node_modules/yallist/iterator.js create mode 100644 node_modules/yallist/package.json create mode 100644 node_modules/yallist/yallist.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..bc9d739 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es2021": true + }, + "extends": [ + "standard" + ], + "parserOptions": { + "ecmaVersion": "latest" + }, + "rules": { + "indent": ["error", 4] + } +} diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn new file mode 120000 index 0000000..cf76760 --- /dev/null +++ b/node_modules/.bin/acorn @@ -0,0 +1 @@ +../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/.bin/eslint b/node_modules/.bin/eslint new file mode 120000 index 0000000..810e4bc --- /dev/null +++ b/node_modules/.bin/eslint @@ -0,0 +1 @@ +../eslint/bin/eslint.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 120000 index 0000000..9dbd010 --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/json5 b/node_modules/.bin/json5 new file mode 120000 index 0000000..217f379 --- /dev/null +++ b/node_modules/.bin/json5 @@ -0,0 +1 @@ +../json5/lib/cli.js \ No newline at end of file diff --git a/node_modules/.bin/node-which b/node_modules/.bin/node-which new file mode 120000 index 0000000..6f8415e --- /dev/null +++ b/node_modules/.bin/node-which @@ -0,0 +1 @@ +../which/bin/node-which \ No newline at end of file diff --git a/node_modules/.bin/resolve b/node_modules/.bin/resolve new file mode 120000 index 0000000..b6afda6 --- /dev/null +++ b/node_modules/.bin/resolve @@ -0,0 +1 @@ +../resolve/bin/resolve \ No newline at end of file diff --git a/node_modules/.bin/rimraf b/node_modules/.bin/rimraf new file mode 120000 index 0000000..4cd49a4 --- /dev/null +++ b/node_modules/.bin/rimraf @@ -0,0 +1 @@ +../rimraf/bin.js \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 120000 index 0000000..5aaadf4 --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index efdca40..80f408e 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -4,6 +4,98 @@ "lockfileVersion": 2, "requires": true, "packages": { + "node_modules/@eslint/eslintrc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", + "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.2", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -16,6 +108,52 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -30,11 +168,54 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/array-includes": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -77,6 +258,15 @@ "concat-map": "0.0.1" } }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -97,6 +287,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -165,6 +364,20 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -173,6 +386,28 @@ "ms": "2.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dev": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -190,6 +425,18 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -217,11 +464,464 @@ "node": ">= 0.8" } }, + "node_modules/es-abstract": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", + "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.3.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.2", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-standard": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peerDependencies": { + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-module-utils": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-n": { + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz", + "integrity": "sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw==", + "dev": true, + "dependencies": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-promise": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", + "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/espree": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "dev": true, + "dependencies": { + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -271,6 +971,36 @@ "node": ">= 0.10.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -315,6 +1045,37 @@ "node": ">= 0.8" } }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -331,11 +1092,50 @@ "node": ">= 0.6" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-intrinsic": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", @@ -349,6 +1149,69 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -360,6 +1223,15 @@ "node": ">= 0.4.0" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -368,6 +1240,18 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -379,6 +1263,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -405,11 +1304,69 @@ "node": ">=0.10.0" } }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -418,6 +1375,197 @@ "node": ">= 0.10" } }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/jake": { "version": "10.8.5", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", @@ -435,6 +1583,86 @@ "node": ">=10" } }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/marked": { "version": "4.0.17", "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz", @@ -508,11 +1736,23 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -548,6 +1788,50 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -559,6 +1843,77 @@ "node": ">= 0.8" } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -567,11 +1922,53 @@ "node": ">= 0.8" } }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -584,6 +1981,15 @@ "node": ">= 0.10" } }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", @@ -620,6 +2026,76 @@ "node": ">= 0.8" } }, + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -644,6 +2120,21 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -691,6 +2182,27 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -712,6 +2224,67 @@ "node": ">= 0.8" } }, + "node_modules/string.prototype.trimend": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -723,6 +2296,24 @@ "node": ">=8" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -736,6 +2327,42 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/tsconfig-paths": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -748,6 +2375,21 @@ "node": ">= 0.6" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -756,6 +2398,15 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -764,6 +2415,12 @@ "node": ">= 0.4.0" } }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -785,6 +2442,58 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/node_modules/@eslint/eslintrc/LICENSE b/node_modules/@eslint/eslintrc/LICENSE new file mode 100644 index 0000000..b607bb3 --- /dev/null +++ b/node_modules/@eslint/eslintrc/LICENSE @@ -0,0 +1,19 @@ +Copyright OpenJS Foundation and other contributors, + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/@eslint/eslintrc/README.md b/node_modules/@eslint/eslintrc/README.md new file mode 100644 index 0000000..11ff46e --- /dev/null +++ b/node_modules/@eslint/eslintrc/README.md @@ -0,0 +1,61 @@ +# ESLintRC Library + +This repository contains the legacy ESLintRC configuration file format for ESLint. + +**Note:** This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs. + +## Installation + +You can install the package as follows: + +``` +npm install @eslint/eslintrc --save-dev + +# or + +yarn add @eslint/eslintrc -D +``` + +## Future Usage + +**Note:** This package is not intended for public use at this time. The following is an example of how it will be used in the future. + +The primary class in this package is `FlatCompat`, which is a utility to translate ESLintRC-style configs into flat configs. Here's how you use it inside of your `eslint.config.js` file: + +```js +import { FlatCompat } from "@eslint/eslintrc"; + +const compat = new FlatCompat(); + +export default [ + + // mimic ESLintRC-style extends + compat.extends("standard", "example"), + + // mimic environments + compat.env({ + es2020: true, + node: true + }), + + // mimic plugins + compat.plugins("airbnb", "react"), + + // translate an entire config + compat.config({ + plugins: ["airbnb", "react"], + extends: "standard", + env: { + es2020: true, + node: true + }, + rules: { + semi: "error" + } + }) +]; +``` + +## License + +MIT License diff --git a/node_modules/@eslint/eslintrc/conf/config-schema.js b/node_modules/@eslint/eslintrc/conf/config-schema.js new file mode 100644 index 0000000..ada90e1 --- /dev/null +++ b/node_modules/@eslint/eslintrc/conf/config-schema.js @@ -0,0 +1,79 @@ +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ + +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, + + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; + +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, + + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, + + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, + + $ref: "#/definitions/objectConfig" +}; + +export default configSchema; diff --git a/node_modules/@eslint/eslintrc/conf/environments.js b/node_modules/@eslint/eslintrc/conf/environments.js new file mode 100644 index 0000000..f842852 --- /dev/null +++ b/node_modules/@eslint/eslintrc/conf/environments.js @@ -0,0 +1,203 @@ +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import globals from "globals"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the object that has difference. + * @param {Record} current The newer object. + * @param {Record} prev The older object. + * @returns {Record} The difference object. + */ +function getDiff(current, prev) { + const retv = {}; + + for (const [key, value] of Object.entries(current)) { + if (!Object.hasOwnProperty.call(prev, key)) { + retv[key] = value; + } + } + + return retv; +} + +const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ... +const newGlobals2017 = { + Atomics: false, + SharedArrayBuffer: false +}; +const newGlobals2020 = { + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; + +const newGlobals2021 = { + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {Map} */ +export default new Map(Object.entries({ + + // Language + builtin: { + globals: globals.es5 + }, + es6: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2015: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2016: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 7 + } + }, + es2017: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 8 + } + }, + es2018: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 9 + } + }, + es2019: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 10 + } + }, + es2020: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, + parserOptions: { + ecmaVersion: 11 + } + }, + es2021: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 12 + } + }, + es2022: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 13 + } + }, + + // Platforms + browser: { + globals: globals.browser + }, + node: { + globals: globals.node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + "shared-node-browser": { + globals: globals["shared-node-browser"] + }, + worker: { + globals: globals.worker + }, + serviceworker: { + globals: globals.serviceworker + }, + + // Frameworks + commonjs: { + globals: globals.commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + amd: { + globals: globals.amd + }, + mocha: { + globals: globals.mocha + }, + jasmine: { + globals: globals.jasmine + }, + jest: { + globals: globals.jest + }, + phantomjs: { + globals: globals.phantomjs + }, + jquery: { + globals: globals.jquery + }, + qunit: { + globals: globals.qunit + }, + prototypejs: { + globals: globals.prototypejs + }, + shelljs: { + globals: globals.shelljs + }, + meteor: { + globals: globals.meteor + }, + mongo: { + globals: globals.mongo + }, + protractor: { + globals: globals.protractor + }, + applescript: { + globals: globals.applescript + }, + nashorn: { + globals: globals.nashorn + }, + atomtest: { + globals: globals.atomtest + }, + embertest: { + globals: globals.embertest + }, + webextensions: { + globals: globals.webextensions + }, + greasemonkey: { + globals: globals.greasemonkey + } +})); diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs b/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs new file mode 100644 index 0000000..b1b7553 --- /dev/null +++ b/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs @@ -0,0 +1,1092 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var util = require('util'); +var path = require('path'); +var Ajv = require('ajv'); +var globals = require('globals'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var util__default = /*#__PURE__*/_interopDefaultLegacy(util); +var path__default = /*#__PURE__*/_interopDefaultLegacy(path); +var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); +var globals__default = /*#__PURE__*/_interopDefaultLegacy(globals); + +/** + * @fileoverview Config file operations. This file must be usable in the browser, + * so no Node-specific code can be here. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const RULE_SEVERITY_STRINGS = ["off", "warn", "error"], + RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { + map[value] = index; + return map; + }, {}), + VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Normalizes the severity value of a rule's configuration to a number + * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally + * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), + * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array + * whose first element is one of the above values. Strings are matched case-insensitively. + * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. + */ +function getRuleSeverity(ruleConfig) { + const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (severityValue === 0 || severityValue === 1 || severityValue === 2) { + return severityValue; + } + + if (typeof severityValue === "string") { + return RULE_SEVERITY[severityValue.toLowerCase()] || 0; + } + + return 0; +} + +/** + * Converts old-style severity settings (0, 1, 2) into new-style + * severity settings (off, warn, error) for all rules. Assumption is that severity + * values have already been validated as correct. + * @param {Object} config The config object to normalize. + * @returns {void} + */ +function normalizeToStrings(config) { + + if (config.rules) { + Object.keys(config.rules).forEach(ruleId => { + const ruleConfig = config.rules[ruleId]; + + if (typeof ruleConfig === "number") { + config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; + } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { + ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; + } + }); + } +} + +/** + * Determines if the severity for the given rule configuration represents an error. + * @param {int|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} True if the rule represents an error, false if not. + */ +function isErrorSeverity(ruleConfig) { + return getRuleSeverity(ruleConfig) === 2; +} + +/** + * Checks whether a given config has valid severity or not. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isValidSeverity(ruleConfig) { + let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (typeof severity === "string") { + severity = severity.toLowerCase(); + } + return VALID_SEVERITIES.indexOf(severity) !== -1; +} + +/** + * Checks whether every rule of a given config has valid severity or not. + * @param {Object} config The configuration for rules. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isEverySeverityValid(config) { + return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId])); +} + +/** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + * @throws Error if global value is invalid + */ +function normalizeConfigGlobal(configuredValue) { + switch (configuredValue) { + case "off": + return "off"; + + case true: + case "true": + case "writeable": + case "writable": + return "writable"; + + case null: + case false: + case "false": + case "readable": + case "readonly": + return "readonly"; + + default: + throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); + } +} + +var ConfigOps = { + __proto__: null, + getRuleSeverity: getRuleSeverity, + normalizeToStrings: normalizeToStrings, + isErrorSeverity: isErrorSeverity, + isValidSeverity: isValidSeverity, + isEverySeverityValid: isEverySeverityValid, + normalizeConfigGlobal: normalizeConfigGlobal +}; + +/** + * @fileoverview Provide the function that emits deprecation warnings. + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// Defitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", + ESLINT_PERSONAL_CONFIG_LOAD: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please use a config file per project or the '--config' option.", + ESLINT_PERSONAL_CONFIG_SUPPRESS: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please remove it or add 'root:true' to the config files in your " + + "projects in order to avoid loading '~/.eslintrc.*' accidentally." +}; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param {string} source The name of the configuration source to report the warning for. + * @param {string} errorCode The warning message to show. + * @returns {void} + */ +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + sourceFileErrorCache.add(cacheKey); + + const rel = path__default["default"].relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/* + * Copied from ajv/lib/refs/json-schema-draft-04.json + * The MIT License (MIT) + * Copyright (c) 2015-2017 Evgeny Poberezkin + */ +const metaSchema = { + id: "http://json-schema.org/draft-04/schema#", + $schema: "http://json-schema.org/draft-04/schema#", + description: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + positiveInteger: { + type: "integer", + minimum: 0 + }, + positiveIntegerDefault0: { + allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true + } + }, + type: "object", + properties: { + id: { + type: "string" + }, + $schema: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: { }, + multipleOf: { + type: "number", + minimum: 0, + exclusiveMinimum: true + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "boolean", + default: false + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "boolean", + default: false + }, + maxLength: { $ref: "#/definitions/positiveInteger" }, + minLength: { $ref: "#/definitions/positiveIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + items: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/schemaArray" } + ], + default: { } + }, + maxItems: { $ref: "#/definitions/positiveInteger" }, + minItems: { $ref: "#/definitions/positiveIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxProperties: { $ref: "#/definitions/positiveInteger" }, + minProperties: { $ref: "#/definitions/positiveIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/stringArray" } + ] + } + }, + enum: { + type: "array", + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + dependencies: { + exclusiveMaximum: ["maximum"], + exclusiveMinimum: ["minimum"] + }, + default: { } +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +var ajvOrig = (additionalOptions = {}) => { + const ajv = new Ajv__default["default"]({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); + + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +}; + +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ + +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, + + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; + +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, + + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, + + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, + + $ref: "#/definitions/objectConfig" +}; + +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the object that has difference. + * @param {Record} current The newer object. + * @param {Record} prev The older object. + * @returns {Record} The difference object. + */ +function getDiff(current, prev) { + const retv = {}; + + for (const [key, value] of Object.entries(current)) { + if (!Object.hasOwnProperty.call(prev, key)) { + retv[key] = value; + } + } + + return retv; +} + +const newGlobals2015 = getDiff(globals__default["default"].es2015, globals__default["default"].es5); // 19 variables such as Promise, Map, ... +const newGlobals2017 = { + Atomics: false, + SharedArrayBuffer: false +}; +const newGlobals2020 = { + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; + +const newGlobals2021 = { + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {Map} */ +var environments = new Map(Object.entries({ + + // Language + builtin: { + globals: globals__default["default"].es5 + }, + es6: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2015: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2016: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 7 + } + }, + es2017: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 8 + } + }, + es2018: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 9 + } + }, + es2019: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 10 + } + }, + es2020: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, + parserOptions: { + ecmaVersion: 11 + } + }, + es2021: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 12 + } + }, + es2022: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 13 + } + }, + + // Platforms + browser: { + globals: globals__default["default"].browser + }, + node: { + globals: globals__default["default"].node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + "shared-node-browser": { + globals: globals__default["default"]["shared-node-browser"] + }, + worker: { + globals: globals__default["default"].worker + }, + serviceworker: { + globals: globals__default["default"].serviceworker + }, + + // Frameworks + commonjs: { + globals: globals__default["default"].commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + amd: { + globals: globals__default["default"].amd + }, + mocha: { + globals: globals__default["default"].mocha + }, + jasmine: { + globals: globals__default["default"].jasmine + }, + jest: { + globals: globals__default["default"].jest + }, + phantomjs: { + globals: globals__default["default"].phantomjs + }, + jquery: { + globals: globals__default["default"].jquery + }, + qunit: { + globals: globals__default["default"].qunit + }, + prototypejs: { + globals: globals__default["default"].prototypejs + }, + shelljs: { + globals: globals__default["default"].shelljs + }, + meteor: { + globals: globals__default["default"].meteor + }, + mongo: { + globals: globals__default["default"].mongo + }, + protractor: { + globals: globals__default["default"].protractor + }, + applescript: { + globals: globals__default["default"].applescript + }, + nashorn: { + globals: globals__default["default"].nashorn + }, + atomtest: { + globals: globals__default["default"].atomtest + }, + embertest: { + globals: globals__default["default"].embertest + }, + webextensions: { + globals: globals__default["default"].webextensions + }, + greasemonkey: { + globals: globals__default["default"].greasemonkey + } +})); + +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ + +const ajv = ajvOrig(); + +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +const validated = new WeakSet(); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +class ConfigValidator { + constructor({ builtInRules = new Map() } = {}) { + this.builtInRules = builtInRules; + } + + /** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ + getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; + } + + /** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ + validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util__default["default"].inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + + } + + /** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @returns {void} + */ + validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = this.getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } + } + + /** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @returns {void} + */ + validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = this.validateRuleSeverity(options); + + if (severity !== 0) { + this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } + } + + /** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ + validateEnvironment( + environment, + source, + getAdditionalEnv = noop + ) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || environments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); + } + + /** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ + validateRules( + rulesConfig, + source, + getAdditionalRule = noop + ) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; + + this.validateRuleOptions(rule, id, rulesConfig[id], source); + }); + } + + /** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ + validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); + } + + /** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @returns {void} + */ + validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } + } + + /** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ + formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); + } + + /** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @returns {void} + */ + validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } + } + + /** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ + validate(config, source, getAdditionalRule, getAdditionalEnv) { + this.validateConfigSchema(config, source); + this.validateRules(config.rules, source, getAdditionalRule); + this.validateEnvironment(config.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + this.validateRules(override.rules, source, getAdditionalRule); + this.validateEnvironment(override.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + } + } + + /** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ + validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + this.validateEnvironment(element.env, element.name, getPluginEnv); + this.validateGlobals(element.globals, element.name); + this.validateProcessor(element.processor, element.name, getPluginProcessor); + this.validateRules(element.rules, element.name, getPluginRule); + } + } + +} + +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ + +const NAMESPACE_REGEX = /^@.*\//iu; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + let normalizedName = name; + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (normalizedName.includes("\\")) { + normalizedName = normalizedName.replace(/\\/gu, "/"); + } + + if (normalizedName.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); + + if (scopedPackageShortcutRegex.test(normalizedName)) { + normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); + } + } else if (!normalizedName.startsWith(`${prefix}-`)) { + normalizedName = `${prefix}-${normalizedName}`; + } + + return normalizedName; +} + +/** + * Removes the prefix from a fullname. + * @param {string} fullname The term which may have the prefix. + * @param {string} prefix The prefix to remove. + * @returns {string} The term without prefix. + */ +function getShorthandName(fullname, prefix) { + if (fullname[0] === "@") { + let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); + + if (matchResult) { + return matchResult[1]; + } + + matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); + if (matchResult) { + return `${matchResult[1]}/${matchResult[2]}`; + } + } else if (fullname.startsWith(`${prefix}-`)) { + return fullname.slice(prefix.length + 1); + } + + return fullname; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namespace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +var naming = { + __proto__: null, + normalizePackageName: normalizePackageName, + getShorthandName: getShorthandName, + getNamespaceFromTerm: getNamespaceFromTerm +}; + +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +const Legacy = { + environments, + + // shared + ConfigOps, + ConfigValidator, + naming +}; + +exports.Legacy = Legacy; +//# sourceMappingURL=eslintrc-universal.cjs.map diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map b/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map new file mode 100644 index 0000000..72665f6 --- /dev/null +++ b/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"eslintrc-universal.cjs","sources":["../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../conf/config-schema.js","../conf/environments.js","../lib/shared/config-validator.js","../lib/shared/naming.js","../lib/index-universal.js"],"sourcesContent":["/**\n * @fileoverview Config file operations. This file must be usable in the browser,\n * so no Node-specific code can be here.\n * @author Nicholas C. Zakas\n */\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\nconst RULE_SEVERITY_STRINGS = [\"off\", \"warn\", \"error\"],\n RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {\n map[value] = index;\n return map;\n }, {}),\n VALID_SEVERITIES = [0, 1, 2, \"off\", \"warn\", \"error\"];\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Normalizes the severity value of a rule's configuration to a number\n * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally\n * received from the user. A valid config value is either 0, 1, 2, the string \"off\" (treated the same as 0),\n * the string \"warn\" (treated the same as 1), the string \"error\" (treated the same as 2), or an array\n * whose first element is one of the above values. Strings are matched case-insensitively.\n * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.\n */\nfunction getRuleSeverity(ruleConfig) {\n const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (severityValue === 0 || severityValue === 1 || severityValue === 2) {\n return severityValue;\n }\n\n if (typeof severityValue === \"string\") {\n return RULE_SEVERITY[severityValue.toLowerCase()] || 0;\n }\n\n return 0;\n}\n\n/**\n * Converts old-style severity settings (0, 1, 2) into new-style\n * severity settings (off, warn, error) for all rules. Assumption is that severity\n * values have already been validated as correct.\n * @param {Object} config The config object to normalize.\n * @returns {void}\n */\nfunction normalizeToStrings(config) {\n\n if (config.rules) {\n Object.keys(config.rules).forEach(ruleId => {\n const ruleConfig = config.rules[ruleId];\n\n if (typeof ruleConfig === \"number\") {\n config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];\n } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === \"number\") {\n ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];\n }\n });\n }\n}\n\n/**\n * Determines if the severity for the given rule configuration represents an error.\n * @param {int|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} True if the rule represents an error, false if not.\n */\nfunction isErrorSeverity(ruleConfig) {\n return getRuleSeverity(ruleConfig) === 2;\n}\n\n/**\n * Checks whether a given config has valid severity or not.\n * @param {number|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isValidSeverity(ruleConfig) {\n let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (typeof severity === \"string\") {\n severity = severity.toLowerCase();\n }\n return VALID_SEVERITIES.indexOf(severity) !== -1;\n}\n\n/**\n * Checks whether every rule of a given config has valid severity or not.\n * @param {Object} config The configuration for rules.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isEverySeverityValid(config) {\n return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));\n}\n\n/**\n * Normalizes a value for a global in a config\n * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in\n * a global directive comment\n * @returns {(\"readable\"|\"writeable\"|\"off\")} The value normalized as a string\n * @throws Error if global value is invalid\n */\nfunction normalizeConfigGlobal(configuredValue) {\n switch (configuredValue) {\n case \"off\":\n return \"off\";\n\n case true:\n case \"true\":\n case \"writeable\":\n case \"writable\":\n return \"writable\";\n\n case null:\n case false:\n case \"false\":\n case \"readable\":\n case \"readonly\":\n return \"readonly\";\n\n default:\n throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);\n }\n}\n\nexport {\n getRuleSeverity,\n normalizeToStrings,\n isErrorSeverity,\n isValidSeverity,\n isEverySeverityValid,\n normalizeConfigGlobal\n};\n","/**\n * @fileoverview Provide the function that emits deprecation warnings.\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport path from \"path\";\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n// Defitions for deprecation warnings.\nconst deprecationWarningMessages = {\n ESLINT_LEGACY_ECMAFEATURES:\n \"The 'ecmaFeatures' config file property is deprecated and has no effect.\",\n ESLINT_PERSONAL_CONFIG_LOAD:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please use a config file per project or the '--config' option.\",\n ESLINT_PERSONAL_CONFIG_SUPPRESS:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please remove it or add 'root:true' to the config files in your \" +\n \"projects in order to avoid loading '~/.eslintrc.*' accidentally.\"\n};\n\nconst sourceFileErrorCache = new Set();\n\n/**\n * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted\n * for each unique file path, but repeated invocations with the same file path have no effect.\n * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.\n * @param {string} source The name of the configuration source to report the warning for.\n * @param {string} errorCode The warning message to show.\n * @returns {void}\n */\nfunction emitDeprecationWarning(source, errorCode) {\n const cacheKey = JSON.stringify({ source, errorCode });\n\n if (sourceFileErrorCache.has(cacheKey)) {\n return;\n }\n sourceFileErrorCache.add(cacheKey);\n\n const rel = path.relative(process.cwd(), source);\n const message = deprecationWarningMessages[errorCode];\n\n process.emitWarning(\n `${message} (found in \"${rel}\")`,\n \"DeprecationWarning\",\n errorCode\n );\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n emitDeprecationWarning\n};\n","/**\n * @fileoverview The instance of Ajv validator.\n * @author Evgeny Poberezkin\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport Ajv from \"ajv\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/*\n * Copied from ajv/lib/refs/json-schema-draft-04.json\n * The MIT License (MIT)\n * Copyright (c) 2015-2017 Evgeny Poberezkin\n */\nconst metaSchema = {\n id: \"http://json-schema.org/draft-04/schema#\",\n $schema: \"http://json-schema.org/draft-04/schema#\",\n description: \"Core schema meta-schema\",\n definitions: {\n schemaArray: {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#\" }\n },\n positiveInteger: {\n type: \"integer\",\n minimum: 0\n },\n positiveIntegerDefault0: {\n allOf: [{ $ref: \"#/definitions/positiveInteger\" }, { default: 0 }]\n },\n simpleTypes: {\n enum: [\"array\", \"boolean\", \"integer\", \"null\", \"number\", \"object\", \"string\"]\n },\n stringArray: {\n type: \"array\",\n items: { type: \"string\" },\n minItems: 1,\n uniqueItems: true\n }\n },\n type: \"object\",\n properties: {\n id: {\n type: \"string\"\n },\n $schema: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n default: { },\n multipleOf: {\n type: \"number\",\n minimum: 0,\n exclusiveMinimum: true\n },\n maximum: {\n type: \"number\"\n },\n exclusiveMaximum: {\n type: \"boolean\",\n default: false\n },\n minimum: {\n type: \"number\"\n },\n exclusiveMinimum: {\n type: \"boolean\",\n default: false\n },\n maxLength: { $ref: \"#/definitions/positiveInteger\" },\n minLength: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n pattern: {\n type: \"string\",\n format: \"regex\"\n },\n additionalItems: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n items: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/schemaArray\" }\n ],\n default: { }\n },\n maxItems: { $ref: \"#/definitions/positiveInteger\" },\n minItems: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n uniqueItems: {\n type: \"boolean\",\n default: false\n },\n maxProperties: { $ref: \"#/definitions/positiveInteger\" },\n minProperties: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n required: { $ref: \"#/definitions/stringArray\" },\n additionalProperties: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n definitions: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n properties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n patternProperties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n dependencies: {\n type: \"object\",\n additionalProperties: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/stringArray\" }\n ]\n }\n },\n enum: {\n type: \"array\",\n minItems: 1,\n uniqueItems: true\n },\n type: {\n anyOf: [\n { $ref: \"#/definitions/simpleTypes\" },\n {\n type: \"array\",\n items: { $ref: \"#/definitions/simpleTypes\" },\n minItems: 1,\n uniqueItems: true\n }\n ]\n },\n format: { type: \"string\" },\n allOf: { $ref: \"#/definitions/schemaArray\" },\n anyOf: { $ref: \"#/definitions/schemaArray\" },\n oneOf: { $ref: \"#/definitions/schemaArray\" },\n not: { $ref: \"#\" }\n },\n dependencies: {\n exclusiveMaximum: [\"maximum\"],\n exclusiveMinimum: [\"minimum\"]\n },\n default: { }\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport default (additionalOptions = {}) => {\n const ajv = new Ajv({\n meta: false,\n useDefaults: true,\n validateSchema: false,\n missingRefs: \"ignore\",\n verbose: true,\n schemaId: \"auto\",\n ...additionalOptions\n });\n\n ajv.addMetaSchema(metaSchema);\n // eslint-disable-next-line no-underscore-dangle\n ajv._opts.defaultMeta = metaSchema.id;\n\n return ajv;\n};\n","/**\n * @fileoverview Defines a schema for configs.\n * @author Sylvan Mably\n */\n\nconst baseConfigProperties = {\n $schema: { type: \"string\" },\n env: { type: \"object\" },\n extends: { $ref: \"#/definitions/stringOrStrings\" },\n globals: { type: \"object\" },\n overrides: {\n type: \"array\",\n items: { $ref: \"#/definitions/overrideConfig\" },\n additionalItems: false\n },\n parser: { type: [\"string\", \"null\"] },\n parserOptions: { type: \"object\" },\n plugins: { type: \"array\" },\n processor: { type: \"string\" },\n rules: { type: \"object\" },\n settings: { type: \"object\" },\n noInlineConfig: { type: \"boolean\" },\n reportUnusedDisableDirectives: { type: \"boolean\" },\n\n ecmaFeatures: { type: \"object\" } // deprecated; logs a warning when used\n};\n\nconst configSchema = {\n definitions: {\n stringOrStrings: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false\n }\n ]\n },\n stringOrStringsRequired: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false,\n minItems: 1\n }\n ]\n },\n\n // Config at top-level.\n objectConfig: {\n type: \"object\",\n properties: {\n root: { type: \"boolean\" },\n ignorePatterns: { $ref: \"#/definitions/stringOrStrings\" },\n ...baseConfigProperties\n },\n additionalProperties: false\n },\n\n // Config in `overrides`.\n overrideConfig: {\n type: \"object\",\n properties: {\n excludedFiles: { $ref: \"#/definitions/stringOrStrings\" },\n files: { $ref: \"#/definitions/stringOrStringsRequired\" },\n ...baseConfigProperties\n },\n required: [\"files\"],\n additionalProperties: false\n }\n },\n\n $ref: \"#/definitions/objectConfig\"\n};\n\nexport default configSchema;\n","/**\n * @fileoverview Defines environment settings and globals.\n * @author Elan Shanker\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport globals from \"globals\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the object that has difference.\n * @param {Record} current The newer object.\n * @param {Record} prev The older object.\n * @returns {Record} The difference object.\n */\nfunction getDiff(current, prev) {\n const retv = {};\n\n for (const [key, value] of Object.entries(current)) {\n if (!Object.hasOwnProperty.call(prev, key)) {\n retv[key] = value;\n }\n }\n\n return retv;\n}\n\nconst newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...\nconst newGlobals2017 = {\n Atomics: false,\n SharedArrayBuffer: false\n};\nconst newGlobals2020 = {\n BigInt: false,\n BigInt64Array: false,\n BigUint64Array: false,\n globalThis: false\n};\n\nconst newGlobals2021 = {\n AggregateError: false,\n FinalizationRegistry: false,\n WeakRef: false\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/** @type {Map} */\nexport default new Map(Object.entries({\n\n // Language\n builtin: {\n globals: globals.es5\n },\n es6: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2015: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2016: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 7\n }\n },\n es2017: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 8\n }\n },\n es2018: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 9\n }\n },\n es2019: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 10\n }\n },\n es2020: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },\n parserOptions: {\n ecmaVersion: 11\n }\n },\n es2021: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 12\n }\n },\n es2022: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 13\n }\n },\n\n // Platforms\n browser: {\n globals: globals.browser\n },\n node: {\n globals: globals.node,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n \"shared-node-browser\": {\n globals: globals[\"shared-node-browser\"]\n },\n worker: {\n globals: globals.worker\n },\n serviceworker: {\n globals: globals.serviceworker\n },\n\n // Frameworks\n commonjs: {\n globals: globals.commonjs,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n amd: {\n globals: globals.amd\n },\n mocha: {\n globals: globals.mocha\n },\n jasmine: {\n globals: globals.jasmine\n },\n jest: {\n globals: globals.jest\n },\n phantomjs: {\n globals: globals.phantomjs\n },\n jquery: {\n globals: globals.jquery\n },\n qunit: {\n globals: globals.qunit\n },\n prototypejs: {\n globals: globals.prototypejs\n },\n shelljs: {\n globals: globals.shelljs\n },\n meteor: {\n globals: globals.meteor\n },\n mongo: {\n globals: globals.mongo\n },\n protractor: {\n globals: globals.protractor\n },\n applescript: {\n globals: globals.applescript\n },\n nashorn: {\n globals: globals.nashorn\n },\n atomtest: {\n globals: globals.atomtest\n },\n embertest: {\n globals: globals.embertest\n },\n webextensions: {\n globals: globals.webextensions\n },\n greasemonkey: {\n globals: globals.greasemonkey\n }\n}));\n","/**\n * @fileoverview Validates configs.\n * @author Brandon Mills\n */\n\n/* eslint class-methods-use-this: \"off\" */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport util from \"util\";\nimport * as ConfigOps from \"./config-ops.js\";\nimport { emitDeprecationWarning } from \"./deprecation-warnings.js\";\nimport ajvOrig from \"./ajv.js\";\nimport configSchema from \"../../conf/config-schema.js\";\nimport BuiltInEnvironments from \"../../conf/environments.js\";\n\nconst ajv = ajvOrig();\n\nconst ruleValidators = new WeakMap();\nconst noop = Function.prototype;\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\nlet validateSchema;\nconst severityMap = {\n error: 2,\n warn: 1,\n off: 0\n};\n\nconst validated = new WeakSet();\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nexport default class ConfigValidator {\n constructor({ builtInRules = new Map() } = {}) {\n this.builtInRules = builtInRules;\n }\n\n /**\n * Gets a complete options schema for a rule.\n * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object\n * @returns {Object} JSON Schema for the rule's options.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n const schema = rule.schema || rule.meta && rule.meta.schema;\n\n // Given a tuple of schemas, insert warning level at the beginning\n if (Array.isArray(schema)) {\n if (schema.length) {\n return {\n type: \"array\",\n items: schema,\n minItems: 0,\n maxItems: schema.length\n };\n }\n return {\n type: \"array\",\n minItems: 0,\n maxItems: 0\n };\n\n }\n\n // Given a full schema, leave it alone\n return schema || null;\n }\n\n /**\n * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.\n * @param {options} options The given options for the rule.\n * @returns {number|string} The rule's severity value\n */\n validateRuleSeverity(options) {\n const severity = Array.isArray(options) ? options[0] : options;\n const normSeverity = typeof severity === \"string\" ? severityMap[severity.toLowerCase()] : severity;\n\n if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {\n return normSeverity;\n }\n\n throw new Error(`\\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, \"\\\"\").replace(/\\n/gu, \"\")}').\\n`);\n\n }\n\n /**\n * Validates the non-severity options passed to a rule, based on its schema.\n * @param {{create: Function}} rule The rule to validate\n * @param {Array} localOptions The options for the rule, excluding severity\n * @returns {void}\n */\n validateRuleSchema(rule, localOptions) {\n if (!ruleValidators.has(rule)) {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n validateRule(localOptions);\n if (validateRule.errors) {\n throw new Error(validateRule.errors.map(\n error => `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n`\n ).join(\"\"));\n }\n }\n }\n\n /**\n * Validates a rule's options against its schema.\n * @param {{create: Function}|null} rule The rule that the config is being validated for\n * @param {string} ruleId The rule's unique name.\n * @param {Array|number} options The given options for the rule.\n * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,\n * no source is prepended to the message.\n * @returns {void}\n */\n validateRuleOptions(rule, ruleId, options, source = null) {\n try {\n const severity = this.validateRuleSeverity(options);\n\n if (severity !== 0) {\n this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);\n }\n } catch (err) {\n const enhancedMessage = `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n throw new Error(`${source}:\\n\\t${enhancedMessage}`);\n } else {\n throw new Error(enhancedMessage);\n }\n }\n }\n\n /**\n * Validates an environment object\n * @param {Object} environment The environment config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.\n * @returns {void}\n */\n validateEnvironment(\n environment,\n source,\n getAdditionalEnv = noop\n ) {\n\n // not having an environment is ok\n if (!environment) {\n return;\n }\n\n Object.keys(environment).forEach(id => {\n const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;\n\n if (!env) {\n const message = `${source}:\\n\\tEnvironment key \"${id}\" is unknown\\n`;\n\n throw new Error(message);\n }\n });\n }\n\n /**\n * Validates a rules config object\n * @param {Object} rulesConfig The rules config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules\n * @returns {void}\n */\n validateRules(\n rulesConfig,\n source,\n getAdditionalRule = noop\n ) {\n if (!rulesConfig) {\n return;\n }\n\n Object.keys(rulesConfig).forEach(id => {\n const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;\n\n this.validateRuleOptions(rule, id, rulesConfig[id], source);\n });\n }\n\n /**\n * Validates a `globals` section of a config file\n * @param {Object} globalsConfig The `globals` section\n * @param {string|null} source The name of the configuration source to report in the event of an error.\n * @returns {void}\n */\n validateGlobals(globalsConfig, source = null) {\n if (!globalsConfig) {\n return;\n }\n\n Object.entries(globalsConfig)\n .forEach(([configuredGlobal, configuredValue]) => {\n try {\n ConfigOps.normalizeConfigGlobal(configuredValue);\n } catch (err) {\n throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\\n${err.message}`);\n }\n });\n }\n\n /**\n * Validate `processor` configuration.\n * @param {string|undefined} processorName The processor name.\n * @param {string} source The name of config file.\n * @param {function(id:string): Processor} getProcessor The getter of defined processors.\n * @returns {void}\n */\n validateProcessor(processorName, source, getProcessor) {\n if (processorName && !getProcessor(processorName)) {\n throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);\n }\n }\n\n /**\n * Formats an array of schema validation errors.\n * @param {Array} errors An array of error messages to format.\n * @returns {string} Formatted error message\n */\n formatErrors(errors) {\n return errors.map(error => {\n if (error.keyword === \"additionalProperties\") {\n const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;\n\n return `Unexpected top-level property \"${formattedPropertyPath}\"`;\n }\n if (error.keyword === \"type\") {\n const formattedField = error.dataPath.slice(1);\n const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join(\"/\") : error.schema;\n const formattedValue = JSON.stringify(error.data);\n\n return `Property \"${formattedField}\" is the wrong type (expected ${formattedExpectedType} but got \\`${formattedValue}\\`)`;\n }\n\n const field = error.dataPath[0] === \".\" ? error.dataPath.slice(1) : error.dataPath;\n\n return `\"${field}\" ${error.message}. Value: ${JSON.stringify(error.data)}`;\n }).map(message => `\\t- ${message}.\\n`).join(\"\");\n }\n\n /**\n * Validates the top level properties of the config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @returns {void}\n */\n validateConfigSchema(config, source = null) {\n validateSchema = validateSchema || ajv.compile(configSchema);\n\n if (!validateSchema(config)) {\n throw new Error(`ESLint configuration in ${source} is invalid:\\n${this.formatErrors(validateSchema.errors)}`);\n }\n\n if (Object.hasOwnProperty.call(config, \"ecmaFeatures\")) {\n emitDeprecationWarning(source, \"ESLINT_LEGACY_ECMAFEATURES\");\n }\n }\n\n /**\n * Validates an entire config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.\n * @returns {void}\n */\n validate(config, source, getAdditionalRule, getAdditionalEnv) {\n this.validateConfigSchema(config, source);\n this.validateRules(config.rules, source, getAdditionalRule);\n this.validateEnvironment(config.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n\n for (const override of config.overrides || []) {\n this.validateRules(override.rules, source, getAdditionalRule);\n this.validateEnvironment(override.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n }\n }\n\n /**\n * Validate config array object.\n * @param {ConfigArray} configArray The config array to validate.\n * @returns {void}\n */\n validateConfigArray(configArray) {\n const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);\n const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);\n const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);\n\n // Validate.\n for (const element of configArray) {\n if (validated.has(element)) {\n continue;\n }\n validated.add(element);\n\n this.validateEnvironment(element.env, element.name, getPluginEnv);\n this.validateGlobals(element.globals, element.name);\n this.validateProcessor(element.processor, element.name, getPluginProcessor);\n this.validateRules(element.rules, element.name, getPluginRule);\n }\n }\n\n}\n","/**\n * @fileoverview Common helpers for naming of plugins, formatters and configs\n */\n\nconst NAMESPACE_REGEX = /^@.*\\//iu;\n\n/**\n * Brings package name to correct format based on prefix\n * @param {string} name The name of the package.\n * @param {string} prefix Can be either \"eslint-plugin\", \"eslint-config\" or \"eslint-formatter\"\n * @returns {string} Normalized name of the package\n * @private\n */\nfunction normalizePackageName(name, prefix) {\n let normalizedName = name;\n\n /**\n * On Windows, name can come in with Windows slashes instead of Unix slashes.\n * Normalize to Unix first to avoid errors later on.\n * https://github.com/eslint/eslint/issues/5644\n */\n if (normalizedName.includes(\"\\\\\")) {\n normalizedName = normalizedName.replace(/\\\\/gu, \"/\");\n }\n\n if (normalizedName.charAt(0) === \"@\") {\n\n /**\n * it's a scoped package\n * package name is the prefix, or just a username\n */\n const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, \"u\"),\n scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, \"u\");\n\n if (scopedPackageShortcutRegex.test(normalizedName)) {\n normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);\n } else if (!scopedPackageNameRegex.test(normalizedName.split(\"/\")[1])) {\n\n /**\n * for scoped packages, insert the prefix after the first / unless\n * the path is already @scope/eslint or @scope/eslint-xxx-yyy\n */\n normalizedName = normalizedName.replace(/^@([^/]+)\\/(.*)$/u, `@$1/${prefix}-$2`);\n }\n } else if (!normalizedName.startsWith(`${prefix}-`)) {\n normalizedName = `${prefix}-${normalizedName}`;\n }\n\n return normalizedName;\n}\n\n/**\n * Removes the prefix from a fullname.\n * @param {string} fullname The term which may have the prefix.\n * @param {string} prefix The prefix to remove.\n * @returns {string} The term without prefix.\n */\nfunction getShorthandName(fullname, prefix) {\n if (fullname[0] === \"@\") {\n let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, \"u\").exec(fullname);\n\n if (matchResult) {\n return matchResult[1];\n }\n\n matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, \"u\").exec(fullname);\n if (matchResult) {\n return `${matchResult[1]}/${matchResult[2]}`;\n }\n } else if (fullname.startsWith(`${prefix}-`)) {\n return fullname.slice(prefix.length + 1);\n }\n\n return fullname;\n}\n\n/**\n * Gets the scope (namespace) of a term.\n * @param {string} term The term which may have the namespace.\n * @returns {string} The namespace of the term if it has one.\n */\nfunction getNamespaceFromTerm(term) {\n const match = term.match(NAMESPACE_REGEX);\n\n return match ? match[0] : \"\";\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n normalizePackageName,\n getShorthandName,\n getNamespaceFromTerm\n};\n","/**\n * @fileoverview Package exports for @eslint/eslintrc\n * @author Nicholas C. Zakas\n */\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport * as ConfigOps from \"./shared/config-ops.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport environments from \"../conf/environments.js\";\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nconst Legacy = {\n environments,\n\n // shared\n ConfigOps,\n ConfigValidator,\n naming\n};\n\nexport {\n Legacy\n};\n"],"names":["path","Ajv","globals","util","BuiltInEnvironments","ConfigOps.normalizeConfigGlobal"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;AACtD,IAAI,aAAa,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,KAAK;AACxE,QAAQ,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AAC3B,QAAQ,OAAO,GAAG,CAAC;AACnB,KAAK,EAAE,EAAE,CAAC;AACV,IAAI,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,UAAU,EAAE;AACrC,IAAI,M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,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAC9C;AACA,IAAI,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACjC;;;;;;;;;ACrFA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACK,MAAC,MAAM,GAAG;AACf,IAAI,YAAY;AAChB;AACA;AACA,IAAI,SAAS;AACb,IAAI,eAAe;AACnB,IAAI,MAAM;AACV;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs new file mode 100644 index 0000000..8b07ba1 --- /dev/null +++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs @@ -0,0 +1,4295 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var debugOrig = require('debug'); +var fs = require('fs'); +var importFresh = require('import-fresh'); +var Module = require('module'); +var path = require('path'); +var stripComments = require('strip-json-comments'); +var assert = require('assert'); +var ignore = require('ignore'); +var util = require('util'); +var minimatch = require('minimatch'); +var Ajv = require('ajv'); +var globals = require('globals'); +var os = require('os'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var debugOrig__default = /*#__PURE__*/_interopDefaultLegacy(debugOrig); +var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); +var importFresh__default = /*#__PURE__*/_interopDefaultLegacy(importFresh); +var Module__default = /*#__PURE__*/_interopDefaultLegacy(Module); +var path__default = /*#__PURE__*/_interopDefaultLegacy(path); +var stripComments__default = /*#__PURE__*/_interopDefaultLegacy(stripComments); +var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert); +var ignore__default = /*#__PURE__*/_interopDefaultLegacy(ignore); +var util__default = /*#__PURE__*/_interopDefaultLegacy(util); +var minimatch__default = /*#__PURE__*/_interopDefaultLegacy(minimatch); +var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); +var globals__default = /*#__PURE__*/_interopDefaultLegacy(globals); +var os__default = /*#__PURE__*/_interopDefaultLegacy(os); + +/** + * @fileoverview `IgnorePattern` class. + * + * `IgnorePattern` class has the set of glob patterns and the base path. + * + * It provides two static methods. + * + * - `IgnorePattern.createDefaultIgnore(cwd)` + * Create the default predicate function. + * - `IgnorePattern.createIgnore(ignorePatterns)` + * Create the predicate function from multiple `IgnorePattern` objects. + * + * It provides two properties and a method. + * + * - `patterns` + * The glob patterns that ignore to lint. + * - `basePath` + * The base path of the glob patterns. If absolute paths existed in the + * glob patterns, those are handled as relative paths to the base path. + * - `getPatternsRelativeTo(basePath)` + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * + * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes + * `ignorePatterns` properties. + * + * @author Toru Nagashima + */ + +const debug$3 = debugOrig__default["default"]("eslintrc:ignore-pattern"); + +/** @typedef {ReturnType} Ignore */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the path to the common ancestor directory of given paths. + * @param {string[]} sourcePaths The paths to calculate the common ancestor. + * @returns {string} The path to the common ancestor directory. + */ +function getCommonAncestorPath(sourcePaths) { + let result = sourcePaths[0]; + + for (let i = 1; i < sourcePaths.length; ++i) { + const a = result; + const b = sourcePaths[i]; + + // Set the shorter one (it's the common ancestor if one includes the other). + result = a.length < b.length ? a : b; + + // Set the common ancestor. + for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) { + if (a[j] !== b[j]) { + result = a.slice(0, lastSepPos); + break; + } + if (a[j] === path__default["default"].sep) { + lastSepPos = j; + } + } + } + + let resolvedResult = result || path__default["default"].sep; + + // if Windows common ancestor is root of drive must have trailing slash to be absolute. + if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") { + resolvedResult += path__default["default"].sep; + } + return resolvedResult; +} + +/** + * Make relative path. + * @param {string} from The source path to get relative path. + * @param {string} to The destination path to get relative path. + * @returns {string} The relative path. + */ +function relative(from, to) { + const relPath = path__default["default"].relative(from, to); + + if (path__default["default"].sep === "/") { + return relPath; + } + return relPath.split(path__default["default"].sep).join("/"); +} + +/** + * Get the trailing slash if existed. + * @param {string} filePath The path to check. + * @returns {string} The trailing slash if existed. + */ +function dirSuffix(filePath) { + const isDir = ( + filePath.endsWith(path__default["default"].sep) || + (process.platform === "win32" && filePath.endsWith("/")) + ); + + return isDir ? "/" : ""; +} + +const DefaultPatterns = Object.freeze(["/**/node_modules/*"]); +const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]); + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +class IgnorePattern { + + /** + * The default patterns. + * @type {string[]} + */ + static get DefaultPatterns() { + return DefaultPatterns; + } + + /** + * Create the default predicate function. + * @param {string} cwd The current working directory. + * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createDefaultIgnore(cwd) { + return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]); + } + + /** + * Create the predicate function from multiple `IgnorePattern` objects. + * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns. + * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createIgnore(ignorePatterns) { + debug$3("Create with: %o", ignorePatterns); + + const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath)); + const patterns = [].concat( + ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath)) + ); + const ig = ignore__default["default"]({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]); + const dotIg = ignore__default["default"]({ allowRelativePaths: true }).add(patterns); + + debug$3(" processed: %o", { basePath, patterns }); + + return Object.assign( + (filePath, dot = false) => { + assert__default["default"](path__default["default"].isAbsolute(filePath), "'filePath' should be an absolute path."); + const relPathRaw = relative(basePath, filePath); + const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath)); + const adoptedIg = dot ? dotIg : ig; + const result = relPath !== "" && adoptedIg.ignores(relPath); + + debug$3("Check", { filePath, dot, relativePath: relPath, result }); + return result; + }, + { basePath, patterns } + ); + } + + /** + * Initialize a new `IgnorePattern` instance. + * @param {string[]} patterns The glob patterns that ignore to lint. + * @param {string} basePath The base path of `patterns`. + */ + constructor(patterns, basePath) { + assert__default["default"](path__default["default"].isAbsolute(basePath), "'basePath' should be an absolute path."); + + /** + * The glob patterns that ignore to lint. + * @type {string[]} + */ + this.patterns = patterns; + + /** + * The base path of `patterns`. + * @type {string} + */ + this.basePath = basePath; + + /** + * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`. + * + * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility. + * It's `false` as-is for `ignorePatterns` property in config files. + * @type {boolean} + */ + this.loose = false; + } + + /** + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * @param {string} newBasePath The base path. + * @returns {string[]} Modifired patterns. + */ + getPatternsRelativeTo(newBasePath) { + assert__default["default"](path__default["default"].isAbsolute(newBasePath), "'newBasePath' should be an absolute path."); + const { basePath, loose, patterns } = this; + + if (newBasePath === basePath) { + return patterns; + } + const prefix = `/${relative(newBasePath, basePath)}`; + + return patterns.map(pattern => { + const negative = pattern.startsWith("!"); + const head = negative ? "!" : ""; + const body = negative ? pattern.slice(1) : pattern; + + if (body.startsWith("/") || body.startsWith("../")) { + return `${head}${prefix}${body}`; + } + return loose ? pattern : `${head}${prefix}/**/${body}`; + }); + } +} + +/** + * @fileoverview `ExtractedConfig` class. + * + * `ExtractedConfig` class expresses a final configuration for a specific file. + * + * It provides one method. + * + * - `toCompatibleObjectAsConfigFileContent()` + * Convert this configuration to the compatible object as the content of + * config files. It converts the loaded parser and plugins to strings. + * `CLIEngine#getConfigForFile(filePath)` method uses this method. + * + * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance. + * + * @author Toru Nagashima + */ + +// For VSCode intellisense +/** @typedef {import("../../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ + +/** + * Check if `xs` starts with `ys`. + * @template T + * @param {T[]} xs The array to check. + * @param {T[]} ys The array that may be the first part of `xs`. + * @returns {boolean} `true` if `xs` starts with `ys`. + */ +function startsWith(xs, ys) { + return xs.length >= ys.length && ys.every((y, i) => y === xs[i]); +} + +/** + * The class for extracted config data. + */ +class ExtractedConfig { + constructor() { + + /** + * The config name what `noInlineConfig` setting came from. + * @type {string} + */ + this.configNameOfNoInlineConfig = ""; + + /** + * Environments. + * @type {Record} + */ + this.env = {}; + + /** + * Global variables. + * @type {Record} + */ + this.globals = {}; + + /** + * The glob patterns that ignore to lint. + * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined} + */ + this.ignores = void 0; + + /** + * The flag that disables directive comments. + * @type {boolean|undefined} + */ + this.noInlineConfig = void 0; + + /** + * Parser definition. + * @type {DependentParser|null} + */ + this.parser = null; + + /** + * Options for the parser. + * @type {Object} + */ + this.parserOptions = {}; + + /** + * Plugin definitions. + * @type {Record} + */ + this.plugins = {}; + + /** + * Processor ID. + * @type {string|null} + */ + this.processor = null; + + /** + * The flag that reports unused `eslint-disable` directive comments. + * @type {boolean|undefined} + */ + this.reportUnusedDisableDirectives = void 0; + + /** + * Rule settings. + * @type {Record} + */ + this.rules = {}; + + /** + * Shared settings. + * @type {Object} + */ + this.settings = {}; + } + + /** + * Convert this config to the compatible object as a config file content. + * @returns {ConfigData} The converted object. + */ + toCompatibleObjectAsConfigFileContent() { + const { + /* eslint-disable no-unused-vars */ + configNameOfNoInlineConfig: _ignore1, + processor: _ignore2, + /* eslint-enable no-unused-vars */ + ignores, + ...config + } = this; + + config.parser = config.parser && config.parser.filePath; + config.plugins = Object.keys(config.plugins).filter(Boolean).reverse(); + config.ignorePatterns = ignores ? ignores.patterns : []; + + // Strip the default patterns from `ignorePatterns`. + if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) { + config.ignorePatterns = + config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length); + } + + return config; + } +} + +/** + * @fileoverview `ConfigArray` class. + * + * `ConfigArray` class expresses the full of a configuration. It has the entry + * config file, base config files that were extended, loaded parsers, and loaded + * plugins. + * + * `ConfigArray` class provides three properties and two methods. + * + * - `pluginEnvironments` + * - `pluginProcessors` + * - `pluginRules` + * The `Map` objects that contain the members of all plugins that this + * config array contains. Those map objects don't have mutation methods. + * Those keys are the member ID such as `pluginId/memberName`. + * - `isRoot()` + * If `true` then this configuration has `root:true` property. + * - `extractConfig(filePath)` + * Extract the final configuration for a given file. This means merging + * every config array element which that `criteria` property matched. The + * `filePath` argument must be an absolute path. + * + * `ConfigArrayFactory` provides the loading logic of config files. + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").RuleConf} RuleConf */ +/** @typedef {import("../../shared/types").Rule} Rule */ +/** @typedef {import("../../shared/types").Plugin} Plugin */ +/** @typedef {import("../../shared/types").Processor} Processor */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ +/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */ + +/** + * @typedef {Object} ConfigArrayElement + * @property {string} name The name of this config element. + * @property {string} filePath The path to the source file of this config element. + * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element. + * @property {Record|undefined} env The environment settings. + * @property {Record|undefined} globals The global variable settings. + * @property {IgnorePattern|undefined} ignorePattern The ignore patterns. + * @property {boolean|undefined} noInlineConfig The flag that disables directive comments. + * @property {DependentParser|undefined} parser The parser loader. + * @property {Object|undefined} parserOptions The parser options. + * @property {Record|undefined} plugins The plugin loaders. + * @property {string|undefined} processor The processor name to refer plugin's processor. + * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. + * @property {boolean|undefined} root The flag to express root. + * @property {Record|undefined} rules The rule settings + * @property {Object|undefined} settings The shared settings. + * @property {"config" | "ignore" | "implicit-processor"} type The element type. + */ + +/** + * @typedef {Object} ConfigArrayInternalSlots + * @property {Map} cache The cache to extract configs. + * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition. + * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition. + * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition. + */ + +/** @type {WeakMap} */ +const internalSlotsMap$2 = new class extends WeakMap { + get(key) { + let value = super.get(key); + + if (!value) { + value = { + cache: new Map(), + envMap: null, + processorMap: null, + ruleMap: null + }; + super.set(key, value); + } + + return value; + } +}(); + +/** + * Get the indices which are matched to a given file. + * @param {ConfigArrayElement[]} elements The elements. + * @param {string} filePath The path to a target file. + * @returns {number[]} The indices. + */ +function getMatchedIndices(elements, filePath) { + const indices = []; + + for (let i = elements.length - 1; i >= 0; --i) { + const element = elements[i]; + + if (!element.criteria || (filePath && element.criteria.test(filePath))) { + indices.push(i); + } + } + + return indices; +} + +/** + * Check if a value is a non-null object. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is a non-null object. + */ +function isNonNullObject(x) { + return typeof x === "object" && x !== null; +} + +/** + * Merge two objects. + * + * Assign every property values of `y` to `x` if `x` doesn't have the property. + * If `x`'s property value is an object, it does recursive. + * @param {Object} target The destination to merge + * @param {Object|undefined} source The source to merge. + * @returns {void} + */ +function mergeWithoutOverwrite(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + + if (isNonNullObject(target[key])) { + mergeWithoutOverwrite(target[key], source[key]); + } else if (target[key] === void 0) { + if (isNonNullObject(source[key])) { + target[key] = Array.isArray(source[key]) ? [] : {}; + mergeWithoutOverwrite(target[key], source[key]); + } else if (source[key] !== void 0) { + target[key] = source[key]; + } + } + } +} + +/** + * The error for plugin conflicts. + */ +class PluginConflictError extends Error { + + /** + * Initialize this error object. + * @param {string} pluginId The plugin ID. + * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. + */ + constructor(pluginId, plugins) { + super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); + this.messageTemplate = "plugin-conflict"; + this.messageData = { pluginId, plugins }; + } +} + +/** + * Merge plugins. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergePlugins(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetValue = target[key]; + const sourceValue = source[key]; + + // Adopt the plugin which was found at first. + if (targetValue === void 0) { + if (sourceValue.error) { + throw sourceValue.error; + } + target[key] = sourceValue; + } else if (sourceValue.filePath !== targetValue.filePath) { + throw new PluginConflictError(key, [ + { + filePath: targetValue.filePath, + importerName: targetValue.importerName + }, + { + filePath: sourceValue.filePath, + importerName: sourceValue.importerName + } + ]); + } + } +} + +/** + * Merge rule configs. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergeRuleConfigs(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetDef = target[key]; + const sourceDef = source[key]; + + // Adopt the rule config which was found at first. + if (targetDef === void 0) { + if (Array.isArray(sourceDef)) { + target[key] = [...sourceDef]; + } else { + target[key] = [sourceDef]; + } + + /* + * If the first found rule config is severity only and the current rule + * config has options, merge the severity and the options. + */ + } else if ( + targetDef.length === 1 && + Array.isArray(sourceDef) && + sourceDef.length >= 2 + ) { + targetDef.push(...sourceDef.slice(1)); + } + } +} + +/** + * Create the extracted config. + * @param {ConfigArray} instance The config elements. + * @param {number[]} indices The indices to use. + * @returns {ExtractedConfig} The extracted config. + */ +function createConfig(instance, indices) { + const config = new ExtractedConfig(); + const ignorePatterns = []; + + // Merge elements. + for (const index of indices) { + const element = instance[index]; + + // Adopt the parser which was found at first. + if (!config.parser && element.parser) { + if (element.parser.error) { + throw element.parser.error; + } + config.parser = element.parser; + } + + // Adopt the processor which was found at first. + if (!config.processor && element.processor) { + config.processor = element.processor; + } + + // Adopt the noInlineConfig which was found at first. + if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) { + config.noInlineConfig = element.noInlineConfig; + config.configNameOfNoInlineConfig = element.name; + } + + // Adopt the reportUnusedDisableDirectives which was found at first. + if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) { + config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives; + } + + // Collect ignorePatterns + if (element.ignorePattern) { + ignorePatterns.push(element.ignorePattern); + } + + // Merge others. + mergeWithoutOverwrite(config.env, element.env); + mergeWithoutOverwrite(config.globals, element.globals); + mergeWithoutOverwrite(config.parserOptions, element.parserOptions); + mergeWithoutOverwrite(config.settings, element.settings); + mergePlugins(config.plugins, element.plugins); + mergeRuleConfigs(config.rules, element.rules); + } + + // Create the predicate function for ignore patterns. + if (ignorePatterns.length > 0) { + config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse()); + } + + return config; +} + +/** + * Collect definitions. + * @template T, U + * @param {string} pluginId The plugin ID for prefix. + * @param {Record} defs The definitions to collect. + * @param {Map} map The map to output. + * @param {function(T): U} [normalize] The normalize function for each value. + * @returns {void} + */ +function collect(pluginId, defs, map, normalize) { + if (defs) { + const prefix = pluginId && `${pluginId}/`; + + for (const [key, value] of Object.entries(defs)) { + map.set( + `${prefix}${key}`, + normalize ? normalize(value) : value + ); + } + } +} + +/** + * Normalize a rule definition. + * @param {Function|Rule} rule The rule definition to normalize. + * @returns {Rule} The normalized rule definition. + */ +function normalizePluginRule(rule) { + return typeof rule === "function" ? { create: rule } : rule; +} + +/** + * Delete the mutation methods from a given map. + * @param {Map} map The map object to delete. + * @returns {void} + */ +function deleteMutationMethods(map) { + Object.defineProperties(map, { + clear: { configurable: true, value: void 0 }, + delete: { configurable: true, value: void 0 }, + set: { configurable: true, value: void 0 } + }); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArrayElement[]} elements The config elements. + * @param {ConfigArrayInternalSlots} slots The internal slots. + * @returns {void} + */ +function initPluginMemberMaps(elements, slots) { + const processed = new Set(); + + slots.envMap = new Map(); + slots.processorMap = new Map(); + slots.ruleMap = new Map(); + + for (const element of elements) { + if (!element.plugins) { + continue; + } + + for (const [pluginId, value] of Object.entries(element.plugins)) { + const plugin = value.definition; + + if (!plugin || processed.has(pluginId)) { + continue; + } + processed.add(pluginId); + + collect(pluginId, plugin.environments, slots.envMap); + collect(pluginId, plugin.processors, slots.processorMap); + collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule); + } + } + + deleteMutationMethods(slots.envMap); + deleteMutationMethods(slots.processorMap); + deleteMutationMethods(slots.ruleMap); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArray} instance The config elements. + * @returns {ConfigArrayInternalSlots} The extracted config. + */ +function ensurePluginMemberMaps(instance) { + const slots = internalSlotsMap$2.get(instance); + + if (!slots.ruleMap) { + initPluginMemberMaps(instance, slots); + } + + return slots; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The Config Array. + * + * `ConfigArray` instance contains all settings, parsers, and plugins. + * You need to call `ConfigArray#extractConfig(filePath)` method in order to + * extract, merge and get only the config data which is related to an arbitrary + * file. + * @extends {Array} + */ +class ConfigArray extends Array { + + /** + * Get the plugin environments. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin environments. + */ + get pluginEnvironments() { + return ensurePluginMemberMaps(this).envMap; + } + + /** + * Get the plugin processors. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin processors. + */ + get pluginProcessors() { + return ensurePluginMemberMaps(this).processorMap; + } + + /** + * Get the plugin rules. + * The returned map cannot be mutated. + * @returns {ReadonlyMap} The plugin rules. + */ + get pluginRules() { + return ensurePluginMemberMaps(this).ruleMap; + } + + /** + * Check if this config has `root` flag. + * @returns {boolean} `true` if this config array is root. + */ + isRoot() { + for (let i = this.length - 1; i >= 0; --i) { + const root = this[i].root; + + if (typeof root === "boolean") { + return root; + } + } + return false; + } + + /** + * Extract the config data which is related to a given file. + * @param {string} filePath The absolute path to the target file. + * @returns {ExtractedConfig} The extracted config data. + */ + extractConfig(filePath) { + const { cache } = internalSlotsMap$2.get(this); + const indices = getMatchedIndices(this, filePath); + const cacheKey = indices.join(","); + + if (!cache.has(cacheKey)) { + cache.set(cacheKey, createConfig(this, indices)); + } + + return cache.get(cacheKey); + } + + /** + * Check if a given path is an additional lint target. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the file is an additional lint target. + */ + isAdditionalTargetPath(filePath) { + for (const { criteria, type } of this) { + if ( + type === "config" && + criteria && + !criteria.endsWithWildcard && + criteria.test(filePath) + ) { + return true; + } + } + return false; + } +} + +/** + * Get the used extracted configs. + * CLIEngine will use this method to collect used deprecated rules. + * @param {ConfigArray} instance The config array object to get. + * @returns {ExtractedConfig[]} The used extracted configs. + * @private + */ +function getUsedExtractedConfigs(instance) { + const { cache } = internalSlotsMap$2.get(instance); + + return Array.from(cache.values()); +} + +/** + * @fileoverview `ConfigDependency` class. + * + * `ConfigDependency` class expresses a loaded parser or plugin. + * + * If the parser or plugin was loaded successfully, it has `definition` property + * and `filePath` property. Otherwise, it has `error` property. + * + * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it + * omits `definition` property. + * + * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers + * or plugins. + * + * @author Toru Nagashima + */ + +/** + * The class is to store parsers or plugins. + * This class hides the loaded object from `JSON.stringify()` and `console.log`. + * @template T + */ +class ConfigDependency { + + /** + * Initialize this instance. + * @param {Object} data The dependency data. + * @param {T} [data.definition] The dependency if the loading succeeded. + * @param {Error} [data.error] The error object if the loading failed. + * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded. + * @param {string} data.id The ID of this dependency. + * @param {string} data.importerName The name of the config file which loads this dependency. + * @param {string} data.importerPath The path to the config file which loads this dependency. + */ + constructor({ + definition = null, + error = null, + filePath = null, + id, + importerName, + importerPath + }) { + + /** + * The loaded dependency if the loading succeeded. + * @type {T|null} + */ + this.definition = definition; + + /** + * The error object if the loading failed. + * @type {Error|null} + */ + this.error = error; + + /** + * The loaded dependency if the loading succeeded. + * @type {string|null} + */ + this.filePath = filePath; + + /** + * The ID of this dependency. + * @type {string} + */ + this.id = id; + + /** + * The name of the config file which loads this dependency. + * @type {string} + */ + this.importerName = importerName; + + /** + * The path to the config file which loads this dependency. + * @type {string} + */ + this.importerPath = importerPath; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + const obj = this[util__default["default"].inspect.custom](); + + // Display `error.message` (`Error#message` is unenumerable). + if (obj.error instanceof Error) { + obj.error = { ...obj.error, message: obj.error.message }; + } + + return obj; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util__default["default"].inspect.custom]() { + const { + definition: _ignore, // eslint-disable-line no-unused-vars + ...obj + } = this; + + return obj; + } +} + +/** + * @fileoverview `OverrideTester` class. + * + * `OverrideTester` class handles `files` property and `excludedFiles` property + * of `overrides` config. + * + * It provides one method. + * + * - `test(filePath)` + * Test if a file path matches the pair of `files` property and + * `excludedFiles` property. The `filePath` argument must be an absolute + * path. + * + * `ConfigArrayFactory` creates `OverrideTester` objects when it processes + * `overrides` properties. + * + * @author Toru Nagashima + */ + +const { Minimatch } = minimatch__default["default"]; + +const minimatchOpts = { dot: true, matchBase: true }; + +/** + * @typedef {Object} Pattern + * @property {InstanceType[] | null} includes The positive matchers. + * @property {InstanceType[] | null} excludes The negative matchers. + */ + +/** + * Normalize a given pattern to an array. + * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns. + * @returns {string[]|null} Normalized patterns. + * @private + */ +function normalizePatterns(patterns) { + if (Array.isArray(patterns)) { + return patterns.filter(Boolean); + } + if (typeof patterns === "string" && patterns) { + return [patterns]; + } + return []; +} + +/** + * Create the matchers of given patterns. + * @param {string[]} patterns The patterns. + * @returns {InstanceType[] | null} The matchers. + */ +function toMatcher(patterns) { + if (patterns.length === 0) { + return null; + } + return patterns.map(pattern => { + if (/^\.[/\\]/u.test(pattern)) { + return new Minimatch( + pattern.slice(2), + + // `./*.js` should not match with `subdir/foo.js` + { ...minimatchOpts, matchBase: false } + ); + } + return new Minimatch(pattern, minimatchOpts); + }); +} + +/** + * Convert a given matcher to string. + * @param {Pattern} matchers The matchers. + * @returns {string} The string expression of the matcher. + */ +function patternToJson({ includes, excludes }) { + return { + includes: includes && includes.map(m => m.pattern), + excludes: excludes && excludes.map(m => m.pattern) + }; +} + +/** + * The class to test given paths are matched by the patterns. + */ +class OverrideTester { + + /** + * Create a tester with given criteria. + * If there are no criteria, returns `null`. + * @param {string|string[]} files The glob patterns for included files. + * @param {string|string[]} excludedFiles The glob patterns for excluded files. + * @param {string} basePath The path to the base directory to test paths. + * @returns {OverrideTester|null} The created instance or `null`. + */ + static create(files, excludedFiles, basePath) { + const includePatterns = normalizePatterns(files); + const excludePatterns = normalizePatterns(excludedFiles); + let endsWithWildcard = false; + + if (includePatterns.length === 0) { + return null; + } + + // Rejects absolute paths or relative paths to parents. + for (const pattern of includePatterns) { + if (path__default["default"].isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + if (pattern.endsWith("*")) { + endsWithWildcard = true; + } + } + for (const pattern of excludePatterns) { + if (path__default["default"].isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + } + + const includes = toMatcher(includePatterns); + const excludes = toMatcher(excludePatterns); + + return new OverrideTester( + [{ includes, excludes }], + basePath, + endsWithWildcard + ); + } + + /** + * Combine two testers by logical and. + * If either of the testers was `null`, returns the other tester. + * The `basePath` property of the two must be the same value. + * @param {OverrideTester|null} a A tester. + * @param {OverrideTester|null} b Another tester. + * @returns {OverrideTester|null} Combined tester. + */ + static and(a, b) { + if (!b) { + return a && new OverrideTester( + a.patterns, + a.basePath, + a.endsWithWildcard + ); + } + if (!a) { + return new OverrideTester( + b.patterns, + b.basePath, + b.endsWithWildcard + ); + } + + assert__default["default"].strictEqual(a.basePath, b.basePath); + return new OverrideTester( + a.patterns.concat(b.patterns), + a.basePath, + a.endsWithWildcard || b.endsWithWildcard + ); + } + + /** + * Initialize this instance. + * @param {Pattern[]} patterns The matchers. + * @param {string} basePath The base path. + * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`. + */ + constructor(patterns, basePath, endsWithWildcard = false) { + + /** @type {Pattern[]} */ + this.patterns = patterns; + + /** @type {string} */ + this.basePath = basePath; + + /** @type {boolean} */ + this.endsWithWildcard = endsWithWildcard; + } + + /** + * Test if a given path is matched or not. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the path was matched. + */ + test(filePath) { + if (typeof filePath !== "string" || !path__default["default"].isAbsolute(filePath)) { + throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`); + } + const relativePath = path__default["default"].relative(this.basePath, filePath); + + return this.patterns.every(({ includes, excludes }) => ( + (!includes || includes.some(m => m.match(relativePath))) && + (!excludes || !excludes.some(m => m.match(relativePath))) + )); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + if (this.patterns.length === 1) { + return { + ...patternToJson(this.patterns[0]), + basePath: this.basePath + }; + } + return { + AND: this.patterns.map(patternToJson), + basePath: this.basePath + }; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util__default["default"].inspect.custom]() { + return this.toJSON(); + } +} + +/** + * @fileoverview `ConfigArray` class. + * @author Toru Nagashima + */ + +/** + * @fileoverview Config file operations. This file must be usable in the browser, + * so no Node-specific code can be here. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const RULE_SEVERITY_STRINGS = ["off", "warn", "error"], + RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { + map[value] = index; + return map; + }, {}), + VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Normalizes the severity value of a rule's configuration to a number + * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally + * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), + * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array + * whose first element is one of the above values. Strings are matched case-insensitively. + * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. + */ +function getRuleSeverity(ruleConfig) { + const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (severityValue === 0 || severityValue === 1 || severityValue === 2) { + return severityValue; + } + + if (typeof severityValue === "string") { + return RULE_SEVERITY[severityValue.toLowerCase()] || 0; + } + + return 0; +} + +/** + * Converts old-style severity settings (0, 1, 2) into new-style + * severity settings (off, warn, error) for all rules. Assumption is that severity + * values have already been validated as correct. + * @param {Object} config The config object to normalize. + * @returns {void} + */ +function normalizeToStrings(config) { + + if (config.rules) { + Object.keys(config.rules).forEach(ruleId => { + const ruleConfig = config.rules[ruleId]; + + if (typeof ruleConfig === "number") { + config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; + } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { + ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; + } + }); + } +} + +/** + * Determines if the severity for the given rule configuration represents an error. + * @param {int|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} True if the rule represents an error, false if not. + */ +function isErrorSeverity(ruleConfig) { + return getRuleSeverity(ruleConfig) === 2; +} + +/** + * Checks whether a given config has valid severity or not. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isValidSeverity(ruleConfig) { + let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (typeof severity === "string") { + severity = severity.toLowerCase(); + } + return VALID_SEVERITIES.indexOf(severity) !== -1; +} + +/** + * Checks whether every rule of a given config has valid severity or not. + * @param {Object} config The configuration for rules. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isEverySeverityValid(config) { + return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId])); +} + +/** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + * @throws Error if global value is invalid + */ +function normalizeConfigGlobal(configuredValue) { + switch (configuredValue) { + case "off": + return "off"; + + case true: + case "true": + case "writeable": + case "writable": + return "writable"; + + case null: + case false: + case "false": + case "readable": + case "readonly": + return "readonly"; + + default: + throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); + } +} + +var ConfigOps = { + __proto__: null, + getRuleSeverity: getRuleSeverity, + normalizeToStrings: normalizeToStrings, + isErrorSeverity: isErrorSeverity, + isValidSeverity: isValidSeverity, + isEverySeverityValid: isEverySeverityValid, + normalizeConfigGlobal: normalizeConfigGlobal +}; + +/** + * @fileoverview Provide the function that emits deprecation warnings. + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// Defitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", + ESLINT_PERSONAL_CONFIG_LOAD: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please use a config file per project or the '--config' option.", + ESLINT_PERSONAL_CONFIG_SUPPRESS: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please remove it or add 'root:true' to the config files in your " + + "projects in order to avoid loading '~/.eslintrc.*' accidentally." +}; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param {string} source The name of the configuration source to report the warning for. + * @param {string} errorCode The warning message to show. + * @returns {void} + */ +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + sourceFileErrorCache.add(cacheKey); + + const rel = path__default["default"].relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/* + * Copied from ajv/lib/refs/json-schema-draft-04.json + * The MIT License (MIT) + * Copyright (c) 2015-2017 Evgeny Poberezkin + */ +const metaSchema = { + id: "http://json-schema.org/draft-04/schema#", + $schema: "http://json-schema.org/draft-04/schema#", + description: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + positiveInteger: { + type: "integer", + minimum: 0 + }, + positiveIntegerDefault0: { + allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true + } + }, + type: "object", + properties: { + id: { + type: "string" + }, + $schema: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: { }, + multipleOf: { + type: "number", + minimum: 0, + exclusiveMinimum: true + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "boolean", + default: false + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "boolean", + default: false + }, + maxLength: { $ref: "#/definitions/positiveInteger" }, + minLength: { $ref: "#/definitions/positiveIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + items: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/schemaArray" } + ], + default: { } + }, + maxItems: { $ref: "#/definitions/positiveInteger" }, + minItems: { $ref: "#/definitions/positiveIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxProperties: { $ref: "#/definitions/positiveInteger" }, + minProperties: { $ref: "#/definitions/positiveIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/stringArray" } + ] + } + }, + enum: { + type: "array", + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + dependencies: { + exclusiveMaximum: ["maximum"], + exclusiveMinimum: ["minimum"] + }, + default: { } +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +var ajvOrig = (additionalOptions = {}) => { + const ajv = new Ajv__default["default"]({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); + + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +}; + +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ + +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, + + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; + +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, + + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, + + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, + + $ref: "#/definitions/objectConfig" +}; + +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the object that has difference. + * @param {Record} current The newer object. + * @param {Record} prev The older object. + * @returns {Record} The difference object. + */ +function getDiff(current, prev) { + const retv = {}; + + for (const [key, value] of Object.entries(current)) { + if (!Object.hasOwnProperty.call(prev, key)) { + retv[key] = value; + } + } + + return retv; +} + +const newGlobals2015 = getDiff(globals__default["default"].es2015, globals__default["default"].es5); // 19 variables such as Promise, Map, ... +const newGlobals2017 = { + Atomics: false, + SharedArrayBuffer: false +}; +const newGlobals2020 = { + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; + +const newGlobals2021 = { + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {Map} */ +var environments = new Map(Object.entries({ + + // Language + builtin: { + globals: globals__default["default"].es5 + }, + es6: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2015: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2016: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 7 + } + }, + es2017: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 8 + } + }, + es2018: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 9 + } + }, + es2019: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 10 + } + }, + es2020: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, + parserOptions: { + ecmaVersion: 11 + } + }, + es2021: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 12 + } + }, + es2022: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 13 + } + }, + + // Platforms + browser: { + globals: globals__default["default"].browser + }, + node: { + globals: globals__default["default"].node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + "shared-node-browser": { + globals: globals__default["default"]["shared-node-browser"] + }, + worker: { + globals: globals__default["default"].worker + }, + serviceworker: { + globals: globals__default["default"].serviceworker + }, + + // Frameworks + commonjs: { + globals: globals__default["default"].commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + amd: { + globals: globals__default["default"].amd + }, + mocha: { + globals: globals__default["default"].mocha + }, + jasmine: { + globals: globals__default["default"].jasmine + }, + jest: { + globals: globals__default["default"].jest + }, + phantomjs: { + globals: globals__default["default"].phantomjs + }, + jquery: { + globals: globals__default["default"].jquery + }, + qunit: { + globals: globals__default["default"].qunit + }, + prototypejs: { + globals: globals__default["default"].prototypejs + }, + shelljs: { + globals: globals__default["default"].shelljs + }, + meteor: { + globals: globals__default["default"].meteor + }, + mongo: { + globals: globals__default["default"].mongo + }, + protractor: { + globals: globals__default["default"].protractor + }, + applescript: { + globals: globals__default["default"].applescript + }, + nashorn: { + globals: globals__default["default"].nashorn + }, + atomtest: { + globals: globals__default["default"].atomtest + }, + embertest: { + globals: globals__default["default"].embertest + }, + webextensions: { + globals: globals__default["default"].webextensions + }, + greasemonkey: { + globals: globals__default["default"].greasemonkey + } +})); + +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ + +const ajv = ajvOrig(); + +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +const validated = new WeakSet(); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +class ConfigValidator { + constructor({ builtInRules = new Map() } = {}) { + this.builtInRules = builtInRules; + } + + /** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ + getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; + } + + /** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ + validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util__default["default"].inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + + } + + /** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @returns {void} + */ + validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = this.getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } + } + + /** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @returns {void} + */ + validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = this.validateRuleSeverity(options); + + if (severity !== 0) { + this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } + } + + /** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ + validateEnvironment( + environment, + source, + getAdditionalEnv = noop + ) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || environments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); + } + + /** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ + validateRules( + rulesConfig, + source, + getAdditionalRule = noop + ) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; + + this.validateRuleOptions(rule, id, rulesConfig[id], source); + }); + } + + /** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ + validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); + } + + /** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @returns {void} + */ + validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } + } + + /** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ + formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); + } + + /** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @returns {void} + */ + validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } + } + + /** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ + validate(config, source, getAdditionalRule, getAdditionalEnv) { + this.validateConfigSchema(config, source); + this.validateRules(config.rules, source, getAdditionalRule); + this.validateEnvironment(config.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + this.validateRules(override.rules, source, getAdditionalRule); + this.validateEnvironment(override.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + } + } + + /** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ + validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + this.validateEnvironment(element.env, element.name, getPluginEnv); + this.validateGlobals(element.globals, element.name); + this.validateProcessor(element.processor, element.name, getPluginProcessor); + this.validateRules(element.rules, element.name, getPluginRule); + } + } + +} + +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ + +const NAMESPACE_REGEX = /^@.*\//iu; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + let normalizedName = name; + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (normalizedName.includes("\\")) { + normalizedName = normalizedName.replace(/\\/gu, "/"); + } + + if (normalizedName.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); + + if (scopedPackageShortcutRegex.test(normalizedName)) { + normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); + } + } else if (!normalizedName.startsWith(`${prefix}-`)) { + normalizedName = `${prefix}-${normalizedName}`; + } + + return normalizedName; +} + +/** + * Removes the prefix from a fullname. + * @param {string} fullname The term which may have the prefix. + * @param {string} prefix The prefix to remove. + * @returns {string} The term without prefix. + */ +function getShorthandName(fullname, prefix) { + if (fullname[0] === "@") { + let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); + + if (matchResult) { + return matchResult[1]; + } + + matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); + if (matchResult) { + return `${matchResult[1]}/${matchResult[2]}`; + } + } else if (fullname.startsWith(`${prefix}-`)) { + return fullname.slice(prefix.length + 1); + } + + return fullname; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namespace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +var naming = { + __proto__: null, + normalizePackageName: normalizePackageName, + getShorthandName: getShorthandName, + getNamespaceFromTerm: getNamespaceFromTerm +}; + +/** + * Utility for resolving a module relative to another module + * @author Teddy Katz + */ + +/* + * `Module.createRequire` is added in v12.2.0. It supports URL as well. + * We only support the case where the argument is a filepath, not a URL. + */ +const createRequire = Module__default["default"].createRequire; + +/** + * Resolves a Node module relative to another module + * @param {string} moduleName The name of a Node module, or a path to a Node module. + * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be + * a file rather than a directory, but the file need not actually exist. + * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` + */ +function resolve(moduleName, relativeToPath) { + try { + return createRequire(relativeToPath).resolve(moduleName); + } catch (error) { + + // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. + if ( + typeof error === "object" && + error !== null && + error.code === "MODULE_NOT_FOUND" && + !error.requireStack && + error.message.includes(moduleName) + ) { + error.message += `\nRequire stack:\n- ${relativeToPath}`; + } + throw error; + } +} + +var ModuleResolver = { + __proto__: null, + resolve: resolve +}; + +/** + * @fileoverview The factory of `ConfigArray` objects. + * + * This class provides methods to create `ConfigArray` instance. + * + * - `create(configData, options)` + * Create a `ConfigArray` instance from a config data. This is to handle CLI + * options except `--config`. + * - `loadFile(filePath, options)` + * Create a `ConfigArray` instance from a config file. This is to handle + * `--config` option. If the file was not found, throws the following error: + * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error. + * - If the filename was `package.json`, an IO error or an + * `ESLINT_CONFIG_FIELD_NOT_FOUND` error. + * - Otherwise, an IO error such as `ENOENT`. + * - `loadInDirectory(directoryPath, options)` + * Create a `ConfigArray` instance from a config file which is on a given + * directory. This tries to load `.eslintrc.*` or `package.json`. If not + * found, returns an empty `ConfigArray`. + * - `loadESLintIgnore(filePath)` + * Create a `ConfigArray` instance from a config file that is `.eslintignore` + * format. This is to handle `--ignore-path` option. + * - `loadDefaultESLintIgnore()` + * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in + * the current working directory. + * + * `ConfigArrayFactory` class has the responsibility that loads configuration + * files, including loading `extends`, `parser`, and `plugins`. The created + * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`. + * + * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class + * handles cascading and hierarchy. + * + * @author Toru Nagashima + */ + +const require$1 = Module.createRequire(require('url').pathToFileURL(__filename).toString()); + +const debug$2 = debugOrig__default["default"]("eslintrc:config-array-factory"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const configFilenames = [ + ".eslintrc.js", + ".eslintrc.cjs", + ".eslintrc.yaml", + ".eslintrc.yml", + ".eslintrc.json", + ".eslintrc", + "package.json" +]; + +// Define types for VSCode IntelliSense. +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").OverrideConfigData} OverrideConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ +/** @typedef {import("./config-array/config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-array/config-dependency").DependentPlugin} DependentPlugin */ +/** @typedef {ConfigArray[0]} ConfigArrayElement */ + +/** + * @typedef {Object} ConfigArrayFactoryOptions + * @property {Map} [additionalPluginPool] The map for additional plugins. + * @property {string} [cwd] The path to the current working directory. + * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} ConfigArrayFactoryInternalSlots + * @property {Map} additionalPluginPool The map for additional plugins. + * @property {string} cwd The path to the current working directory. + * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {string} pluginBasePath The base path to resolve plugins. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. + */ + +/** @type {WeakMap} */ +const internalSlotsMap$1 = new WeakMap(); + +/** + * Check if a given string is a file path. + * @param {string} nameOrPath A module name or file path. + * @returns {boolean} `true` if the `nameOrPath` is a file path. + */ +function isFilePath(nameOrPath) { + return ( + /^\.{1,2}[/\\]/u.test(nameOrPath) || + path__default["default"].isAbsolute(nameOrPath) + ); +} + +/** + * Convenience wrapper for synchronously reading file contents. + * @param {string} filePath The filename to read. + * @returns {string} The file contents, with the BOM removed. + * @private + */ +function readFile(filePath) { + return fs__default["default"].readFileSync(filePath, "utf8").replace(/^\ufeff/u, ""); +} + +/** + * Loads a YAML configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadYAMLConfigFile(filePath) { + debug$2(`Loading YAML config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require$1("js-yaml"); + + try { + + // empty YAML file can be null, so always use + return yaml.load(readFile(filePath)) || {}; + } catch (e) { + debug$2(`Error reading YAML file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a JSON configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadJSONConfigFile(filePath) { + debug$2(`Loading JSON config file: ${filePath}`); + + try { + return JSON.parse(stripComments__default["default"](readFile(filePath))); + } catch (e) { + debug$2(`Error reading JSON file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + e.messageTemplate = "failed-to-read-json"; + e.messageData = { + path: filePath, + message: e.message + }; + throw e; + } +} + +/** + * Loads a legacy (.eslintrc) configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadLegacyConfigFile(filePath) { + debug$2(`Loading legacy config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require$1("js-yaml"); + + try { + return yaml.load(stripComments__default["default"](readFile(filePath))) || /* istanbul ignore next */ {}; + } catch (e) { + debug$2("Error reading YAML file: %s\n%o", filePath, e); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a JavaScript configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadJSConfigFile(filePath) { + debug$2(`Loading JS config file: ${filePath}`); + try { + return importFresh__default["default"](filePath); + } catch (e) { + debug$2(`Error reading JavaScript file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a configuration from a package.json file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadPackageJSONConfigFile(filePath) { + debug$2(`Loading package.json config file: ${filePath}`); + try { + const packageData = loadJSONConfigFile(filePath); + + if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) { + throw Object.assign( + new Error("package.json file doesn't have 'eslintConfig' field."), + { code: "ESLINT_CONFIG_FIELD_NOT_FOUND" } + ); + } + + return packageData.eslintConfig; + } catch (e) { + debug$2(`Error reading package.json file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a `.eslintignore` from a file. + * @param {string} filePath The filename to load. + * @returns {string[]} The ignore patterns from the file. + * @private + */ +function loadESLintIgnoreFile(filePath) { + debug$2(`Loading .eslintignore file: ${filePath}`); + + try { + return readFile(filePath) + .split(/\r?\n/gu) + .filter(line => line.trim() !== "" && !line.startsWith("#")); + } catch (e) { + debug$2(`Error reading .eslintignore file: ${filePath}`); + e.message = `Cannot read .eslintignore file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Creates an error to notify about a missing config to extend from. + * @param {string} configName The name of the missing config. + * @param {string} importerName The name of the config that imported the missing config + * @param {string} messageTemplate The text template to source error strings from. + * @returns {Error} The error object to throw + * @private + */ +function configInvalidError(configName, importerName, messageTemplate) { + return Object.assign( + new Error(`Failed to load config "${configName}" to extend from.`), + { + messageTemplate, + messageData: { configName, importerName } + } + ); +} + +/** + * Loads a configuration file regardless of the source. Inspects the file path + * to determine the correctly way to load the config file. + * @param {string} filePath The path to the configuration. + * @returns {ConfigData|null} The configuration information. + * @private + */ +function loadConfigFile(filePath) { + switch (path__default["default"].extname(filePath)) { + case ".js": + case ".cjs": + return loadJSConfigFile(filePath); + + case ".json": + if (path__default["default"].basename(filePath) === "package.json") { + return loadPackageJSONConfigFile(filePath); + } + return loadJSONConfigFile(filePath); + + case ".yaml": + case ".yml": + return loadYAMLConfigFile(filePath); + + default: + return loadLegacyConfigFile(filePath); + } +} + +/** + * Write debug log. + * @param {string} request The requested module name. + * @param {string} relativeTo The file path to resolve the request relative to. + * @param {string} filePath The resolved file path. + * @returns {void} + */ +function writeDebugLogForLoading(request, relativeTo, filePath) { + /* istanbul ignore next */ + if (debug$2.enabled) { + let nameAndVersion = null; + + try { + const packageJsonPath = resolve( + `${request}/package.json`, + relativeTo + ); + const { version = "unknown" } = require$1(packageJsonPath); + + nameAndVersion = `${request}@${version}`; + } catch (error) { + debug$2("package.json was not found:", error.message); + nameAndVersion = request; + } + + debug$2("Loaded: %s (%s)", nameAndVersion, filePath); + } +} + +/** + * Create a new context with default values. + * @param {ConfigArrayFactoryInternalSlots} slots The internal slots. + * @param {"config" | "ignore" | "implicit-processor" | undefined} providedType The type of the current configuration. Default is `"config"`. + * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`. + * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string. + * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`. + * @returns {ConfigArrayFactoryLoadingContext} The created context. + */ +function createContext( + { cwd, resolvePluginsRelativeTo }, + providedType, + providedName, + providedFilePath, + providedMatchBasePath +) { + const filePath = providedFilePath + ? path__default["default"].resolve(cwd, providedFilePath) + : ""; + const matchBasePath = + (providedMatchBasePath && path__default["default"].resolve(cwd, providedMatchBasePath)) || + (filePath && path__default["default"].dirname(filePath)) || + cwd; + const name = + providedName || + (filePath && path__default["default"].relative(cwd, filePath)) || + ""; + const pluginBasePath = + resolvePluginsRelativeTo || + (filePath && path__default["default"].dirname(filePath)) || + cwd; + const type = providedType || "config"; + + return { filePath, matchBasePath, name, pluginBasePath, type }; +} + +/** + * Normalize a given plugin. + * - Ensure the object to have four properties: configs, environments, processors, and rules. + * - Ensure the object to not have other properties. + * @param {Plugin} plugin The plugin to normalize. + * @returns {Plugin} The normalized plugin. + */ +function normalizePlugin(plugin) { + return { + configs: plugin.configs || {}, + environments: plugin.environments || {}, + processors: plugin.processors || {}, + rules: plugin.rules || {} + }; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The factory of `ConfigArray` objects. + */ +class ConfigArrayFactory { + + /** + * Initialize this instance. + * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins. + */ + constructor({ + additionalPluginPool = new Map(), + cwd = process.cwd(), + resolvePluginsRelativeTo, + builtInRules, + resolver = ModuleResolver, + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + } = {}) { + internalSlotsMap$1.set(this, { + additionalPluginPool, + cwd, + resolvePluginsRelativeTo: + resolvePluginsRelativeTo && + path__default["default"].resolve(cwd, resolvePluginsRelativeTo), + builtInRules, + resolver, + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + }); + } + + /** + * Create `ConfigArray` instance from a config data. + * @param {ConfigData|null} configData The config data to create. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.filePath] The path to this config data. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + create(configData, { basePath, filePath, name } = {}) { + if (!configData) { + return new ConfigArray(); + } + + const slots = internalSlotsMap$1.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + const elements = this._normalizeConfigData(configData, ctx); + + return new ConfigArray(...elements); + } + + /** + * Load a config file. + * @param {string} filePath The path to a config file. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + loadFile(filePath, { basePath, name } = {}) { + const slots = internalSlotsMap$1.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + + return new ConfigArray(...this._loadConfigData(ctx)); + } + + /** + * Load the config file on a given directory if exists. + * @param {string} directoryPath The path to a directory. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadInDirectory(directoryPath, { basePath, name } = {}) { + const slots = internalSlotsMap$1.get(this); + + for (const filename of configFilenames) { + const ctx = createContext( + slots, + "config", + name, + path__default["default"].join(directoryPath, filename), + basePath + ); + + if (fs__default["default"].existsSync(ctx.filePath) && fs__default["default"].statSync(ctx.filePath).isFile()) { + let configData; + + try { + configData = loadConfigFile(ctx.filePath); + } catch (error) { + if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { + throw error; + } + } + + if (configData) { + debug$2(`Config file found: ${ctx.filePath}`); + return new ConfigArray( + ...this._normalizeConfigData(configData, ctx) + ); + } + } + } + + debug$2(`Config file not found on ${directoryPath}`); + return new ConfigArray(); + } + + /** + * Check if a config file on a given directory exists or not. + * @param {string} directoryPath The path to a directory. + * @returns {string | null} The path to the found config file. If not found then null. + */ + static getPathToConfigFileInDirectory(directoryPath) { + for (const filename of configFilenames) { + const filePath = path__default["default"].join(directoryPath, filename); + + if (fs__default["default"].existsSync(filePath)) { + if (filename === "package.json") { + try { + loadPackageJSONConfigFile(filePath); + return filePath; + } catch { /* ignore */ } + } else { + return filePath; + } + } + } + return null; + } + + /** + * Load `.eslintignore` file. + * @param {string} filePath The path to a `.eslintignore` file to load. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadESLintIgnore(filePath) { + const slots = internalSlotsMap$1.get(this); + const ctx = createContext( + slots, + "ignore", + void 0, + filePath, + slots.cwd + ); + const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(ignorePatterns, ctx) + ); + } + + /** + * Load `.eslintignore` file in the current working directory. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadDefaultESLintIgnore() { + const slots = internalSlotsMap$1.get(this); + const eslintIgnorePath = path__default["default"].resolve(slots.cwd, ".eslintignore"); + const packageJsonPath = path__default["default"].resolve(slots.cwd, "package.json"); + + if (fs__default["default"].existsSync(eslintIgnorePath)) { + return this.loadESLintIgnore(eslintIgnorePath); + } + if (fs__default["default"].existsSync(packageJsonPath)) { + const data = loadJSONConfigFile(packageJsonPath); + + if (Object.hasOwnProperty.call(data, "eslintIgnore")) { + if (!Array.isArray(data.eslintIgnore)) { + throw new Error("Package.json eslintIgnore property requires an array of paths"); + } + const ctx = createContext( + slots, + "ignore", + "eslintIgnore in package.json", + packageJsonPath, + slots.cwd + ); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx) + ); + } + } + + return new ConfigArray(); + } + + /** + * Load a given config file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} Loaded config. + * @private + */ + _loadConfigData(ctx) { + return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); + } + + /** + * Normalize a given `.eslintignore` data to config array elements. + * @param {string[]} ignorePatterns The patterns to ignore files. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeESLintIgnoreData(ignorePatterns, ctx) { + const elements = this._normalizeObjectConfigData( + { ignorePatterns }, + ctx + ); + + // Set `ignorePattern.loose` flag for backward compatibility. + for (const element of elements) { + if (element.ignorePattern) { + element.ignorePattern.loose = true; + } + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _normalizeConfigData(configData, ctx) { + const validator = new ConfigValidator(); + + validator.validateConfigSchema(configData, ctx.name || ctx.filePath); + return this._normalizeObjectConfigData(configData, ctx); + } + + /** + * Normalize a given config to an array. + * @param {ConfigData|OverrideConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigData(configData, ctx) { + const { files, excludedFiles, ...configBody } = configData; + const criteria = OverrideTester.create( + files, + excludedFiles, + ctx.matchBasePath + ); + const elements = this._normalizeObjectConfigDataBody(configBody, ctx); + + // Apply the criteria to every element. + for (const element of elements) { + + /* + * Merge the criteria. + * This is for the `overrides` entries that came from the + * configurations of `overrides[].extends`. + */ + element.criteria = OverrideTester.and(criteria, element.criteria); + + /* + * Remove `root` property to ignore `root` settings which came from + * `extends` in `overrides`. + */ + if (element.criteria) { + element.root = void 0; + } + + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigDataBody( + { + env, + extends: extend, + globals, + ignorePatterns, + noInlineConfig, + parser: parserName, + parserOptions, + plugins: pluginList, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings, + overrides: overrideList = [] + }, + ctx + ) { + const extendList = Array.isArray(extend) ? extend : [extend]; + const ignorePattern = ignorePatterns && new IgnorePattern( + Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], + ctx.matchBasePath + ); + + // Flatten `extends`. + for (const extendName of extendList.filter(Boolean)) { + yield* this._loadExtends(extendName, ctx); + } + + // Load parser & plugins. + const parser = parserName && this._loadParser(parserName, ctx); + const plugins = pluginList && this._loadPlugins(pluginList, ctx); + + // Yield pseudo config data for file extension processors. + if (plugins) { + yield* this._takeFileExtensionProcessors(plugins, ctx); + } + + // Yield the config data except `extends` and `overrides`. + yield { + + // Debug information. + type: ctx.type, + name: ctx.name, + filePath: ctx.filePath, + + // Config data. + criteria: null, + env, + globals, + ignorePattern, + noInlineConfig, + parser, + parserOptions, + plugins, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings + }; + + // Flatten `overries`. + for (let i = 0; i < overrideList.length; ++i) { + yield* this._normalizeObjectConfigData( + overrideList[i], + { ...ctx, name: `${ctx.name}#overrides[${i}]` } + ); + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtends(extendName, ctx) { + debug$2("Loading {extends:%j} relative to %s", extendName, ctx.filePath); + try { + if (extendName.startsWith("eslint:")) { + return this._loadExtendedBuiltInConfig(extendName, ctx); + } + if (extendName.startsWith("plugin:")) { + return this._loadExtendedPluginConfig(extendName, ctx); + } + return this._loadExtendedShareableConfig(extendName, ctx); + } catch (error) { + error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; + throw error; + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedBuiltInConfig(extendName, ctx) { + const { + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + } = internalSlotsMap$1.get(this); + + if (extendName === "eslint:recommended") { + const name = `${ctx.name} » ${extendName}`; + + if (getEslintRecommendedConfig) { + if (typeof getEslintRecommendedConfig !== "function") { + throw new Error(`getEslintRecommendedConfig must be a function instead of '${getEslintRecommendedConfig}'`); + } + return this._normalizeConfigData(getEslintRecommendedConfig(), { ...ctx, name, filePath: "" }); + } + return this._loadConfigData({ + ...ctx, + name, + filePath: eslintRecommendedPath + }); + } + if (extendName === "eslint:all") { + const name = `${ctx.name} » ${extendName}`; + + if (getEslintAllConfig) { + if (typeof getEslintAllConfig !== "function") { + throw new Error(`getEslintAllConfig must be a function instead of '${getEslintAllConfig}'`); + } + return this._normalizeConfigData(getEslintAllConfig(), { ...ctx, name, filePath: "" }); + } + return this._loadConfigData({ + ...ctx, + name, + filePath: eslintAllPath + }); + } + + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedPluginConfig(extendName, ctx) { + const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + + const pluginName = extendName.slice("plugin:".length, slashIndex); + const configName = extendName.slice(slashIndex + 1); + + if (isFilePath(pluginName)) { + throw new Error("'extends' cannot use a file path for plugins."); + } + + const plugin = this._loadPlugin(pluginName, ctx); + const configData = + plugin.definition && + plugin.definition.configs[configName]; + + if (configData) { + return this._normalizeConfigData(configData, { + ...ctx, + filePath: plugin.filePath || ctx.filePath, + name: `${ctx.name} » plugin:${plugin.id}/${configName}` + }); + } + + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedShareableConfig(extendName, ctx) { + const { cwd, resolver } = internalSlotsMap$1.get(this); + const relativeTo = ctx.filePath || path__default["default"].join(cwd, "__placeholder__.js"); + let request; + + if (isFilePath(extendName)) { + request = extendName; + } else if (extendName.startsWith(".")) { + request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior. + } else { + request = normalizePackageName( + extendName, + "eslint-config" + ); + } + + let filePath; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (error) { + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); + } + throw error; + } + + writeDebugLogForLoading(request, relativeTo, filePath); + return this._loadConfigData({ + ...ctx, + filePath, + name: `${ctx.name} » ${request}` + }); + } + + /** + * Load given plugins. + * @param {string[]} names The plugin names to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {Record} The loaded parser. + * @private + */ + _loadPlugins(names, ctx) { + return names.reduce((map, name) => { + if (isFilePath(name)) { + throw new Error("Plugins array cannot includes file paths."); + } + const plugin = this._loadPlugin(name, ctx); + + map[plugin.id] = plugin; + + return map; + }, {}); + } + + /** + * Load a given parser. + * @param {string} nameOrPath The package name or the path to a parser file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentParser} The loaded parser. + */ + _loadParser(nameOrPath, ctx) { + debug$2("Loading parser %j from %s", nameOrPath, ctx.filePath); + + const { cwd, resolver } = internalSlotsMap$1.get(this); + const relativeTo = ctx.filePath || path__default["default"].join(cwd, "__placeholder__.js"); + + try { + const filePath = resolver.resolve(nameOrPath, relativeTo); + + writeDebugLogForLoading(nameOrPath, relativeTo, filePath); + + return new ConfigDependency({ + definition: require$1(filePath), + filePath, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (error) { + + // If the parser name is "espree", load the espree of ESLint. + if (nameOrPath === "espree") { + debug$2("Fallback espree."); + return new ConfigDependency({ + definition: require$1("espree"), + filePath: require$1.resolve("espree"), + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + debug$2("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); + error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; + + return new ConfigDependency({ + error, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + } + + /** + * Load a given plugin. + * @param {string} name The plugin name to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentPlugin} The loaded plugin. + * @private + */ + _loadPlugin(name, ctx) { + debug$2("Loading plugin %j from %s", name, ctx.filePath); + + const { additionalPluginPool, resolver } = internalSlotsMap$1.get(this); + const request = normalizePackageName(name, "eslint-plugin"); + const id = getShorthandName(request, "eslint-plugin"); + const relativeTo = path__default["default"].join(ctx.pluginBasePath, "__placeholder__.js"); + + if (name.match(/\s+/u)) { + const error = Object.assign( + new Error(`Whitespace found in plugin name '${name}'`), + { + messageTemplate: "whitespace-found", + messageData: { pluginName: request } + } + ); + + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + // Check for additional pool. + const plugin = + additionalPluginPool.get(request) || + additionalPluginPool.get(id); + + if (plugin) { + return new ConfigDependency({ + definition: normalizePlugin(plugin), + filePath: "", // It's unknown where the plugin came from. + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + let filePath; + let error; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (resolveError) { + error = resolveError; + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + error.messageTemplate = "plugin-missing"; + error.messageData = { + pluginName: request, + resolvePluginsRelativeTo: ctx.pluginBasePath, + importerName: ctx.name + }; + } + } + + if (filePath) { + try { + writeDebugLogForLoading(request, relativeTo, filePath); + + const startTime = Date.now(); + const pluginDefinition = require$1(filePath); + + debug$2(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); + + return new ConfigDependency({ + definition: normalizePlugin(pluginDefinition), + filePath, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (loadError) { + error = loadError; + } + } + + debug$2("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); + error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + /** + * Take file expression processors as config array elements. + * @param {Record} plugins The plugin definitions. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The config array elements of file expression processors. + * @private + */ + *_takeFileExtensionProcessors(plugins, ctx) { + for (const pluginId of Object.keys(plugins)) { + const processors = + plugins[pluginId] && + plugins[pluginId].definition && + plugins[pluginId].definition.processors; + + if (!processors) { + continue; + } + + for (const processorId of Object.keys(processors)) { + if (processorId.startsWith(".")) { + yield* this._normalizeObjectConfigData( + { + files: [`*${processorId}`], + processor: `${pluginId}/${processorId}` + }, + { + ...ctx, + type: "implicit-processor", + name: `${ctx.name}#processors["${pluginId}/${processorId}"]` + } + ); + } + } + } + } +} + +/** + * @fileoverview `CascadingConfigArrayFactory` class. + * + * `CascadingConfigArrayFactory` class has a responsibility: + * + * 1. Handles cascading of config files. + * + * It provides two methods: + * + * - `getConfigArrayForFile(filePath)` + * Get the corresponded configuration of a given file. This method doesn't + * throw even if the given file didn't exist. + * - `clearCache()` + * Clear the internal cache. You have to call this method when + * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends + * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.) + * + * @author Toru Nagashima + */ + +const debug$1 = debugOrig__default["default"]("eslintrc:cascading-config-array-factory"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ +/** @typedef {ReturnType} ConfigArray */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryOptions + * @property {Map} [additionalPluginPool] The map for additional plugins. + * @property {ConfigData} [baseConfig] The config by `baseConfig` option. + * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files. + * @property {string} [cwd] The base directory to start lookup. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]} [rulePaths] The value of `--rulesdir` option. + * @property {string} [specificConfigPath] The value of `--config` option. + * @property {boolean} [useEslintrc] if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryInternalSlots + * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option. + * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`. + * @property {ConfigArray} cliConfigArray The config array of CLI options. + * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`. + * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays. + * @property {Map} configCache The cache from directory paths to config arrays. + * @property {string} cwd The base directory to start lookup. + * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`. + * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`. + * @property {boolean} useEslintrc if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Create the config array from `baseConfig` and `rulePaths`. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createBaseConfigArray({ + configArrayFactory, + baseConfigData, + rulePaths, + cwd, + loadRules +}) { + const baseConfigArray = configArrayFactory.create( + baseConfigData, + { name: "BaseConfig" } + ); + + /* + * Create the config array element for the default ignore patterns. + * This element has `ignorePattern` property that ignores the default + * patterns in the current working directory. + */ + baseConfigArray.unshift(configArrayFactory.create( + { ignorePatterns: IgnorePattern.DefaultPatterns }, + { name: "DefaultIgnorePattern" } + )[0]); + + /* + * Load rules `--rulesdir` option as a pseudo plugin. + * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate + * the rule's options with only information in the config array. + */ + if (rulePaths && rulePaths.length > 0) { + baseConfigArray.push({ + type: "config", + name: "--rulesdir", + filePath: "", + plugins: { + "": new ConfigDependency({ + definition: { + rules: rulePaths.reduce( + (map, rulesPath) => Object.assign( + map, + loadRules(rulesPath, cwd) + ), + {} + ) + }, + filePath: "", + id: "", + importerName: "--rulesdir", + importerPath: "" + }) + } + }); + } + + return baseConfigArray; +} + +/** + * Create the config array from CLI options. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath +}) { + const cliConfigArray = configArrayFactory.create( + cliConfigData, + { name: "CLIOptions" } + ); + + cliConfigArray.unshift( + ...(ignorePath + ? configArrayFactory.loadESLintIgnore(ignorePath) + : configArrayFactory.loadDefaultESLintIgnore()) + ); + + if (specificConfigPath) { + cliConfigArray.unshift( + ...configArrayFactory.loadFile( + specificConfigPath, + { name: "--config", basePath: cwd } + ) + ); + } + + return cliConfigArray; +} + +/** + * The error type when there are files matched by a glob, but all of them have been ignored. + */ +class ConfigurationNotFoundError extends Error { + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {string} directoryPath The directory path. + */ + constructor(directoryPath) { + super(`No ESLint configuration found in ${directoryPath}.`); + this.messageTemplate = "no-config-found"; + this.messageData = { directoryPath }; + } +} + +/** + * This class provides the functionality that enumerates every file which is + * matched by given glob patterns and that configuration. + */ +class CascadingConfigArrayFactory { + + /** + * Initialize this enumerator. + * @param {CascadingConfigArrayFactoryOptions} options The options. + */ + constructor({ + additionalPluginPool = new Map(), + baseConfig: baseConfigData = null, + cliConfig: cliConfigData = null, + cwd = process.cwd(), + ignorePath, + resolvePluginsRelativeTo, + rulePaths = [], + specificConfigPath = null, + useEslintrc = true, + builtInRules = new Map(), + loadRules, + resolver, + eslintRecommendedPath, + getEslintRecommendedConfig, + eslintAllPath, + getEslintAllConfig + } = {}) { + const configArrayFactory = new ConfigArrayFactory({ + additionalPluginPool, + cwd, + resolvePluginsRelativeTo, + builtInRules, + resolver, + eslintRecommendedPath, + getEslintRecommendedConfig, + eslintAllPath, + getEslintAllConfig + }); + + internalSlotsMap.set(this, { + baseConfigArray: createBaseConfigArray({ + baseConfigData, + configArrayFactory, + cwd, + rulePaths, + loadRules, + resolver + }), + baseConfigData, + cliConfigArray: createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath + }), + cliConfigData, + configArrayFactory, + configCache: new Map(), + cwd, + finalizeCache: new WeakMap(), + ignorePath, + rulePaths, + specificConfigPath, + useEslintrc, + builtInRules, + loadRules + }); + } + + /** + * The path to the current working directory. + * This is used by tests. + * @type {string} + */ + get cwd() { + const { cwd } = internalSlotsMap.get(this); + + return cwd; + } + + /** + * Get the config array of a given file. + * If `filePath` was not given, it returns the config which contains only + * `baseConfigData` and `cliConfigData`. + * @param {string} [filePath] The file path to a file. + * @param {Object} [options] The options. + * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The config array of the file. + */ + getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) { + const { + baseConfigArray, + cliConfigArray, + cwd + } = internalSlotsMap.get(this); + + if (!filePath) { + return new ConfigArray(...baseConfigArray, ...cliConfigArray); + } + + const directoryPath = path__default["default"].dirname(path__default["default"].resolve(cwd, filePath)); + + debug$1(`Load config files for ${directoryPath}.`); + + return this._finalizeConfigArray( + this._loadConfigInAncestors(directoryPath), + directoryPath, + ignoreNotFoundError + ); + } + + /** + * Set the config data to override all configs. + * Require to call `clearCache()` method after this method is called. + * @param {ConfigData} configData The config data to override all configs. + * @returns {void} + */ + setOverrideConfig(configData) { + const slots = internalSlotsMap.get(this); + + slots.cliConfigData = configData; + } + + /** + * Clear config cache. + * @returns {void} + */ + clearCache() { + const slots = internalSlotsMap.get(this); + + slots.baseConfigArray = createBaseConfigArray(slots); + slots.cliConfigArray = createCLIConfigArray(slots); + slots.configCache.clear(); + } + + /** + * Load and normalize config files from the ancestor directories. + * @param {string} directoryPath The path to a leaf directory. + * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories. + * @returns {ConfigArray} The loaded config. + * @private + */ + _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) { + const { + baseConfigArray, + configArrayFactory, + configCache, + cwd, + useEslintrc + } = internalSlotsMap.get(this); + + if (!useEslintrc) { + return baseConfigArray; + } + + let configArray = configCache.get(directoryPath); + + // Hit cache. + if (configArray) { + debug$1(`Cache hit: ${directoryPath}.`); + return configArray; + } + debug$1(`No cache found: ${directoryPath}.`); + + const homePath = os__default["default"].homedir(); + + // Consider this is root. + if (directoryPath === homePath && cwd !== homePath) { + debug$1("Stop traversing because of considered root."); + if (configsExistInSubdirs) { + const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath); + + if (filePath) { + emitDeprecationWarning( + filePath, + "ESLINT_PERSONAL_CONFIG_SUPPRESS" + ); + } + } + return this._cacheConfig(directoryPath, baseConfigArray); + } + + // Load the config on this directory. + try { + configArray = configArrayFactory.loadInDirectory(directoryPath); + } catch (error) { + /* istanbul ignore next */ + if (error.code === "EACCES") { + debug$1("Stop traversing because of 'EACCES' error."); + return this._cacheConfig(directoryPath, baseConfigArray); + } + throw error; + } + + if (configArray.length > 0 && configArray.isRoot()) { + debug$1("Stop traversing because of 'root:true'."); + configArray.unshift(...baseConfigArray); + return this._cacheConfig(directoryPath, configArray); + } + + // Load from the ancestors and merge it. + const parentPath = path__default["default"].dirname(directoryPath); + const parentConfigArray = parentPath && parentPath !== directoryPath + ? this._loadConfigInAncestors( + parentPath, + configsExistInSubdirs || configArray.length > 0 + ) + : baseConfigArray; + + if (configArray.length > 0) { + configArray.unshift(...parentConfigArray); + } else { + configArray = parentConfigArray; + } + + // Cache and return. + return this._cacheConfig(directoryPath, configArray); + } + + /** + * Freeze and cache a given config. + * @param {string} directoryPath The path to a directory as a cache key. + * @param {ConfigArray} configArray The config array as a cache value. + * @returns {ConfigArray} The `configArray` (frozen). + */ + _cacheConfig(directoryPath, configArray) { + const { configCache } = internalSlotsMap.get(this); + + Object.freeze(configArray); + configCache.set(directoryPath, configArray); + + return configArray; + } + + /** + * Finalize a given config array. + * Concatenate `--config` and other CLI options. + * @param {ConfigArray} configArray The parent config array. + * @param {string} directoryPath The path to the leaf directory to find config files. + * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The loaded config. + * @private + */ + _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) { + const { + cliConfigArray, + configArrayFactory, + finalizeCache, + useEslintrc, + builtInRules + } = internalSlotsMap.get(this); + + let finalConfigArray = finalizeCache.get(configArray); + + if (!finalConfigArray) { + finalConfigArray = configArray; + + // Load the personal config if there are no regular config files. + if ( + useEslintrc && + configArray.every(c => !c.filePath) && + cliConfigArray.every(c => !c.filePath) // `--config` option can be a file. + ) { + const homePath = os__default["default"].homedir(); + + debug$1("Loading the config file of the home directory:", homePath); + + const personalConfigArray = configArrayFactory.loadInDirectory( + homePath, + { name: "PersonalConfig" } + ); + + if ( + personalConfigArray.length > 0 && + !directoryPath.startsWith(homePath) + ) { + const lastElement = + personalConfigArray[personalConfigArray.length - 1]; + + emitDeprecationWarning( + lastElement.filePath, + "ESLINT_PERSONAL_CONFIG_LOAD" + ); + } + + finalConfigArray = finalConfigArray.concat(personalConfigArray); + } + + // Apply CLI options. + if (cliConfigArray.length > 0) { + finalConfigArray = finalConfigArray.concat(cliConfigArray); + } + + // Validate rule settings and environments. + const validator = new ConfigValidator({ + builtInRules + }); + + validator.validateConfigArray(finalConfigArray); + + // Cache it. + Object.freeze(finalConfigArray); + finalizeCache.set(configArray, finalConfigArray); + + debug$1( + "Configuration was determined: %o on %s", + finalConfigArray, + directoryPath + ); + } + + // At least one element (the default ignore patterns) exists. + if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) { + throw new ConfigurationNotFoundError(directoryPath); + } + + return finalConfigArray; + } +} + +/** + * @fileoverview Compatibility class for flat config. + * @author Nicholas C. Zakas + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").Processor} Processor */ + +const debug = debugOrig__default["default"]("eslintrc:flat-compat"); +const cafactory = Symbol("cafactory"); + +/** + * Translates an ESLintRC-style config object into a flag-config-style config + * object. + * @param {Object} eslintrcConfig An ESLintRC-style config object. + * @param {Object} options Options to help translate the config. + * @param {string} options.resolveConfigRelativeTo To the directory to resolve + * configs from. + * @param {string} options.resolvePluginsRelativeTo The directory to resolve + * plugins from. + * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment + * names to objects. + * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor + * names to objects. + * @returns {Object} A flag-config-style config object. + */ +function translateESLintRC(eslintrcConfig, { + resolveConfigRelativeTo, + resolvePluginsRelativeTo, + pluginEnvironments, + pluginProcessors +}) { + + const flatConfig = {}; + const configs = []; + const languageOptions = {}; + const linterOptions = {}; + const keysToCopy = ["settings", "rules", "processor"]; + const languageOptionsKeysToCopy = ["globals", "parser", "parserOptions"]; + const linterOptionsKeysToCopy = ["noInlineConfig", "reportUnusedDisableDirectives"]; + + // check for special settings for eslint:all and eslint:recommended: + if (eslintrcConfig.settings) { + if (eslintrcConfig.settings["eslint:all"] === true) { + return ["eslint:all"]; + } + + if (eslintrcConfig.settings["eslint:recommended"] === true) { + return ["eslint:recommended"]; + } + } + + // copy over simple translations + for (const key of keysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig[key] = eslintrcConfig[key]; + } + } + + // copy over languageOptions + for (const key of languageOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + + // create the languageOptions key in the flat config + flatConfig.languageOptions = languageOptions; + + if (key === "parser") { + debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`); + + if (eslintrcConfig[key].error) { + throw eslintrcConfig[key].error; + } + + languageOptions[key] = eslintrcConfig[key].definition; + continue; + } + + // clone any object values that are in the eslintrc config + if (eslintrcConfig[key] && typeof eslintrcConfig[key] === "object") { + languageOptions[key] = { + ...eslintrcConfig[key] + }; + } else { + languageOptions[key] = eslintrcConfig[key]; + } + } + } + + // copy over linterOptions + for (const key of linterOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig.linterOptions = linterOptions; + linterOptions[key] = eslintrcConfig[key]; + } + } + + // move ecmaVersion a level up + if (languageOptions.parserOptions) { + + if ("ecmaVersion" in languageOptions.parserOptions) { + languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion; + delete languageOptions.parserOptions.ecmaVersion; + } + + if ("sourceType" in languageOptions.parserOptions) { + languageOptions.sourceType = languageOptions.parserOptions.sourceType; + delete languageOptions.parserOptions.sourceType; + } + + // check to see if we even need parserOptions anymore and remove it if not + if (Object.keys(languageOptions.parserOptions).length === 0) { + delete languageOptions.parserOptions; + } + } + + // overrides + if (eslintrcConfig.criteria) { + flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)]; + } + + // translate plugins + if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === "object") { + debug(`Translating plugins: ${eslintrcConfig.plugins}`); + + flatConfig.plugins = {}; + + for (const pluginName of Object.keys(eslintrcConfig.plugins)) { + + debug(`Translating plugin: ${pluginName}`); + debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`); + + const { definition: plugin, error } = eslintrcConfig.plugins[pluginName]; + + if (error) { + throw error; + } + + flatConfig.plugins[pluginName] = plugin; + + // create a config for any processors + if (plugin.processors) { + for (const processorName of Object.keys(plugin.processors)) { + if (processorName.startsWith(".")) { + debug(`Assigning processor: ${pluginName}/${processorName}`); + + configs.unshift({ + files: [`**/*${processorName}`], + processor: pluginProcessors.get(`${pluginName}/${processorName}`) + }); + } + + } + } + } + } + + // translate env - must come after plugins + if (eslintrcConfig.env && typeof eslintrcConfig.env === "object") { + for (const envName of Object.keys(eslintrcConfig.env)) { + + // only add environments that are true + if (eslintrcConfig.env[envName]) { + debug(`Translating environment: ${envName}`); + + if (environments.has(envName)) { + + // built-in environments should be defined first + configs.unshift(...translateESLintRC(environments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } else if (pluginEnvironments.has(envName)) { + + // if the environment comes from a plugin, it should come after the plugin config + configs.push(...translateESLintRC(pluginEnvironments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } + } + } + } + + // only add if there are actually keys in the config + if (Object.keys(flatConfig).length > 0) { + configs.push(flatConfig); + } + + return configs; +} + + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A compatibility class for working with configs. + */ +class FlatCompat { + + constructor({ + baseDirectory = process.cwd(), + resolvePluginsRelativeTo = baseDirectory + } = {}) { + this.baseDirectory = baseDirectory; + this.resolvePluginsRelativeTo = resolvePluginsRelativeTo; + this[cafactory] = new ConfigArrayFactory({ + cwd: baseDirectory, + resolvePluginsRelativeTo, + getEslintAllConfig: () => ({ settings: { "eslint:all": true } }), + getEslintRecommendedConfig: () => ({ settings: { "eslint:recommended": true } }) + }); + } + + /** + * Translates an ESLintRC-style config into a flag-config-style config. + * @param {Object} eslintrcConfig The ESLintRC-style config object. + * @returns {Object} A flag-config-style config object. + */ + config(eslintrcConfig) { + const eslintrcArray = this[cafactory].create(eslintrcConfig, { + basePath: this.baseDirectory + }); + + const flatArray = []; + let hasIgnorePatterns = false; + + eslintrcArray.forEach(configData => { + if (configData.type === "config") { + hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern; + flatArray.push(...translateESLintRC(configData, { + resolveConfigRelativeTo: path__default["default"].join(this.baseDirectory, "__placeholder.js"), + resolvePluginsRelativeTo: path__default["default"].join(this.resolvePluginsRelativeTo, "__placeholder.js"), + pluginEnvironments: eslintrcArray.pluginEnvironments, + pluginProcessors: eslintrcArray.pluginProcessors + })); + } + }); + + // combine ignorePatterns to emulate ESLintRC behavior better + if (hasIgnorePatterns) { + flatArray.unshift({ + ignores: [filePath => { + + // Compute the final config for this file. + // This filters config array elements by `files`/`excludedFiles` then merges the elements. + const finalConfig = eslintrcArray.extractConfig(filePath); + + // Test the `ignorePattern` properties of the final config. + return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath); + }] + }); + } + + return flatArray; + } + + /** + * Translates the `env` section of an ESLintRC-style config. + * @param {Object} envConfig The `env` section of an ESLintRC config. + * @returns {Object} A flag-config object representing the environments. + */ + env(envConfig) { + return this.config({ + env: envConfig + }); + } + + /** + * Translates the `extends` section of an ESLintRC-style config. + * @param {...string} configsToExtend The names of the configs to load. + * @returns {Object} A flag-config object representing the config. + */ + extends(...configsToExtend) { + return this.config({ + extends: configsToExtend + }); + } + + /** + * Translates the `plugins` section of an ESLintRC-style config. + * @param {...string} plugins The names of the plugins to load. + * @returns {Object} A flag-config object representing the plugins. + */ + plugins(...plugins) { + return this.config({ + plugins + }); + } +} + +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +const Legacy = { + ConfigArray, + createConfigArrayFactoryContext: createContext, + CascadingConfigArrayFactory, + ConfigArrayFactory, + ConfigDependency, + ExtractedConfig, + IgnorePattern, + OverrideTester, + getUsedExtractedConfigs, + environments, + + // shared + ConfigOps, + ConfigValidator, + ModuleResolver, + naming +}; + +exports.FlatCompat = FlatCompat; +exports.Legacy = Legacy; +//# sourceMappingURL=eslintrc.cjs.map diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map new file mode 100644 index 0000000..246d9f2 --- /dev/null +++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"eslintrc.cjs","sources":["../lib/config-array/ignore-pattern.js","../lib/config-array/extracted-config.js","../lib/config-array/config-array.js","../lib/config-array/config-dependency.js","../lib/config-array/override-tester.js","../lib/config-array/index.js","../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../conf/config-schema.js","../conf/environments.js","../lib/shared/config-validator.js","../lib/shared/naming.js","../lib/shared/relative-module-resolver.js","../lib/config-array-factory.js","../lib/cascading-config-array-factory.js","../lib/flat-compat.js","../lib/index.js"],"sourcesContent":["/**\n * @fileoverview `IgnorePattern` class.\n *\n * `IgnorePattern` class has the set of glob patterns and the base path.\n *\n * It provides two static methods.\n *\n * - `IgnorePattern.createDefaultIgnore(cwd)`\n * Create the default predicate function.\n * - `IgnorePattern.createIgnore(ignorePatterns)`\n * Create the predicate function from multiple `IgnorePattern` objects.\n *\n * It provides two properties and a method.\n *\n * - `patterns`\n * The glob patterns that ignore to lint.\n * - `basePath`\n * The base path of the glob patterns. If absolute paths existed in the\n * glob patterns, those are handled as relative paths to the base path.\n * - `getPatternsRelativeTo(basePath)`\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n *\n * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes\n * `ignorePatterns` properties.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport ignore from \"ignore\";\nimport debugOrig from \"debug\";\n\nconst debug = debugOrig(\"eslintrc:ignore-pattern\");\n\n/** @typedef {ReturnType} Ignore */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the path to the common ancestor directory of given paths.\n * @param {string[]} sourcePaths The paths to calculate the common ancestor.\n * @returns {string} The path to the common ancestor directory.\n */\nfunction getCommonAncestorPath(sourcePaths) {\n let result = sourcePaths[0];\n\n for (let i = 1; i < sourcePaths.length; ++i) {\n const a = result;\n const b = sourcePaths[i];\n\n // Set the shorter one (it's the common ancestor if one includes the other).\n result = a.length < b.length ? a : b;\n\n // Set the common ancestor.\n for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {\n if (a[j] !== b[j]) {\n result = a.slice(0, lastSepPos);\n break;\n }\n if (a[j] === path.sep) {\n lastSepPos = j;\n }\n }\n }\n\n let resolvedResult = result || path.sep;\n\n // if Windows common ancestor is root of drive must have trailing slash to be absolute.\n if (resolvedResult && resolvedResult.endsWith(\":\") && process.platform === \"win32\") {\n resolvedResult += path.sep;\n }\n return resolvedResult;\n}\n\n/**\n * Make relative path.\n * @param {string} from The source path to get relative path.\n * @param {string} to The destination path to get relative path.\n * @returns {string} The relative path.\n */\nfunction relative(from, to) {\n const relPath = path.relative(from, to);\n\n if (path.sep === \"/\") {\n return relPath;\n }\n return relPath.split(path.sep).join(\"/\");\n}\n\n/**\n * Get the trailing slash if existed.\n * @param {string} filePath The path to check.\n * @returns {string} The trailing slash if existed.\n */\nfunction dirSuffix(filePath) {\n const isDir = (\n filePath.endsWith(path.sep) ||\n (process.platform === \"win32\" && filePath.endsWith(\"/\"))\n );\n\n return isDir ? \"/\" : \"\";\n}\n\nconst DefaultPatterns = Object.freeze([\"/**/node_modules/*\"]);\nconst DotPatterns = Object.freeze([\".*\", \"!.eslintrc.*\", \"!../\"]);\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nclass IgnorePattern {\n\n /**\n * The default patterns.\n * @type {string[]}\n */\n static get DefaultPatterns() {\n return DefaultPatterns;\n }\n\n /**\n * Create the default predicate function.\n * @param {string} cwd The current working directory.\n * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createDefaultIgnore(cwd) {\n return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);\n }\n\n /**\n * Create the predicate function from multiple `IgnorePattern` objects.\n * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.\n * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createIgnore(ignorePatterns) {\n debug(\"Create with: %o\", ignorePatterns);\n\n const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));\n const patterns = [].concat(\n ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))\n );\n const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);\n const dotIg = ignore({ allowRelativePaths: true }).add(patterns);\n\n debug(\" processed: %o\", { basePath, patterns });\n\n return Object.assign(\n (filePath, dot = false) => {\n assert(path.isAbsolute(filePath), \"'filePath' should be an absolute path.\");\n const relPathRaw = relative(basePath, filePath);\n const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));\n const adoptedIg = dot ? dotIg : ig;\n const result = relPath !== \"\" && adoptedIg.ignores(relPath);\n\n debug(\"Check\", { filePath, dot, relativePath: relPath, result });\n return result;\n },\n { basePath, patterns }\n );\n }\n\n /**\n * Initialize a new `IgnorePattern` instance.\n * @param {string[]} patterns The glob patterns that ignore to lint.\n * @param {string} basePath The base path of `patterns`.\n */\n constructor(patterns, basePath) {\n assert(path.isAbsolute(basePath), \"'basePath' should be an absolute path.\");\n\n /**\n * The glob patterns that ignore to lint.\n * @type {string[]}\n */\n this.patterns = patterns;\n\n /**\n * The base path of `patterns`.\n * @type {string}\n */\n this.basePath = basePath;\n\n /**\n * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.\n *\n * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.\n * It's `false` as-is for `ignorePatterns` property in config files.\n * @type {boolean}\n */\n this.loose = false;\n }\n\n /**\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n * @param {string} newBasePath The base path.\n * @returns {string[]} Modifired patterns.\n */\n getPatternsRelativeTo(newBasePath) {\n assert(path.isAbsolute(newBasePath), \"'newBasePath' should be an absolute path.\");\n const { basePath, loose, patterns } = this;\n\n if (newBasePath === basePath) {\n return patterns;\n }\n const prefix = `/${relative(newBasePath, basePath)}`;\n\n return patterns.map(pattern => {\n const negative = pattern.startsWith(\"!\");\n const head = negative ? \"!\" : \"\";\n const body = negative ? pattern.slice(1) : pattern;\n\n if (body.startsWith(\"/\") || body.startsWith(\"../\")) {\n return `${head}${prefix}${body}`;\n }\n return loose ? pattern : `${head}${prefix}/**/${body}`;\n });\n }\n}\n\nexport { IgnorePattern };\n","/**\n * @fileoverview `ExtractedConfig` class.\n *\n * `ExtractedConfig` class expresses a final configuration for a specific file.\n *\n * It provides one method.\n *\n * - `toCompatibleObjectAsConfigFileContent()`\n * Convert this configuration to the compatible object as the content of\n * config files. It converts the loaded parser and plugins to strings.\n * `CLIEngine#getConfigForFile(filePath)` method uses this method.\n *\n * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.\n *\n * @author Toru Nagashima \n */\n\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n// For VSCode intellisense\n/** @typedef {import(\"../../shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").SeverityConf} SeverityConf */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n\n/**\n * Check if `xs` starts with `ys`.\n * @template T\n * @param {T[]} xs The array to check.\n * @param {T[]} ys The array that may be the first part of `xs`.\n * @returns {boolean} `true` if `xs` starts with `ys`.\n */\nfunction startsWith(xs, ys) {\n return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);\n}\n\n/**\n * The class for extracted config data.\n */\nclass ExtractedConfig {\n constructor() {\n\n /**\n * The config name what `noInlineConfig` setting came from.\n * @type {string}\n */\n this.configNameOfNoInlineConfig = \"\";\n\n /**\n * Environments.\n * @type {Record}\n */\n this.env = {};\n\n /**\n * Global variables.\n * @type {Record}\n */\n this.globals = {};\n\n /**\n * The glob patterns that ignore to lint.\n * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}\n */\n this.ignores = void 0;\n\n /**\n * The flag that disables directive comments.\n * @type {boolean|undefined}\n */\n this.noInlineConfig = void 0;\n\n /**\n * Parser definition.\n * @type {DependentParser|null}\n */\n this.parser = null;\n\n /**\n * Options for the parser.\n * @type {Object}\n */\n this.parserOptions = {};\n\n /**\n * Plugin definitions.\n * @type {Record}\n */\n this.plugins = {};\n\n /**\n * Processor ID.\n * @type {string|null}\n */\n this.processor = null;\n\n /**\n * The flag that reports unused `eslint-disable` directive comments.\n * @type {boolean|undefined}\n */\n this.reportUnusedDisableDirectives = void 0;\n\n /**\n * Rule settings.\n * @type {Record}\n */\n this.rules = {};\n\n /**\n * Shared settings.\n * @type {Object}\n */\n this.settings = {};\n }\n\n /**\n * Convert this config to the compatible object as a config file content.\n * @returns {ConfigData} The converted object.\n */\n toCompatibleObjectAsConfigFileContent() {\n const {\n /* eslint-disable no-unused-vars */\n configNameOfNoInlineConfig: _ignore1,\n processor: _ignore2,\n /* eslint-enable no-unused-vars */\n ignores,\n ...config\n } = this;\n\n config.parser = config.parser && config.parser.filePath;\n config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();\n config.ignorePatterns = ignores ? ignores.patterns : [];\n\n // Strip the default patterns from `ignorePatterns`.\n if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {\n config.ignorePatterns =\n config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);\n }\n\n return config;\n }\n}\n\nexport { ExtractedConfig };\n","/**\n * @fileoverview `ConfigArray` class.\n *\n * `ConfigArray` class expresses the full of a configuration. It has the entry\n * config file, base config files that were extended, loaded parsers, and loaded\n * plugins.\n *\n * `ConfigArray` class provides three properties and two methods.\n *\n * - `pluginEnvironments`\n * - `pluginProcessors`\n * - `pluginRules`\n * The `Map` objects that contain the members of all plugins that this\n * config array contains. Those map objects don't have mutation methods.\n * Those keys are the member ID such as `pluginId/memberName`.\n * - `isRoot()`\n * If `true` then this configuration has `root:true` property.\n * - `extractConfig(filePath)`\n * Extract the final configuration for a given file. This means merging\n * every config array element which that `criteria` property matched. The\n * `filePath` argument must be an absolute path.\n *\n * `ConfigArrayFactory` provides the loading logic of config files.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").RuleConf} RuleConf */\n/** @typedef {import(\"../../shared/types\").Rule} Rule */\n/** @typedef {import(\"../../shared/types\").Plugin} Plugin */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {import(\"./override-tester\")[\"OverrideTester\"]} OverrideTester */\n\n/**\n * @typedef {Object} ConfigArrayElement\n * @property {string} name The name of this config element.\n * @property {string} filePath The path to the source file of this config element.\n * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element.\n * @property {Record|undefined} env The environment settings.\n * @property {Record|undefined} globals The global variable settings.\n * @property {IgnorePattern|undefined} ignorePattern The ignore patterns.\n * @property {boolean|undefined} noInlineConfig The flag that disables directive comments.\n * @property {DependentParser|undefined} parser The parser loader.\n * @property {Object|undefined} parserOptions The parser options.\n * @property {Record|undefined} plugins The plugin loaders.\n * @property {string|undefined} processor The processor name to refer plugin's processor.\n * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.\n * @property {boolean|undefined} root The flag to express root.\n * @property {Record|undefined} rules The rule settings\n * @property {Object|undefined} settings The shared settings.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The element type.\n */\n\n/**\n * @typedef {Object} ConfigArrayInternalSlots\n * @property {Map} cache The cache to extract configs.\n * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition.\n * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition.\n * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new class extends WeakMap {\n get(key) {\n let value = super.get(key);\n\n if (!value) {\n value = {\n cache: new Map(),\n envMap: null,\n processorMap: null,\n ruleMap: null\n };\n super.set(key, value);\n }\n\n return value;\n }\n}();\n\n/**\n * Get the indices which are matched to a given file.\n * @param {ConfigArrayElement[]} elements The elements.\n * @param {string} filePath The path to a target file.\n * @returns {number[]} The indices.\n */\nfunction getMatchedIndices(elements, filePath) {\n const indices = [];\n\n for (let i = elements.length - 1; i >= 0; --i) {\n const element = elements[i];\n\n if (!element.criteria || (filePath && element.criteria.test(filePath))) {\n indices.push(i);\n }\n }\n\n return indices;\n}\n\n/**\n * Check if a value is a non-null object.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is a non-null object.\n */\nfunction isNonNullObject(x) {\n return typeof x === \"object\" && x !== null;\n}\n\n/**\n * Merge two objects.\n *\n * Assign every property values of `y` to `x` if `x` doesn't have the property.\n * If `x`'s property value is an object, it does recursive.\n * @param {Object} target The destination to merge\n * @param {Object|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeWithoutOverwrite(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n\n if (isNonNullObject(target[key])) {\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (target[key] === void 0) {\n if (isNonNullObject(source[key])) {\n target[key] = Array.isArray(source[key]) ? [] : {};\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (source[key] !== void 0) {\n target[key] = source[key];\n }\n }\n }\n}\n\n/**\n * The error for plugin conflicts.\n */\nclass PluginConflictError extends Error {\n\n /**\n * Initialize this error object.\n * @param {string} pluginId The plugin ID.\n * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.\n */\n constructor(pluginId, plugins) {\n super(`Plugin \"${pluginId}\" was conflicted between ${plugins.map(p => `\"${p.importerName}\"`).join(\" and \")}.`);\n this.messageTemplate = \"plugin-conflict\";\n this.messageData = { pluginId, plugins };\n }\n}\n\n/**\n * Merge plugins.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergePlugins(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetValue = target[key];\n const sourceValue = source[key];\n\n // Adopt the plugin which was found at first.\n if (targetValue === void 0) {\n if (sourceValue.error) {\n throw sourceValue.error;\n }\n target[key] = sourceValue;\n } else if (sourceValue.filePath !== targetValue.filePath) {\n throw new PluginConflictError(key, [\n {\n filePath: targetValue.filePath,\n importerName: targetValue.importerName\n },\n {\n filePath: sourceValue.filePath,\n importerName: sourceValue.importerName\n }\n ]);\n }\n }\n}\n\n/**\n * Merge rule configs.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeRuleConfigs(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetDef = target[key];\n const sourceDef = source[key];\n\n // Adopt the rule config which was found at first.\n if (targetDef === void 0) {\n if (Array.isArray(sourceDef)) {\n target[key] = [...sourceDef];\n } else {\n target[key] = [sourceDef];\n }\n\n /*\n * If the first found rule config is severity only and the current rule\n * config has options, merge the severity and the options.\n */\n } else if (\n targetDef.length === 1 &&\n Array.isArray(sourceDef) &&\n sourceDef.length >= 2\n ) {\n targetDef.push(...sourceDef.slice(1));\n }\n }\n}\n\n/**\n * Create the extracted config.\n * @param {ConfigArray} instance The config elements.\n * @param {number[]} indices The indices to use.\n * @returns {ExtractedConfig} The extracted config.\n */\nfunction createConfig(instance, indices) {\n const config = new ExtractedConfig();\n const ignorePatterns = [];\n\n // Merge elements.\n for (const index of indices) {\n const element = instance[index];\n\n // Adopt the parser which was found at first.\n if (!config.parser && element.parser) {\n if (element.parser.error) {\n throw element.parser.error;\n }\n config.parser = element.parser;\n }\n\n // Adopt the processor which was found at first.\n if (!config.processor && element.processor) {\n config.processor = element.processor;\n }\n\n // Adopt the noInlineConfig which was found at first.\n if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {\n config.noInlineConfig = element.noInlineConfig;\n config.configNameOfNoInlineConfig = element.name;\n }\n\n // Adopt the reportUnusedDisableDirectives which was found at first.\n if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {\n config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;\n }\n\n // Collect ignorePatterns\n if (element.ignorePattern) {\n ignorePatterns.push(element.ignorePattern);\n }\n\n // Merge others.\n mergeWithoutOverwrite(config.env, element.env);\n mergeWithoutOverwrite(config.globals, element.globals);\n mergeWithoutOverwrite(config.parserOptions, element.parserOptions);\n mergeWithoutOverwrite(config.settings, element.settings);\n mergePlugins(config.plugins, element.plugins);\n mergeRuleConfigs(config.rules, element.rules);\n }\n\n // Create the predicate function for ignore patterns.\n if (ignorePatterns.length > 0) {\n config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());\n }\n\n return config;\n}\n\n/**\n * Collect definitions.\n * @template T, U\n * @param {string} pluginId The plugin ID for prefix.\n * @param {Record} defs The definitions to collect.\n * @param {Map} map The map to output.\n * @param {function(T): U} [normalize] The normalize function for each value.\n * @returns {void}\n */\nfunction collect(pluginId, defs, map, normalize) {\n if (defs) {\n const prefix = pluginId && `${pluginId}/`;\n\n for (const [key, value] of Object.entries(defs)) {\n map.set(\n `${prefix}${key}`,\n normalize ? normalize(value) : value\n );\n }\n }\n}\n\n/**\n * Normalize a rule definition.\n * @param {Function|Rule} rule The rule definition to normalize.\n * @returns {Rule} The normalized rule definition.\n */\nfunction normalizePluginRule(rule) {\n return typeof rule === \"function\" ? { create: rule } : rule;\n}\n\n/**\n * Delete the mutation methods from a given map.\n * @param {Map} map The map object to delete.\n * @returns {void}\n */\nfunction deleteMutationMethods(map) {\n Object.defineProperties(map, {\n clear: { configurable: true, value: void 0 },\n delete: { configurable: true, value: void 0 },\n set: { configurable: true, value: void 0 }\n });\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArrayElement[]} elements The config elements.\n * @param {ConfigArrayInternalSlots} slots The internal slots.\n * @returns {void}\n */\nfunction initPluginMemberMaps(elements, slots) {\n const processed = new Set();\n\n slots.envMap = new Map();\n slots.processorMap = new Map();\n slots.ruleMap = new Map();\n\n for (const element of elements) {\n if (!element.plugins) {\n continue;\n }\n\n for (const [pluginId, value] of Object.entries(element.plugins)) {\n const plugin = value.definition;\n\n if (!plugin || processed.has(pluginId)) {\n continue;\n }\n processed.add(pluginId);\n\n collect(pluginId, plugin.environments, slots.envMap);\n collect(pluginId, plugin.processors, slots.processorMap);\n collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);\n }\n }\n\n deleteMutationMethods(slots.envMap);\n deleteMutationMethods(slots.processorMap);\n deleteMutationMethods(slots.ruleMap);\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArray} instance The config elements.\n * @returns {ConfigArrayInternalSlots} The extracted config.\n */\nfunction ensurePluginMemberMaps(instance) {\n const slots = internalSlotsMap.get(instance);\n\n if (!slots.ruleMap) {\n initPluginMemberMaps(instance, slots);\n }\n\n return slots;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The Config Array.\n *\n * `ConfigArray` instance contains all settings, parsers, and plugins.\n * You need to call `ConfigArray#extractConfig(filePath)` method in order to\n * extract, merge and get only the config data which is related to an arbitrary\n * file.\n * @extends {Array}\n */\nclass ConfigArray extends Array {\n\n /**\n * Get the plugin environments.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin environments.\n */\n get pluginEnvironments() {\n return ensurePluginMemberMaps(this).envMap;\n }\n\n /**\n * Get the plugin processors.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin processors.\n */\n get pluginProcessors() {\n return ensurePluginMemberMaps(this).processorMap;\n }\n\n /**\n * Get the plugin rules.\n * The returned map cannot be mutated.\n * @returns {ReadonlyMap} The plugin rules.\n */\n get pluginRules() {\n return ensurePluginMemberMaps(this).ruleMap;\n }\n\n /**\n * Check if this config has `root` flag.\n * @returns {boolean} `true` if this config array is root.\n */\n isRoot() {\n for (let i = this.length - 1; i >= 0; --i) {\n const root = this[i].root;\n\n if (typeof root === \"boolean\") {\n return root;\n }\n }\n return false;\n }\n\n /**\n * Extract the config data which is related to a given file.\n * @param {string} filePath The absolute path to the target file.\n * @returns {ExtractedConfig} The extracted config data.\n */\n extractConfig(filePath) {\n const { cache } = internalSlotsMap.get(this);\n const indices = getMatchedIndices(this, filePath);\n const cacheKey = indices.join(\",\");\n\n if (!cache.has(cacheKey)) {\n cache.set(cacheKey, createConfig(this, indices));\n }\n\n return cache.get(cacheKey);\n }\n\n /**\n * Check if a given path is an additional lint target.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the file is an additional lint target.\n */\n isAdditionalTargetPath(filePath) {\n for (const { criteria, type } of this) {\n if (\n type === \"config\" &&\n criteria &&\n !criteria.endsWithWildcard &&\n criteria.test(filePath)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * Get the used extracted configs.\n * CLIEngine will use this method to collect used deprecated rules.\n * @param {ConfigArray} instance The config array object to get.\n * @returns {ExtractedConfig[]} The used extracted configs.\n * @private\n */\nfunction getUsedExtractedConfigs(instance) {\n const { cache } = internalSlotsMap.get(instance);\n\n return Array.from(cache.values());\n}\n\n\nexport {\n ConfigArray,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview `ConfigDependency` class.\n *\n * `ConfigDependency` class expresses a loaded parser or plugin.\n *\n * If the parser or plugin was loaded successfully, it has `definition` property\n * and `filePath` property. Otherwise, it has `error` property.\n *\n * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it\n * omits `definition` property.\n *\n * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers\n * or plugins.\n *\n * @author Toru Nagashima \n */\n\nimport util from \"util\";\n\n/**\n * The class is to store parsers or plugins.\n * This class hides the loaded object from `JSON.stringify()` and `console.log`.\n * @template T\n */\nclass ConfigDependency {\n\n /**\n * Initialize this instance.\n * @param {Object} data The dependency data.\n * @param {T} [data.definition] The dependency if the loading succeeded.\n * @param {Error} [data.error] The error object if the loading failed.\n * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.\n * @param {string} data.id The ID of this dependency.\n * @param {string} data.importerName The name of the config file which loads this dependency.\n * @param {string} data.importerPath The path to the config file which loads this dependency.\n */\n constructor({\n definition = null,\n error = null,\n filePath = null,\n id,\n importerName,\n importerPath\n }) {\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {T|null}\n */\n this.definition = definition;\n\n /**\n * The error object if the loading failed.\n * @type {Error|null}\n */\n this.error = error;\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {string|null}\n */\n this.filePath = filePath;\n\n /**\n * The ID of this dependency.\n * @type {string}\n */\n this.id = id;\n\n /**\n * The name of the config file which loads this dependency.\n * @type {string}\n */\n this.importerName = importerName;\n\n /**\n * The path to the config file which loads this dependency.\n * @type {string}\n */\n this.importerPath = importerPath;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n const obj = this[util.inspect.custom]();\n\n // Display `error.message` (`Error#message` is unenumerable).\n if (obj.error instanceof Error) {\n obj.error = { ...obj.error, message: obj.error.message };\n }\n\n return obj;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n const {\n definition: _ignore, // eslint-disable-line no-unused-vars\n ...obj\n } = this;\n\n return obj;\n }\n}\n\n/** @typedef {ConfigDependency} DependentParser */\n/** @typedef {ConfigDependency} DependentPlugin */\n\nexport { ConfigDependency };\n","/**\n * @fileoverview `OverrideTester` class.\n *\n * `OverrideTester` class handles `files` property and `excludedFiles` property\n * of `overrides` config.\n *\n * It provides one method.\n *\n * - `test(filePath)`\n * Test if a file path matches the pair of `files` property and\n * `excludedFiles` property. The `filePath` argument must be an absolute\n * path.\n *\n * `ConfigArrayFactory` creates `OverrideTester` objects when it processes\n * `overrides` properties.\n *\n * @author Toru Nagashima \n */\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport util from \"util\";\nimport minimatch from \"minimatch\";\n\nconst { Minimatch } = minimatch;\n\nconst minimatchOpts = { dot: true, matchBase: true };\n\n/**\n * @typedef {Object} Pattern\n * @property {InstanceType[] | null} includes The positive matchers.\n * @property {InstanceType[] | null} excludes The negative matchers.\n */\n\n/**\n * Normalize a given pattern to an array.\n * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.\n * @returns {string[]|null} Normalized patterns.\n * @private\n */\nfunction normalizePatterns(patterns) {\n if (Array.isArray(patterns)) {\n return patterns.filter(Boolean);\n }\n if (typeof patterns === \"string\" && patterns) {\n return [patterns];\n }\n return [];\n}\n\n/**\n * Create the matchers of given patterns.\n * @param {string[]} patterns The patterns.\n * @returns {InstanceType[] | null} The matchers.\n */\nfunction toMatcher(patterns) {\n if (patterns.length === 0) {\n return null;\n }\n return patterns.map(pattern => {\n if (/^\\.[/\\\\]/u.test(pattern)) {\n return new Minimatch(\n pattern.slice(2),\n\n // `./*.js` should not match with `subdir/foo.js`\n { ...minimatchOpts, matchBase: false }\n );\n }\n return new Minimatch(pattern, minimatchOpts);\n });\n}\n\n/**\n * Convert a given matcher to string.\n * @param {Pattern} matchers The matchers.\n * @returns {string} The string expression of the matcher.\n */\nfunction patternToJson({ includes, excludes }) {\n return {\n includes: includes && includes.map(m => m.pattern),\n excludes: excludes && excludes.map(m => m.pattern)\n };\n}\n\n/**\n * The class to test given paths are matched by the patterns.\n */\nclass OverrideTester {\n\n /**\n * Create a tester with given criteria.\n * If there are no criteria, returns `null`.\n * @param {string|string[]} files The glob patterns for included files.\n * @param {string|string[]} excludedFiles The glob patterns for excluded files.\n * @param {string} basePath The path to the base directory to test paths.\n * @returns {OverrideTester|null} The created instance or `null`.\n */\n static create(files, excludedFiles, basePath) {\n const includePatterns = normalizePatterns(files);\n const excludePatterns = normalizePatterns(excludedFiles);\n let endsWithWildcard = false;\n\n if (includePatterns.length === 0) {\n return null;\n }\n\n // Rejects absolute paths or relative paths to parents.\n for (const pattern of includePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n if (pattern.endsWith(\"*\")) {\n endsWithWildcard = true;\n }\n }\n for (const pattern of excludePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n }\n\n const includes = toMatcher(includePatterns);\n const excludes = toMatcher(excludePatterns);\n\n return new OverrideTester(\n [{ includes, excludes }],\n basePath,\n endsWithWildcard\n );\n }\n\n /**\n * Combine two testers by logical and.\n * If either of the testers was `null`, returns the other tester.\n * The `basePath` property of the two must be the same value.\n * @param {OverrideTester|null} a A tester.\n * @param {OverrideTester|null} b Another tester.\n * @returns {OverrideTester|null} Combined tester.\n */\n static and(a, b) {\n if (!b) {\n return a && new OverrideTester(\n a.patterns,\n a.basePath,\n a.endsWithWildcard\n );\n }\n if (!a) {\n return new OverrideTester(\n b.patterns,\n b.basePath,\n b.endsWithWildcard\n );\n }\n\n assert.strictEqual(a.basePath, b.basePath);\n return new OverrideTester(\n a.patterns.concat(b.patterns),\n a.basePath,\n a.endsWithWildcard || b.endsWithWildcard\n );\n }\n\n /**\n * Initialize this instance.\n * @param {Pattern[]} patterns The matchers.\n * @param {string} basePath The base path.\n * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.\n */\n constructor(patterns, basePath, endsWithWildcard = false) {\n\n /** @type {Pattern[]} */\n this.patterns = patterns;\n\n /** @type {string} */\n this.basePath = basePath;\n\n /** @type {boolean} */\n this.endsWithWildcard = endsWithWildcard;\n }\n\n /**\n * Test if a given path is matched or not.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the path was matched.\n */\n test(filePath) {\n if (typeof filePath !== \"string\" || !path.isAbsolute(filePath)) {\n throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);\n }\n const relativePath = path.relative(this.basePath, filePath);\n\n return this.patterns.every(({ includes, excludes }) => (\n (!includes || includes.some(m => m.match(relativePath))) &&\n (!excludes || !excludes.some(m => m.match(relativePath)))\n ));\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n if (this.patterns.length === 1) {\n return {\n ...patternToJson(this.patterns[0]),\n basePath: this.basePath\n };\n }\n return {\n AND: this.patterns.map(patternToJson),\n basePath: this.basePath\n };\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n return this.toJSON();\n }\n}\n\nexport { OverrideTester };\n","/**\n * @fileoverview `ConfigArray` class.\n * @author Toru Nagashima \n */\n\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array.js\";\nimport { ConfigDependency } from \"./config-dependency.js\";\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\nimport { OverrideTester } from \"./override-tester.js\";\n\nexport {\n ConfigArray,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview Config file operations. This file must be usable in the browser,\n * so no Node-specific code can be here.\n * @author Nicholas C. Zakas\n */\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\nconst RULE_SEVERITY_STRINGS = [\"off\", \"warn\", \"error\"],\n RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {\n map[value] = index;\n return map;\n }, {}),\n VALID_SEVERITIES = [0, 1, 2, \"off\", \"warn\", \"error\"];\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Normalizes the severity value of a rule's configuration to a number\n * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally\n * received from the user. A valid config value is either 0, 1, 2, the string \"off\" (treated the same as 0),\n * the string \"warn\" (treated the same as 1), the string \"error\" (treated the same as 2), or an array\n * whose first element is one of the above values. Strings are matched case-insensitively.\n * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.\n */\nfunction getRuleSeverity(ruleConfig) {\n const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (severityValue === 0 || severityValue === 1 || severityValue === 2) {\n return severityValue;\n }\n\n if (typeof severityValue === \"string\") {\n return RULE_SEVERITY[severityValue.toLowerCase()] || 0;\n }\n\n return 0;\n}\n\n/**\n * Converts old-style severity settings (0, 1, 2) into new-style\n * severity settings (off, warn, error) for all rules. Assumption is that severity\n * values have already been validated as correct.\n * @param {Object} config The config object to normalize.\n * @returns {void}\n */\nfunction normalizeToStrings(config) {\n\n if (config.rules) {\n Object.keys(config.rules).forEach(ruleId => {\n const ruleConfig = config.rules[ruleId];\n\n if (typeof ruleConfig === \"number\") {\n config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];\n } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === \"number\") {\n ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];\n }\n });\n }\n}\n\n/**\n * Determines if the severity for the given rule configuration represents an error.\n * @param {int|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} True if the rule represents an error, false if not.\n */\nfunction isErrorSeverity(ruleConfig) {\n return getRuleSeverity(ruleConfig) === 2;\n}\n\n/**\n * Checks whether a given config has valid severity or not.\n * @param {number|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isValidSeverity(ruleConfig) {\n let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (typeof severity === \"string\") {\n severity = severity.toLowerCase();\n }\n return VALID_SEVERITIES.indexOf(severity) !== -1;\n}\n\n/**\n * Checks whether every rule of a given config has valid severity or not.\n * @param {Object} config The configuration for rules.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isEverySeverityValid(config) {\n return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));\n}\n\n/**\n * Normalizes a value for a global in a config\n * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in\n * a global directive comment\n * @returns {(\"readable\"|\"writeable\"|\"off\")} The value normalized as a string\n * @throws Error if global value is invalid\n */\nfunction normalizeConfigGlobal(configuredValue) {\n switch (configuredValue) {\n case \"off\":\n return \"off\";\n\n case true:\n case \"true\":\n case \"writeable\":\n case \"writable\":\n return \"writable\";\n\n case null:\n case false:\n case \"false\":\n case \"readable\":\n case \"readonly\":\n return \"readonly\";\n\n default:\n throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);\n }\n}\n\nexport {\n getRuleSeverity,\n normalizeToStrings,\n isErrorSeverity,\n isValidSeverity,\n isEverySeverityValid,\n normalizeConfigGlobal\n};\n","/**\n * @fileoverview Provide the function that emits deprecation warnings.\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport path from \"path\";\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n// Defitions for deprecation warnings.\nconst deprecationWarningMessages = {\n ESLINT_LEGACY_ECMAFEATURES:\n \"The 'ecmaFeatures' config file property is deprecated and has no effect.\",\n ESLINT_PERSONAL_CONFIG_LOAD:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please use a config file per project or the '--config' option.\",\n ESLINT_PERSONAL_CONFIG_SUPPRESS:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please remove it or add 'root:true' to the config files in your \" +\n \"projects in order to avoid loading '~/.eslintrc.*' accidentally.\"\n};\n\nconst sourceFileErrorCache = new Set();\n\n/**\n * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted\n * for each unique file path, but repeated invocations with the same file path have no effect.\n * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.\n * @param {string} source The name of the configuration source to report the warning for.\n * @param {string} errorCode The warning message to show.\n * @returns {void}\n */\nfunction emitDeprecationWarning(source, errorCode) {\n const cacheKey = JSON.stringify({ source, errorCode });\n\n if (sourceFileErrorCache.has(cacheKey)) {\n return;\n }\n sourceFileErrorCache.add(cacheKey);\n\n const rel = path.relative(process.cwd(), source);\n const message = deprecationWarningMessages[errorCode];\n\n process.emitWarning(\n `${message} (found in \"${rel}\")`,\n \"DeprecationWarning\",\n errorCode\n );\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n emitDeprecationWarning\n};\n","/**\n * @fileoverview The instance of Ajv validator.\n * @author Evgeny Poberezkin\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport Ajv from \"ajv\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/*\n * Copied from ajv/lib/refs/json-schema-draft-04.json\n * The MIT License (MIT)\n * Copyright (c) 2015-2017 Evgeny Poberezkin\n */\nconst metaSchema = {\n id: \"http://json-schema.org/draft-04/schema#\",\n $schema: \"http://json-schema.org/draft-04/schema#\",\n description: \"Core schema meta-schema\",\n definitions: {\n schemaArray: {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#\" }\n },\n positiveInteger: {\n type: \"integer\",\n minimum: 0\n },\n positiveIntegerDefault0: {\n allOf: [{ $ref: \"#/definitions/positiveInteger\" }, { default: 0 }]\n },\n simpleTypes: {\n enum: [\"array\", \"boolean\", \"integer\", \"null\", \"number\", \"object\", \"string\"]\n },\n stringArray: {\n type: \"array\",\n items: { type: \"string\" },\n minItems: 1,\n uniqueItems: true\n }\n },\n type: \"object\",\n properties: {\n id: {\n type: \"string\"\n },\n $schema: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n default: { },\n multipleOf: {\n type: \"number\",\n minimum: 0,\n exclusiveMinimum: true\n },\n maximum: {\n type: \"number\"\n },\n exclusiveMaximum: {\n type: \"boolean\",\n default: false\n },\n minimum: {\n type: \"number\"\n },\n exclusiveMinimum: {\n type: \"boolean\",\n default: false\n },\n maxLength: { $ref: \"#/definitions/positiveInteger\" },\n minLength: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n pattern: {\n type: \"string\",\n format: \"regex\"\n },\n additionalItems: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n items: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/schemaArray\" }\n ],\n default: { }\n },\n maxItems: { $ref: \"#/definitions/positiveInteger\" },\n minItems: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n uniqueItems: {\n type: \"boolean\",\n default: false\n },\n maxProperties: { $ref: \"#/definitions/positiveInteger\" },\n minProperties: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n required: { $ref: \"#/definitions/stringArray\" },\n additionalProperties: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n definitions: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n properties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n patternProperties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n dependencies: {\n type: \"object\",\n additionalProperties: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/stringArray\" }\n ]\n }\n },\n enum: {\n type: \"array\",\n minItems: 1,\n uniqueItems: true\n },\n type: {\n anyOf: [\n { $ref: \"#/definitions/simpleTypes\" },\n {\n type: \"array\",\n items: { $ref: \"#/definitions/simpleTypes\" },\n minItems: 1,\n uniqueItems: true\n }\n ]\n },\n format: { type: \"string\" },\n allOf: { $ref: \"#/definitions/schemaArray\" },\n anyOf: { $ref: \"#/definitions/schemaArray\" },\n oneOf: { $ref: \"#/definitions/schemaArray\" },\n not: { $ref: \"#\" }\n },\n dependencies: {\n exclusiveMaximum: [\"maximum\"],\n exclusiveMinimum: [\"minimum\"]\n },\n default: { }\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport default (additionalOptions = {}) => {\n const ajv = new Ajv({\n meta: false,\n useDefaults: true,\n validateSchema: false,\n missingRefs: \"ignore\",\n verbose: true,\n schemaId: \"auto\",\n ...additionalOptions\n });\n\n ajv.addMetaSchema(metaSchema);\n // eslint-disable-next-line no-underscore-dangle\n ajv._opts.defaultMeta = metaSchema.id;\n\n return ajv;\n};\n","/**\n * @fileoverview Defines a schema for configs.\n * @author Sylvan Mably\n */\n\nconst baseConfigProperties = {\n $schema: { type: \"string\" },\n env: { type: \"object\" },\n extends: { $ref: \"#/definitions/stringOrStrings\" },\n globals: { type: \"object\" },\n overrides: {\n type: \"array\",\n items: { $ref: \"#/definitions/overrideConfig\" },\n additionalItems: false\n },\n parser: { type: [\"string\", \"null\"] },\n parserOptions: { type: \"object\" },\n plugins: { type: \"array\" },\n processor: { type: \"string\" },\n rules: { type: \"object\" },\n settings: { type: \"object\" },\n noInlineConfig: { type: \"boolean\" },\n reportUnusedDisableDirectives: { type: \"boolean\" },\n\n ecmaFeatures: { type: \"object\" } // deprecated; logs a warning when used\n};\n\nconst configSchema = {\n definitions: {\n stringOrStrings: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false\n }\n ]\n },\n stringOrStringsRequired: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false,\n minItems: 1\n }\n ]\n },\n\n // Config at top-level.\n objectConfig: {\n type: \"object\",\n properties: {\n root: { type: \"boolean\" },\n ignorePatterns: { $ref: \"#/definitions/stringOrStrings\" },\n ...baseConfigProperties\n },\n additionalProperties: false\n },\n\n // Config in `overrides`.\n overrideConfig: {\n type: \"object\",\n properties: {\n excludedFiles: { $ref: \"#/definitions/stringOrStrings\" },\n files: { $ref: \"#/definitions/stringOrStringsRequired\" },\n ...baseConfigProperties\n },\n required: [\"files\"],\n additionalProperties: false\n }\n },\n\n $ref: \"#/definitions/objectConfig\"\n};\n\nexport default configSchema;\n","/**\n * @fileoverview Defines environment settings and globals.\n * @author Elan Shanker\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport globals from \"globals\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the object that has difference.\n * @param {Record} current The newer object.\n * @param {Record} prev The older object.\n * @returns {Record} The difference object.\n */\nfunction getDiff(current, prev) {\n const retv = {};\n\n for (const [key, value] of Object.entries(current)) {\n if (!Object.hasOwnProperty.call(prev, key)) {\n retv[key] = value;\n }\n }\n\n return retv;\n}\n\nconst newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...\nconst newGlobals2017 = {\n Atomics: false,\n SharedArrayBuffer: false\n};\nconst newGlobals2020 = {\n BigInt: false,\n BigInt64Array: false,\n BigUint64Array: false,\n globalThis: false\n};\n\nconst newGlobals2021 = {\n AggregateError: false,\n FinalizationRegistry: false,\n WeakRef: false\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/** @type {Map} */\nexport default new Map(Object.entries({\n\n // Language\n builtin: {\n globals: globals.es5\n },\n es6: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2015: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2016: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 7\n }\n },\n es2017: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 8\n }\n },\n es2018: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 9\n }\n },\n es2019: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 10\n }\n },\n es2020: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },\n parserOptions: {\n ecmaVersion: 11\n }\n },\n es2021: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 12\n }\n },\n es2022: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 13\n }\n },\n\n // Platforms\n browser: {\n globals: globals.browser\n },\n node: {\n globals: globals.node,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n \"shared-node-browser\": {\n globals: globals[\"shared-node-browser\"]\n },\n worker: {\n globals: globals.worker\n },\n serviceworker: {\n globals: globals.serviceworker\n },\n\n // Frameworks\n commonjs: {\n globals: globals.commonjs,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n amd: {\n globals: globals.amd\n },\n mocha: {\n globals: globals.mocha\n },\n jasmine: {\n globals: globals.jasmine\n },\n jest: {\n globals: globals.jest\n },\n phantomjs: {\n globals: globals.phantomjs\n },\n jquery: {\n globals: globals.jquery\n },\n qunit: {\n globals: globals.qunit\n },\n prototypejs: {\n globals: globals.prototypejs\n },\n shelljs: {\n globals: globals.shelljs\n },\n meteor: {\n globals: globals.meteor\n },\n mongo: {\n globals: globals.mongo\n },\n protractor: {\n globals: globals.protractor\n },\n applescript: {\n globals: globals.applescript\n },\n nashorn: {\n globals: globals.nashorn\n },\n atomtest: {\n globals: globals.atomtest\n },\n embertest: {\n globals: globals.embertest\n },\n webextensions: {\n globals: globals.webextensions\n },\n greasemonkey: {\n globals: globals.greasemonkey\n }\n}));\n","/**\n * @fileoverview Validates configs.\n * @author Brandon Mills\n */\n\n/* eslint class-methods-use-this: \"off\" */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport util from \"util\";\nimport * as ConfigOps from \"./config-ops.js\";\nimport { emitDeprecationWarning } from \"./deprecation-warnings.js\";\nimport ajvOrig from \"./ajv.js\";\nimport configSchema from \"../../conf/config-schema.js\";\nimport BuiltInEnvironments from \"../../conf/environments.js\";\n\nconst ajv = ajvOrig();\n\nconst ruleValidators = new WeakMap();\nconst noop = Function.prototype;\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\nlet validateSchema;\nconst severityMap = {\n error: 2,\n warn: 1,\n off: 0\n};\n\nconst validated = new WeakSet();\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nexport default class ConfigValidator {\n constructor({ builtInRules = new Map() } = {}) {\n this.builtInRules = builtInRules;\n }\n\n /**\n * Gets a complete options schema for a rule.\n * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object\n * @returns {Object} JSON Schema for the rule's options.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n const schema = rule.schema || rule.meta && rule.meta.schema;\n\n // Given a tuple of schemas, insert warning level at the beginning\n if (Array.isArray(schema)) {\n if (schema.length) {\n return {\n type: \"array\",\n items: schema,\n minItems: 0,\n maxItems: schema.length\n };\n }\n return {\n type: \"array\",\n minItems: 0,\n maxItems: 0\n };\n\n }\n\n // Given a full schema, leave it alone\n return schema || null;\n }\n\n /**\n * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.\n * @param {options} options The given options for the rule.\n * @returns {number|string} The rule's severity value\n */\n validateRuleSeverity(options) {\n const severity = Array.isArray(options) ? options[0] : options;\n const normSeverity = typeof severity === \"string\" ? severityMap[severity.toLowerCase()] : severity;\n\n if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {\n return normSeverity;\n }\n\n throw new Error(`\\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, \"\\\"\").replace(/\\n/gu, \"\")}').\\n`);\n\n }\n\n /**\n * Validates the non-severity options passed to a rule, based on its schema.\n * @param {{create: Function}} rule The rule to validate\n * @param {Array} localOptions The options for the rule, excluding severity\n * @returns {void}\n */\n validateRuleSchema(rule, localOptions) {\n if (!ruleValidators.has(rule)) {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n validateRule(localOptions);\n if (validateRule.errors) {\n throw new Error(validateRule.errors.map(\n error => `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n`\n ).join(\"\"));\n }\n }\n }\n\n /**\n * Validates a rule's options against its schema.\n * @param {{create: Function}|null} rule The rule that the config is being validated for\n * @param {string} ruleId The rule's unique name.\n * @param {Array|number} options The given options for the rule.\n * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,\n * no source is prepended to the message.\n * @returns {void}\n */\n validateRuleOptions(rule, ruleId, options, source = null) {\n try {\n const severity = this.validateRuleSeverity(options);\n\n if (severity !== 0) {\n this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);\n }\n } catch (err) {\n const enhancedMessage = `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n throw new Error(`${source}:\\n\\t${enhancedMessage}`);\n } else {\n throw new Error(enhancedMessage);\n }\n }\n }\n\n /**\n * Validates an environment object\n * @param {Object} environment The environment config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.\n * @returns {void}\n */\n validateEnvironment(\n environment,\n source,\n getAdditionalEnv = noop\n ) {\n\n // not having an environment is ok\n if (!environment) {\n return;\n }\n\n Object.keys(environment).forEach(id => {\n const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;\n\n if (!env) {\n const message = `${source}:\\n\\tEnvironment key \"${id}\" is unknown\\n`;\n\n throw new Error(message);\n }\n });\n }\n\n /**\n * Validates a rules config object\n * @param {Object} rulesConfig The rules config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules\n * @returns {void}\n */\n validateRules(\n rulesConfig,\n source,\n getAdditionalRule = noop\n ) {\n if (!rulesConfig) {\n return;\n }\n\n Object.keys(rulesConfig).forEach(id => {\n const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;\n\n this.validateRuleOptions(rule, id, rulesConfig[id], source);\n });\n }\n\n /**\n * Validates a `globals` section of a config file\n * @param {Object} globalsConfig The `globals` section\n * @param {string|null} source The name of the configuration source to report in the event of an error.\n * @returns {void}\n */\n validateGlobals(globalsConfig, source = null) {\n if (!globalsConfig) {\n return;\n }\n\n Object.entries(globalsConfig)\n .forEach(([configuredGlobal, configuredValue]) => {\n try {\n ConfigOps.normalizeConfigGlobal(configuredValue);\n } catch (err) {\n throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\\n${err.message}`);\n }\n });\n }\n\n /**\n * Validate `processor` configuration.\n * @param {string|undefined} processorName The processor name.\n * @param {string} source The name of config file.\n * @param {function(id:string): Processor} getProcessor The getter of defined processors.\n * @returns {void}\n */\n validateProcessor(processorName, source, getProcessor) {\n if (processorName && !getProcessor(processorName)) {\n throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);\n }\n }\n\n /**\n * Formats an array of schema validation errors.\n * @param {Array} errors An array of error messages to format.\n * @returns {string} Formatted error message\n */\n formatErrors(errors) {\n return errors.map(error => {\n if (error.keyword === \"additionalProperties\") {\n const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;\n\n return `Unexpected top-level property \"${formattedPropertyPath}\"`;\n }\n if (error.keyword === \"type\") {\n const formattedField = error.dataPath.slice(1);\n const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join(\"/\") : error.schema;\n const formattedValue = JSON.stringify(error.data);\n\n return `Property \"${formattedField}\" is the wrong type (expected ${formattedExpectedType} but got \\`${formattedValue}\\`)`;\n }\n\n const field = error.dataPath[0] === \".\" ? error.dataPath.slice(1) : error.dataPath;\n\n return `\"${field}\" ${error.message}. Value: ${JSON.stringify(error.data)}`;\n }).map(message => `\\t- ${message}.\\n`).join(\"\");\n }\n\n /**\n * Validates the top level properties of the config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @returns {void}\n */\n validateConfigSchema(config, source = null) {\n validateSchema = validateSchema || ajv.compile(configSchema);\n\n if (!validateSchema(config)) {\n throw new Error(`ESLint configuration in ${source} is invalid:\\n${this.formatErrors(validateSchema.errors)}`);\n }\n\n if (Object.hasOwnProperty.call(config, \"ecmaFeatures\")) {\n emitDeprecationWarning(source, \"ESLINT_LEGACY_ECMAFEATURES\");\n }\n }\n\n /**\n * Validates an entire config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.\n * @returns {void}\n */\n validate(config, source, getAdditionalRule, getAdditionalEnv) {\n this.validateConfigSchema(config, source);\n this.validateRules(config.rules, source, getAdditionalRule);\n this.validateEnvironment(config.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n\n for (const override of config.overrides || []) {\n this.validateRules(override.rules, source, getAdditionalRule);\n this.validateEnvironment(override.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n }\n }\n\n /**\n * Validate config array object.\n * @param {ConfigArray} configArray The config array to validate.\n * @returns {void}\n */\n validateConfigArray(configArray) {\n const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);\n const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);\n const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);\n\n // Validate.\n for (const element of configArray) {\n if (validated.has(element)) {\n continue;\n }\n validated.add(element);\n\n this.validateEnvironment(element.env, element.name, getPluginEnv);\n this.validateGlobals(element.globals, element.name);\n this.validateProcessor(element.processor, element.name, getPluginProcessor);\n this.validateRules(element.rules, element.name, getPluginRule);\n }\n }\n\n}\n","/**\n * @fileoverview Common helpers for naming of plugins, formatters and configs\n */\n\nconst NAMESPACE_REGEX = /^@.*\\//iu;\n\n/**\n * Brings package name to correct format based on prefix\n * @param {string} name The name of the package.\n * @param {string} prefix Can be either \"eslint-plugin\", \"eslint-config\" or \"eslint-formatter\"\n * @returns {string} Normalized name of the package\n * @private\n */\nfunction normalizePackageName(name, prefix) {\n let normalizedName = name;\n\n /**\n * On Windows, name can come in with Windows slashes instead of Unix slashes.\n * Normalize to Unix first to avoid errors later on.\n * https://github.com/eslint/eslint/issues/5644\n */\n if (normalizedName.includes(\"\\\\\")) {\n normalizedName = normalizedName.replace(/\\\\/gu, \"/\");\n }\n\n if (normalizedName.charAt(0) === \"@\") {\n\n /**\n * it's a scoped package\n * package name is the prefix, or just a username\n */\n const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, \"u\"),\n scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, \"u\");\n\n if (scopedPackageShortcutRegex.test(normalizedName)) {\n normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);\n } else if (!scopedPackageNameRegex.test(normalizedName.split(\"/\")[1])) {\n\n /**\n * for scoped packages, insert the prefix after the first / unless\n * the path is already @scope/eslint or @scope/eslint-xxx-yyy\n */\n normalizedName = normalizedName.replace(/^@([^/]+)\\/(.*)$/u, `@$1/${prefix}-$2`);\n }\n } else if (!normalizedName.startsWith(`${prefix}-`)) {\n normalizedName = `${prefix}-${normalizedName}`;\n }\n\n return normalizedName;\n}\n\n/**\n * Removes the prefix from a fullname.\n * @param {string} fullname The term which may have the prefix.\n * @param {string} prefix The prefix to remove.\n * @returns {string} The term without prefix.\n */\nfunction getShorthandName(fullname, prefix) {\n if (fullname[0] === \"@\") {\n let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, \"u\").exec(fullname);\n\n if (matchResult) {\n return matchResult[1];\n }\n\n matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, \"u\").exec(fullname);\n if (matchResult) {\n return `${matchResult[1]}/${matchResult[2]}`;\n }\n } else if (fullname.startsWith(`${prefix}-`)) {\n return fullname.slice(prefix.length + 1);\n }\n\n return fullname;\n}\n\n/**\n * Gets the scope (namespace) of a term.\n * @param {string} term The term which may have the namespace.\n * @returns {string} The namespace of the term if it has one.\n */\nfunction getNamespaceFromTerm(term) {\n const match = term.match(NAMESPACE_REGEX);\n\n return match ? match[0] : \"\";\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n normalizePackageName,\n getShorthandName,\n getNamespaceFromTerm\n};\n","/**\n * Utility for resolving a module relative to another module\n * @author Teddy Katz\n */\n\nimport Module from \"module\";\n\n/*\n * `Module.createRequire` is added in v12.2.0. It supports URL as well.\n * We only support the case where the argument is a filepath, not a URL.\n */\nconst createRequire = Module.createRequire;\n\n/**\n * Resolves a Node module relative to another module\n * @param {string} moduleName The name of a Node module, or a path to a Node module.\n * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be\n * a file rather than a directory, but the file need not actually exist.\n * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`\n */\nfunction resolve(moduleName, relativeToPath) {\n try {\n return createRequire(relativeToPath).resolve(moduleName);\n } catch (error) {\n\n // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.\n if (\n typeof error === \"object\" &&\n error !== null &&\n error.code === \"MODULE_NOT_FOUND\" &&\n !error.requireStack &&\n error.message.includes(moduleName)\n ) {\n error.message += `\\nRequire stack:\\n- ${relativeToPath}`;\n }\n throw error;\n }\n}\n\nexport {\n resolve\n};\n","/**\n * @fileoverview The factory of `ConfigArray` objects.\n *\n * This class provides methods to create `ConfigArray` instance.\n *\n * - `create(configData, options)`\n * Create a `ConfigArray` instance from a config data. This is to handle CLI\n * options except `--config`.\n * - `loadFile(filePath, options)`\n * Create a `ConfigArray` instance from a config file. This is to handle\n * `--config` option. If the file was not found, throws the following error:\n * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error.\n * - If the filename was `package.json`, an IO error or an\n * `ESLINT_CONFIG_FIELD_NOT_FOUND` error.\n * - Otherwise, an IO error such as `ENOENT`.\n * - `loadInDirectory(directoryPath, options)`\n * Create a `ConfigArray` instance from a config file which is on a given\n * directory. This tries to load `.eslintrc.*` or `package.json`. If not\n * found, returns an empty `ConfigArray`.\n * - `loadESLintIgnore(filePath)`\n * Create a `ConfigArray` instance from a config file that is `.eslintignore`\n * format. This is to handle `--ignore-path` option.\n * - `loadDefaultESLintIgnore()`\n * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in\n * the current working directory.\n *\n * `ConfigArrayFactory` class has the responsibility that loads configuration\n * files, including loading `extends`, `parser`, and `plugins`. The created\n * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`.\n *\n * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class\n * handles cascading and hierarchy.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport fs from \"fs\";\nimport importFresh from \"import-fresh\";\nimport { createRequire } from \"module\";\nimport path from \"path\";\nimport stripComments from \"strip-json-comments\";\n\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern,\n OverrideTester\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\n\nconst require = createRequire(import.meta.url);\n\nconst debug = debugOrig(\"eslintrc:config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst configFilenames = [\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.yaml\",\n \".eslintrc.yml\",\n \".eslintrc.json\",\n \".eslintrc\",\n \"package.json\"\n];\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").OverrideConfigData} OverrideConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {import(\"./config-array/config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-array/config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {ConfigArray[0]} ConfigArrayElement */\n\n/**\n * @typedef {Object} ConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {string} [cwd] The path to the current working directory.\n * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryInternalSlots\n * @property {Map} additionalPluginPool The map for additional plugins.\n * @property {string} cwd The path to the current working directory.\n * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {string} pluginBasePath The base path to resolve plugins.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/**\n * Check if a given string is a file path.\n * @param {string} nameOrPath A module name or file path.\n * @returns {boolean} `true` if the `nameOrPath` is a file path.\n */\nfunction isFilePath(nameOrPath) {\n return (\n /^\\.{1,2}[/\\\\]/u.test(nameOrPath) ||\n path.isAbsolute(nameOrPath)\n );\n}\n\n/**\n * Convenience wrapper for synchronously reading file contents.\n * @param {string} filePath The filename to read.\n * @returns {string} The file contents, with the BOM removed.\n * @private\n */\nfunction readFile(filePath) {\n return fs.readFileSync(filePath, \"utf8\").replace(/^\\ufeff/u, \"\");\n}\n\n/**\n * Loads a YAML configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadYAMLConfigFile(filePath) {\n debug(`Loading YAML config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n\n // empty YAML file can be null, so always use\n return yaml.load(readFile(filePath)) || {};\n } catch (e) {\n debug(`Error reading YAML file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JSON configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSONConfigFile(filePath) {\n debug(`Loading JSON config file: ${filePath}`);\n\n try {\n return JSON.parse(stripComments(readFile(filePath)));\n } catch (e) {\n debug(`Error reading JSON file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n e.messageTemplate = \"failed-to-read-json\";\n e.messageData = {\n path: filePath,\n message: e.message\n };\n throw e;\n }\n}\n\n/**\n * Loads a legacy (.eslintrc) configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadLegacyConfigFile(filePath) {\n debug(`Loading legacy config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n return yaml.load(stripComments(readFile(filePath))) || /* istanbul ignore next */ {};\n } catch (e) {\n debug(\"Error reading YAML file: %s\\n%o\", filePath, e);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JavaScript configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSConfigFile(filePath) {\n debug(`Loading JS config file: ${filePath}`);\n try {\n return importFresh(filePath);\n } catch (e) {\n debug(`Error reading JavaScript file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a configuration from a package.json file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadPackageJSONConfigFile(filePath) {\n debug(`Loading package.json config file: ${filePath}`);\n try {\n const packageData = loadJSONConfigFile(filePath);\n\n if (!Object.hasOwnProperty.call(packageData, \"eslintConfig\")) {\n throw Object.assign(\n new Error(\"package.json file doesn't have 'eslintConfig' field.\"),\n { code: \"ESLINT_CONFIG_FIELD_NOT_FOUND\" }\n );\n }\n\n return packageData.eslintConfig;\n } catch (e) {\n debug(`Error reading package.json file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a `.eslintignore` from a file.\n * @param {string} filePath The filename to load.\n * @returns {string[]} The ignore patterns from the file.\n * @private\n */\nfunction loadESLintIgnoreFile(filePath) {\n debug(`Loading .eslintignore file: ${filePath}`);\n\n try {\n return readFile(filePath)\n .split(/\\r?\\n/gu)\n .filter(line => line.trim() !== \"\" && !line.startsWith(\"#\"));\n } catch (e) {\n debug(`Error reading .eslintignore file: ${filePath}`);\n e.message = `Cannot read .eslintignore file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Creates an error to notify about a missing config to extend from.\n * @param {string} configName The name of the missing config.\n * @param {string} importerName The name of the config that imported the missing config\n * @param {string} messageTemplate The text template to source error strings from.\n * @returns {Error} The error object to throw\n * @private\n */\nfunction configInvalidError(configName, importerName, messageTemplate) {\n return Object.assign(\n new Error(`Failed to load config \"${configName}\" to extend from.`),\n {\n messageTemplate,\n messageData: { configName, importerName }\n }\n );\n}\n\n/**\n * Loads a configuration file regardless of the source. Inspects the file path\n * to determine the correctly way to load the config file.\n * @param {string} filePath The path to the configuration.\n * @returns {ConfigData|null} The configuration information.\n * @private\n */\nfunction loadConfigFile(filePath) {\n switch (path.extname(filePath)) {\n case \".js\":\n case \".cjs\":\n return loadJSConfigFile(filePath);\n\n case \".json\":\n if (path.basename(filePath) === \"package.json\") {\n return loadPackageJSONConfigFile(filePath);\n }\n return loadJSONConfigFile(filePath);\n\n case \".yaml\":\n case \".yml\":\n return loadYAMLConfigFile(filePath);\n\n default:\n return loadLegacyConfigFile(filePath);\n }\n}\n\n/**\n * Write debug log.\n * @param {string} request The requested module name.\n * @param {string} relativeTo The file path to resolve the request relative to.\n * @param {string} filePath The resolved file path.\n * @returns {void}\n */\nfunction writeDebugLogForLoading(request, relativeTo, filePath) {\n /* istanbul ignore next */\n if (debug.enabled) {\n let nameAndVersion = null;\n\n try {\n const packageJsonPath = ModuleResolver.resolve(\n `${request}/package.json`,\n relativeTo\n );\n const { version = \"unknown\" } = require(packageJsonPath);\n\n nameAndVersion = `${request}@${version}`;\n } catch (error) {\n debug(\"package.json was not found:\", error.message);\n nameAndVersion = request;\n }\n\n debug(\"Loaded: %s (%s)\", nameAndVersion, filePath);\n }\n}\n\n/**\n * Create a new context with default values.\n * @param {ConfigArrayFactoryInternalSlots} slots The internal slots.\n * @param {\"config\" | \"ignore\" | \"implicit-processor\" | undefined} providedType The type of the current configuration. Default is `\"config\"`.\n * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`.\n * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string.\n * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`.\n * @returns {ConfigArrayFactoryLoadingContext} The created context.\n */\nfunction createContext(\n { cwd, resolvePluginsRelativeTo },\n providedType,\n providedName,\n providedFilePath,\n providedMatchBasePath\n) {\n const filePath = providedFilePath\n ? path.resolve(cwd, providedFilePath)\n : \"\";\n const matchBasePath =\n (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const name =\n providedName ||\n (filePath && path.relative(cwd, filePath)) ||\n \"\";\n const pluginBasePath =\n resolvePluginsRelativeTo ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const type = providedType || \"config\";\n\n return { filePath, matchBasePath, name, pluginBasePath, type };\n}\n\n/**\n * Normalize a given plugin.\n * - Ensure the object to have four properties: configs, environments, processors, and rules.\n * - Ensure the object to not have other properties.\n * @param {Plugin} plugin The plugin to normalize.\n * @returns {Plugin} The normalized plugin.\n */\nfunction normalizePlugin(plugin) {\n return {\n configs: plugin.configs || {},\n environments: plugin.environments || {},\n processors: plugin.processors || {},\n rules: plugin.rules || {}\n };\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The factory of `ConfigArray` objects.\n */\nclass ConfigArrayFactory {\n\n /**\n * Initialize this instance.\n * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins.\n */\n constructor({\n additionalPluginPool = new Map(),\n cwd = process.cwd(),\n resolvePluginsRelativeTo,\n builtInRules,\n resolver = ModuleResolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = {}) {\n internalSlotsMap.set(this, {\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo:\n resolvePluginsRelativeTo &&\n path.resolve(cwd, resolvePluginsRelativeTo),\n builtInRules,\n resolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n });\n }\n\n /**\n * Create `ConfigArray` instance from a config data.\n * @param {ConfigData|null} configData The config data to create.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.filePath] The path to this config data.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n create(configData, { basePath, filePath, name } = {}) {\n if (!configData) {\n return new ConfigArray();\n }\n\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n const elements = this._normalizeConfigData(configData, ctx);\n\n return new ConfigArray(...elements);\n }\n\n /**\n * Load a config file.\n * @param {string} filePath The path to a config file.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n loadFile(filePath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n\n return new ConfigArray(...this._loadConfigData(ctx));\n }\n\n /**\n * Load the config file on a given directory if exists.\n * @param {string} directoryPath The path to a directory.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadInDirectory(directoryPath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n\n for (const filename of configFilenames) {\n const ctx = createContext(\n slots,\n \"config\",\n name,\n path.join(directoryPath, filename),\n basePath\n );\n\n if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) {\n let configData;\n\n try {\n configData = loadConfigFile(ctx.filePath);\n } catch (error) {\n if (!error || error.code !== \"ESLINT_CONFIG_FIELD_NOT_FOUND\") {\n throw error;\n }\n }\n\n if (configData) {\n debug(`Config file found: ${ctx.filePath}`);\n return new ConfigArray(\n ...this._normalizeConfigData(configData, ctx)\n );\n }\n }\n }\n\n debug(`Config file not found on ${directoryPath}`);\n return new ConfigArray();\n }\n\n /**\n * Check if a config file on a given directory exists or not.\n * @param {string} directoryPath The path to a directory.\n * @returns {string | null} The path to the found config file. If not found then null.\n */\n static getPathToConfigFileInDirectory(directoryPath) {\n for (const filename of configFilenames) {\n const filePath = path.join(directoryPath, filename);\n\n if (fs.existsSync(filePath)) {\n if (filename === \"package.json\") {\n try {\n loadPackageJSONConfigFile(filePath);\n return filePath;\n } catch { /* ignore */ }\n } else {\n return filePath;\n }\n }\n }\n return null;\n }\n\n /**\n * Load `.eslintignore` file.\n * @param {string} filePath The path to a `.eslintignore` file to load.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadESLintIgnore(filePath) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(\n slots,\n \"ignore\",\n void 0,\n filePath,\n slots.cwd\n );\n const ignorePatterns = loadESLintIgnoreFile(ctx.filePath);\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(ignorePatterns, ctx)\n );\n }\n\n /**\n * Load `.eslintignore` file in the current working directory.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadDefaultESLintIgnore() {\n const slots = internalSlotsMap.get(this);\n const eslintIgnorePath = path.resolve(slots.cwd, \".eslintignore\");\n const packageJsonPath = path.resolve(slots.cwd, \"package.json\");\n\n if (fs.existsSync(eslintIgnorePath)) {\n return this.loadESLintIgnore(eslintIgnorePath);\n }\n if (fs.existsSync(packageJsonPath)) {\n const data = loadJSONConfigFile(packageJsonPath);\n\n if (Object.hasOwnProperty.call(data, \"eslintIgnore\")) {\n if (!Array.isArray(data.eslintIgnore)) {\n throw new Error(\"Package.json eslintIgnore property requires an array of paths\");\n }\n const ctx = createContext(\n slots,\n \"ignore\",\n \"eslintIgnore in package.json\",\n packageJsonPath,\n slots.cwd\n );\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx)\n );\n }\n }\n\n return new ConfigArray();\n }\n\n /**\n * Load a given config file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} Loaded config.\n * @private\n */\n _loadConfigData(ctx) {\n return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx);\n }\n\n /**\n * Normalize a given `.eslintignore` data to config array elements.\n * @param {string[]} ignorePatterns The patterns to ignore files.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeESLintIgnoreData(ignorePatterns, ctx) {\n const elements = this._normalizeObjectConfigData(\n { ignorePatterns },\n ctx\n );\n\n // Set `ignorePattern.loose` flag for backward compatibility.\n for (const element of elements) {\n if (element.ignorePattern) {\n element.ignorePattern.loose = true;\n }\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _normalizeConfigData(configData, ctx) {\n const validator = new ConfigValidator();\n\n validator.validateConfigSchema(configData, ctx.name || ctx.filePath);\n return this._normalizeObjectConfigData(configData, ctx);\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData|OverrideConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigData(configData, ctx) {\n const { files, excludedFiles, ...configBody } = configData;\n const criteria = OverrideTester.create(\n files,\n excludedFiles,\n ctx.matchBasePath\n );\n const elements = this._normalizeObjectConfigDataBody(configBody, ctx);\n\n // Apply the criteria to every element.\n for (const element of elements) {\n\n /*\n * Merge the criteria.\n * This is for the `overrides` entries that came from the\n * configurations of `overrides[].extends`.\n */\n element.criteria = OverrideTester.and(criteria, element.criteria);\n\n /*\n * Remove `root` property to ignore `root` settings which came from\n * `extends` in `overrides`.\n */\n if (element.criteria) {\n element.root = void 0;\n }\n\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigDataBody(\n {\n env,\n extends: extend,\n globals,\n ignorePatterns,\n noInlineConfig,\n parser: parserName,\n parserOptions,\n plugins: pluginList,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings,\n overrides: overrideList = []\n },\n ctx\n ) {\n const extendList = Array.isArray(extend) ? extend : [extend];\n const ignorePattern = ignorePatterns && new IgnorePattern(\n Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns],\n ctx.matchBasePath\n );\n\n // Flatten `extends`.\n for (const extendName of extendList.filter(Boolean)) {\n yield* this._loadExtends(extendName, ctx);\n }\n\n // Load parser & plugins.\n const parser = parserName && this._loadParser(parserName, ctx);\n const plugins = pluginList && this._loadPlugins(pluginList, ctx);\n\n // Yield pseudo config data for file extension processors.\n if (plugins) {\n yield* this._takeFileExtensionProcessors(plugins, ctx);\n }\n\n // Yield the config data except `extends` and `overrides`.\n yield {\n\n // Debug information.\n type: ctx.type,\n name: ctx.name,\n filePath: ctx.filePath,\n\n // Config data.\n criteria: null,\n env,\n globals,\n ignorePattern,\n noInlineConfig,\n parser,\n parserOptions,\n plugins,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings\n };\n\n // Flatten `overries`.\n for (let i = 0; i < overrideList.length; ++i) {\n yield* this._normalizeObjectConfigData(\n overrideList[i],\n { ...ctx, name: `${ctx.name}#overrides[${i}]` }\n );\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtends(extendName, ctx) {\n debug(\"Loading {extends:%j} relative to %s\", extendName, ctx.filePath);\n try {\n if (extendName.startsWith(\"eslint:\")) {\n return this._loadExtendedBuiltInConfig(extendName, ctx);\n }\n if (extendName.startsWith(\"plugin:\")) {\n return this._loadExtendedPluginConfig(extendName, ctx);\n }\n return this._loadExtendedShareableConfig(extendName, ctx);\n } catch (error) {\n error.message += `\\nReferenced from: ${ctx.filePath || ctx.name}`;\n throw error;\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedBuiltInConfig(extendName, ctx) {\n const {\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = internalSlotsMap.get(this);\n\n if (extendName === \"eslint:recommended\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintRecommendedConfig) {\n if (typeof getEslintRecommendedConfig !== \"function\") {\n throw new Error(`getEslintRecommendedConfig must be a function instead of '${getEslintRecommendedConfig}'`);\n }\n return this._normalizeConfigData(getEslintRecommendedConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintRecommendedPath\n });\n }\n if (extendName === \"eslint:all\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintAllConfig) {\n if (typeof getEslintAllConfig !== \"function\") {\n throw new Error(`getEslintAllConfig must be a function instead of '${getEslintAllConfig}'`);\n }\n return this._normalizeConfigData(getEslintAllConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintAllPath\n });\n }\n\n throw configInvalidError(extendName, ctx.name, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedPluginConfig(extendName, ctx) {\n const slashIndex = extendName.lastIndexOf(\"/\");\n\n if (slashIndex === -1) {\n throw configInvalidError(extendName, ctx.filePath, \"plugin-invalid\");\n }\n\n const pluginName = extendName.slice(\"plugin:\".length, slashIndex);\n const configName = extendName.slice(slashIndex + 1);\n\n if (isFilePath(pluginName)) {\n throw new Error(\"'extends' cannot use a file path for plugins.\");\n }\n\n const plugin = this._loadPlugin(pluginName, ctx);\n const configData =\n plugin.definition &&\n plugin.definition.configs[configName];\n\n if (configData) {\n return this._normalizeConfigData(configData, {\n ...ctx,\n filePath: plugin.filePath || ctx.filePath,\n name: `${ctx.name} » plugin:${plugin.id}/${configName}`\n });\n }\n\n throw plugin.error || configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedShareableConfig(extendName, ctx) {\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n let request;\n\n if (isFilePath(extendName)) {\n request = extendName;\n } else if (extendName.startsWith(\".\")) {\n request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior.\n } else {\n request = naming.normalizePackageName(\n extendName,\n \"eslint-config\"\n );\n }\n\n let filePath;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (error) {\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n throw configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n throw error;\n }\n\n writeDebugLogForLoading(request, relativeTo, filePath);\n return this._loadConfigData({\n ...ctx,\n filePath,\n name: `${ctx.name} » ${request}`\n });\n }\n\n /**\n * Load given plugins.\n * @param {string[]} names The plugin names to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {Record} The loaded parser.\n * @private\n */\n _loadPlugins(names, ctx) {\n return names.reduce((map, name) => {\n if (isFilePath(name)) {\n throw new Error(\"Plugins array cannot includes file paths.\");\n }\n const plugin = this._loadPlugin(name, ctx);\n\n map[plugin.id] = plugin;\n\n return map;\n }, {});\n }\n\n /**\n * Load a given parser.\n * @param {string} nameOrPath The package name or the path to a parser file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentParser} The loaded parser.\n */\n _loadParser(nameOrPath, ctx) {\n debug(\"Loading parser %j from %s\", nameOrPath, ctx.filePath);\n\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n\n try {\n const filePath = resolver.resolve(nameOrPath, relativeTo);\n\n writeDebugLogForLoading(nameOrPath, relativeTo, filePath);\n\n return new ConfigDependency({\n definition: require(filePath),\n filePath,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (error) {\n\n // If the parser name is \"espree\", load the espree of ESLint.\n if (nameOrPath === \"espree\") {\n debug(\"Fallback espree.\");\n return new ConfigDependency({\n definition: require(\"espree\"),\n filePath: require.resolve(\"espree\"),\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n debug(\"Failed to load parser '%s' declared in '%s'.\", nameOrPath, ctx.name);\n error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`;\n\n return new ConfigDependency({\n error,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n }\n\n /**\n * Load a given plugin.\n * @param {string} name The plugin name to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentPlugin} The loaded plugin.\n * @private\n */\n _loadPlugin(name, ctx) {\n debug(\"Loading plugin %j from %s\", name, ctx.filePath);\n\n const { additionalPluginPool, resolver } = internalSlotsMap.get(this);\n const request = naming.normalizePackageName(name, \"eslint-plugin\");\n const id = naming.getShorthandName(request, \"eslint-plugin\");\n const relativeTo = path.join(ctx.pluginBasePath, \"__placeholder__.js\");\n\n if (name.match(/\\s+/u)) {\n const error = Object.assign(\n new Error(`Whitespace found in plugin name '${name}'`),\n {\n messageTemplate: \"whitespace-found\",\n messageData: { pluginName: request }\n }\n );\n\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n // Check for additional pool.\n const plugin =\n additionalPluginPool.get(request) ||\n additionalPluginPool.get(id);\n\n if (plugin) {\n return new ConfigDependency({\n definition: normalizePlugin(plugin),\n filePath: \"\", // It's unknown where the plugin came from.\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n let filePath;\n let error;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (resolveError) {\n error = resolveError;\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n error.messageTemplate = \"plugin-missing\";\n error.messageData = {\n pluginName: request,\n resolvePluginsRelativeTo: ctx.pluginBasePath,\n importerName: ctx.name\n };\n }\n }\n\n if (filePath) {\n try {\n writeDebugLogForLoading(request, relativeTo, filePath);\n\n const startTime = Date.now();\n const pluginDefinition = require(filePath);\n\n debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`);\n\n return new ConfigDependency({\n definition: normalizePlugin(pluginDefinition),\n filePath,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (loadError) {\n error = loadError;\n }\n }\n\n debug(\"Failed to load plugin '%s' declared in '%s'.\", name, ctx.name);\n error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`;\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n /**\n * Take file expression processors as config array elements.\n * @param {Record} plugins The plugin definitions.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The config array elements of file expression processors.\n * @private\n */\n *_takeFileExtensionProcessors(plugins, ctx) {\n for (const pluginId of Object.keys(plugins)) {\n const processors =\n plugins[pluginId] &&\n plugins[pluginId].definition &&\n plugins[pluginId].definition.processors;\n\n if (!processors) {\n continue;\n }\n\n for (const processorId of Object.keys(processors)) {\n if (processorId.startsWith(\".\")) {\n yield* this._normalizeObjectConfigData(\n {\n files: [`*${processorId}`],\n processor: `${pluginId}/${processorId}`\n },\n {\n ...ctx,\n type: \"implicit-processor\",\n name: `${ctx.name}#processors[\"${pluginId}/${processorId}\"]`\n }\n );\n }\n }\n }\n }\n}\n\nexport { ConfigArrayFactory, createContext };\n","/**\n * @fileoverview `CascadingConfigArrayFactory` class.\n *\n * `CascadingConfigArrayFactory` class has a responsibility:\n *\n * 1. Handles cascading of config files.\n *\n * It provides two methods:\n *\n * - `getConfigArrayForFile(filePath)`\n * Get the corresponded configuration of a given file. This method doesn't\n * throw even if the given file didn't exist.\n * - `clearCache()`\n * Clear the internal cache. You have to call this method when\n * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends\n * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport os from \"os\";\nimport path from \"path\";\n\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport { emitDeprecationWarning } from \"./shared/deprecation-warnings.js\";\n\nconst debug = debugOrig(\"eslintrc:cascading-config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {ReturnType} ConfigArray */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {ConfigData} [baseConfig] The config by `baseConfig` option.\n * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.\n * @property {string} [cwd] The base directory to start lookup.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]} [rulePaths] The value of `--rulesdir` option.\n * @property {string} [specificConfigPath] The value of `--config` option.\n * @property {boolean} [useEslintrc] if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryInternalSlots\n * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.\n * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.\n * @property {ConfigArray} cliConfigArray The config array of CLI options.\n * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.\n * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.\n * @property {Map} configCache The cache from directory paths to config arrays.\n * @property {string} cwd The base directory to start lookup.\n * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.\n * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.\n * @property {boolean} useEslintrc if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/**\n * Create the config array from `baseConfig` and `rulePaths`.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createBaseConfigArray({\n configArrayFactory,\n baseConfigData,\n rulePaths,\n cwd,\n loadRules\n}) {\n const baseConfigArray = configArrayFactory.create(\n baseConfigData,\n { name: \"BaseConfig\" }\n );\n\n /*\n * Create the config array element for the default ignore patterns.\n * This element has `ignorePattern` property that ignores the default\n * patterns in the current working directory.\n */\n baseConfigArray.unshift(configArrayFactory.create(\n { ignorePatterns: IgnorePattern.DefaultPatterns },\n { name: \"DefaultIgnorePattern\" }\n )[0]);\n\n /*\n * Load rules `--rulesdir` option as a pseudo plugin.\n * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate\n * the rule's options with only information in the config array.\n */\n if (rulePaths && rulePaths.length > 0) {\n baseConfigArray.push({\n type: \"config\",\n name: \"--rulesdir\",\n filePath: \"\",\n plugins: {\n \"\": new ConfigDependency({\n definition: {\n rules: rulePaths.reduce(\n (map, rulesPath) => Object.assign(\n map,\n loadRules(rulesPath, cwd)\n ),\n {}\n )\n },\n filePath: \"\",\n id: \"\",\n importerName: \"--rulesdir\",\n importerPath: \"\"\n })\n }\n });\n }\n\n return baseConfigArray;\n}\n\n/**\n * Create the config array from CLI options.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n}) {\n const cliConfigArray = configArrayFactory.create(\n cliConfigData,\n { name: \"CLIOptions\" }\n );\n\n cliConfigArray.unshift(\n ...(ignorePath\n ? configArrayFactory.loadESLintIgnore(ignorePath)\n : configArrayFactory.loadDefaultESLintIgnore())\n );\n\n if (specificConfigPath) {\n cliConfigArray.unshift(\n ...configArrayFactory.loadFile(\n specificConfigPath,\n { name: \"--config\", basePath: cwd }\n )\n );\n }\n\n return cliConfigArray;\n}\n\n/**\n * The error type when there are files matched by a glob, but all of them have been ignored.\n */\nclass ConfigurationNotFoundError extends Error {\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @param {string} directoryPath The directory path.\n */\n constructor(directoryPath) {\n super(`No ESLint configuration found in ${directoryPath}.`);\n this.messageTemplate = \"no-config-found\";\n this.messageData = { directoryPath };\n }\n}\n\n/**\n * This class provides the functionality that enumerates every file which is\n * matched by given glob patterns and that configuration.\n */\nclass CascadingConfigArrayFactory {\n\n /**\n * Initialize this enumerator.\n * @param {CascadingConfigArrayFactoryOptions} options The options.\n */\n constructor({\n additionalPluginPool = new Map(),\n baseConfig: baseConfigData = null,\n cliConfig: cliConfigData = null,\n cwd = process.cwd(),\n ignorePath,\n resolvePluginsRelativeTo,\n rulePaths = [],\n specificConfigPath = null,\n useEslintrc = true,\n builtInRules = new Map(),\n loadRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n } = {}) {\n const configArrayFactory = new ConfigArrayFactory({\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo,\n builtInRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n });\n\n internalSlotsMap.set(this, {\n baseConfigArray: createBaseConfigArray({\n baseConfigData,\n configArrayFactory,\n cwd,\n rulePaths,\n loadRules,\n resolver\n }),\n baseConfigData,\n cliConfigArray: createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n }),\n cliConfigData,\n configArrayFactory,\n configCache: new Map(),\n cwd,\n finalizeCache: new WeakMap(),\n ignorePath,\n rulePaths,\n specificConfigPath,\n useEslintrc,\n builtInRules,\n loadRules\n });\n }\n\n /**\n * The path to the current working directory.\n * This is used by tests.\n * @type {string}\n */\n get cwd() {\n const { cwd } = internalSlotsMap.get(this);\n\n return cwd;\n }\n\n /**\n * Get the config array of a given file.\n * If `filePath` was not given, it returns the config which contains only\n * `baseConfigData` and `cliConfigData`.\n * @param {string} [filePath] The file path to a file.\n * @param {Object} [options] The options.\n * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The config array of the file.\n */\n getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {\n const {\n baseConfigArray,\n cliConfigArray,\n cwd\n } = internalSlotsMap.get(this);\n\n if (!filePath) {\n return new ConfigArray(...baseConfigArray, ...cliConfigArray);\n }\n\n const directoryPath = path.dirname(path.resolve(cwd, filePath));\n\n debug(`Load config files for ${directoryPath}.`);\n\n return this._finalizeConfigArray(\n this._loadConfigInAncestors(directoryPath),\n directoryPath,\n ignoreNotFoundError\n );\n }\n\n /**\n * Set the config data to override all configs.\n * Require to call `clearCache()` method after this method is called.\n * @param {ConfigData} configData The config data to override all configs.\n * @returns {void}\n */\n setOverrideConfig(configData) {\n const slots = internalSlotsMap.get(this);\n\n slots.cliConfigData = configData;\n }\n\n /**\n * Clear config cache.\n * @returns {void}\n */\n clearCache() {\n const slots = internalSlotsMap.get(this);\n\n slots.baseConfigArray = createBaseConfigArray(slots);\n slots.cliConfigArray = createCLIConfigArray(slots);\n slots.configCache.clear();\n }\n\n /**\n * Load and normalize config files from the ancestor directories.\n * @param {string} directoryPath The path to a leaf directory.\n * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {\n const {\n baseConfigArray,\n configArrayFactory,\n configCache,\n cwd,\n useEslintrc\n } = internalSlotsMap.get(this);\n\n if (!useEslintrc) {\n return baseConfigArray;\n }\n\n let configArray = configCache.get(directoryPath);\n\n // Hit cache.\n if (configArray) {\n debug(`Cache hit: ${directoryPath}.`);\n return configArray;\n }\n debug(`No cache found: ${directoryPath}.`);\n\n const homePath = os.homedir();\n\n // Consider this is root.\n if (directoryPath === homePath && cwd !== homePath) {\n debug(\"Stop traversing because of considered root.\");\n if (configsExistInSubdirs) {\n const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);\n\n if (filePath) {\n emitDeprecationWarning(\n filePath,\n \"ESLINT_PERSONAL_CONFIG_SUPPRESS\"\n );\n }\n }\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n\n // Load the config on this directory.\n try {\n configArray = configArrayFactory.loadInDirectory(directoryPath);\n } catch (error) {\n /* istanbul ignore next */\n if (error.code === \"EACCES\") {\n debug(\"Stop traversing because of 'EACCES' error.\");\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n throw error;\n }\n\n if (configArray.length > 0 && configArray.isRoot()) {\n debug(\"Stop traversing because of 'root:true'.\");\n configArray.unshift(...baseConfigArray);\n return this._cacheConfig(directoryPath, configArray);\n }\n\n // Load from the ancestors and merge it.\n const parentPath = path.dirname(directoryPath);\n const parentConfigArray = parentPath && parentPath !== directoryPath\n ? this._loadConfigInAncestors(\n parentPath,\n configsExistInSubdirs || configArray.length > 0\n )\n : baseConfigArray;\n\n if (configArray.length > 0) {\n configArray.unshift(...parentConfigArray);\n } else {\n configArray = parentConfigArray;\n }\n\n // Cache and return.\n return this._cacheConfig(directoryPath, configArray);\n }\n\n /**\n * Freeze and cache a given config.\n * @param {string} directoryPath The path to a directory as a cache key.\n * @param {ConfigArray} configArray The config array as a cache value.\n * @returns {ConfigArray} The `configArray` (frozen).\n */\n _cacheConfig(directoryPath, configArray) {\n const { configCache } = internalSlotsMap.get(this);\n\n Object.freeze(configArray);\n configCache.set(directoryPath, configArray);\n\n return configArray;\n }\n\n /**\n * Finalize a given config array.\n * Concatenate `--config` and other CLI options.\n * @param {ConfigArray} configArray The parent config array.\n * @param {string} directoryPath The path to the leaf directory to find config files.\n * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {\n const {\n cliConfigArray,\n configArrayFactory,\n finalizeCache,\n useEslintrc,\n builtInRules\n } = internalSlotsMap.get(this);\n\n let finalConfigArray = finalizeCache.get(configArray);\n\n if (!finalConfigArray) {\n finalConfigArray = configArray;\n\n // Load the personal config if there are no regular config files.\n if (\n useEslintrc &&\n configArray.every(c => !c.filePath) &&\n cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.\n ) {\n const homePath = os.homedir();\n\n debug(\"Loading the config file of the home directory:\", homePath);\n\n const personalConfigArray = configArrayFactory.loadInDirectory(\n homePath,\n { name: \"PersonalConfig\" }\n );\n\n if (\n personalConfigArray.length > 0 &&\n !directoryPath.startsWith(homePath)\n ) {\n const lastElement =\n personalConfigArray[personalConfigArray.length - 1];\n\n emitDeprecationWarning(\n lastElement.filePath,\n \"ESLINT_PERSONAL_CONFIG_LOAD\"\n );\n }\n\n finalConfigArray = finalConfigArray.concat(personalConfigArray);\n }\n\n // Apply CLI options.\n if (cliConfigArray.length > 0) {\n finalConfigArray = finalConfigArray.concat(cliConfigArray);\n }\n\n // Validate rule settings and environments.\n const validator = new ConfigValidator({\n builtInRules\n });\n\n validator.validateConfigArray(finalConfigArray);\n\n // Cache it.\n Object.freeze(finalConfigArray);\n finalizeCache.set(configArray, finalConfigArray);\n\n debug(\n \"Configuration was determined: %o on %s\",\n finalConfigArray,\n directoryPath\n );\n }\n\n // At least one element (the default ignore patterns) exists.\n if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {\n throw new ConfigurationNotFoundError(directoryPath);\n }\n\n return finalConfigArray;\n }\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport { CascadingConfigArrayFactory };\n","/**\n * @fileoverview Compatibility class for flat config.\n * @author Nicholas C. Zakas\n */\n\n//-----------------------------------------------------------------------------\n// Requirements\n//-----------------------------------------------------------------------------\n\nimport createDebug from \"debug\";\nimport path from \"path\";\n\nimport environments from \"../conf/environments.js\";\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n\nconst debug = createDebug(\"eslintrc:flat-compat\");\nconst cafactory = Symbol(\"cafactory\");\n\n/**\n * Translates an ESLintRC-style config object into a flag-config-style config\n * object.\n * @param {Object} eslintrcConfig An ESLintRC-style config object.\n * @param {Object} options Options to help translate the config.\n * @param {string} options.resolveConfigRelativeTo To the directory to resolve\n * configs from.\n * @param {string} options.resolvePluginsRelativeTo The directory to resolve\n * plugins from.\n * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment\n * names to objects.\n * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor\n * names to objects.\n * @returns {Object} A flag-config-style config object.\n */\nfunction translateESLintRC(eslintrcConfig, {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo,\n pluginEnvironments,\n pluginProcessors\n}) {\n\n const flatConfig = {};\n const configs = [];\n const languageOptions = {};\n const linterOptions = {};\n const keysToCopy = [\"settings\", \"rules\", \"processor\"];\n const languageOptionsKeysToCopy = [\"globals\", \"parser\", \"parserOptions\"];\n const linterOptionsKeysToCopy = [\"noInlineConfig\", \"reportUnusedDisableDirectives\"];\n\n // check for special settings for eslint:all and eslint:recommended:\n if (eslintrcConfig.settings) {\n if (eslintrcConfig.settings[\"eslint:all\"] === true) {\n return [\"eslint:all\"];\n }\n\n if (eslintrcConfig.settings[\"eslint:recommended\"] === true) {\n return [\"eslint:recommended\"];\n }\n }\n\n // copy over simple translations\n for (const key of keysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig[key] = eslintrcConfig[key];\n }\n }\n\n // copy over languageOptions\n for (const key of languageOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n\n // create the languageOptions key in the flat config\n flatConfig.languageOptions = languageOptions;\n\n if (key === \"parser\") {\n debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`);\n\n if (eslintrcConfig[key].error) {\n throw eslintrcConfig[key].error;\n }\n\n languageOptions[key] = eslintrcConfig[key].definition;\n continue;\n }\n\n // clone any object values that are in the eslintrc config\n if (eslintrcConfig[key] && typeof eslintrcConfig[key] === \"object\") {\n languageOptions[key] = {\n ...eslintrcConfig[key]\n };\n } else {\n languageOptions[key] = eslintrcConfig[key];\n }\n }\n }\n\n // copy over linterOptions\n for (const key of linterOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig.linterOptions = linterOptions;\n linterOptions[key] = eslintrcConfig[key];\n }\n }\n\n // move ecmaVersion a level up\n if (languageOptions.parserOptions) {\n\n if (\"ecmaVersion\" in languageOptions.parserOptions) {\n languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion;\n delete languageOptions.parserOptions.ecmaVersion;\n }\n\n if (\"sourceType\" in languageOptions.parserOptions) {\n languageOptions.sourceType = languageOptions.parserOptions.sourceType;\n delete languageOptions.parserOptions.sourceType;\n }\n\n // check to see if we even need parserOptions anymore and remove it if not\n if (Object.keys(languageOptions.parserOptions).length === 0) {\n delete languageOptions.parserOptions;\n }\n }\n\n // overrides\n if (eslintrcConfig.criteria) {\n flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)];\n }\n\n // translate plugins\n if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === \"object\") {\n debug(`Translating plugins: ${eslintrcConfig.plugins}`);\n\n flatConfig.plugins = {};\n\n for (const pluginName of Object.keys(eslintrcConfig.plugins)) {\n\n debug(`Translating plugin: ${pluginName}`);\n debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);\n\n const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];\n\n if (error) {\n throw error;\n }\n\n flatConfig.plugins[pluginName] = plugin;\n\n // create a config for any processors\n if (plugin.processors) {\n for (const processorName of Object.keys(plugin.processors)) {\n if (processorName.startsWith(\".\")) {\n debug(`Assigning processor: ${pluginName}/${processorName}`);\n\n configs.unshift({\n files: [`**/*${processorName}`],\n processor: pluginProcessors.get(`${pluginName}/${processorName}`)\n });\n }\n\n }\n }\n }\n }\n\n // translate env - must come after plugins\n if (eslintrcConfig.env && typeof eslintrcConfig.env === \"object\") {\n for (const envName of Object.keys(eslintrcConfig.env)) {\n\n // only add environments that are true\n if (eslintrcConfig.env[envName]) {\n debug(`Translating environment: ${envName}`);\n\n if (environments.has(envName)) {\n\n // built-in environments should be defined first\n configs.unshift(...translateESLintRC(environments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n } else if (pluginEnvironments.has(envName)) {\n\n // if the environment comes from a plugin, it should come after the plugin config\n configs.push(...translateESLintRC(pluginEnvironments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n }\n }\n }\n }\n\n // only add if there are actually keys in the config\n if (Object.keys(flatConfig).length > 0) {\n configs.push(flatConfig);\n }\n\n return configs;\n}\n\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\n/**\n * A compatibility class for working with configs.\n */\nclass FlatCompat {\n\n constructor({\n baseDirectory = process.cwd(),\n resolvePluginsRelativeTo = baseDirectory\n } = {}) {\n this.baseDirectory = baseDirectory;\n this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;\n this[cafactory] = new ConfigArrayFactory({\n cwd: baseDirectory,\n resolvePluginsRelativeTo,\n getEslintAllConfig: () => ({ settings: { \"eslint:all\": true } }),\n getEslintRecommendedConfig: () => ({ settings: { \"eslint:recommended\": true } })\n });\n }\n\n /**\n * Translates an ESLintRC-style config into a flag-config-style config.\n * @param {Object} eslintrcConfig The ESLintRC-style config object.\n * @returns {Object} A flag-config-style config object.\n */\n config(eslintrcConfig) {\n const eslintrcArray = this[cafactory].create(eslintrcConfig, {\n basePath: this.baseDirectory\n });\n\n const flatArray = [];\n let hasIgnorePatterns = false;\n\n eslintrcArray.forEach(configData => {\n if (configData.type === \"config\") {\n hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern;\n flatArray.push(...translateESLintRC(configData, {\n resolveConfigRelativeTo: path.join(this.baseDirectory, \"__placeholder.js\"),\n resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, \"__placeholder.js\"),\n pluginEnvironments: eslintrcArray.pluginEnvironments,\n pluginProcessors: eslintrcArray.pluginProcessors\n }));\n }\n });\n\n // combine ignorePatterns to emulate ESLintRC behavior better\n if (hasIgnorePatterns) {\n flatArray.unshift({\n ignores: [filePath => {\n\n // Compute the final config for this file.\n // This filters config array elements by `files`/`excludedFiles` then merges the elements.\n const finalConfig = eslintrcArray.extractConfig(filePath);\n\n // Test the `ignorePattern` properties of the final config.\n return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath);\n }]\n });\n }\n\n return flatArray;\n }\n\n /**\n * Translates the `env` section of an ESLintRC-style config.\n * @param {Object} envConfig The `env` section of an ESLintRC config.\n * @returns {Object} A flag-config object representing the environments.\n */\n env(envConfig) {\n return this.config({\n env: envConfig\n });\n }\n\n /**\n * Translates the `extends` section of an ESLintRC-style config.\n * @param {...string} configsToExtend The names of the configs to load.\n * @returns {Object} A flag-config object representing the config.\n */\n extends(...configsToExtend) {\n return this.config({\n extends: configsToExtend\n });\n }\n\n /**\n * Translates the `plugins` section of an ESLintRC-style config.\n * @param {...string} plugins The names of the plugins to load.\n * @returns {Object} A flag-config object representing the plugins.\n */\n plugins(...plugins) {\n return this.config({\n plugins\n });\n }\n}\n\nexport { FlatCompat };\n","/**\n * @fileoverview Package exports for @eslint/eslintrc\n * @author Nicholas C. Zakas\n */\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport {\n ConfigArrayFactory,\n createContext as createConfigArrayFactoryContext\n} from \"./config-array-factory.js\";\n\nimport { CascadingConfigArrayFactory } from \"./cascading-config-array-factory.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array/index.js\";\nimport { ConfigDependency } from \"./config-array/config-dependency.js\";\nimport { ExtractedConfig } from \"./config-array/extracted-config.js\";\nimport { IgnorePattern } from \"./config-array/ignore-pattern.js\";\nimport { OverrideTester } from \"./config-array/override-tester.js\";\nimport * as ConfigOps from \"./shared/config-ops.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport { FlatCompat } from \"./flat-compat.js\";\nimport environments from \"../conf/environments.js\";\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nconst Legacy = {\n ConfigArray,\n createConfigArrayFactoryContext,\n CascadingConfigArrayFactory,\n ConfigArrayFactory,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs,\n environments,\n\n // shared\n ConfigOps,\n ConfigValidator,\n ModuleResolver,\n naming\n};\n\nexport {\n\n Legacy,\n\n FlatCompat\n\n};\n"],"names":["debug","debugOrig","path","ignore","assert","internalSlotsMap","util","minimatch","Ajv","globals","BuiltInEnvironments","ConfigOps.normalizeConfigGlobal","Module","require","createRequire","fs","stripComments","importFresh","ModuleResolver.resolve","naming.normalizePackageName","naming.getShorthandName","os","createDebug","createConfigArrayFactoryContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA,MAAMA,OAAK,GAAGC,6BAAS,CAAC,yBAAyB,CAAC,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,WAAW,EAAE;AAC5C,IAAI,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAChC;AACA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;AACjD,QAAQ,MAAM,CAAC,GAAG,MAAM,CAAC;AACzB,QAAQ,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACjC;AACA;AACA,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,G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modules/@eslint/eslintrc/lib/cascading-config-array-factory.js b/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js new file mode 100644 index 0000000..4b575c2 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js @@ -0,0 +1,533 @@ +/** + * @fileoverview `CascadingConfigArrayFactory` class. + * + * `CascadingConfigArrayFactory` class has a responsibility: + * + * 1. Handles cascading of config files. + * + * It provides two methods: + * + * - `getConfigArrayForFile(filePath)` + * Get the corresponded configuration of a given file. This method doesn't + * throw even if the given file didn't exist. + * - `clearCache()` + * Clear the internal cache. You have to call this method when + * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends + * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.) + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import debugOrig from "debug"; +import os from "os"; +import path from "path"; + +import { ConfigArrayFactory } from "./config-array-factory.js"; +import { + ConfigArray, + ConfigDependency, + IgnorePattern +} from "./config-array/index.js"; +import ConfigValidator from "./shared/config-validator.js"; +import { emitDeprecationWarning } from "./shared/deprecation-warnings.js"; + +const debug = debugOrig("eslintrc:cascading-config-array-factory"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ +/** @typedef {ReturnType} ConfigArray */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryOptions + * @property {Map} [additionalPluginPool] The map for additional plugins. + * @property {ConfigData} [baseConfig] The config by `baseConfig` option. + * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files. + * @property {string} [cwd] The base directory to start lookup. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]} [rulePaths] The value of `--rulesdir` option. + * @property {string} [specificConfigPath] The value of `--config` option. + * @property {boolean} [useEslintrc] if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryInternalSlots + * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option. + * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`. + * @property {ConfigArray} cliConfigArray The config array of CLI options. + * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`. + * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays. + * @property {Map} configCache The cache from directory paths to config arrays. + * @property {string} cwd The base directory to start lookup. + * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`. + * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`. + * @property {boolean} useEslintrc if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Create the config array from `baseConfig` and `rulePaths`. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createBaseConfigArray({ + configArrayFactory, + baseConfigData, + rulePaths, + cwd, + loadRules +}) { + const baseConfigArray = configArrayFactory.create( + baseConfigData, + { name: "BaseConfig" } + ); + + /* + * Create the config array element for the default ignore patterns. + * This element has `ignorePattern` property that ignores the default + * patterns in the current working directory. + */ + baseConfigArray.unshift(configArrayFactory.create( + { ignorePatterns: IgnorePattern.DefaultPatterns }, + { name: "DefaultIgnorePattern" } + )[0]); + + /* + * Load rules `--rulesdir` option as a pseudo plugin. + * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate + * the rule's options with only information in the config array. + */ + if (rulePaths && rulePaths.length > 0) { + baseConfigArray.push({ + type: "config", + name: "--rulesdir", + filePath: "", + plugins: { + "": new ConfigDependency({ + definition: { + rules: rulePaths.reduce( + (map, rulesPath) => Object.assign( + map, + loadRules(rulesPath, cwd) + ), + {} + ) + }, + filePath: "", + id: "", + importerName: "--rulesdir", + importerPath: "" + }) + } + }); + } + + return baseConfigArray; +} + +/** + * Create the config array from CLI options. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath +}) { + const cliConfigArray = configArrayFactory.create( + cliConfigData, + { name: "CLIOptions" } + ); + + cliConfigArray.unshift( + ...(ignorePath + ? configArrayFactory.loadESLintIgnore(ignorePath) + : configArrayFactory.loadDefaultESLintIgnore()) + ); + + if (specificConfigPath) { + cliConfigArray.unshift( + ...configArrayFactory.loadFile( + specificConfigPath, + { name: "--config", basePath: cwd } + ) + ); + } + + return cliConfigArray; +} + +/** + * The error type when there are files matched by a glob, but all of them have been ignored. + */ +class ConfigurationNotFoundError extends Error { + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {string} directoryPath The directory path. + */ + constructor(directoryPath) { + super(`No ESLint configuration found in ${directoryPath}.`); + this.messageTemplate = "no-config-found"; + this.messageData = { directoryPath }; + } +} + +/** + * This class provides the functionality that enumerates every file which is + * matched by given glob patterns and that configuration. + */ +class CascadingConfigArrayFactory { + + /** + * Initialize this enumerator. + * @param {CascadingConfigArrayFactoryOptions} options The options. + */ + constructor({ + additionalPluginPool = new Map(), + baseConfig: baseConfigData = null, + cliConfig: cliConfigData = null, + cwd = process.cwd(), + ignorePath, + resolvePluginsRelativeTo, + rulePaths = [], + specificConfigPath = null, + useEslintrc = true, + builtInRules = new Map(), + loadRules, + resolver, + eslintRecommendedPath, + getEslintRecommendedConfig, + eslintAllPath, + getEslintAllConfig + } = {}) { + const configArrayFactory = new ConfigArrayFactory({ + additionalPluginPool, + cwd, + resolvePluginsRelativeTo, + builtInRules, + resolver, + eslintRecommendedPath, + getEslintRecommendedConfig, + eslintAllPath, + getEslintAllConfig + }); + + internalSlotsMap.set(this, { + baseConfigArray: createBaseConfigArray({ + baseConfigData, + configArrayFactory, + cwd, + rulePaths, + loadRules, + resolver + }), + baseConfigData, + cliConfigArray: createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath + }), + cliConfigData, + configArrayFactory, + configCache: new Map(), + cwd, + finalizeCache: new WeakMap(), + ignorePath, + rulePaths, + specificConfigPath, + useEslintrc, + builtInRules, + loadRules + }); + } + + /** + * The path to the current working directory. + * This is used by tests. + * @type {string} + */ + get cwd() { + const { cwd } = internalSlotsMap.get(this); + + return cwd; + } + + /** + * Get the config array of a given file. + * If `filePath` was not given, it returns the config which contains only + * `baseConfigData` and `cliConfigData`. + * @param {string} [filePath] The file path to a file. + * @param {Object} [options] The options. + * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The config array of the file. + */ + getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) { + const { + baseConfigArray, + cliConfigArray, + cwd + } = internalSlotsMap.get(this); + + if (!filePath) { + return new ConfigArray(...baseConfigArray, ...cliConfigArray); + } + + const directoryPath = path.dirname(path.resolve(cwd, filePath)); + + debug(`Load config files for ${directoryPath}.`); + + return this._finalizeConfigArray( + this._loadConfigInAncestors(directoryPath), + directoryPath, + ignoreNotFoundError + ); + } + + /** + * Set the config data to override all configs. + * Require to call `clearCache()` method after this method is called. + * @param {ConfigData} configData The config data to override all configs. + * @returns {void} + */ + setOverrideConfig(configData) { + const slots = internalSlotsMap.get(this); + + slots.cliConfigData = configData; + } + + /** + * Clear config cache. + * @returns {void} + */ + clearCache() { + const slots = internalSlotsMap.get(this); + + slots.baseConfigArray = createBaseConfigArray(slots); + slots.cliConfigArray = createCLIConfigArray(slots); + slots.configCache.clear(); + } + + /** + * Load and normalize config files from the ancestor directories. + * @param {string} directoryPath The path to a leaf directory. + * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories. + * @returns {ConfigArray} The loaded config. + * @private + */ + _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) { + const { + baseConfigArray, + configArrayFactory, + configCache, + cwd, + useEslintrc + } = internalSlotsMap.get(this); + + if (!useEslintrc) { + return baseConfigArray; + } + + let configArray = configCache.get(directoryPath); + + // Hit cache. + if (configArray) { + debug(`Cache hit: ${directoryPath}.`); + return configArray; + } + debug(`No cache found: ${directoryPath}.`); + + const homePath = os.homedir(); + + // Consider this is root. + if (directoryPath === homePath && cwd !== homePath) { + debug("Stop traversing because of considered root."); + if (configsExistInSubdirs) { + const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath); + + if (filePath) { + emitDeprecationWarning( + filePath, + "ESLINT_PERSONAL_CONFIG_SUPPRESS" + ); + } + } + return this._cacheConfig(directoryPath, baseConfigArray); + } + + // Load the config on this directory. + try { + configArray = configArrayFactory.loadInDirectory(directoryPath); + } catch (error) { + /* istanbul ignore next */ + if (error.code === "EACCES") { + debug("Stop traversing because of 'EACCES' error."); + return this._cacheConfig(directoryPath, baseConfigArray); + } + throw error; + } + + if (configArray.length > 0 && configArray.isRoot()) { + debug("Stop traversing because of 'root:true'."); + configArray.unshift(...baseConfigArray); + return this._cacheConfig(directoryPath, configArray); + } + + // Load from the ancestors and merge it. + const parentPath = path.dirname(directoryPath); + const parentConfigArray = parentPath && parentPath !== directoryPath + ? this._loadConfigInAncestors( + parentPath, + configsExistInSubdirs || configArray.length > 0 + ) + : baseConfigArray; + + if (configArray.length > 0) { + configArray.unshift(...parentConfigArray); + } else { + configArray = parentConfigArray; + } + + // Cache and return. + return this._cacheConfig(directoryPath, configArray); + } + + /** + * Freeze and cache a given config. + * @param {string} directoryPath The path to a directory as a cache key. + * @param {ConfigArray} configArray The config array as a cache value. + * @returns {ConfigArray} The `configArray` (frozen). + */ + _cacheConfig(directoryPath, configArray) { + const { configCache } = internalSlotsMap.get(this); + + Object.freeze(configArray); + configCache.set(directoryPath, configArray); + + return configArray; + } + + /** + * Finalize a given config array. + * Concatenate `--config` and other CLI options. + * @param {ConfigArray} configArray The parent config array. + * @param {string} directoryPath The path to the leaf directory to find config files. + * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The loaded config. + * @private + */ + _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) { + const { + cliConfigArray, + configArrayFactory, + finalizeCache, + useEslintrc, + builtInRules + } = internalSlotsMap.get(this); + + let finalConfigArray = finalizeCache.get(configArray); + + if (!finalConfigArray) { + finalConfigArray = configArray; + + // Load the personal config if there are no regular config files. + if ( + useEslintrc && + configArray.every(c => !c.filePath) && + cliConfigArray.every(c => !c.filePath) // `--config` option can be a file. + ) { + const homePath = os.homedir(); + + debug("Loading the config file of the home directory:", homePath); + + const personalConfigArray = configArrayFactory.loadInDirectory( + homePath, + { name: "PersonalConfig" } + ); + + if ( + personalConfigArray.length > 0 && + !directoryPath.startsWith(homePath) + ) { + const lastElement = + personalConfigArray[personalConfigArray.length - 1]; + + emitDeprecationWarning( + lastElement.filePath, + "ESLINT_PERSONAL_CONFIG_LOAD" + ); + } + + finalConfigArray = finalConfigArray.concat(personalConfigArray); + } + + // Apply CLI options. + if (cliConfigArray.length > 0) { + finalConfigArray = finalConfigArray.concat(cliConfigArray); + } + + // Validate rule settings and environments. + const validator = new ConfigValidator({ + builtInRules + }); + + validator.validateConfigArray(finalConfigArray); + + // Cache it. + Object.freeze(finalConfigArray); + finalizeCache.set(configArray, finalConfigArray); + + debug( + "Configuration was determined: %o on %s", + finalConfigArray, + directoryPath + ); + } + + // At least one element (the default ignore patterns) exists. + if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) { + throw new ConfigurationNotFoundError(directoryPath); + } + + return finalConfigArray; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +export { CascadingConfigArrayFactory }; diff --git a/node_modules/@eslint/eslintrc/lib/config-array-factory.js b/node_modules/@eslint/eslintrc/lib/config-array-factory.js new file mode 100644 index 0000000..9553d1f --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array-factory.js @@ -0,0 +1,1133 @@ +/** + * @fileoverview The factory of `ConfigArray` objects. + * + * This class provides methods to create `ConfigArray` instance. + * + * - `create(configData, options)` + * Create a `ConfigArray` instance from a config data. This is to handle CLI + * options except `--config`. + * - `loadFile(filePath, options)` + * Create a `ConfigArray` instance from a config file. This is to handle + * `--config` option. If the file was not found, throws the following error: + * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error. + * - If the filename was `package.json`, an IO error or an + * `ESLINT_CONFIG_FIELD_NOT_FOUND` error. + * - Otherwise, an IO error such as `ENOENT`. + * - `loadInDirectory(directoryPath, options)` + * Create a `ConfigArray` instance from a config file which is on a given + * directory. This tries to load `.eslintrc.*` or `package.json`. If not + * found, returns an empty `ConfigArray`. + * - `loadESLintIgnore(filePath)` + * Create a `ConfigArray` instance from a config file that is `.eslintignore` + * format. This is to handle `--ignore-path` option. + * - `loadDefaultESLintIgnore()` + * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in + * the current working directory. + * + * `ConfigArrayFactory` class has the responsibility that loads configuration + * files, including loading `extends`, `parser`, and `plugins`. The created + * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`. + * + * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class + * handles cascading and hierarchy. + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import debugOrig from "debug"; +import fs from "fs"; +import importFresh from "import-fresh"; +import { createRequire } from "module"; +import path from "path"; +import stripComments from "strip-json-comments"; + +import { + ConfigArray, + ConfigDependency, + IgnorePattern, + OverrideTester +} from "./config-array/index.js"; +import ConfigValidator from "./shared/config-validator.js"; +import * as naming from "./shared/naming.js"; +import * as ModuleResolver from "./shared/relative-module-resolver.js"; + +const require = createRequire(import.meta.url); + +const debug = debugOrig("eslintrc:config-array-factory"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const configFilenames = [ + ".eslintrc.js", + ".eslintrc.cjs", + ".eslintrc.yaml", + ".eslintrc.yml", + ".eslintrc.json", + ".eslintrc", + "package.json" +]; + +// Define types for VSCode IntelliSense. +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").OverrideConfigData} OverrideConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ +/** @typedef {import("./config-array/config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-array/config-dependency").DependentPlugin} DependentPlugin */ +/** @typedef {ConfigArray[0]} ConfigArrayElement */ + +/** + * @typedef {Object} ConfigArrayFactoryOptions + * @property {Map} [additionalPluginPool] The map for additional plugins. + * @property {string} [cwd] The path to the current working directory. + * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} ConfigArrayFactoryInternalSlots + * @property {Map} additionalPluginPool The map for additional plugins. + * @property {string} cwd The path to the current working directory. + * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {Function} getEslintAllConfig Returns the config data for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {string} pluginBasePath The base path to resolve plugins. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Check if a given string is a file path. + * @param {string} nameOrPath A module name or file path. + * @returns {boolean} `true` if the `nameOrPath` is a file path. + */ +function isFilePath(nameOrPath) { + return ( + /^\.{1,2}[/\\]/u.test(nameOrPath) || + path.isAbsolute(nameOrPath) + ); +} + +/** + * Convenience wrapper for synchronously reading file contents. + * @param {string} filePath The filename to read. + * @returns {string} The file contents, with the BOM removed. + * @private + */ +function readFile(filePath) { + return fs.readFileSync(filePath, "utf8").replace(/^\ufeff/u, ""); +} + +/** + * Loads a YAML configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadYAMLConfigFile(filePath) { + debug(`Loading YAML config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require("js-yaml"); + + try { + + // empty YAML file can be null, so always use + return yaml.load(readFile(filePath)) || {}; + } catch (e) { + debug(`Error reading YAML file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a JSON configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadJSONConfigFile(filePath) { + debug(`Loading JSON config file: ${filePath}`); + + try { + return JSON.parse(stripComments(readFile(filePath))); + } catch (e) { + debug(`Error reading JSON file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + e.messageTemplate = "failed-to-read-json"; + e.messageData = { + path: filePath, + message: e.message + }; + throw e; + } +} + +/** + * Loads a legacy (.eslintrc) configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadLegacyConfigFile(filePath) { + debug(`Loading legacy config file: ${filePath}`); + + // lazy load YAML to improve performance when not used + const yaml = require("js-yaml"); + + try { + return yaml.load(stripComments(readFile(filePath))) || /* istanbul ignore next */ {}; + } catch (e) { + debug("Error reading YAML file: %s\n%o", filePath, e); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a JavaScript configuration from a file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadJSConfigFile(filePath) { + debug(`Loading JS config file: ${filePath}`); + try { + return importFresh(filePath); + } catch (e) { + debug(`Error reading JavaScript file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a configuration from a package.json file. + * @param {string} filePath The filename to load. + * @returns {ConfigData} The configuration object from the file. + * @throws {Error} If the file cannot be read. + * @private + */ +function loadPackageJSONConfigFile(filePath) { + debug(`Loading package.json config file: ${filePath}`); + try { + const packageData = loadJSONConfigFile(filePath); + + if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) { + throw Object.assign( + new Error("package.json file doesn't have 'eslintConfig' field."), + { code: "ESLINT_CONFIG_FIELD_NOT_FOUND" } + ); + } + + return packageData.eslintConfig; + } catch (e) { + debug(`Error reading package.json file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Loads a `.eslintignore` from a file. + * @param {string} filePath The filename to load. + * @returns {string[]} The ignore patterns from the file. + * @private + */ +function loadESLintIgnoreFile(filePath) { + debug(`Loading .eslintignore file: ${filePath}`); + + try { + return readFile(filePath) + .split(/\r?\n/gu) + .filter(line => line.trim() !== "" && !line.startsWith("#")); + } catch (e) { + debug(`Error reading .eslintignore file: ${filePath}`); + e.message = `Cannot read .eslintignore file: ${filePath}\nError: ${e.message}`; + throw e; + } +} + +/** + * Creates an error to notify about a missing config to extend from. + * @param {string} configName The name of the missing config. + * @param {string} importerName The name of the config that imported the missing config + * @param {string} messageTemplate The text template to source error strings from. + * @returns {Error} The error object to throw + * @private + */ +function configInvalidError(configName, importerName, messageTemplate) { + return Object.assign( + new Error(`Failed to load config "${configName}" to extend from.`), + { + messageTemplate, + messageData: { configName, importerName } + } + ); +} + +/** + * Loads a configuration file regardless of the source. Inspects the file path + * to determine the correctly way to load the config file. + * @param {string} filePath The path to the configuration. + * @returns {ConfigData|null} The configuration information. + * @private + */ +function loadConfigFile(filePath) { + switch (path.extname(filePath)) { + case ".js": + case ".cjs": + return loadJSConfigFile(filePath); + + case ".json": + if (path.basename(filePath) === "package.json") { + return loadPackageJSONConfigFile(filePath); + } + return loadJSONConfigFile(filePath); + + case ".yaml": + case ".yml": + return loadYAMLConfigFile(filePath); + + default: + return loadLegacyConfigFile(filePath); + } +} + +/** + * Write debug log. + * @param {string} request The requested module name. + * @param {string} relativeTo The file path to resolve the request relative to. + * @param {string} filePath The resolved file path. + * @returns {void} + */ +function writeDebugLogForLoading(request, relativeTo, filePath) { + /* istanbul ignore next */ + if (debug.enabled) { + let nameAndVersion = null; + + try { + const packageJsonPath = ModuleResolver.resolve( + `${request}/package.json`, + relativeTo + ); + const { version = "unknown" } = require(packageJsonPath); + + nameAndVersion = `${request}@${version}`; + } catch (error) { + debug("package.json was not found:", error.message); + nameAndVersion = request; + } + + debug("Loaded: %s (%s)", nameAndVersion, filePath); + } +} + +/** + * Create a new context with default values. + * @param {ConfigArrayFactoryInternalSlots} slots The internal slots. + * @param {"config" | "ignore" | "implicit-processor" | undefined} providedType The type of the current configuration. Default is `"config"`. + * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`. + * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string. + * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`. + * @returns {ConfigArrayFactoryLoadingContext} The created context. + */ +function createContext( + { cwd, resolvePluginsRelativeTo }, + providedType, + providedName, + providedFilePath, + providedMatchBasePath +) { + const filePath = providedFilePath + ? path.resolve(cwd, providedFilePath) + : ""; + const matchBasePath = + (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) || + (filePath && path.dirname(filePath)) || + cwd; + const name = + providedName || + (filePath && path.relative(cwd, filePath)) || + ""; + const pluginBasePath = + resolvePluginsRelativeTo || + (filePath && path.dirname(filePath)) || + cwd; + const type = providedType || "config"; + + return { filePath, matchBasePath, name, pluginBasePath, type }; +} + +/** + * Normalize a given plugin. + * - Ensure the object to have four properties: configs, environments, processors, and rules. + * - Ensure the object to not have other properties. + * @param {Plugin} plugin The plugin to normalize. + * @returns {Plugin} The normalized plugin. + */ +function normalizePlugin(plugin) { + return { + configs: plugin.configs || {}, + environments: plugin.environments || {}, + processors: plugin.processors || {}, + rules: plugin.rules || {} + }; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The factory of `ConfigArray` objects. + */ +class ConfigArrayFactory { + + /** + * Initialize this instance. + * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins. + */ + constructor({ + additionalPluginPool = new Map(), + cwd = process.cwd(), + resolvePluginsRelativeTo, + builtInRules, + resolver = ModuleResolver, + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + } = {}) { + internalSlotsMap.set(this, { + additionalPluginPool, + cwd, + resolvePluginsRelativeTo: + resolvePluginsRelativeTo && + path.resolve(cwd, resolvePluginsRelativeTo), + builtInRules, + resolver, + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + }); + } + + /** + * Create `ConfigArray` instance from a config data. + * @param {ConfigData|null} configData The config data to create. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.filePath] The path to this config data. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + create(configData, { basePath, filePath, name } = {}) { + if (!configData) { + return new ConfigArray(); + } + + const slots = internalSlotsMap.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + const elements = this._normalizeConfigData(configData, ctx); + + return new ConfigArray(...elements); + } + + /** + * Load a config file. + * @param {string} filePath The path to a config file. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + loadFile(filePath, { basePath, name } = {}) { + const slots = internalSlotsMap.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + + return new ConfigArray(...this._loadConfigData(ctx)); + } + + /** + * Load the config file on a given directory if exists. + * @param {string} directoryPath The path to a directory. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadInDirectory(directoryPath, { basePath, name } = {}) { + const slots = internalSlotsMap.get(this); + + for (const filename of configFilenames) { + const ctx = createContext( + slots, + "config", + name, + path.join(directoryPath, filename), + basePath + ); + + if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) { + let configData; + + try { + configData = loadConfigFile(ctx.filePath); + } catch (error) { + if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { + throw error; + } + } + + if (configData) { + debug(`Config file found: ${ctx.filePath}`); + return new ConfigArray( + ...this._normalizeConfigData(configData, ctx) + ); + } + } + } + + debug(`Config file not found on ${directoryPath}`); + return new ConfigArray(); + } + + /** + * Check if a config file on a given directory exists or not. + * @param {string} directoryPath The path to a directory. + * @returns {string | null} The path to the found config file. If not found then null. + */ + static getPathToConfigFileInDirectory(directoryPath) { + for (const filename of configFilenames) { + const filePath = path.join(directoryPath, filename); + + if (fs.existsSync(filePath)) { + if (filename === "package.json") { + try { + loadPackageJSONConfigFile(filePath); + return filePath; + } catch { /* ignore */ } + } else { + return filePath; + } + } + } + return null; + } + + /** + * Load `.eslintignore` file. + * @param {string} filePath The path to a `.eslintignore` file to load. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadESLintIgnore(filePath) { + const slots = internalSlotsMap.get(this); + const ctx = createContext( + slots, + "ignore", + void 0, + filePath, + slots.cwd + ); + const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(ignorePatterns, ctx) + ); + } + + /** + * Load `.eslintignore` file in the current working directory. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadDefaultESLintIgnore() { + const slots = internalSlotsMap.get(this); + const eslintIgnorePath = path.resolve(slots.cwd, ".eslintignore"); + const packageJsonPath = path.resolve(slots.cwd, "package.json"); + + if (fs.existsSync(eslintIgnorePath)) { + return this.loadESLintIgnore(eslintIgnorePath); + } + if (fs.existsSync(packageJsonPath)) { + const data = loadJSONConfigFile(packageJsonPath); + + if (Object.hasOwnProperty.call(data, "eslintIgnore")) { + if (!Array.isArray(data.eslintIgnore)) { + throw new Error("Package.json eslintIgnore property requires an array of paths"); + } + const ctx = createContext( + slots, + "ignore", + "eslintIgnore in package.json", + packageJsonPath, + slots.cwd + ); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx) + ); + } + } + + return new ConfigArray(); + } + + /** + * Load a given config file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} Loaded config. + * @private + */ + _loadConfigData(ctx) { + return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); + } + + /** + * Normalize a given `.eslintignore` data to config array elements. + * @param {string[]} ignorePatterns The patterns to ignore files. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeESLintIgnoreData(ignorePatterns, ctx) { + const elements = this._normalizeObjectConfigData( + { ignorePatterns }, + ctx + ); + + // Set `ignorePattern.loose` flag for backward compatibility. + for (const element of elements) { + if (element.ignorePattern) { + element.ignorePattern.loose = true; + } + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _normalizeConfigData(configData, ctx) { + const validator = new ConfigValidator(); + + validator.validateConfigSchema(configData, ctx.name || ctx.filePath); + return this._normalizeObjectConfigData(configData, ctx); + } + + /** + * Normalize a given config to an array. + * @param {ConfigData|OverrideConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigData(configData, ctx) { + const { files, excludedFiles, ...configBody } = configData; + const criteria = OverrideTester.create( + files, + excludedFiles, + ctx.matchBasePath + ); + const elements = this._normalizeObjectConfigDataBody(configBody, ctx); + + // Apply the criteria to every element. + for (const element of elements) { + + /* + * Merge the criteria. + * This is for the `overrides` entries that came from the + * configurations of `overrides[].extends`. + */ + element.criteria = OverrideTester.and(criteria, element.criteria); + + /* + * Remove `root` property to ignore `root` settings which came from + * `extends` in `overrides`. + */ + if (element.criteria) { + element.root = void 0; + } + + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigDataBody( + { + env, + extends: extend, + globals, + ignorePatterns, + noInlineConfig, + parser: parserName, + parserOptions, + plugins: pluginList, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings, + overrides: overrideList = [] + }, + ctx + ) { + const extendList = Array.isArray(extend) ? extend : [extend]; + const ignorePattern = ignorePatterns && new IgnorePattern( + Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], + ctx.matchBasePath + ); + + // Flatten `extends`. + for (const extendName of extendList.filter(Boolean)) { + yield* this._loadExtends(extendName, ctx); + } + + // Load parser & plugins. + const parser = parserName && this._loadParser(parserName, ctx); + const plugins = pluginList && this._loadPlugins(pluginList, ctx); + + // Yield pseudo config data for file extension processors. + if (plugins) { + yield* this._takeFileExtensionProcessors(plugins, ctx); + } + + // Yield the config data except `extends` and `overrides`. + yield { + + // Debug information. + type: ctx.type, + name: ctx.name, + filePath: ctx.filePath, + + // Config data. + criteria: null, + env, + globals, + ignorePattern, + noInlineConfig, + parser, + parserOptions, + plugins, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings + }; + + // Flatten `overries`. + for (let i = 0; i < overrideList.length; ++i) { + yield* this._normalizeObjectConfigData( + overrideList[i], + { ...ctx, name: `${ctx.name}#overrides[${i}]` } + ); + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtends(extendName, ctx) { + debug("Loading {extends:%j} relative to %s", extendName, ctx.filePath); + try { + if (extendName.startsWith("eslint:")) { + return this._loadExtendedBuiltInConfig(extendName, ctx); + } + if (extendName.startsWith("plugin:")) { + return this._loadExtendedPluginConfig(extendName, ctx); + } + return this._loadExtendedShareableConfig(extendName, ctx); + } catch (error) { + error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; + throw error; + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedBuiltInConfig(extendName, ctx) { + const { + eslintAllPath, + getEslintAllConfig, + eslintRecommendedPath, + getEslintRecommendedConfig + } = internalSlotsMap.get(this); + + if (extendName === "eslint:recommended") { + const name = `${ctx.name} » ${extendName}`; + + if (getEslintRecommendedConfig) { + if (typeof getEslintRecommendedConfig !== "function") { + throw new Error(`getEslintRecommendedConfig must be a function instead of '${getEslintRecommendedConfig}'`); + } + return this._normalizeConfigData(getEslintRecommendedConfig(), { ...ctx, name, filePath: "" }); + } + return this._loadConfigData({ + ...ctx, + name, + filePath: eslintRecommendedPath + }); + } + if (extendName === "eslint:all") { + const name = `${ctx.name} » ${extendName}`; + + if (getEslintAllConfig) { + if (typeof getEslintAllConfig !== "function") { + throw new Error(`getEslintAllConfig must be a function instead of '${getEslintAllConfig}'`); + } + return this._normalizeConfigData(getEslintAllConfig(), { ...ctx, name, filePath: "" }); + } + return this._loadConfigData({ + ...ctx, + name, + filePath: eslintAllPath + }); + } + + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedPluginConfig(extendName, ctx) { + const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + + const pluginName = extendName.slice("plugin:".length, slashIndex); + const configName = extendName.slice(slashIndex + 1); + + if (isFilePath(pluginName)) { + throw new Error("'extends' cannot use a file path for plugins."); + } + + const plugin = this._loadPlugin(pluginName, ctx); + const configData = + plugin.definition && + plugin.definition.configs[configName]; + + if (configData) { + return this._normalizeConfigData(configData, { + ...ctx, + filePath: plugin.filePath || ctx.filePath, + name: `${ctx.name} » plugin:${plugin.id}/${configName}` + }); + } + + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedShareableConfig(extendName, ctx) { + const { cwd, resolver } = internalSlotsMap.get(this); + const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); + let request; + + if (isFilePath(extendName)) { + request = extendName; + } else if (extendName.startsWith(".")) { + request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior. + } else { + request = naming.normalizePackageName( + extendName, + "eslint-config" + ); + } + + let filePath; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (error) { + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); + } + throw error; + } + + writeDebugLogForLoading(request, relativeTo, filePath); + return this._loadConfigData({ + ...ctx, + filePath, + name: `${ctx.name} » ${request}` + }); + } + + /** + * Load given plugins. + * @param {string[]} names The plugin names to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {Record} The loaded parser. + * @private + */ + _loadPlugins(names, ctx) { + return names.reduce((map, name) => { + if (isFilePath(name)) { + throw new Error("Plugins array cannot includes file paths."); + } + const plugin = this._loadPlugin(name, ctx); + + map[plugin.id] = plugin; + + return map; + }, {}); + } + + /** + * Load a given parser. + * @param {string} nameOrPath The package name or the path to a parser file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentParser} The loaded parser. + */ + _loadParser(nameOrPath, ctx) { + debug("Loading parser %j from %s", nameOrPath, ctx.filePath); + + const { cwd, resolver } = internalSlotsMap.get(this); + const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); + + try { + const filePath = resolver.resolve(nameOrPath, relativeTo); + + writeDebugLogForLoading(nameOrPath, relativeTo, filePath); + + return new ConfigDependency({ + definition: require(filePath), + filePath, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (error) { + + // If the parser name is "espree", load the espree of ESLint. + if (nameOrPath === "espree") { + debug("Fallback espree."); + return new ConfigDependency({ + definition: require("espree"), + filePath: require.resolve("espree"), + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + debug("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); + error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; + + return new ConfigDependency({ + error, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + } + + /** + * Load a given plugin. + * @param {string} name The plugin name to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentPlugin} The loaded plugin. + * @private + */ + _loadPlugin(name, ctx) { + debug("Loading plugin %j from %s", name, ctx.filePath); + + const { additionalPluginPool, resolver } = internalSlotsMap.get(this); + const request = naming.normalizePackageName(name, "eslint-plugin"); + const id = naming.getShorthandName(request, "eslint-plugin"); + const relativeTo = path.join(ctx.pluginBasePath, "__placeholder__.js"); + + if (name.match(/\s+/u)) { + const error = Object.assign( + new Error(`Whitespace found in plugin name '${name}'`), + { + messageTemplate: "whitespace-found", + messageData: { pluginName: request } + } + ); + + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + // Check for additional pool. + const plugin = + additionalPluginPool.get(request) || + additionalPluginPool.get(id); + + if (plugin) { + return new ConfigDependency({ + definition: normalizePlugin(plugin), + filePath: "", // It's unknown where the plugin came from. + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + let filePath; + let error; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (resolveError) { + error = resolveError; + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + error.messageTemplate = "plugin-missing"; + error.messageData = { + pluginName: request, + resolvePluginsRelativeTo: ctx.pluginBasePath, + importerName: ctx.name + }; + } + } + + if (filePath) { + try { + writeDebugLogForLoading(request, relativeTo, filePath); + + const startTime = Date.now(); + const pluginDefinition = require(filePath); + + debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); + + return new ConfigDependency({ + definition: normalizePlugin(pluginDefinition), + filePath, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (loadError) { + error = loadError; + } + } + + debug("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); + error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + /** + * Take file expression processors as config array elements. + * @param {Record} plugins The plugin definitions. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The config array elements of file expression processors. + * @private + */ + *_takeFileExtensionProcessors(plugins, ctx) { + for (const pluginId of Object.keys(plugins)) { + const processors = + plugins[pluginId] && + plugins[pluginId].definition && + plugins[pluginId].definition.processors; + + if (!processors) { + continue; + } + + for (const processorId of Object.keys(processors)) { + if (processorId.startsWith(".")) { + yield* this._normalizeObjectConfigData( + { + files: [`*${processorId}`], + processor: `${pluginId}/${processorId}` + }, + { + ...ctx, + type: "implicit-processor", + name: `${ctx.name}#processors["${pluginId}/${processorId}"]` + } + ); + } + } + } + } +} + +export { ConfigArrayFactory, createContext }; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/config-array.js b/node_modules/@eslint/eslintrc/lib/config-array/config-array.js new file mode 100644 index 0000000..133f5a2 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/config-array.js @@ -0,0 +1,523 @@ +/** + * @fileoverview `ConfigArray` class. + * + * `ConfigArray` class expresses the full of a configuration. It has the entry + * config file, base config files that were extended, loaded parsers, and loaded + * plugins. + * + * `ConfigArray` class provides three properties and two methods. + * + * - `pluginEnvironments` + * - `pluginProcessors` + * - `pluginRules` + * The `Map` objects that contain the members of all plugins that this + * config array contains. Those map objects don't have mutation methods. + * Those keys are the member ID such as `pluginId/memberName`. + * - `isRoot()` + * If `true` then this configuration has `root:true` property. + * - `extractConfig(filePath)` + * Extract the final configuration for a given file. This means merging + * every config array element which that `criteria` property matched. The + * `filePath` argument must be an absolute path. + * + * `ConfigArrayFactory` provides the loading logic of config files. + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import { ExtractedConfig } from "./extracted-config.js"; +import { IgnorePattern } from "./ignore-pattern.js"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").RuleConf} RuleConf */ +/** @typedef {import("../../shared/types").Rule} Rule */ +/** @typedef {import("../../shared/types").Plugin} Plugin */ +/** @typedef {import("../../shared/types").Processor} Processor */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ +/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */ + +/** + * @typedef {Object} ConfigArrayElement + * @property {string} name The name of this config element. + * @property {string} filePath The path to the source file of this config element. + * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element. + * @property {Record|undefined} env The environment settings. + * @property {Record|undefined} globals The global variable settings. + * @property {IgnorePattern|undefined} ignorePattern The ignore patterns. + * @property {boolean|undefined} noInlineConfig The flag that disables directive comments. + * @property {DependentParser|undefined} parser The parser loader. + * @property {Object|undefined} parserOptions The parser options. + * @property {Record|undefined} plugins The plugin loaders. + * @property {string|undefined} processor The processor name to refer plugin's processor. + * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. + * @property {boolean|undefined} root The flag to express root. + * @property {Record|undefined} rules The rule settings + * @property {Object|undefined} settings The shared settings. + * @property {"config" | "ignore" | "implicit-processor"} type The element type. + */ + +/** + * @typedef {Object} ConfigArrayInternalSlots + * @property {Map} cache The cache to extract configs. + * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition. + * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition. + * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new class extends WeakMap { + get(key) { + let value = super.get(key); + + if (!value) { + value = { + cache: new Map(), + envMap: null, + processorMap: null, + ruleMap: null + }; + super.set(key, value); + } + + return value; + } +}(); + +/** + * Get the indices which are matched to a given file. + * @param {ConfigArrayElement[]} elements The elements. + * @param {string} filePath The path to a target file. + * @returns {number[]} The indices. + */ +function getMatchedIndices(elements, filePath) { + const indices = []; + + for (let i = elements.length - 1; i >= 0; --i) { + const element = elements[i]; + + if (!element.criteria || (filePath && element.criteria.test(filePath))) { + indices.push(i); + } + } + + return indices; +} + +/** + * Check if a value is a non-null object. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is a non-null object. + */ +function isNonNullObject(x) { + return typeof x === "object" && x !== null; +} + +/** + * Merge two objects. + * + * Assign every property values of `y` to `x` if `x` doesn't have the property. + * If `x`'s property value is an object, it does recursive. + * @param {Object} target The destination to merge + * @param {Object|undefined} source The source to merge. + * @returns {void} + */ +function mergeWithoutOverwrite(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + + if (isNonNullObject(target[key])) { + mergeWithoutOverwrite(target[key], source[key]); + } else if (target[key] === void 0) { + if (isNonNullObject(source[key])) { + target[key] = Array.isArray(source[key]) ? [] : {}; + mergeWithoutOverwrite(target[key], source[key]); + } else if (source[key] !== void 0) { + target[key] = source[key]; + } + } + } +} + +/** + * The error for plugin conflicts. + */ +class PluginConflictError extends Error { + + /** + * Initialize this error object. + * @param {string} pluginId The plugin ID. + * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. + */ + constructor(pluginId, plugins) { + super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); + this.messageTemplate = "plugin-conflict"; + this.messageData = { pluginId, plugins }; + } +} + +/** + * Merge plugins. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergePlugins(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetValue = target[key]; + const sourceValue = source[key]; + + // Adopt the plugin which was found at first. + if (targetValue === void 0) { + if (sourceValue.error) { + throw sourceValue.error; + } + target[key] = sourceValue; + } else if (sourceValue.filePath !== targetValue.filePath) { + throw new PluginConflictError(key, [ + { + filePath: targetValue.filePath, + importerName: targetValue.importerName + }, + { + filePath: sourceValue.filePath, + importerName: sourceValue.importerName + } + ]); + } + } +} + +/** + * Merge rule configs. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergeRuleConfigs(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetDef = target[key]; + const sourceDef = source[key]; + + // Adopt the rule config which was found at first. + if (targetDef === void 0) { + if (Array.isArray(sourceDef)) { + target[key] = [...sourceDef]; + } else { + target[key] = [sourceDef]; + } + + /* + * If the first found rule config is severity only and the current rule + * config has options, merge the severity and the options. + */ + } else if ( + targetDef.length === 1 && + Array.isArray(sourceDef) && + sourceDef.length >= 2 + ) { + targetDef.push(...sourceDef.slice(1)); + } + } +} + +/** + * Create the extracted config. + * @param {ConfigArray} instance The config elements. + * @param {number[]} indices The indices to use. + * @returns {ExtractedConfig} The extracted config. + */ +function createConfig(instance, indices) { + const config = new ExtractedConfig(); + const ignorePatterns = []; + + // Merge elements. + for (const index of indices) { + const element = instance[index]; + + // Adopt the parser which was found at first. + if (!config.parser && element.parser) { + if (element.parser.error) { + throw element.parser.error; + } + config.parser = element.parser; + } + + // Adopt the processor which was found at first. + if (!config.processor && element.processor) { + config.processor = element.processor; + } + + // Adopt the noInlineConfig which was found at first. + if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) { + config.noInlineConfig = element.noInlineConfig; + config.configNameOfNoInlineConfig = element.name; + } + + // Adopt the reportUnusedDisableDirectives which was found at first. + if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) { + config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives; + } + + // Collect ignorePatterns + if (element.ignorePattern) { + ignorePatterns.push(element.ignorePattern); + } + + // Merge others. + mergeWithoutOverwrite(config.env, element.env); + mergeWithoutOverwrite(config.globals, element.globals); + mergeWithoutOverwrite(config.parserOptions, element.parserOptions); + mergeWithoutOverwrite(config.settings, element.settings); + mergePlugins(config.plugins, element.plugins); + mergeRuleConfigs(config.rules, element.rules); + } + + // Create the predicate function for ignore patterns. + if (ignorePatterns.length > 0) { + config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse()); + } + + return config; +} + +/** + * Collect definitions. + * @template T, U + * @param {string} pluginId The plugin ID for prefix. + * @param {Record} defs The definitions to collect. + * @param {Map} map The map to output. + * @param {function(T): U} [normalize] The normalize function for each value. + * @returns {void} + */ +function collect(pluginId, defs, map, normalize) { + if (defs) { + const prefix = pluginId && `${pluginId}/`; + + for (const [key, value] of Object.entries(defs)) { + map.set( + `${prefix}${key}`, + normalize ? normalize(value) : value + ); + } + } +} + +/** + * Normalize a rule definition. + * @param {Function|Rule} rule The rule definition to normalize. + * @returns {Rule} The normalized rule definition. + */ +function normalizePluginRule(rule) { + return typeof rule === "function" ? { create: rule } : rule; +} + +/** + * Delete the mutation methods from a given map. + * @param {Map} map The map object to delete. + * @returns {void} + */ +function deleteMutationMethods(map) { + Object.defineProperties(map, { + clear: { configurable: true, value: void 0 }, + delete: { configurable: true, value: void 0 }, + set: { configurable: true, value: void 0 } + }); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArrayElement[]} elements The config elements. + * @param {ConfigArrayInternalSlots} slots The internal slots. + * @returns {void} + */ +function initPluginMemberMaps(elements, slots) { + const processed = new Set(); + + slots.envMap = new Map(); + slots.processorMap = new Map(); + slots.ruleMap = new Map(); + + for (const element of elements) { + if (!element.plugins) { + continue; + } + + for (const [pluginId, value] of Object.entries(element.plugins)) { + const plugin = value.definition; + + if (!plugin || processed.has(pluginId)) { + continue; + } + processed.add(pluginId); + + collect(pluginId, plugin.environments, slots.envMap); + collect(pluginId, plugin.processors, slots.processorMap); + collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule); + } + } + + deleteMutationMethods(slots.envMap); + deleteMutationMethods(slots.processorMap); + deleteMutationMethods(slots.ruleMap); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArray} instance The config elements. + * @returns {ConfigArrayInternalSlots} The extracted config. + */ +function ensurePluginMemberMaps(instance) { + const slots = internalSlotsMap.get(instance); + + if (!slots.ruleMap) { + initPluginMemberMaps(instance, slots); + } + + return slots; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The Config Array. + * + * `ConfigArray` instance contains all settings, parsers, and plugins. + * You need to call `ConfigArray#extractConfig(filePath)` method in order to + * extract, merge and get only the config data which is related to an arbitrary + * file. + * @extends {Array} + */ +class ConfigArray extends Array { + + /** + * Get the plugin environments. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin environments. + */ + get pluginEnvironments() { + return ensurePluginMemberMaps(this).envMap; + } + + /** + * Get the plugin processors. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin processors. + */ + get pluginProcessors() { + return ensurePluginMemberMaps(this).processorMap; + } + + /** + * Get the plugin rules. + * The returned map cannot be mutated. + * @returns {ReadonlyMap} The plugin rules. + */ + get pluginRules() { + return ensurePluginMemberMaps(this).ruleMap; + } + + /** + * Check if this config has `root` flag. + * @returns {boolean} `true` if this config array is root. + */ + isRoot() { + for (let i = this.length - 1; i >= 0; --i) { + const root = this[i].root; + + if (typeof root === "boolean") { + return root; + } + } + return false; + } + + /** + * Extract the config data which is related to a given file. + * @param {string} filePath The absolute path to the target file. + * @returns {ExtractedConfig} The extracted config data. + */ + extractConfig(filePath) { + const { cache } = internalSlotsMap.get(this); + const indices = getMatchedIndices(this, filePath); + const cacheKey = indices.join(","); + + if (!cache.has(cacheKey)) { + cache.set(cacheKey, createConfig(this, indices)); + } + + return cache.get(cacheKey); + } + + /** + * Check if a given path is an additional lint target. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the file is an additional lint target. + */ + isAdditionalTargetPath(filePath) { + for (const { criteria, type } of this) { + if ( + type === "config" && + criteria && + !criteria.endsWithWildcard && + criteria.test(filePath) + ) { + return true; + } + } + return false; + } +} + +/** + * Get the used extracted configs. + * CLIEngine will use this method to collect used deprecated rules. + * @param {ConfigArray} instance The config array object to get. + * @returns {ExtractedConfig[]} The used extracted configs. + * @private + */ +function getUsedExtractedConfigs(instance) { + const { cache } = internalSlotsMap.get(instance); + + return Array.from(cache.values()); +} + + +export { + ConfigArray, + getUsedExtractedConfigs +}; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js b/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js new file mode 100644 index 0000000..2883c3a --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js @@ -0,0 +1,115 @@ +/** + * @fileoverview `ConfigDependency` class. + * + * `ConfigDependency` class expresses a loaded parser or plugin. + * + * If the parser or plugin was loaded successfully, it has `definition` property + * and `filePath` property. Otherwise, it has `error` property. + * + * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it + * omits `definition` property. + * + * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers + * or plugins. + * + * @author Toru Nagashima + */ + +import util from "util"; + +/** + * The class is to store parsers or plugins. + * This class hides the loaded object from `JSON.stringify()` and `console.log`. + * @template T + */ +class ConfigDependency { + + /** + * Initialize this instance. + * @param {Object} data The dependency data. + * @param {T} [data.definition] The dependency if the loading succeeded. + * @param {Error} [data.error] The error object if the loading failed. + * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded. + * @param {string} data.id The ID of this dependency. + * @param {string} data.importerName The name of the config file which loads this dependency. + * @param {string} data.importerPath The path to the config file which loads this dependency. + */ + constructor({ + definition = null, + error = null, + filePath = null, + id, + importerName, + importerPath + }) { + + /** + * The loaded dependency if the loading succeeded. + * @type {T|null} + */ + this.definition = definition; + + /** + * The error object if the loading failed. + * @type {Error|null} + */ + this.error = error; + + /** + * The loaded dependency if the loading succeeded. + * @type {string|null} + */ + this.filePath = filePath; + + /** + * The ID of this dependency. + * @type {string} + */ + this.id = id; + + /** + * The name of the config file which loads this dependency. + * @type {string} + */ + this.importerName = importerName; + + /** + * The path to the config file which loads this dependency. + * @type {string} + */ + this.importerPath = importerPath; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + const obj = this[util.inspect.custom](); + + // Display `error.message` (`Error#message` is unenumerable). + if (obj.error instanceof Error) { + obj.error = { ...obj.error, message: obj.error.message }; + } + + return obj; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util.inspect.custom]() { + const { + definition: _ignore, // eslint-disable-line no-unused-vars + ...obj + } = this; + + return obj; + } +} + +/** @typedef {ConfigDependency} DependentParser */ +/** @typedef {ConfigDependency} DependentPlugin */ + +export { ConfigDependency }; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js b/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js new file mode 100644 index 0000000..e93b0b6 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js @@ -0,0 +1,145 @@ +/** + * @fileoverview `ExtractedConfig` class. + * + * `ExtractedConfig` class expresses a final configuration for a specific file. + * + * It provides one method. + * + * - `toCompatibleObjectAsConfigFileContent()` + * Convert this configuration to the compatible object as the content of + * config files. It converts the loaded parser and plugins to strings. + * `CLIEngine#getConfigForFile(filePath)` method uses this method. + * + * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance. + * + * @author Toru Nagashima + */ + +import { IgnorePattern } from "./ignore-pattern.js"; + +// For VSCode intellisense +/** @typedef {import("../../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ + +/** + * Check if `xs` starts with `ys`. + * @template T + * @param {T[]} xs The array to check. + * @param {T[]} ys The array that may be the first part of `xs`. + * @returns {boolean} `true` if `xs` starts with `ys`. + */ +function startsWith(xs, ys) { + return xs.length >= ys.length && ys.every((y, i) => y === xs[i]); +} + +/** + * The class for extracted config data. + */ +class ExtractedConfig { + constructor() { + + /** + * The config name what `noInlineConfig` setting came from. + * @type {string} + */ + this.configNameOfNoInlineConfig = ""; + + /** + * Environments. + * @type {Record} + */ + this.env = {}; + + /** + * Global variables. + * @type {Record} + */ + this.globals = {}; + + /** + * The glob patterns that ignore to lint. + * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined} + */ + this.ignores = void 0; + + /** + * The flag that disables directive comments. + * @type {boolean|undefined} + */ + this.noInlineConfig = void 0; + + /** + * Parser definition. + * @type {DependentParser|null} + */ + this.parser = null; + + /** + * Options for the parser. + * @type {Object} + */ + this.parserOptions = {}; + + /** + * Plugin definitions. + * @type {Record} + */ + this.plugins = {}; + + /** + * Processor ID. + * @type {string|null} + */ + this.processor = null; + + /** + * The flag that reports unused `eslint-disable` directive comments. + * @type {boolean|undefined} + */ + this.reportUnusedDisableDirectives = void 0; + + /** + * Rule settings. + * @type {Record} + */ + this.rules = {}; + + /** + * Shared settings. + * @type {Object} + */ + this.settings = {}; + } + + /** + * Convert this config to the compatible object as a config file content. + * @returns {ConfigData} The converted object. + */ + toCompatibleObjectAsConfigFileContent() { + const { + /* eslint-disable no-unused-vars */ + configNameOfNoInlineConfig: _ignore1, + processor: _ignore2, + /* eslint-enable no-unused-vars */ + ignores, + ...config + } = this; + + config.parser = config.parser && config.parser.filePath; + config.plugins = Object.keys(config.plugins).filter(Boolean).reverse(); + config.ignorePatterns = ignores ? ignores.patterns : []; + + // Strip the default patterns from `ignorePatterns`. + if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) { + config.ignorePatterns = + config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length); + } + + return config; + } +} + +export { ExtractedConfig }; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js b/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js new file mode 100644 index 0000000..3022ba9 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js @@ -0,0 +1,238 @@ +/** + * @fileoverview `IgnorePattern` class. + * + * `IgnorePattern` class has the set of glob patterns and the base path. + * + * It provides two static methods. + * + * - `IgnorePattern.createDefaultIgnore(cwd)` + * Create the default predicate function. + * - `IgnorePattern.createIgnore(ignorePatterns)` + * Create the predicate function from multiple `IgnorePattern` objects. + * + * It provides two properties and a method. + * + * - `patterns` + * The glob patterns that ignore to lint. + * - `basePath` + * The base path of the glob patterns. If absolute paths existed in the + * glob patterns, those are handled as relative paths to the base path. + * - `getPatternsRelativeTo(basePath)` + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * + * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes + * `ignorePatterns` properties. + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import assert from "assert"; +import path from "path"; +import ignore from "ignore"; +import debugOrig from "debug"; + +const debug = debugOrig("eslintrc:ignore-pattern"); + +/** @typedef {ReturnType} Ignore */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the path to the common ancestor directory of given paths. + * @param {string[]} sourcePaths The paths to calculate the common ancestor. + * @returns {string} The path to the common ancestor directory. + */ +function getCommonAncestorPath(sourcePaths) { + let result = sourcePaths[0]; + + for (let i = 1; i < sourcePaths.length; ++i) { + const a = result; + const b = sourcePaths[i]; + + // Set the shorter one (it's the common ancestor if one includes the other). + result = a.length < b.length ? a : b; + + // Set the common ancestor. + for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) { + if (a[j] !== b[j]) { + result = a.slice(0, lastSepPos); + break; + } + if (a[j] === path.sep) { + lastSepPos = j; + } + } + } + + let resolvedResult = result || path.sep; + + // if Windows common ancestor is root of drive must have trailing slash to be absolute. + if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") { + resolvedResult += path.sep; + } + return resolvedResult; +} + +/** + * Make relative path. + * @param {string} from The source path to get relative path. + * @param {string} to The destination path to get relative path. + * @returns {string} The relative path. + */ +function relative(from, to) { + const relPath = path.relative(from, to); + + if (path.sep === "/") { + return relPath; + } + return relPath.split(path.sep).join("/"); +} + +/** + * Get the trailing slash if existed. + * @param {string} filePath The path to check. + * @returns {string} The trailing slash if existed. + */ +function dirSuffix(filePath) { + const isDir = ( + filePath.endsWith(path.sep) || + (process.platform === "win32" && filePath.endsWith("/")) + ); + + return isDir ? "/" : ""; +} + +const DefaultPatterns = Object.freeze(["/**/node_modules/*"]); +const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]); + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +class IgnorePattern { + + /** + * The default patterns. + * @type {string[]} + */ + static get DefaultPatterns() { + return DefaultPatterns; + } + + /** + * Create the default predicate function. + * @param {string} cwd The current working directory. + * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createDefaultIgnore(cwd) { + return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]); + } + + /** + * Create the predicate function from multiple `IgnorePattern` objects. + * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns. + * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createIgnore(ignorePatterns) { + debug("Create with: %o", ignorePatterns); + + const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath)); + const patterns = [].concat( + ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath)) + ); + const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]); + const dotIg = ignore({ allowRelativePaths: true }).add(patterns); + + debug(" processed: %o", { basePath, patterns }); + + return Object.assign( + (filePath, dot = false) => { + assert(path.isAbsolute(filePath), "'filePath' should be an absolute path."); + const relPathRaw = relative(basePath, filePath); + const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath)); + const adoptedIg = dot ? dotIg : ig; + const result = relPath !== "" && adoptedIg.ignores(relPath); + + debug("Check", { filePath, dot, relativePath: relPath, result }); + return result; + }, + { basePath, patterns } + ); + } + + /** + * Initialize a new `IgnorePattern` instance. + * @param {string[]} patterns The glob patterns that ignore to lint. + * @param {string} basePath The base path of `patterns`. + */ + constructor(patterns, basePath) { + assert(path.isAbsolute(basePath), "'basePath' should be an absolute path."); + + /** + * The glob patterns that ignore to lint. + * @type {string[]} + */ + this.patterns = patterns; + + /** + * The base path of `patterns`. + * @type {string} + */ + this.basePath = basePath; + + /** + * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`. + * + * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility. + * It's `false` as-is for `ignorePatterns` property in config files. + * @type {boolean} + */ + this.loose = false; + } + + /** + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * @param {string} newBasePath The base path. + * @returns {string[]} Modifired patterns. + */ + getPatternsRelativeTo(newBasePath) { + assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path."); + const { basePath, loose, patterns } = this; + + if (newBasePath === basePath) { + return patterns; + } + const prefix = `/${relative(newBasePath, basePath)}`; + + return patterns.map(pattern => { + const negative = pattern.startsWith("!"); + const head = negative ? "!" : ""; + const body = negative ? pattern.slice(1) : pattern; + + if (body.startsWith("/") || body.startsWith("../")) { + return `${head}${prefix}${body}`; + } + return loose ? pattern : `${head}${prefix}/**/${body}`; + }); + } +} + +export { IgnorePattern }; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/index.js b/node_modules/@eslint/eslintrc/lib/config-array/index.js new file mode 100644 index 0000000..647f02b --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/index.js @@ -0,0 +1,19 @@ +/** + * @fileoverview `ConfigArray` class. + * @author Toru Nagashima + */ + +import { ConfigArray, getUsedExtractedConfigs } from "./config-array.js"; +import { ConfigDependency } from "./config-dependency.js"; +import { ExtractedConfig } from "./extracted-config.js"; +import { IgnorePattern } from "./ignore-pattern.js"; +import { OverrideTester } from "./override-tester.js"; + +export { + ConfigArray, + ConfigDependency, + ExtractedConfig, + IgnorePattern, + OverrideTester, + getUsedExtractedConfigs +}; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js b/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js new file mode 100644 index 0000000..460aafc --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js @@ -0,0 +1,225 @@ +/** + * @fileoverview `OverrideTester` class. + * + * `OverrideTester` class handles `files` property and `excludedFiles` property + * of `overrides` config. + * + * It provides one method. + * + * - `test(filePath)` + * Test if a file path matches the pair of `files` property and + * `excludedFiles` property. The `filePath` argument must be an absolute + * path. + * + * `ConfigArrayFactory` creates `OverrideTester` objects when it processes + * `overrides` properties. + * + * @author Toru Nagashima + */ + +import assert from "assert"; +import path from "path"; +import util from "util"; +import minimatch from "minimatch"; + +const { Minimatch } = minimatch; + +const minimatchOpts = { dot: true, matchBase: true }; + +/** + * @typedef {Object} Pattern + * @property {InstanceType[] | null} includes The positive matchers. + * @property {InstanceType[] | null} excludes The negative matchers. + */ + +/** + * Normalize a given pattern to an array. + * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns. + * @returns {string[]|null} Normalized patterns. + * @private + */ +function normalizePatterns(patterns) { + if (Array.isArray(patterns)) { + return patterns.filter(Boolean); + } + if (typeof patterns === "string" && patterns) { + return [patterns]; + } + return []; +} + +/** + * Create the matchers of given patterns. + * @param {string[]} patterns The patterns. + * @returns {InstanceType[] | null} The matchers. + */ +function toMatcher(patterns) { + if (patterns.length === 0) { + return null; + } + return patterns.map(pattern => { + if (/^\.[/\\]/u.test(pattern)) { + return new Minimatch( + pattern.slice(2), + + // `./*.js` should not match with `subdir/foo.js` + { ...minimatchOpts, matchBase: false } + ); + } + return new Minimatch(pattern, minimatchOpts); + }); +} + +/** + * Convert a given matcher to string. + * @param {Pattern} matchers The matchers. + * @returns {string} The string expression of the matcher. + */ +function patternToJson({ includes, excludes }) { + return { + includes: includes && includes.map(m => m.pattern), + excludes: excludes && excludes.map(m => m.pattern) + }; +} + +/** + * The class to test given paths are matched by the patterns. + */ +class OverrideTester { + + /** + * Create a tester with given criteria. + * If there are no criteria, returns `null`. + * @param {string|string[]} files The glob patterns for included files. + * @param {string|string[]} excludedFiles The glob patterns for excluded files. + * @param {string} basePath The path to the base directory to test paths. + * @returns {OverrideTester|null} The created instance or `null`. + */ + static create(files, excludedFiles, basePath) { + const includePatterns = normalizePatterns(files); + const excludePatterns = normalizePatterns(excludedFiles); + let endsWithWildcard = false; + + if (includePatterns.length === 0) { + return null; + } + + // Rejects absolute paths or relative paths to parents. + for (const pattern of includePatterns) { + if (path.isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + if (pattern.endsWith("*")) { + endsWithWildcard = true; + } + } + for (const pattern of excludePatterns) { + if (path.isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + } + + const includes = toMatcher(includePatterns); + const excludes = toMatcher(excludePatterns); + + return new OverrideTester( + [{ includes, excludes }], + basePath, + endsWithWildcard + ); + } + + /** + * Combine two testers by logical and. + * If either of the testers was `null`, returns the other tester. + * The `basePath` property of the two must be the same value. + * @param {OverrideTester|null} a A tester. + * @param {OverrideTester|null} b Another tester. + * @returns {OverrideTester|null} Combined tester. + */ + static and(a, b) { + if (!b) { + return a && new OverrideTester( + a.patterns, + a.basePath, + a.endsWithWildcard + ); + } + if (!a) { + return new OverrideTester( + b.patterns, + b.basePath, + b.endsWithWildcard + ); + } + + assert.strictEqual(a.basePath, b.basePath); + return new OverrideTester( + a.patterns.concat(b.patterns), + a.basePath, + a.endsWithWildcard || b.endsWithWildcard + ); + } + + /** + * Initialize this instance. + * @param {Pattern[]} patterns The matchers. + * @param {string} basePath The base path. + * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`. + */ + constructor(patterns, basePath, endsWithWildcard = false) { + + /** @type {Pattern[]} */ + this.patterns = patterns; + + /** @type {string} */ + this.basePath = basePath; + + /** @type {boolean} */ + this.endsWithWildcard = endsWithWildcard; + } + + /** + * Test if a given path is matched or not. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the path was matched. + */ + test(filePath) { + if (typeof filePath !== "string" || !path.isAbsolute(filePath)) { + throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`); + } + const relativePath = path.relative(this.basePath, filePath); + + return this.patterns.every(({ includes, excludes }) => ( + (!includes || includes.some(m => m.match(relativePath))) && + (!excludes || !excludes.some(m => m.match(relativePath))) + )); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + if (this.patterns.length === 1) { + return { + ...patternToJson(this.patterns[0]), + basePath: this.basePath + }; + } + return { + AND: this.patterns.map(patternToJson), + basePath: this.basePath + }; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util.inspect.custom]() { + return this.toJSON(); + } +} + +export { OverrideTester }; diff --git a/node_modules/@eslint/eslintrc/lib/flat-compat.js b/node_modules/@eslint/eslintrc/lib/flat-compat.js new file mode 100644 index 0000000..8df15a5 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/flat-compat.js @@ -0,0 +1,307 @@ +/** + * @fileoverview Compatibility class for flat config. + * @author Nicholas C. Zakas + */ + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +import createDebug from "debug"; +import path from "path"; + +import environments from "../conf/environments.js"; +import { ConfigArrayFactory } from "./config-array-factory.js"; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").Processor} Processor */ + +const debug = createDebug("eslintrc:flat-compat"); +const cafactory = Symbol("cafactory"); + +/** + * Translates an ESLintRC-style config object into a flag-config-style config + * object. + * @param {Object} eslintrcConfig An ESLintRC-style config object. + * @param {Object} options Options to help translate the config. + * @param {string} options.resolveConfigRelativeTo To the directory to resolve + * configs from. + * @param {string} options.resolvePluginsRelativeTo The directory to resolve + * plugins from. + * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment + * names to objects. + * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor + * names to objects. + * @returns {Object} A flag-config-style config object. + */ +function translateESLintRC(eslintrcConfig, { + resolveConfigRelativeTo, + resolvePluginsRelativeTo, + pluginEnvironments, + pluginProcessors +}) { + + const flatConfig = {}; + const configs = []; + const languageOptions = {}; + const linterOptions = {}; + const keysToCopy = ["settings", "rules", "processor"]; + const languageOptionsKeysToCopy = ["globals", "parser", "parserOptions"]; + const linterOptionsKeysToCopy = ["noInlineConfig", "reportUnusedDisableDirectives"]; + + // check for special settings for eslint:all and eslint:recommended: + if (eslintrcConfig.settings) { + if (eslintrcConfig.settings["eslint:all"] === true) { + return ["eslint:all"]; + } + + if (eslintrcConfig.settings["eslint:recommended"] === true) { + return ["eslint:recommended"]; + } + } + + // copy over simple translations + for (const key of keysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig[key] = eslintrcConfig[key]; + } + } + + // copy over languageOptions + for (const key of languageOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + + // create the languageOptions key in the flat config + flatConfig.languageOptions = languageOptions; + + if (key === "parser") { + debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`); + + if (eslintrcConfig[key].error) { + throw eslintrcConfig[key].error; + } + + languageOptions[key] = eslintrcConfig[key].definition; + continue; + } + + // clone any object values that are in the eslintrc config + if (eslintrcConfig[key] && typeof eslintrcConfig[key] === "object") { + languageOptions[key] = { + ...eslintrcConfig[key] + }; + } else { + languageOptions[key] = eslintrcConfig[key]; + } + } + } + + // copy over linterOptions + for (const key of linterOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig.linterOptions = linterOptions; + linterOptions[key] = eslintrcConfig[key]; + } + } + + // move ecmaVersion a level up + if (languageOptions.parserOptions) { + + if ("ecmaVersion" in languageOptions.parserOptions) { + languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion; + delete languageOptions.parserOptions.ecmaVersion; + } + + if ("sourceType" in languageOptions.parserOptions) { + languageOptions.sourceType = languageOptions.parserOptions.sourceType; + delete languageOptions.parserOptions.sourceType; + } + + // check to see if we even need parserOptions anymore and remove it if not + if (Object.keys(languageOptions.parserOptions).length === 0) { + delete languageOptions.parserOptions; + } + } + + // overrides + if (eslintrcConfig.criteria) { + flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)]; + } + + // translate plugins + if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === "object") { + debug(`Translating plugins: ${eslintrcConfig.plugins}`); + + flatConfig.plugins = {}; + + for (const pluginName of Object.keys(eslintrcConfig.plugins)) { + + debug(`Translating plugin: ${pluginName}`); + debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`); + + const { definition: plugin, error } = eslintrcConfig.plugins[pluginName]; + + if (error) { + throw error; + } + + flatConfig.plugins[pluginName] = plugin; + + // create a config for any processors + if (plugin.processors) { + for (const processorName of Object.keys(plugin.processors)) { + if (processorName.startsWith(".")) { + debug(`Assigning processor: ${pluginName}/${processorName}`); + + configs.unshift({ + files: [`**/*${processorName}`], + processor: pluginProcessors.get(`${pluginName}/${processorName}`) + }); + } + + } + } + } + } + + // translate env - must come after plugins + if (eslintrcConfig.env && typeof eslintrcConfig.env === "object") { + for (const envName of Object.keys(eslintrcConfig.env)) { + + // only add environments that are true + if (eslintrcConfig.env[envName]) { + debug(`Translating environment: ${envName}`); + + if (environments.has(envName)) { + + // built-in environments should be defined first + configs.unshift(...translateESLintRC(environments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } else if (pluginEnvironments.has(envName)) { + + // if the environment comes from a plugin, it should come after the plugin config + configs.push(...translateESLintRC(pluginEnvironments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } + } + } + } + + // only add if there are actually keys in the config + if (Object.keys(flatConfig).length > 0) { + configs.push(flatConfig); + } + + return configs; +} + + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A compatibility class for working with configs. + */ +class FlatCompat { + + constructor({ + baseDirectory = process.cwd(), + resolvePluginsRelativeTo = baseDirectory + } = {}) { + this.baseDirectory = baseDirectory; + this.resolvePluginsRelativeTo = resolvePluginsRelativeTo; + this[cafactory] = new ConfigArrayFactory({ + cwd: baseDirectory, + resolvePluginsRelativeTo, + getEslintAllConfig: () => ({ settings: { "eslint:all": true } }), + getEslintRecommendedConfig: () => ({ settings: { "eslint:recommended": true } }) + }); + } + + /** + * Translates an ESLintRC-style config into a flag-config-style config. + * @param {Object} eslintrcConfig The ESLintRC-style config object. + * @returns {Object} A flag-config-style config object. + */ + config(eslintrcConfig) { + const eslintrcArray = this[cafactory].create(eslintrcConfig, { + basePath: this.baseDirectory + }); + + const flatArray = []; + let hasIgnorePatterns = false; + + eslintrcArray.forEach(configData => { + if (configData.type === "config") { + hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern; + flatArray.push(...translateESLintRC(configData, { + resolveConfigRelativeTo: path.join(this.baseDirectory, "__placeholder.js"), + resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, "__placeholder.js"), + pluginEnvironments: eslintrcArray.pluginEnvironments, + pluginProcessors: eslintrcArray.pluginProcessors + })); + } + }); + + // combine ignorePatterns to emulate ESLintRC behavior better + if (hasIgnorePatterns) { + flatArray.unshift({ + ignores: [filePath => { + + // Compute the final config for this file. + // This filters config array elements by `files`/`excludedFiles` then merges the elements. + const finalConfig = eslintrcArray.extractConfig(filePath); + + // Test the `ignorePattern` properties of the final config. + return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath); + }] + }); + } + + return flatArray; + } + + /** + * Translates the `env` section of an ESLintRC-style config. + * @param {Object} envConfig The `env` section of an ESLintRC config. + * @returns {Object} A flag-config object representing the environments. + */ + env(envConfig) { + return this.config({ + env: envConfig + }); + } + + /** + * Translates the `extends` section of an ESLintRC-style config. + * @param {...string} configsToExtend The names of the configs to load. + * @returns {Object} A flag-config object representing the config. + */ + extends(...configsToExtend) { + return this.config({ + extends: configsToExtend + }); + } + + /** + * Translates the `plugins` section of an ESLintRC-style config. + * @param {...string} plugins The names of the plugins to load. + * @returns {Object} A flag-config object representing the plugins. + */ + plugins(...plugins) { + return this.config({ + plugins + }); + } +} + +export { FlatCompat }; diff --git a/node_modules/@eslint/eslintrc/lib/index-universal.js b/node_modules/@eslint/eslintrc/lib/index-universal.js new file mode 100644 index 0000000..6f6b302 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/index-universal.js @@ -0,0 +1,29 @@ +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import * as ConfigOps from "./shared/config-ops.js"; +import ConfigValidator from "./shared/config-validator.js"; +import * as naming from "./shared/naming.js"; +import environments from "../conf/environments.js"; + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +const Legacy = { + environments, + + // shared + ConfigOps, + ConfigValidator, + naming +}; + +export { + Legacy +}; diff --git a/node_modules/@eslint/eslintrc/lib/index.js b/node_modules/@eslint/eslintrc/lib/index.js new file mode 100644 index 0000000..9e3d13f --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/index.js @@ -0,0 +1,56 @@ +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import { + ConfigArrayFactory, + createContext as createConfigArrayFactoryContext +} from "./config-array-factory.js"; + +import { CascadingConfigArrayFactory } from "./cascading-config-array-factory.js"; +import * as ModuleResolver from "./shared/relative-module-resolver.js"; +import { ConfigArray, getUsedExtractedConfigs } from "./config-array/index.js"; +import { ConfigDependency } from "./config-array/config-dependency.js"; +import { ExtractedConfig } from "./config-array/extracted-config.js"; +import { IgnorePattern } from "./config-array/ignore-pattern.js"; +import { OverrideTester } from "./config-array/override-tester.js"; +import * as ConfigOps from "./shared/config-ops.js"; +import ConfigValidator from "./shared/config-validator.js"; +import * as naming from "./shared/naming.js"; +import { FlatCompat } from "./flat-compat.js"; +import environments from "../conf/environments.js"; + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +const Legacy = { + ConfigArray, + createConfigArrayFactoryContext, + CascadingConfigArrayFactory, + ConfigArrayFactory, + ConfigDependency, + ExtractedConfig, + IgnorePattern, + OverrideTester, + getUsedExtractedConfigs, + environments, + + // shared + ConfigOps, + ConfigValidator, + ModuleResolver, + naming +}; + +export { + + Legacy, + + FlatCompat + +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/ajv.js b/node_modules/@eslint/eslintrc/lib/shared/ajv.js new file mode 100644 index 0000000..b79ad36 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/ajv.js @@ -0,0 +1,191 @@ +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import Ajv from "ajv"; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/* + * Copied from ajv/lib/refs/json-schema-draft-04.json + * The MIT License (MIT) + * Copyright (c) 2015-2017 Evgeny Poberezkin + */ +const metaSchema = { + id: "http://json-schema.org/draft-04/schema#", + $schema: "http://json-schema.org/draft-04/schema#", + description: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + positiveInteger: { + type: "integer", + minimum: 0 + }, + positiveIntegerDefault0: { + allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true + } + }, + type: "object", + properties: { + id: { + type: "string" + }, + $schema: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: { }, + multipleOf: { + type: "number", + minimum: 0, + exclusiveMinimum: true + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "boolean", + default: false + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "boolean", + default: false + }, + maxLength: { $ref: "#/definitions/positiveInteger" }, + minLength: { $ref: "#/definitions/positiveIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + items: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/schemaArray" } + ], + default: { } + }, + maxItems: { $ref: "#/definitions/positiveInteger" }, + minItems: { $ref: "#/definitions/positiveIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxProperties: { $ref: "#/definitions/positiveInteger" }, + minProperties: { $ref: "#/definitions/positiveIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/stringArray" } + ] + } + }, + enum: { + type: "array", + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + dependencies: { + exclusiveMaximum: ["maximum"], + exclusiveMinimum: ["minimum"] + }, + default: { } +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +export default (additionalOptions = {}) => { + const ajv = new Ajv({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); + + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/config-ops.js b/node_modules/@eslint/eslintrc/lib/shared/config-ops.js new file mode 100644 index 0000000..d203be0 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/config-ops.js @@ -0,0 +1,135 @@ +/** + * @fileoverview Config file operations. This file must be usable in the browser, + * so no Node-specific code can be here. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const RULE_SEVERITY_STRINGS = ["off", "warn", "error"], + RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { + map[value] = index; + return map; + }, {}), + VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Normalizes the severity value of a rule's configuration to a number + * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally + * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), + * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array + * whose first element is one of the above values. Strings are matched case-insensitively. + * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. + */ +function getRuleSeverity(ruleConfig) { + const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (severityValue === 0 || severityValue === 1 || severityValue === 2) { + return severityValue; + } + + if (typeof severityValue === "string") { + return RULE_SEVERITY[severityValue.toLowerCase()] || 0; + } + + return 0; +} + +/** + * Converts old-style severity settings (0, 1, 2) into new-style + * severity settings (off, warn, error) for all rules. Assumption is that severity + * values have already been validated as correct. + * @param {Object} config The config object to normalize. + * @returns {void} + */ +function normalizeToStrings(config) { + + if (config.rules) { + Object.keys(config.rules).forEach(ruleId => { + const ruleConfig = config.rules[ruleId]; + + if (typeof ruleConfig === "number") { + config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; + } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { + ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; + } + }); + } +} + +/** + * Determines if the severity for the given rule configuration represents an error. + * @param {int|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} True if the rule represents an error, false if not. + */ +function isErrorSeverity(ruleConfig) { + return getRuleSeverity(ruleConfig) === 2; +} + +/** + * Checks whether a given config has valid severity or not. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isValidSeverity(ruleConfig) { + let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + + if (typeof severity === "string") { + severity = severity.toLowerCase(); + } + return VALID_SEVERITIES.indexOf(severity) !== -1; +} + +/** + * Checks whether every rule of a given config has valid severity or not. + * @param {Object} config The configuration for rules. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isEverySeverityValid(config) { + return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId])); +} + +/** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + * @throws Error if global value is invalid + */ +function normalizeConfigGlobal(configuredValue) { + switch (configuredValue) { + case "off": + return "off"; + + case true: + case "true": + case "writeable": + case "writable": + return "writable"; + + case null: + case false: + case "false": + case "readable": + case "readonly": + return "readonly"; + + default: + throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); + } +} + +export { + getRuleSeverity, + normalizeToStrings, + isErrorSeverity, + isValidSeverity, + isEverySeverityValid, + normalizeConfigGlobal +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/config-validator.js b/node_modules/@eslint/eslintrc/lib/shared/config-validator.js new file mode 100644 index 0000000..32174a5 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/config-validator.js @@ -0,0 +1,325 @@ +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ + +/* eslint class-methods-use-this: "off" */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import util from "util"; +import * as ConfigOps from "./config-ops.js"; +import { emitDeprecationWarning } from "./deprecation-warnings.js"; +import ajvOrig from "./ajv.js"; +import configSchema from "../../conf/config-schema.js"; +import BuiltInEnvironments from "../../conf/environments.js"; + +const ajv = ajvOrig(); + +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +const validated = new WeakSet(); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +export default class ConfigValidator { + constructor({ builtInRules = new Map() } = {}) { + this.builtInRules = builtInRules; + } + + /** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ + getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; + } + + /** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ + validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + + } + + /** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @returns {void} + */ + validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = this.getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } + } + + /** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @returns {void} + */ + validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = this.validateRuleSeverity(options); + + if (severity !== 0) { + this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } + } + + /** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ + validateEnvironment( + environment, + source, + getAdditionalEnv = noop + ) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); + } + + /** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ + validateRules( + rulesConfig, + source, + getAdditionalRule = noop + ) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; + + this.validateRuleOptions(rule, id, rulesConfig[id], source); + }); + } + + /** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ + validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + ConfigOps.normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); + } + + /** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @returns {void} + */ + validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } + } + + /** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ + formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); + } + + /** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @returns {void} + */ + validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } + } + + /** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ + validate(config, source, getAdditionalRule, getAdditionalEnv) { + this.validateConfigSchema(config, source); + this.validateRules(config.rules, source, getAdditionalRule); + this.validateEnvironment(config.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + this.validateRules(override.rules, source, getAdditionalRule); + this.validateEnvironment(override.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + } + } + + /** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ + validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + this.validateEnvironment(element.env, element.name, getPluginEnv); + this.validateGlobals(element.globals, element.name); + this.validateProcessor(element.processor, element.name, getPluginProcessor); + this.validateRules(element.rules, element.name, getPluginRule); + } + } + +} diff --git a/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js b/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js new file mode 100644 index 0000000..91907b1 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js @@ -0,0 +1,63 @@ +/** + * @fileoverview Provide the function that emits deprecation warnings. + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +import path from "path"; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// Defitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", + ESLINT_PERSONAL_CONFIG_LOAD: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please use a config file per project or the '--config' option.", + ESLINT_PERSONAL_CONFIG_SUPPRESS: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please remove it or add 'root:true' to the config files in your " + + "projects in order to avoid loading '~/.eslintrc.*' accidentally." +}; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param {string} source The name of the configuration source to report the warning for. + * @param {string} errorCode The warning message to show. + * @returns {void} + */ +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + sourceFileErrorCache.add(cacheKey); + + const rel = path.relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +export { + emitDeprecationWarning +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/naming.js b/node_modules/@eslint/eslintrc/lib/shared/naming.js new file mode 100644 index 0000000..93df5fc --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/naming.js @@ -0,0 +1,96 @@ +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ + +const NAMESPACE_REGEX = /^@.*\//iu; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + let normalizedName = name; + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (normalizedName.includes("\\")) { + normalizedName = normalizedName.replace(/\\/gu, "/"); + } + + if (normalizedName.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); + + if (scopedPackageShortcutRegex.test(normalizedName)) { + normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); + } + } else if (!normalizedName.startsWith(`${prefix}-`)) { + normalizedName = `${prefix}-${normalizedName}`; + } + + return normalizedName; +} + +/** + * Removes the prefix from a fullname. + * @param {string} fullname The term which may have the prefix. + * @param {string} prefix The prefix to remove. + * @returns {string} The term without prefix. + */ +function getShorthandName(fullname, prefix) { + if (fullname[0] === "@") { + let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); + + if (matchResult) { + return matchResult[1]; + } + + matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); + if (matchResult) { + return `${matchResult[1]}/${matchResult[2]}`; + } + } else if (fullname.startsWith(`${prefix}-`)) { + return fullname.slice(prefix.length + 1); + } + + return fullname; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namespace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +export { + normalizePackageName, + getShorthandName, + getNamespaceFromTerm +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js b/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js new file mode 100644 index 0000000..1df0ca8 --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js @@ -0,0 +1,42 @@ +/** + * Utility for resolving a module relative to another module + * @author Teddy Katz + */ + +import Module from "module"; + +/* + * `Module.createRequire` is added in v12.2.0. It supports URL as well. + * We only support the case where the argument is a filepath, not a URL. + */ +const createRequire = Module.createRequire; + +/** + * Resolves a Node module relative to another module + * @param {string} moduleName The name of a Node module, or a path to a Node module. + * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be + * a file rather than a directory, but the file need not actually exist. + * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` + */ +function resolve(moduleName, relativeToPath) { + try { + return createRequire(relativeToPath).resolve(moduleName); + } catch (error) { + + // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. + if ( + typeof error === "object" && + error !== null && + error.code === "MODULE_NOT_FOUND" && + !error.requireStack && + error.message.includes(moduleName) + ) { + error.message += `\nRequire stack:\n- ${relativeToPath}`; + } + throw error; + } +} + +export { + resolve +}; diff --git a/node_modules/@eslint/eslintrc/lib/shared/types.js b/node_modules/@eslint/eslintrc/lib/shared/types.js new file mode 100644 index 0000000..a32c35e --- /dev/null +++ b/node_modules/@eslint/eslintrc/lib/shared/types.js @@ -0,0 +1,149 @@ +/** + * @fileoverview Define common types for input completion. + * @author Toru Nagashima + */ + +/** @type {any} */ +export default {}; + +/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */ +/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */ +/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */ + +/** + * @typedef {Object} EcmaFeatures + * @property {boolean} [globalReturn] Enabling `return` statements at the top-level. + * @property {boolean} [jsx] Enabling JSX syntax. + * @property {boolean} [impliedStrict] Enabling strict mode always. + */ + +/** + * @typedef {Object} ParserOptions + * @property {EcmaFeatures} [ecmaFeatures] The optional features. + * @property {3|5|6|7|8|9|10|11|12|2015|2016|2017|2018|2019|2020|2021} [ecmaVersion] The ECMAScript version (or revision number). + * @property {"script"|"module"} [sourceType] The source code type. + */ + +/** + * @typedef {Object} ConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {Record} [globals] The global variable settings. + * @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {boolean} [root] The root flag. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} OverrideConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [excludedFiles] The glob pattarns for excluded files. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {string | string[]} files The glob patterns for target files. + * @property {Record} [globals] The global variable settings. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} ParseResult + * @property {Object} ast The AST. + * @property {ScopeManager} [scopeManager] The scope manager of the AST. + * @property {Record} [services] The services that the parser provides. + * @property {Record} [visitorKeys] The visitor keys of the AST. + */ + +/** + * @typedef {Object} Parser + * @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables. + * @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} Environment + * @property {Record} [globals] The definition of global variables. + * @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} LintMessage + * @property {number} column The 1-based column number. + * @property {number} [endColumn] The 1-based column number of the end location. + * @property {number} [endLine] The 1-based line number of the end location. + * @property {boolean} fatal If `true` then this is a fatal error. + * @property {{range:[number,number], text:string}} [fix] Information for autofix. + * @property {number} line The 1-based line number. + * @property {string} message The error message. + * @property {string|null} ruleId The ID of the rule which makes this message. + * @property {0|1|2} severity The severity of this message. + * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. + */ + +/** + * @typedef {Object} SuggestionResult + * @property {string} desc A short description. + * @property {string} [messageId] Id referencing a message for the description. + * @property {{ text: string, range: number[] }} fix fix result info + */ + +/** + * @typedef {Object} Processor + * @property {(text:string, filename:string) => Array} [preprocess] The function to extract code blocks. + * @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages. + * @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix. + */ + +/** + * @typedef {Object} RuleMetaDocs + * @property {string} category The category of the rule. + * @property {string} description The description of the rule. + * @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset. + * @property {string} url The URL of the rule documentation. + */ + +/** + * @typedef {Object} RuleMeta + * @property {boolean} [deprecated] If `true` then the rule has been deprecated. + * @property {RuleMetaDocs} docs The document information of the rule. + * @property {"code"|"whitespace"} [fixable] The autofix type. + * @property {Record} [messages] The messages the rule reports. + * @property {string[]} [replacedBy] The IDs of the alternative rules. + * @property {Array|Object} schema The option schema of the rule. + * @property {"problem"|"suggestion"|"layout"} type The rule type. + */ + +/** + * @typedef {Object} Rule + * @property {Function} create The factory of the rule. + * @property {RuleMeta} meta The meta data of the rule. + */ + +/** + * @typedef {Object} Plugin + * @property {Record} [configs] The definition of plugin configs. + * @property {Record} [environments] The definition of plugin environments. + * @property {Record} [processors] The definition of plugin processors. + * @property {Record} [rules] The definition of plugin rules. + */ + +/** + * Information of deprecated rules. + * @typedef {Object} DeprecatedRuleInfo + * @property {string} ruleId The rule ID. + * @property {string[]} replacedBy The rule IDs that replace this deprecated rule. + */ diff --git a/node_modules/@eslint/eslintrc/node_modules/debug/LICENSE b/node_modules/@eslint/eslintrc/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +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/@eslint/eslintrc/node_modules/debug/README.md b/node_modules/@eslint/eslintrc/node_modules/debug/README.md new file mode 100644 index 0000000..e9c3e04 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +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/@eslint/eslintrc/node_modules/debug/package.json b/node_modules/@eslint/eslintrc/node_modules/debug/package.json new file mode 100644 index 0000000..3bcdc24 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.4", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon ", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/node_modules/@eslint/eslintrc/node_modules/debug/src/browser.js b/node_modules/@eslint/eslintrc/node_modules/debug/src/browser.js new file mode 100644 index 0000000..cd0fc35 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/@eslint/eslintrc/node_modules/debug/src/common.js b/node_modules/@eslint/eslintrc/node_modules/debug/src/common.js new file mode 100644 index 0000000..e3291b2 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/@eslint/eslintrc/node_modules/debug/src/index.js b/node_modules/@eslint/eslintrc/node_modules/debug/src/index.js new file mode 100644 index 0000000..bf4c57f --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/@eslint/eslintrc/node_modules/debug/src/node.js b/node_modules/@eslint/eslintrc/node_modules/debug/src/node.js new file mode 100644 index 0000000..79bc085 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/@eslint/eslintrc/node_modules/ms/index.js b/node_modules/@eslint/eslintrc/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/@eslint/eslintrc/node_modules/ms/license.md b/node_modules/@eslint/eslintrc/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, 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. diff --git a/node_modules/@eslint/eslintrc/node_modules/ms/package.json b/node_modules/@eslint/eslintrc/node_modules/ms/package.json new file mode 100644 index 0000000..eea666e --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/node_modules/@eslint/eslintrc/node_modules/ms/readme.md b/node_modules/@eslint/eslintrc/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/@eslint/eslintrc/package.json b/node_modules/@eslint/eslintrc/package.json new file mode 100644 index 0000000..397ae85 --- /dev/null +++ b/node_modules/@eslint/eslintrc/package.json @@ -0,0 +1,81 @@ +{ + "name": "@eslint/eslintrc", + "version": "1.3.0", + "description": "The legacy ESLintRC config file format for ESLint", + "type": "module", + "main": "./dist/eslintrc.cjs", + "exports": { + ".": { + "import": "./lib/index.js", + "require": "./dist/eslintrc.cjs" + }, + "./package.json": "./package.json", + "./universal": { + "import": "./lib/index-universal.js", + "require": "./dist/eslintrc-universal.cjs" + } + }, + "files": [ + "lib", + "conf", + "LICENSE", + "dist", + "universal.js" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "prepare": "npm run build", + "build": "rollup -c", + "lint": "eslint . --report-unused-disable-directives", + "fix": "npm run lint -- --fix", + "test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + }, + "repository": "eslint/eslintrc", + "keywords": [ + "ESLint", + "ESLintRC", + "Configuration" + ], + "author": "Nicholas C. Zakas", + "license": "MIT", + "bugs": { + "url": "https://github.com/eslint/eslintrc/issues" + }, + "homepage": "https://github.com/eslint/eslintrc#readme", + "devDependencies": { + "c8": "^7.7.3", + "chai": "^4.3.4", + "eslint": "^7.31.0", + "eslint-config-eslint": "^7.0.0", + "eslint-plugin-jsdoc": "^35.4.1", + "eslint-plugin-node": "^11.1.0", + "eslint-release": "^3.2.0", + "fs-teardown": "^0.1.3", + "mocha": "^9.0.3", + "rollup": "^2.70.1", + "shelljs": "^0.8.4", + "sinon": "^11.1.2", + "temp-dir": "^2.0.0" + }, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.2", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } +} diff --git a/node_modules/@eslint/eslintrc/universal.js b/node_modules/@eslint/eslintrc/universal.js new file mode 100644 index 0000000..4e1846e --- /dev/null +++ b/node_modules/@eslint/eslintrc/universal.js @@ -0,0 +1,9 @@ +// Jest (and probably some other runtimes with custom implementations of +// `require`) doesn't support `exports` in `package.json`, so this file is here +// to help them load this module. Note that it is also `.js` and not `.cjs` for +// the same reason - `cjs` files requires to be loaded with an extension, but +// since Jest doesn't respect `module` outside of ESM mode it still works in +// this case (and the `require` in _this_ file does specify the extension). + +// eslint-disable-next-line no-undef +module.exports = require("./dist/eslintrc-universal.cjs"); diff --git a/node_modules/@humanwhocodes/config-array/CHANGELOG.md b/node_modules/@humanwhocodes/config-array/CHANGELOG.md new file mode 100644 index 0000000..1bbfe12 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/CHANGELOG.md @@ -0,0 +1,71 @@ +# Changelog + +### [0.9.5](https://www.github.com/humanwhocodes/config-array/compare/v0.9.4...v0.9.5) (2022-02-23) + + +### Bug Fixes + +* Ensure dot directories are matched correctly ([6e8d180](https://www.github.com/humanwhocodes/config-array/commit/6e8d180f43cedf3c2072d8a1229470e9fafabf5b)) +* preprocessConfig should have correct 'this' value ([9641540](https://www.github.com/humanwhocodes/config-array/commit/96415402cf0012ccf8e4af6c7b934dfc1a058986)) + +### [0.9.4](https://www.github.com/humanwhocodes/config-array/compare/v0.9.3...v0.9.4) (2022-01-27) + + +### Bug Fixes + +* Negated patterns to work when files match ([398c811](https://www.github.com/humanwhocodes/config-array/commit/398c8119d359493dc7b82b40df4d92ea6528375f)) + +### [0.9.3](https://www.github.com/humanwhocodes/config-array/compare/v0.9.2...v0.9.3) (2022-01-26) + + +### Bug Fixes + +* Make negated ignore patterns work like gitignore ([4ee8e99](https://www.github.com/humanwhocodes/config-array/commit/4ee8e998436e2c4538b06476e0bead8a44fe5a1b)) + +### [0.9.2](https://www.github.com/humanwhocodes/config-array/compare/v0.9.1...v0.9.2) (2021-11-02) + + +### Bug Fixes + +* Object merging error by upgrading object-schema ([377d06d](https://www.github.com/humanwhocodes/config-array/commit/377d06d2a44d781b0bec70b3389c48b3d5a63f94)) + +### [0.9.1](https://www.github.com/humanwhocodes/config-array/compare/v0.9.0...v0.9.1) (2021-10-05) + + +### Bug Fixes + +* Properly build package for release ([168155f](https://www.github.com/humanwhocodes/config-array/commit/168155f3fed91ab35566c452efd28debf8ec2b85)) + +## [0.9.0](https://www.github.com/humanwhocodes/config-array/compare/v0.8.0...v0.9.0) (2021-10-04) + + +### Features + +* getConfig() now returns undefined when no configs match. ([a563b82](https://www.github.com/humanwhocodes/config-array/commit/a563b8255d4eb2bb7745314e3f00ef53792b343f)) + +## [0.8.0](https://www.github.com/humanwhocodes/config-array/compare/v0.7.0...v0.8.0) (2021-10-01) + + +### Features + +* Add isIgnored() method ([343e5a0](https://www.github.com/humanwhocodes/config-array/commit/343e5a0a9e32028bfc6c0bf1ec0c6badf74f47f9)) + + +### Bug Fixes + +* Ensure global ignores are honored ([343e5a0](https://www.github.com/humanwhocodes/config-array/commit/343e5a0a9e32028bfc6c0bf1ec0c6badf74f47f9)) + +## [0.7.0](https://www.github.com/humanwhocodes/config-array/compare/v0.6.0...v0.7.0) (2021-09-24) + + +### Features + +* Only object configs by default ([5645f24](https://www.github.com/humanwhocodes/config-array/commit/5645f241b2412a3263a02ef9e3a9bd19cc86035d)) + +## [0.6.0](https://www.github.com/humanwhocodes/config-array/compare/v0.5.0...v0.6.0) (2021-04-20) + + +### Features + +* Add the normalizeSync() method ([3e347f9](https://www.github.com/humanwhocodes/config-array/commit/3e347f9d77c5ca2b15995e75ff7bc4fb96b7d66e)) +* Allow async config functions ([a9def0f](https://www.github.com/humanwhocodes/config-array/commit/a9def0faf579c223349dfe08d2486756840538c3)) diff --git a/node_modules/@humanwhocodes/config-array/LICENSE b/node_modules/@humanwhocodes/config-array/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@humanwhocodes/config-array/README.md b/node_modules/@humanwhocodes/config-array/README.md new file mode 100644 index 0000000..bb0c989 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/README.md @@ -0,0 +1,301 @@ +# Config Array + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate). + +## Description + +A config array is a way of managing configurations that are based on glob pattern matching of filenames. Each config array contains the information needed to determine the correct configuration for any file based on the filename. + +## Background + +In 2019, I submitted an [ESLint RFC](https://github.com/eslint/rfcs/pull/9) proposing a new way of configuring ESLint. The goal was to streamline what had become an increasingly complicated configuration process. Over several iterations, this proposal was eventually born. + +The basic idea is that all configuration, including overrides, can be represented by a single array where each item in the array is a config object. Config objects appearing later in the array override config objects appearing earlier in the array. You can calculate a config for a given file by traversing all config objects in the array to find the ones that match the filename. Matching is done by specifying glob patterns in `files` and `ignores` properties on each config object. Here's an example: + +```js +export default [ + + // match all JSON files + { + name: "JSON Handler", + files: ["**/*.json"], + handler: jsonHandler + }, + + // match only package.json + { + name: "package.json Handler", + files: ["package.json"], + handler: packageJsonHandler + } +]; +``` + +In this example, there are two config objects: the first matches all JSON files in all directories and the second matches just `package.json` in the base path directory (all the globs are evaluated as relative to a base path that can be specified). When you retrieve a configuration for `foo.json`, only the first config object matches so `handler` is equal to `jsonHandler`; when you retrieve a configuration for `package.json`, `handler` is equal to `packageJsonHandler` (because both config objects match, the second one wins). + +## Installation + +You can install the package using npm or Yarn: + +```bash +npm install @humanwhocodes/config-array --save + +# or + +yarn add @humanwhocodes/config-array +``` + +## Usage + +First, import the `ConfigArray` constructor: + +```js +import { ConfigArray } from "@humanwhocodes/config-array"; + +// or using CommonJS + +const { ConfigArray } = require("@humanwhocodes/config-array"); +``` + +When you create a new instance of `ConfigArray`, you must pass in two arguments: an array of configs and an options object. The array of configs is most likely read in from a configuration file, so here's a typical example: + +```js +const configFilename = path.resolve(process.cwd(), "my.config.js"); +const { default: rawConfigs } = await import(configFilename); +const configs = new ConfigArray(rawConfigs, { + + // the path to match filenames from + basePath: process.cwd(), + + // additional items in each config + schema: mySchema +}); +``` + +This example reads in an object or array from `my.config.js` and passes it into the `ConfigArray` constructor as the first argument. The second argument is an object specifying the `basePath` (the directoy in which `my.config.js` is found) and a `schema` to define the additional properties of a config object beyond `files`, `ignores`, and `name`. + +### Specifying a Schema + +The `schema` option is required for you to use additional properties in config objects. The schema is object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@humanwhocodes/object-schema). The schema specifies both validation and merge rules that the `ConfigArray` instance needs to combine configs when there are multiple matches. Here's an example: + +```js +const configFilename = path.resolve(process.cwd(), "my.config.js"); +const { default: rawConfigs } = await import(configFilename); + +const mySchema = { + + // define the handler key in configs + handler: { + required: true, + merge(a, b) { + if (!b) return a; + if (!a) return b; + }, + validate(value) { + if (typeof value !== "function") { + throw new TypeError("Function expected."); + } + } + } +}; + +const configs = new ConfigArray(rawConfigs, { + + // the path to match filenames from + basePath: process.cwd(), + + // additional item schemas in each config + schema: mySchema, + + // additional config types supported (default: []) + extraConfigTypes: ["array", "function"]; +}); +``` + +### Config Arrays + +Config arrays can be multidimensional, so it's possible for a config array to contain another config array when `extraConfigTypes` contains `"array"`, such as: + +```js +export default [ + + // JS config + { + files: ["**/*.js"], + handler: jsHandler + }, + + // JSON configs + [ + + // match all JSON files + { + name: "JSON Handler", + files: ["**/*.json"], + handler: jsonHandler + }, + + // match only package.json + { + name: "package.json Handler", + files: ["package.json"], + handler: packageJsonHandler + } + ], + + // filename must match function + { + files: [ filePath => filePath.endsWith(".md") ], + handler: markdownHandler + }, + + // filename must match all patterns in subarray + { + files: [ ["*.test.*", "*.js"] ], + handler: jsTestHandler + }, + + // filename must not match patterns beginning with ! + { + name: "Non-JS files", + files: ["!*.js"], + settings: { + js: false + } + } +]; +``` + +In this example, the array contains both config objects and a config array. When a config array is normalized (see details below), it is flattened so only config objects remain. However, the order of evaluation remains the same. + +If the `files` array contains a function, then that function is called with the absolute path of the file and is expected to return `true` if there is a match and `false` if not. (The `ignores` array can also contain functions.) + +If the `files` array contains an item that is an array of strings and functions, then all patterns must match in order for the config to match. In the preceding examples, both `*.test.*` and `*.js` must match in order for the config object to be used. + +If a pattern in the files array begins with `!` then it excludes that pattern. In the preceding example, any filename that doesn't end with `.js` will automatically getting a `settings.js` property set to `false`. + +You can also specify an `ignores` key that will force files matching those patterns to not be included. If the `ignores` key is in a config object without a `files` key, then those ignores will always be applied; if the `ignores` key is in a config object with a `files` key, then those ignores are only applied when `files` matches. Here's an example: + +```js +export default [ + + // Always ignored + { + ignores: ["**/.git/**", "**/node_modules/**"] + }, + + // .eslintrc.js file is ignored only when .js file matches + { + files: ["**/*.js"], + ignores: [".eslintrc.js"] + handler: jsHandler + } +]; +``` + +You can use negated patterns in `ignores` to exclude a file that was already ignored, such as: + +```js +export default [ + + // Ignore all JSON files except tsconfig.json + { + ignores: ["**/*.json", "!tsconfig.json"] + }, + +]; +``` + +### Config Functions + +Config arrays can also include config functions when `extraConfigTypes` contains `"function"`. A config function accepts a single parameter, `context` (defined by you), and must return either a config object or a config array (it cannot return another function). Config functions allow end users to execute code in the creation of appropriate config objects. Here's an example: + +```js +export default [ + + // JS config + { + files: ["**/*.js"], + handler: jsHandler + }, + + // JSON configs + function (context) { + return [ + + // match all JSON files + { + name: context.name + " JSON Handler", + files: ["**/*.json"], + handler: jsonHandler + }, + + // match only package.json + { + name: context.name + " package.json Handler", + files: ["package.json"], + handler: packageJsonHandler + } + ]; + } +]; +``` + +When a config array is normalized, each function is executed and replaced in the config array with the return value. + +**Note:** Config functions can also be async. + +### Normalizing Config Arrays + +Once a config array has been created and loaded with all of the raw config data, it must be normalized before it can be used. The normalization process goes through and flattens the config array as well as executing all config functions to get their final values. + +To normalize a config array, call the `normalize()` method and pass in a context object: + +```js +await configs.normalize({ + name: "MyApp" +}); +``` + +The `normalize()` method returns a promise, so be sure to use the `await` operator. The config array instance is normalized in-place, so you don't need to create a new variable. + +If you want to disallow async config functions, you can call `normalizeSync()` instead. This method is completely synchronous and does not require using the `await` operator as it does not return a promise: + +```js +await configs.normalizeSync({ + name: "MyApp" +}); +``` + +**Important:** Once a `ConfigArray` is normalized, it cannot be changed further. You can, however, create a new `ConfigArray` and pass in the normalized instance to create an unnormalized copy. + +### Getting Config for a File + +To get the config for a file, use the `getConfig()` method on a normalized config array and pass in the filename to get a config for: + +```js +// pass in absolute filename +const fileConfig = configs.getConfig(path.resolve(process.cwd(), "package.json")); +``` + +The config array always returns an object, even if there are no configs matching the given filename. You can then inspect the returned config object to determine how to proceed. + +A few things to keep in mind: + +* You must pass in the absolute filename to get a config for. +* The returned config object never has `files`, `ignores`, or `name` properties; the only properties on the object will be the other configuration options specified. +* The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation. + +## Acknowledgements + +The design of this project was influenced by feedback on the ESLint RFC, and incorporates ideas from: + +* Teddy Katz (@not-an-aardvark) +* Toru Nagashima (@mysticatea) +* Kai Cataldo (@kaicataldo) + +## License + +Apache 2.0 diff --git a/node_modules/@humanwhocodes/config-array/api.js b/node_modules/@humanwhocodes/config-array/api.js new file mode 100644 index 0000000..ae64dcc --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/api.js @@ -0,0 +1,695 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var path = _interopDefault(require('path')); +var minimatch = _interopDefault(require('minimatch')); +var createDebug = _interopDefault(require('debug')); +var objectSchema = require('@humanwhocodes/object-schema'); + +/** + * @fileoverview ConfigSchema + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Assets that a given value is an array. + * @param {*} value The value to check. + * @returns {void} + * @throws {TypeError} When the value is not an array. + */ +function assertIsArray(value) { + if (!Array.isArray(value)) { + throw new TypeError('Expected value to be an array.'); + } +} + +/** + * Assets that a given value is an array containing only strings and functions. + * @param {*} value The value to check. + * @returns {void} + * @throws {TypeError} When the value is not an array of strings and functions. + */ +function assertIsArrayOfStringsAndFunctions(value, name) { + assertIsArray(value); + + if (value.some(item => typeof item !== 'string' && typeof item !== 'function')) { + throw new TypeError('Expected array to only contain strings.'); + } +} + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The base schema that every ConfigArray uses. + * @type Object + */ +const baseSchema = Object.freeze({ + name: { + required: false, + merge() { + return undefined; + }, + validate(value) { + if (typeof value !== 'string') { + throw new TypeError('Property must be a string.'); + } + } + }, + files: { + required: false, + merge() { + return undefined; + }, + validate(value) { + + // first check if it's an array + assertIsArray(value); + + // then check each member + value.forEach(item => { + if (Array.isArray(item)) { + assertIsArrayOfStringsAndFunctions(item); + } else if (typeof item !== 'string' && typeof item !== 'function') { + throw new TypeError('Items must be a string, a function, or an array of strings and functions.'); + } + }); + + } + }, + ignores: { + required: false, + merge() { + return undefined; + }, + validate: assertIsArrayOfStringsAndFunctions + } +}); + +/** + * @fileoverview ConfigArray + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const debug = createDebug('@hwc/config-array'); + +const MINIMATCH_OPTIONS = { + matchBase: true, + dot: true +}; + +const CONFIG_TYPES = new Set(['array', 'function']); + +/** + * Shorthand for checking if a value is a string. + * @param {any} value The value to check. + * @returns {boolean} True if a string, false if not. + */ +function isString(value) { + return typeof value === 'string'; +} + +/** + * Normalizes a `ConfigArray` by flattening it and executing any functions + * that are found inside. + * @param {Array} items The items in a `ConfigArray`. + * @param {Object} context The context object to pass into any function + * found. + * @param {Array} extraConfigTypes The config types to check. + * @returns {Promise} A flattened array containing only config objects. + * @throws {TypeError} When a config function returns a function. + */ +async function normalize(items, context, extraConfigTypes) { + + const allowFunctions = extraConfigTypes.includes('function'); + const allowArrays = extraConfigTypes.includes('array'); + + async function *flatTraverse(array) { + for (let item of array) { + if (typeof item === 'function') { + if (!allowFunctions) { + throw new TypeError('Unexpected function.'); + } + + item = item(context); + if (item.then) { + item = await item; + } + } + + if (Array.isArray(item)) { + if (!allowArrays) { + throw new TypeError('Unexpected array.'); + } + yield * flatTraverse(item); + } else if (typeof item === 'function') { + throw new TypeError('A config function can only return an object or array.'); + } else { + yield item; + } + } + } + + /* + * Async iterables cannot be used with the spread operator, so we need to manually + * create the array to return. + */ + const asyncIterable = await flatTraverse(items); + const configs = []; + + for await (const config of asyncIterable) { + configs.push(config); + } + + return configs; +} + +/** + * Normalizes a `ConfigArray` by flattening it and executing any functions + * that are found inside. + * @param {Array} items The items in a `ConfigArray`. + * @param {Object} context The context object to pass into any function + * found. + * @param {Array} extraConfigTypes The config types to check. + * @returns {Array} A flattened array containing only config objects. + * @throws {TypeError} When a config function returns a function. + */ +function normalizeSync(items, context, extraConfigTypes) { + + const allowFunctions = extraConfigTypes.includes('function'); + const allowArrays = extraConfigTypes.includes('array'); + + function *flatTraverse(array) { + for (let item of array) { + if (typeof item === 'function') { + + if (!allowFunctions) { + throw new TypeError('Unexpected function.'); + } + + item = item(context); + if (item.then) { + throw new TypeError('Async config functions are not supported.'); + } + } + + if (Array.isArray(item)) { + + if (!allowArrays) { + throw new TypeError('Unexpected array.'); + } + + yield * flatTraverse(item); + } else if (typeof item === 'function') { + throw new TypeError('A config function can only return an object or array.'); + } else { + yield item; + } + } + } + + return [...flatTraverse(items)]; +} + +/** + * Determines if a given file path should be ignored based on the given + * matcher. + * @param {Array boolean>} ignores The ignore patterns to check. + * @param {string} filePath The absolute path of the file to check. + * @param {string} relativeFilePath The relative path of the file to check. + * @returns {boolean} True if the path should be ignored and false if not. + */ +function shouldIgnoreFilePath(ignores, filePath, relativeFilePath) { + + let shouldIgnore = false; + + for (const matcher of ignores) { + + if (typeof matcher === 'function') { + shouldIgnore = shouldIgnore || matcher(filePath); + continue; + } + + /* + * If there's a negated pattern, that means anything matching + * must NOT be ignored. To do that, we need to use the `flipNegate` + * option for minimatch to check if the filepath matches the + * pattern specified after the !, and if that result is true, + * then we return false immediately because this file should + * never be ignored. + */ + if (matcher.startsWith('!')) { + + /* + * The file must already be ignored in order to apply a negated + * pattern, because negated patterns simply remove files that + * would already be ignored. + */ + if (shouldIgnore && + minimatch(relativeFilePath, matcher, { + ...MINIMATCH_OPTIONS, + flipNegate: true + })) { + return false; + } + } else { + shouldIgnore = shouldIgnore || minimatch(relativeFilePath, matcher, MINIMATCH_OPTIONS); + } + + } + + return shouldIgnore; +} + +/** + * Determines if a given file path is matched by a config. If the config + * has no `files` field, then it matches; otherwise, if a `files` field + * is present then we match the globs in `files` and exclude any globs in + * `ignores`. + * @param {string} filePath The absolute file path to check. + * @param {Object} config The config object to check. + * @returns {boolean} True if the file path is matched by the config, + * false if not. + */ +function pathMatches(filePath, basePath, config) { + + // a config without `files` field always match + if (!config.files) { + return true; + } + + /* + * For both files and ignores, functions are passed the absolute + * file path while strings are compared against the relative + * file path. + */ + const relativeFilePath = path.relative(basePath, filePath); + + // if files isn't an array, throw an error + if (!Array.isArray(config.files) || config.files.length === 0) { + throw new TypeError('The files key must be a non-empty array.'); + } + + // match both strings and functions + const match = pattern => { + + if (isString(pattern)) { + return minimatch(relativeFilePath, pattern, MINIMATCH_OPTIONS); + } + + if (typeof pattern === 'function') { + return pattern(filePath); + } + + throw new TypeError(`Unexpected matcher type ${pattern}.`); + }; + + // check for all matches to config.files + let filePathMatchesPattern = config.files.some(pattern => { + if (Array.isArray(pattern)) { + return pattern.every(match); + } + + return match(pattern); + }); + + /* + * If the file path matches the config.files patterns, then check to see + * if there are any files to ignore. + */ + if (filePathMatchesPattern && config.ignores) { + filePathMatchesPattern = !shouldIgnoreFilePath(config.ignores, filePath, relativeFilePath); + } + + return filePathMatchesPattern; +} + +/** + * Ensures that a ConfigArray has been normalized. + * @param {ConfigArray} configArray The ConfigArray to check. + * @returns {void} + * @throws {Error} When the `ConfigArray` is not normalized. + */ +function assertNormalized(configArray) { + // TODO: Throw more verbose error + if (!configArray.isNormalized()) { + throw new Error('ConfigArray must be normalized to perform this operation.'); + } +} + +/** + * Ensures that config types are valid. + * @param {Array} extraConfigTypes The config types to check. + * @returns {void} + * @throws {Error} When the config types array is invalid. + */ +function assertExtraConfigTypes(extraConfigTypes) { + if (extraConfigTypes.length > 2) { + throw new TypeError('configTypes must be an array with at most two items.'); + } + + for (const configType of extraConfigTypes) { + if (!CONFIG_TYPES.has(configType)) { + throw new TypeError(`Unexpected config type "${configType}" found. Expected one of: "object", "array", "function".`); + } + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +const ConfigArraySymbol = { + isNormalized: Symbol('isNormalized'), + configCache: Symbol('configCache'), + schema: Symbol('schema'), + finalizeConfig: Symbol('finalizeConfig'), + preprocessConfig: Symbol('preprocessConfig') +}; + +// used to store calculate data for faster lookup +const dataCache = new WeakMap(); + +/** + * Represents an array of config objects and provides method for working with + * those config objects. + */ +class ConfigArray extends Array { + + /** + * Creates a new instance of ConfigArray. + * @param {Iterable|Function|Object} configs An iterable yielding config + * objects, or a config function, or a config object. + * @param {string} [options.basePath=""] The path of the config file + * @param {boolean} [options.normalized=false] Flag indicating if the + * configs have already been normalized. + * @param {Object} [options.schema] The additional schema + * definitions to use for the ConfigArray schema. + * @param {Array} [options.configTypes] List of config types supported. + */ + constructor(configs, + { + basePath = '', + normalized = false, + schema: customSchema, + extraConfigTypes = [] + } = {} +) { + super(); + + /** + * Tracks if the array has been normalized. + * @property isNormalized + * @type boolean + * @private + */ + this[ConfigArraySymbol.isNormalized] = normalized; + + /** + * The schema used for validating and merging configs. + * @property schema + * @type ObjectSchema + * @private + */ + this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema({ + ...customSchema, + ...baseSchema + }); + + /** + * The path of the config file that this array was loaded from. + * This is used to calculate filename matches. + * @property basePath + * @type string + */ + this.basePath = basePath; + + assertExtraConfigTypes(extraConfigTypes); + + /** + * The supported config types. + * @property configTypes + * @type Array + */ + this.extraConfigTypes = Object.freeze([...extraConfigTypes]); + + /** + * A cache to store calculated configs for faster repeat lookup. + * @property configCache + * @type Map + * @private + */ + this[ConfigArraySymbol.configCache] = new Map(); + + // init cache + dataCache.set(this, {}); + + // load the configs into this array + if (Array.isArray(configs)) { + this.push(...configs); + } else { + this.push(configs); + } + + } + +/** + * Prevent normal array methods from creating a new `ConfigArray` instance. + * This is to ensure that methods such as `slice()` won't try to create a + * new instance of `ConfigArray` behind the scenes as doing so may throw + * an error due to the different constructor signature. + * @returns {Function} The `Array` constructor. + */ +static get [Symbol.species]() { + return Array; +} + +/** + * Returns the `files` globs from every config object in the array. + * This can be used to determine which files will be matched by a + * config array or to use as a glob pattern when no patterns are provided + * for a command line interface. + * @returns {Array} An array of matchers. + */ +get files() { + + assertNormalized(this); + + // if this data has been cached, retrieve it + const cache = dataCache.get(this); + + if (cache.files) { + return cache.files; + } + + // otherwise calculate it + + const result = []; + + for (const config of this) { + if (config.files) { + config.files.forEach(filePattern => { + result.push(filePattern); + }); + } + } + + // store result + cache.files = result; + dataCache.set(this, cache); + + return result; +} + +/** + * Returns ignore matchers that should always be ignored regardless of + * the matching `files` fields in any configs. This is necessary to mimic + * the behavior of things like .gitignore and .eslintignore, allowing a + * globbing operation to be faster. + * @returns {string[]} An array of string patterns and functions to be ignored. + */ +get ignores() { + + assertNormalized(this); + + // if this data has been cached, retrieve it + const cache = dataCache.get(this); + + if (cache.ignores) { + return cache.ignores; + } + + // otherwise calculate it + + const result = []; + + for (const config of this) { + if (config.ignores && !config.files) { + result.push(...config.ignores); + } + } + + // store result + cache.ignores = result; + dataCache.set(this, cache); + + return result; +} + +/** + * Indicates if the config array has been normalized. + * @returns {boolean} True if the config array is normalized, false if not. + */ +isNormalized() { + return this[ConfigArraySymbol.isNormalized]; +} + +/** + * Normalizes a config array by flattening embedded arrays and executing + * config functions. + * @param {ConfigContext} context The context object for config functions. + * @returns {Promise} The current ConfigArray instance. + */ +async normalize(context = {}) { + + if (!this.isNormalized()) { + const normalizedConfigs = await normalize(this, context, this.extraConfigTypes); + this.length = 0; + this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig].bind(this))); + this[ConfigArraySymbol.isNormalized] = true; + + // prevent further changes + Object.freeze(this); + } + + return this; +} + +/** + * Normalizes a config array by flattening embedded arrays and executing + * config functions. + * @param {ConfigContext} context The context object for config functions. + * @returns {ConfigArray} The current ConfigArray instance. + */ +normalizeSync(context = {}) { + + if (!this.isNormalized()) { + const normalizedConfigs = normalizeSync(this, context, this.extraConfigTypes); + this.length = 0; + this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig])); + this[ConfigArraySymbol.isNormalized] = true; + + // prevent further changes + Object.freeze(this); + } + + return this; +} + +/** + * Finalizes the state of a config before being cached and returned by + * `getConfig()`. Does nothing by default but is provided to be + * overridden by subclasses as necessary. + * @param {Object} config The config to finalize. + * @returns {Object} The finalized config. + */ +[ConfigArraySymbol.finalizeConfig](config) { + return config; +} + +/** + * Preprocesses a config during the normalization process. This is the + * method to override if you want to convert an array item before it is + * validated for the first time. For example, if you want to replace a + * string with an object, this is the method to override. + * @param {Object} config The config to preprocess. + * @returns {Object} The config to use in place of the argument. + */ +[ConfigArraySymbol.preprocessConfig](config) { + return config; +} + +/** + * Returns the config object for a given file path. + * @param {string} filePath The complete path of a file to get a config for. + * @returns {Object} The config object for this file. + */ +getConfig(filePath) { + + assertNormalized(this); + + // first check the cache to avoid duplicate work + let finalConfig = this[ConfigArraySymbol.configCache].get(filePath); + + if (finalConfig) { + return finalConfig; + } + + // TODO: Maybe move elsewhere? + const relativeFilePath = path.relative(this.basePath, filePath); + + if (shouldIgnoreFilePath(this.ignores, filePath, relativeFilePath)) { + + // cache and return result - finalConfig is undefined at this point + this[ConfigArraySymbol.configCache].set(filePath, finalConfig); + return finalConfig; + } + + // filePath isn't automatically ignored, so try to construct config + + const matchingConfigs = []; + + for (const config of this) { + if (pathMatches(filePath, this.basePath, config)) { + debug(`Matching config found for ${filePath}`); + matchingConfigs.push(config); + } else { + debug(`No matching config found for ${filePath}`); + } + } + + // if matching both files and ignores, there will be no config to create + if (matchingConfigs.length === 0) { + // cache and return result - finalConfig is undefined at this point + this[ConfigArraySymbol.configCache].set(filePath, finalConfig); + return finalConfig; + } + + // otherwise construct the config + + finalConfig = matchingConfigs.reduce((result, config) => { + return this[ConfigArraySymbol.schema].merge(result, config); + }, {}, this); + + finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig); + + this[ConfigArraySymbol.configCache].set(filePath, finalConfig); + + return finalConfig; +} + +/** + * Determines if the given filepath is ignored based on the configs. + * @param {string} filePath The complete path of a file to check. + * @returns {boolean} True if the path is ignored, false if not. + */ +isIgnored(filePath) { + return this.getConfig(filePath) === undefined; +} + +} + +exports.ConfigArray = ConfigArray; +exports.ConfigArraySymbol = ConfigArraySymbol; diff --git a/node_modules/@humanwhocodes/config-array/node_modules/debug/LICENSE b/node_modules/@humanwhocodes/config-array/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +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/@humanwhocodes/config-array/node_modules/debug/README.md b/node_modules/@humanwhocodes/config-array/node_modules/debug/README.md new file mode 100644 index 0000000..e9c3e04 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +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/@humanwhocodes/config-array/node_modules/debug/package.json b/node_modules/@humanwhocodes/config-array/node_modules/debug/package.json new file mode 100644 index 0000000..3bcdc24 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.4", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon ", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/node_modules/@humanwhocodes/config-array/node_modules/debug/src/browser.js b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/browser.js new file mode 100644 index 0000000..cd0fc35 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/@humanwhocodes/config-array/node_modules/debug/src/common.js b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/common.js new file mode 100644 index 0000000..e3291b2 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/@humanwhocodes/config-array/node_modules/debug/src/index.js b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/index.js new file mode 100644 index 0000000..bf4c57f --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/@humanwhocodes/config-array/node_modules/debug/src/node.js b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/node.js new file mode 100644 index 0000000..79bc085 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/@humanwhocodes/config-array/node_modules/ms/index.js b/node_modules/@humanwhocodes/config-array/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/@humanwhocodes/config-array/node_modules/ms/license.md b/node_modules/@humanwhocodes/config-array/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, 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. diff --git a/node_modules/@humanwhocodes/config-array/node_modules/ms/package.json b/node_modules/@humanwhocodes/config-array/node_modules/ms/package.json new file mode 100644 index 0000000..eea666e --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/node_modules/@humanwhocodes/config-array/node_modules/ms/readme.md b/node_modules/@humanwhocodes/config-array/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/@humanwhocodes/config-array/package.json b/node_modules/@humanwhocodes/config-array/package.json new file mode 100644 index 0000000..ae21aff --- /dev/null +++ b/node_modules/@humanwhocodes/config-array/package.json @@ -0,0 +1,61 @@ +{ + "name": "@humanwhocodes/config-array", + "version": "0.9.5", + "description": "Glob-based configuration matching.", + "author": "Nicholas C. Zakas", + "main": "api.js", + "files": [ + "api.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/config-array.git" + }, + "bugs": { + "url": "https://github.com/humanwhocodes/config-array/issues" + }, + "homepage": "https://github.com/humanwhocodes/config-array#readme", + "scripts": { + "build": "rollup -c", + "format": "nitpik", + "lint": "eslint *.config.js src/*.js tests/*.js", + "prepublish": "npm run build", + "test:coverage": "nyc --include src/*.js npm run test", + "test": "mocha -r esm tests/ --recursive" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.js": [ + "nitpik", + "eslint --fix --ignore-pattern '!.eslintrc.js'" + ] + }, + "keywords": [ + "configuration", + "configarray", + "config file" + ], + "license": "Apache-2.0", + "engines": { + "node": ">=10.10.0" + }, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "devDependencies": { + "@nitpik/javascript": "^0.3.3", + "@nitpik/node": "0.0.5", + "chai": "^4.2.0", + "eslint": "^6.7.1", + "esm": "^3.2.25", + "lint-staged": "^10.2.8", + "mocha": "^6.2.3", + "nyc": "^14.1.1", + "rollup": "^1.12.3", + "yorkie": "^2.0.0" + } +} diff --git a/node_modules/@humanwhocodes/object-schema/.eslintrc.js b/node_modules/@humanwhocodes/object-schema/.eslintrc.js new file mode 100644 index 0000000..4934076 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/.eslintrc.js @@ -0,0 +1,29 @@ +module.exports = { + "env": { + "commonjs": true, + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2018 + }, + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ] + } +}; \ No newline at end of file diff --git a/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml b/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml new file mode 100644 index 0000000..8ea1951 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml @@ -0,0 +1,27 @@ +name: Node CI + +on: [push, pull_request] + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [windows-latest, macOS-latest, ubuntu-latest] + node: [8.x, 10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm test + env: + CI: true diff --git a/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml b/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml new file mode 100644 index 0000000..42f75f7 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml @@ -0,0 +1,39 @@ +on: + push: + branches: + - main +name: release-please +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + release-type: node + package-name: test-release-please + # The logic below handles the npm publication: + - uses: actions/checkout@v2 + # these if statements ensure that a publication only occurs when + # a new release is created: + if: ${{ steps.release.outputs.release_created }} + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: 'https://registry.npmjs.org' + if: ${{ steps.release.outputs.release_created }} + - run: npm ci + if: ${{ steps.release.outputs.release_created }} + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.release.outputs.release_created }} + + # Tweets out release announcement + - run: 'npx @humanwhocodes/tweet "Object Schema v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released!\n\n${{ github.event.release.html_url }}"' + if: ${{ steps.release.outputs.release_created }} + env: + TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} + TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} + TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} diff --git a/node_modules/@humanwhocodes/object-schema/CHANGELOG.md b/node_modules/@humanwhocodes/object-schema/CHANGELOG.md new file mode 100644 index 0000000..bb63f5f --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +### [1.2.1](https://www.github.com/humanwhocodes/object-schema/compare/v1.2.0...v1.2.1) (2021-11-02) + + +### Bug Fixes + +* Never return original object from individual config ([5463c5c](https://www.github.com/humanwhocodes/object-schema/commit/5463c5c6d2cb35a7b7948dffc37c899a41d1775f)) diff --git a/node_modules/@humanwhocodes/object-schema/LICENSE b/node_modules/@humanwhocodes/object-schema/LICENSE new file mode 100644 index 0000000..a5e3ae4 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, Human Who Codes +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@humanwhocodes/object-schema/README.md b/node_modules/@humanwhocodes/object-schema/README.md new file mode 100644 index 0000000..2163797 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/README.md @@ -0,0 +1,234 @@ +# JavaScript ObjectSchema Package + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate). + +## Overview + +A JavaScript object merge/validation utility where you can define a different merge and validation strategy for each key. This is helpful when you need to validate complex data structures and then merge them in a way that is more complex than `Object.assign()`. + +## Installation + +You can install using either npm: + +``` +npm install @humanwhocodes/object-schema +``` + +Or Yarn: + +``` +yarn add @humanwhocodes/object-schema +``` + +## Usage + +Use CommonJS to get access to the `ObjectSchema` constructor: + +```js +const { ObjectSchema } = require("@humanwhocodes/object-schema"); + +const schema = new ObjectSchema({ + + // define a definition for the "downloads" key + downloads: { + required: true, + merge(value1, value2) { + return value1 + value2; + }, + validate(value) { + if (typeof value !== "number") { + throw new Error("Expected downloads to be a number."); + } + } + }, + + // define a strategy for the "versions" key + version: { + required: true, + merge(value1, value2) { + return value1.concat(value2); + }, + validate(value) { + if (!Array.isArray(value)) { + throw new Error("Expected versions to be an array."); + } + } + } +}); + +const record1 = { + downloads: 25, + versions: [ + "v1.0.0", + "v1.1.0", + "v1.2.0" + ] +}; + +const record2 = { + downloads: 125, + versions: [ + "v2.0.0", + "v2.1.0", + "v3.0.0" + ] +}; + +// make sure the records are valid +schema.validate(record1); +schema.validate(record2); + +// merge together (schema.merge() accepts any number of objects) +const result = schema.merge(record1, record2); + +// result looks like this: + +const result = { + downloads: 75, + versions: [ + "v1.0.0", + "v1.1.0", + "v1.2.0", + "v2.0.0", + "v2.1.0", + "v3.0.0" + ] +}; +``` + +## Tips and Tricks + +### Named merge strategies + +Instead of specifying a `merge()` method, you can specify one of the following strings to use a default merge strategy: + +* `"assign"` - use `Object.assign()` to merge the two values into one object. +* `"overwrite"` - the second value always replaces the first. +* `"replace"` - the second value replaces the first if the second is not `undefined`. + +For example: + +```js +const schema = new ObjectSchema({ + name: { + merge: "replace", + validate() {} + } +}); +``` + +### Named validation strategies + +Instead of specifying a `validate()` method, you can specify one of the following strings to use a default validation strategy: + +* `"array"` - value must be an array. +* `"boolean"` - value must be a boolean. +* `"number"` - value must be a number. +* `"object"` - value must be an object. +* `"object?"` - value must be an object or null. +* `"string"` - value must be a string. +* `"string!"` - value must be a non-empty string. + +For example: + +```js +const schema = new ObjectSchema({ + name: { + merge: "replace", + validate: "string" + } +}); +``` + +### Subschemas + +If you are defining a key that is, itself, an object, you can simplify the process by using a subschema. Instead of defining `merge()` and `validate()`, assign a `schema` key that contains a schema definition, like this: + +```js +const schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } +}); + +schema.validate({ + name: { + first: "n", + last: "z" + } +}); +``` + +### Remove Keys During Merge + +If the merge strategy for a key returns `undefined`, then the key will not appear in the final object. For example: + +```js +const schema = new ObjectSchema({ + date: { + merge() { + return undefined; + }, + validate(value) { + Date.parse(value); // throws an error when invalid + } + } +}); + +const object1 = { date: "5/5/2005" }; +const object2 = { date: "6/6/2006" }; + +const result = schema.merge(object1, object2); + +console.log("date" in result); // false +``` + +### Requiring Another Key Be Present + +If you'd like the presence of one key to require the presence of another key, you can use the `requires` property to specify an array of other properties that any key requires. For example: + +```js +const schema = new ObjectSchema(); + +const schema = new ObjectSchema({ + date: { + merge() { + return undefined; + }, + validate(value) { + Date.parse(value); // throws an error when invalid + } + }, + time: { + requires: ["date"], + merge(first, second) { + return second; + }, + validate(value) { + // ... + } + } +}); + +// throws error: Key "time" requires keys "date" +schema.validate({ + time: "13:45" +}); +``` + +In this example, even though `date` is an optional key, it is required to be present whenever `time` is present. + +## License + +BSD 3-Clause diff --git a/node_modules/@humanwhocodes/object-schema/package.json b/node_modules/@humanwhocodes/object-schema/package.json new file mode 100644 index 0000000..9fc90bf --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/package.json @@ -0,0 +1,33 @@ +{ + "name": "@humanwhocodes/object-schema", + "version": "1.2.1", + "description": "An object schema merger/validator", + "main": "src/index.js", + "directories": { + "test": "tests" + }, + "scripts": { + "test": "mocha tests/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/object-schema.git" + }, + "keywords": [ + "object", + "validation", + "schema", + "merge" + ], + "author": "Nicholas C. Zakas", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/humanwhocodes/object-schema/issues" + }, + "homepage": "https://github.com/humanwhocodes/object-schema#readme", + "devDependencies": { + "chai": "^4.2.0", + "eslint": "^5.13.0", + "mocha": "^5.2.0" + } +} diff --git a/node_modules/@humanwhocodes/object-schema/src/index.js b/node_modules/@humanwhocodes/object-schema/src/index.js new file mode 100644 index 0000000..b2bc4fb --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/src/index.js @@ -0,0 +1,7 @@ +/** + * @filedescription Object Schema Package + */ + +exports.ObjectSchema = require("./object-schema").ObjectSchema; +exports.MergeStrategy = require("./merge-strategy").MergeStrategy; +exports.ValidationStrategy = require("./validation-strategy").ValidationStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js b/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js new file mode 100644 index 0000000..8217449 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js @@ -0,0 +1,53 @@ +/** + * @filedescription Merge Strategy + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different merge strategies. + */ +class MergeStrategy { + + /** + * Merges two keys by overwriting the first with the second. + * @param {*} value1 The value from the first object key. + * @param {*} value2 The value from the second object key. + * @returns {*} The second value. + */ + static overwrite(value1, value2) { + return value2; + } + + /** + * Merges two keys by replacing the first with the second only if the + * second is defined. + * @param {*} value1 The value from the first object key. + * @param {*} value2 The value from the second object key. + * @returns {*} The second value if it is defined. + */ + static replace(value1, value2) { + if (typeof value2 !== "undefined") { + return value2; + } + + return value1; + } + + /** + * Merges two properties by assigning properties from the second to the first. + * @param {*} value1 The value from the first object key. + * @param {*} value2 The value from the second object key. + * @returns {*} A new object containing properties from both value1 and + * value2. + */ + static assign(value1, value2) { + return Object.assign({}, value1, value2); + } +} + +exports.MergeStrategy = MergeStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/src/object-schema.js b/node_modules/@humanwhocodes/object-schema/src/object-schema.js new file mode 100644 index 0000000..b663236 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/src/object-schema.js @@ -0,0 +1,235 @@ +/** + * @filedescription Object Schema + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const { MergeStrategy } = require("./merge-strategy"); +const { ValidationStrategy } = require("./validation-strategy"); + +//----------------------------------------------------------------------------- +// Private +//----------------------------------------------------------------------------- + +const strategies = Symbol("strategies"); +const requiredKeys = Symbol("requiredKeys"); + +/** + * Validates a schema strategy. + * @param {string} name The name of the key this strategy is for. + * @param {Object} strategy The strategy for the object key. + * @param {boolean} [strategy.required=true] Whether the key is required. + * @param {string[]} [strategy.requires] Other keys that are required when + * this key is present. + * @param {Function} strategy.merge A method to call when merging two objects + * with the same key. + * @param {Function} strategy.validate A method to call when validating an + * object with the key. + * @returns {void} + * @throws {Error} When the strategy is missing a name. + * @throws {Error} When the strategy is missing a merge() method. + * @throws {Error} When the strategy is missing a validate() method. + */ +function validateDefinition(name, strategy) { + + let hasSchema = false; + if (strategy.schema) { + if (typeof strategy.schema === "object") { + hasSchema = true; + } else { + throw new TypeError("Schema must be an object."); + } + } + + if (typeof strategy.merge === "string") { + if (!(strategy.merge in MergeStrategy)) { + throw new TypeError(`Definition for key "${name}" missing valid merge strategy.`); + } + } else if (!hasSchema && typeof strategy.merge !== "function") { + throw new TypeError(`Definition for key "${name}" must have a merge property.`); + } + + if (typeof strategy.validate === "string") { + if (!(strategy.validate in ValidationStrategy)) { + throw new TypeError(`Definition for key "${name}" missing valid validation strategy.`); + } + } else if (!hasSchema && typeof strategy.validate !== "function") { + throw new TypeError(`Definition for key "${name}" must have a validate() method.`); + } +} + + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Represents an object validation/merging schema. + */ +class ObjectSchema { + + /** + * Creates a new instance. + */ + constructor(definitions) { + + if (!definitions) { + throw new Error("Schema definitions missing."); + } + + /** + * Track all strategies in the schema by key. + * @type {Map} + * @property strategies + */ + this[strategies] = new Map(); + + /** + * Separately track any keys that are required for faster validation. + * @type {Map} + * @property requiredKeys + */ + this[requiredKeys] = new Map(); + + // add in all strategies + for (const key of Object.keys(definitions)) { + validateDefinition(key, definitions[key]); + + // normalize merge and validate methods if subschema is present + if (typeof definitions[key].schema === "object") { + const schema = new ObjectSchema(definitions[key].schema); + definitions[key] = { + ...definitions[key], + merge(first = {}, second = {}) { + return schema.merge(first, second); + }, + validate(value) { + ValidationStrategy.object(value); + schema.validate(value); + } + }; + } + + // normalize the merge method in case there's a string + if (typeof definitions[key].merge === "string") { + definitions[key] = { + ...definitions[key], + merge: MergeStrategy[definitions[key].merge] + }; + }; + + // normalize the validate method in case there's a string + if (typeof definitions[key].validate === "string") { + definitions[key] = { + ...definitions[key], + validate: ValidationStrategy[definitions[key].validate] + }; + }; + + this[strategies].set(key, definitions[key]); + + if (definitions[key].required) { + this[requiredKeys].set(key, definitions[key]); + } + } + } + + /** + * Determines if a strategy has been registered for the given object key. + * @param {string} key The object key to find a strategy for. + * @returns {boolean} True if the key has a strategy registered, false if not. + */ + hasKey(key) { + return this[strategies].has(key); + } + + /** + * Merges objects together to create a new object comprised of the keys + * of the all objects. Keys are merged based on the each key's merge + * strategy. + * @param {...Object} objects The objects to merge. + * @returns {Object} A new object with a mix of all objects' keys. + * @throws {Error} If any object is invalid. + */ + merge(...objects) { + + // double check arguments + if (objects.length < 2) { + throw new Error("merge() requires at least two arguments."); + } + + if (objects.some(object => (object == null || typeof object !== "object"))) { + throw new Error("All arguments must be objects."); + } + + return objects.reduce((result, object) => { + + this.validate(object); + + for (const [key, strategy] of this[strategies]) { + try { + if (key in result || key in object) { + const value = strategy.merge.call(this, result[key], object[key]); + if (value !== undefined) { + result[key] = value; + } + } + } catch (ex) { + ex.message = `Key "${key}": ` + ex.message; + throw ex; + } + } + return result; + }, {}); + } + + /** + * Validates an object's keys based on the validate strategy for each key. + * @param {Object} object The object to validate. + * @returns {void} + * @throws {Error} When the object is invalid. + */ + validate(object) { + + // check existing keys first + for (const key of Object.keys(object)) { + + // check to see if the key is defined + if (!this.hasKey(key)) { + throw new Error(`Unexpected key "${key}" found.`); + } + + // validate existing keys + const strategy = this[strategies].get(key); + + // first check to see if any other keys are required + if (Array.isArray(strategy.requires)) { + if (!strategy.requires.every(otherKey => otherKey in object)) { + throw new Error(`Key "${key}" requires keys "${strategy.requires.join("\", \"")}".`); + } + } + + // now apply remaining validation strategy + try { + strategy.validate.call(strategy, object[key]); + } catch (ex) { + ex.message = `Key "${key}": ` + ex.message; + throw ex; + } + } + + // ensure required keys aren't missing + for (const [key] of this[requiredKeys]) { + if (!(key in object)) { + throw new Error(`Missing required key "${key}".`); + } + } + + } +} + +exports.ObjectSchema = ObjectSchema; diff --git a/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js b/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js new file mode 100644 index 0000000..ecf918b --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js @@ -0,0 +1,102 @@ +/** + * @filedescription Validation Strategy + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different validation strategies. + */ +class ValidationStrategy { + + /** + * Validates that a value is an array. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static array(value) { + if (!Array.isArray(value)) { + throw new TypeError("Expected an array."); + } + } + + /** + * Validates that a value is a boolean. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static boolean(value) { + if (typeof value !== "boolean") { + throw new TypeError("Expected a Boolean."); + } + } + + /** + * Validates that a value is a number. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static number(value) { + if (typeof value !== "number") { + throw new TypeError("Expected a number."); + } + } + + /** + * Validates that a value is a object. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static object(value) { + if (!value || typeof value !== "object") { + throw new TypeError("Expected an object."); + } + } + + /** + * Validates that a value is a object or null. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "object?"(value) { + if (typeof value !== "object") { + throw new TypeError("Expected an object or null."); + } + } + + /** + * Validates that a value is a string. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static string(value) { + if (typeof value !== "string") { + throw new TypeError("Expected a string."); + } + } + + /** + * Validates that a value is a non-empty string. + * @param {*} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "string!"(value) { + if (typeof value !== "string" || value.length === 0) { + throw new TypeError("Expected a non-empty string."); + } + } + +} + +exports.ValidationStrategy = ValidationStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js b/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js new file mode 100644 index 0000000..84032d7 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js @@ -0,0 +1,66 @@ +/** + * @filedescription Merge Strategy Tests + */ +/* global it, describe, beforeEach */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const assert = require("chai").assert; +const { MergeStrategy } = require("../src/"); + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +describe("MergeStrategy", () => { + + + describe("overwrite()", () => { + + it("should overwrite the first value with the second when the second is defined", () => { + const result = MergeStrategy.overwrite(1, 2); + assert.strictEqual(result, 2); + }); + + it("should overwrite the first value with the second when the second is undefined", () => { + const result = MergeStrategy.overwrite(1, undefined); + assert.strictEqual(result, undefined); + }); + + }); + + describe("replace()", () => { + + it("should overwrite the first value with the second when the second is defined", () => { + const result = MergeStrategy.replace(1, 2); + assert.strictEqual(result, 2); + }); + + it("should return the first value when the second is undefined", () => { + const result = MergeStrategy.replace(1, undefined); + assert.strictEqual(result, 1); + }); + + }); + + describe("assign()", () => { + + it("should merge properties from two objects when called", () => { + + const object1 = { foo: 1, bar: 3 }; + const object2 = { foo: 2 }; + + const result = MergeStrategy.assign(object1, object2); + assert.deepStrictEqual(result, { + foo: 2, + bar: 3 + }); + }); + + }); + +}); diff --git a/node_modules/@humanwhocodes/object-schema/tests/object-schema.js b/node_modules/@humanwhocodes/object-schema/tests/object-schema.js new file mode 100644 index 0000000..d86ef6e --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/tests/object-schema.js @@ -0,0 +1,611 @@ +/** + * @filedescription Object Schema Tests + */ +/* global it, describe, beforeEach */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const assert = require("chai").assert; +const { ObjectSchema } = require("../src/"); + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +describe("ObjectSchema", () => { + + let schema; + + describe("new ObjectSchema()", () => { + + it("should add a new key when a strategy is passed", () => { + schema = new ObjectSchema({ + foo: { + merge() {}, + validate() {} + } + }); + + assert.isTrue(schema.hasKey("foo")); + }); + + it("should throw an error when a strategy is missing a merge() method", () => { + assert.throws(() => { + schema = new ObjectSchema({ + foo: { + validate() { } + } + }); + }, /Definition for key "foo" must have a merge property/); + }); + + it("should throw an error when a strategy is missing a merge() method", () => { + assert.throws(() => { + schema = new ObjectSchema(); + }, /Schema definitions missing/); + }); + + it("should throw an error when a strategy is missing a validate() method", () => { + assert.throws(() => { + schema = new ObjectSchema({ + foo: { + merge() { }, + } + }); + }, /Definition for key "foo" must have a validate\(\) method/); + }); + + it("should throw an error when merge is an invalid string", () => { + assert.throws(() => { + new ObjectSchema({ + foo: { + merge: "bar", + validate() { } + } + }); + }, /key "foo" missing valid merge strategy/); + }); + + it("should throw an error when validate is an invalid string", () => { + assert.throws(() => { + new ObjectSchema({ + foo: { + merge: "assign", + validate: "s" + } + }); + }, /key "foo" missing valid validation strategy/); + }); + + }); + + + describe("merge()", () => { + + it("should throw an error when an unexpected key is found", () => { + let schema = new ObjectSchema({}); + + assert.throws(() => { + schema.merge({ foo: true }, { foo: true }); + }, /Unexpected key "foo"/); + }); + + it("should throw an error when merge() throws an error", () => { + let schema = new ObjectSchema({ + foo: { + merge() { + throw new Error("Boom!"); + }, + validate() {} + } + }); + + assert.throws(() => { + schema.merge({ foo: true }, { foo: true }); + }, /Key "foo": Boom!/); + + }); + + it("should call the merge() strategy for one key when called", () => { + + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() {} + } + }); + + const result = schema.merge({ foo: true }, { foo: false }); + assert.propertyVal(result, "foo", "bar"); + }); + + it("should not call the merge() strategy when both objects don't contain the key", () => { + + let called = false; + + schema = new ObjectSchema({ + foo: { + merge() { + called = true; + }, + validate() {} + } + }); + + schema.merge({}, {}); + assert.isFalse(called, "The merge() strategy should not have been called."); + }); + + it("should omit returning the key when the merge() strategy returns undefined", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return undefined; + }, + validate() { } + } + }); + + const result = schema.merge({ foo: true }, { foo: false }); + assert.notProperty(result, "foo"); + }); + + it("should call the merge() strategy for two keys when called", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() { } + }, + bar: { + merge() { + return "baz"; + }, + validate() {} + } + }); + + const result = schema.merge({ foo: true, bar: 1 }, { foo: true, bar: 2 }); + assert.propertyVal(result, "foo", "bar"); + assert.propertyVal(result, "bar", "baz"); + }); + + it("should call the merge() strategy for two keys when called on three objects", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() { } + }, + bar: { + merge() { + return "baz"; + }, + validate() { } + } + }); + + const result = schema.merge( + { foo: true, bar: 1 }, + { foo: true, bar: 3 }, + { foo: false, bar: 2 } + ); + assert.propertyVal(result, "foo", "bar"); + assert.propertyVal(result, "bar", "baz"); + }); + + it("should call the merge() strategy when defined as 'overwrite'", () => { + schema = new ObjectSchema({ + foo: { + merge: "overwrite", + validate() { } + } + }); + + const result = schema.merge( + { foo: true }, + { foo: false } + ); + assert.propertyVal(result, "foo", false); + }); + + it("should call the merge() strategy when defined as 'assign'", () => { + schema = new ObjectSchema({ + foo: { + merge: "assign", + validate() { } + } + }); + + const result = schema.merge( + { foo: { bar: true } }, + { foo: { baz: false } } + ); + + assert.strictEqual(result.foo.bar, true); + assert.strictEqual(result.foo.baz, false); + }); + + it("should call the merge strategy when there's a subschema", () => { + + schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } + }); + + const result = schema.merge({ + name: { + first: "n", + last: "z" + } + }, { + name: { + first: "g" + } + }); + + assert.strictEqual(result.name.first, "g"); + assert.strictEqual(result.name.last, "z"); + }); + + it("should return separate objects when using subschema", () => { + + schema = new ObjectSchema({ + age: { + merge: "replace", + validate: "number" + }, + address: { + schema: { + street: { + schema: { + number: { + merge: "replace", + validate: "number" + }, + streetName: { + merge: "replace", + validate: "string" + } + } + }, + state: { + merge: "replace", + validate: "string" + } + } + } + }); + + const baseObject = { + address: { + street: { + number: 100, + streetName: "Foo St" + }, + state: "HA" + } + }; + + const result = schema.merge(baseObject, { + age: 29 + }); + + assert.notStrictEqual(result.address.street, baseObject.address.street); + assert.deepStrictEqual(result.address, baseObject.address); + }); + + it("should not error when calling the merge strategy when there's a subschema and no matching key in second object", () => { + + schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } + }); + + const result = schema.merge({ + name: { + first: "n", + last: "z" + } + }, { + }); + + assert.strictEqual(result.name.first, "n"); + assert.strictEqual(result.name.last, "z"); + }); + + it("should not error when calling the merge strategy when there's multiple subschemas and no matching key in second object", () => { + + schema = new ObjectSchema({ + user: { + schema: { + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } + + } + } + }); + + const result = schema.merge({ + user: { + name: { + first: "n", + last: "z" + } + } + }, { + }); + + assert.strictEqual(result.user.name.first, "n"); + assert.strictEqual(result.user.name.last, "z"); + }); + + + }); + + describe("validate()", () => { + + it("should throw an error when an unexpected key is found", () => { + let schema = new ObjectSchema({}); + assert.throws(() => { + schema.validate({ foo: true }); + }, /Unexpected key "foo"/); + }); + + it("should not throw an error when an expected key is found", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() {} + } + }); + + schema.validate({ foo: true }); + }); + + it("should pass the property value into validate() when key is found", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate(value) { + assert.isTrue(value); + } + } + }); + + schema.validate({ foo: true }); + }); + + it("should not throw an error when expected keys are found", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() {} + }, + bar: { + merge() { + return "baz"; + }, + validate() {} + } + }); + + schema.validate({ foo: true, bar: true }); + }); + + it("should not throw an error when expected keys are found with required keys", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() { } + }, + bar: { + requires: ["foo"], + merge() { + return "baz"; + }, + validate() { } + } + }); + + schema.validate({ foo: true, bar: true }); + }); + + it("should throw an error when expected keys are found without required keys", () => { + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() { } + }, + baz: { + merge() { + return "baz"; + }, + validate() { } + }, + bar: { + name: "bar", + requires: ["foo", "baz"], + merge() { }, + validate() { } + } + }); + + assert.throws(() => { + schema.validate({ bar: true }); + }, /Key "bar" requires keys "foo", "baz"./); + }); + + + it("should throw an error when an expected key is found but is invalid", () => { + + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate() { + throw new Error("Invalid key."); + } + } + }); + + assert.throws(() => { + schema.validate({ foo: true }); + }, /Key "foo": Invalid key/); + }); + + it("should throw an error when an expected key is found but is invalid with a string validator", () => { + + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate: "string" + } + }); + + assert.throws(() => { + schema.validate({ foo: true }); + }, /Key "foo": Expected a string/); + }); + + it("should throw an error when an expected key is found but is invalid with a number validator", () => { + + schema = new ObjectSchema({ + foo: { + merge() { + return "bar"; + }, + validate: "number" + } + }); + + assert.throws(() => { + schema.validate({ foo: true }); + }, /Key "foo": Expected a number/); + }); + + it("should throw an error when a required key is missing", () => { + + schema = new ObjectSchema({ + foo: { + required: true, + merge() { + return "bar"; + }, + validate() {} + } + }); + + assert.throws(() => { + schema.validate({}); + }, /Missing required key "foo"/); + }); + + it("should throw an error when a subschema is provided and the value doesn't validate", () => { + + schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } + }); + + assert.throws(() => { + schema.validate({ + name: { + first: 123, + last: "z" + } + }); + + }, /Key "name": Key "first": Expected a string/); + }); + + it("should not throw an error when a subschema is provided and the value validates", () => { + + schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string" + }, + last: { + merge: "replace", + validate: "string" + } + } + } + }); + + schema.validate({ + name: { + first: "n", + last: "z" + } + }); + + }); + + }); + +}); diff --git a/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js b/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js new file mode 100644 index 0000000..5d3e4a2 --- /dev/null +++ b/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js @@ -0,0 +1,186 @@ +/** + * @filedescription Merge Strategy Tests + */ +/* global it, describe, beforeEach */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const assert = require("chai").assert; +const { ValidationStrategy } = require("../src/"); + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +describe("ValidationStrategy", () => { + + describe("boolean", () => { + it("should not throw an error when the value is a boolean", () => { + ValidationStrategy.boolean(true); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy.boolean(null); + }, /Expected a Boolean/); + }); + + it("should throw an error when the value is a string", () => { + assert.throws(() => { + ValidationStrategy.boolean("foo"); + }, /Expected a Boolean/); + }); + + it("should throw an error when the value is a number", () => { + assert.throws(() => { + ValidationStrategy.boolean(123); + }, /Expected a Boolean/); + }); + + it("should throw an error when the value is an object", () => { + assert.throws(() => { + ValidationStrategy.boolean({}); + }, /Expected a Boolean/); + }); + }); + + describe("number", () => { + it("should not throw an error when the value is a number", () => { + ValidationStrategy.number(25); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy.number(null); + }, /Expected a number/); + }); + + it("should throw an error when the value is a string", () => { + assert.throws(() => { + ValidationStrategy.number("foo"); + }, /Expected a number/); + }); + + it("should throw an error when the value is a boolean", () => { + assert.throws(() => { + ValidationStrategy.number(true); + }, /Expected a number/); + }); + + it("should throw an error when the value is an object", () => { + assert.throws(() => { + ValidationStrategy.number({}); + }, /Expected a number/); + }); + }); + + describe("object", () => { + it("should not throw an error when the value is an object", () => { + ValidationStrategy.object({}); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy.object(null); + }, /Expected an object/); + }); + + it("should throw an error when the value is a string", () => { + assert.throws(() => { + ValidationStrategy.object(""); + }, /Expected an object/); + }); + }); + + describe("array", () => { + it("should not throw an error when the value is an array", () => { + ValidationStrategy.array([]); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy.array(null); + }, /Expected an array/); + }); + + it("should throw an error when the value is a string", () => { + assert.throws(() => { + ValidationStrategy.array(""); + }, /Expected an array/); + }); + + it("should throw an error when the value is an object", () => { + assert.throws(() => { + ValidationStrategy.array({}); + }, /Expected an array/); + }); + }); + + describe("object?", () => { + it("should not throw an error when the value is an object", () => { + ValidationStrategy["object?"]({}); + }); + + it("should not throw an error when the value is null", () => { + ValidationStrategy["object?"](null); + }); + + it("should throw an error when the value is a string", () => { + assert.throws(() => { + ValidationStrategy["object?"](""); + }, /Expected an object/); + }); + }); + + describe("string", () => { + it("should not throw an error when the value is a string", () => { + ValidationStrategy.string("foo"); + }); + + it("should not throw an error when the value is an empty string", () => { + ValidationStrategy.string(""); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy.string(null); + }, /Expected a string/); + }); + + it("should throw an error when the value is an object", () => { + assert.throws(() => { + ValidationStrategy.string({}); + }, /Expected a string/); + }); + }); + + describe("string!", () => { + it("should not throw an error when the value is an string", () => { + ValidationStrategy["string!"]("foo"); + }); + + it("should throw an error when the value is an empty string", () => { + assert.throws(() => { + ValidationStrategy["string!"](""); + }, /Expected a non-empty string/); + }); + + it("should throw an error when the value is null", () => { + assert.throws(() => { + ValidationStrategy["string!"](null); + }, /Expected a non-empty string/); + }); + + it("should throw an error when the value is an object", () => { + assert.throws(() => { + ValidationStrategy["string!"]({}); + }, /Expected a non-empty string/); + }); + }); + + +}); diff --git a/node_modules/@types/json5/README.md b/node_modules/@types/json5/README.md new file mode 100644 index 0000000..ea81c5c --- /dev/null +++ b/node_modules/@types/json5/README.md @@ -0,0 +1,18 @@ +# Installation +> `npm install --save @types/json5` + +# Summary +This package contains type definitions for JSON5 (http://json5.org/). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/json5 + +Additional Details + * Last updated: Mon, 19 Sep 2016 17:28:59 GMT + * File structure: ProperModule + * Library Dependencies: none + * Module Dependencies: none + * Global values: json5 + +# Credits +These definitions were written by Jason Swearingen . diff --git a/node_modules/@types/json5/index.d.ts b/node_modules/@types/json5/index.d.ts new file mode 100644 index 0000000..76a0352 --- /dev/null +++ b/node_modules/@types/json5/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for JSON5 +// Project: http://json5.org/ +// Definitions by: Jason Swearingen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +//commonjs loader + +/** + * The following is the exact list of additions to JSON's syntax introduced by JSON5. All of these are optional, and all of these come from ES5. + +Objects + +Object keys can be unquoted if they're valid identifiers. Yes, even reserved keywords (like default) are valid unquoted keys in ES5 [§11.1.5, §7.6]. (More info) + +(TODO: Unicode characters and escape sequences aren’t yet supported in this implementation.) + +Objects can have trailing commas. + +Arrays + +Arrays can have trailing commas. +Strings + +Strings can be single-quoted. + +Strings can be split across multiple lines; just prefix each newline with a backslash. [ES5 §7.8.4] + +Numbers + +Numbers can be hexadecimal (base 16). + +Numbers can begin or end with a (leading or trailing) decimal point. + +Numbers can include Infinity, -Infinity, NaN, and -NaN. + +Numbers can begin with an explicit plus sign. + +Comments + +Both inline (single-line) and block (multi-line) comments are allowed. + */ +declare var json5: JSON; +export = json5; diff --git a/node_modules/@types/json5/package.json b/node_modules/@types/json5/package.json new file mode 100644 index 0000000..ff784d5 --- /dev/null +++ b/node_modules/@types/json5/package.json @@ -0,0 +1,16 @@ +{ + "name": "@types/json5", + "version": "0.0.29", + "description": "TypeScript definitions for JSON5", + "license": "MIT", + "author": "Jason Swearingen ", + "main": "", + "repository": { + "type": "git", + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "typings": "index.d.ts", + "typesPublisherContentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331" +} \ No newline at end of file diff --git a/node_modules/@types/json5/types-metadata.json b/node_modules/@types/json5/types-metadata.json new file mode 100644 index 0000000..1c02afe --- /dev/null +++ b/node_modules/@types/json5/types-metadata.json @@ -0,0 +1,25 @@ +{ + "authors": "Jason Swearingen ", + "definitionFilename": "index.d.ts", + "libraryDependencies": [], + "moduleDependencies": [], + "libraryMajorVersion": "0", + "libraryMinorVersion": "0", + "libraryName": "JSON5", + "typingsPackageName": "json5", + "projectName": "http://json5.org/", + "sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped", + "sourceBranch": "types-2.0", + "kind": "ProperModule", + "globals": [ + "json5" + ], + "declaredModules": [ + "json5" + ], + "files": [ + "index.d.ts" + ], + "hasPackageJson": false, + "contentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331" +} \ No newline at end of file diff --git a/node_modules/acorn-jsx/LICENSE b/node_modules/acorn-jsx/LICENSE new file mode 100644 index 0000000..695d4b9 --- /dev/null +++ b/node_modules/acorn-jsx/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2012-2017 by Ingvar Stepanyan + +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/acorn-jsx/README.md b/node_modules/acorn-jsx/README.md new file mode 100644 index 0000000..317c3ac --- /dev/null +++ b/node_modules/acorn-jsx/README.md @@ -0,0 +1,40 @@ +# Acorn-JSX + +[![Build Status](https://travis-ci.org/acornjs/acorn-jsx.svg?branch=master)](https://travis-ci.org/acornjs/acorn-jsx) +[![NPM version](https://img.shields.io/npm/v/acorn-jsx.svg)](https://www.npmjs.org/package/acorn-jsx) + +This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript. + +It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. Later, it replaced the [official parser](https://github.com/facebookarchive/esprima) and these days is used by many prominent development tools. + +## Transpiler + +Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out [Babel](https://babeljs.io/) and [Buble](https://buble.surge.sh/) transpilers which use `acorn-jsx` under the hood. + +## Usage + +Requiring this module provides you with an Acorn plugin that you can use like this: + +```javascript +var acorn = require("acorn"); +var jsx = require("acorn-jsx"); +acorn.Parser.extend(jsx()).parse("my(, 'code');"); +``` + +Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in ``, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option: + +```javascript +acorn.Parser.extend(jsx({ allowNamespacedObjects: true })) +``` + +Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely: + +```javascript +acorn.Parser.extend(jsx({ allowNamespaces: false })) +``` + +Note that by default `allowNamespaces` is enabled for spec compliancy. + +## License + +This plugin is issued under the [MIT license](./LICENSE). diff --git a/node_modules/acorn-jsx/index.d.ts b/node_modules/acorn-jsx/index.d.ts new file mode 100644 index 0000000..f37b1df --- /dev/null +++ b/node_modules/acorn-jsx/index.d.ts @@ -0,0 +1,12 @@ +import { Parser } from 'acorn' + +declare const jsx: (options?: jsx.Options) => (BaseParser: typeof Parser) => typeof Parser; + +declare namespace jsx { + interface Options { + allowNamespacedObjects?: boolean; + allowNamespaces?: boolean; + } +} + +export = jsx; diff --git a/node_modules/acorn-jsx/index.js b/node_modules/acorn-jsx/index.js new file mode 100644 index 0000000..004e080 --- /dev/null +++ b/node_modules/acorn-jsx/index.js @@ -0,0 +1,488 @@ +'use strict'; + +const XHTMLEntities = require('./xhtml'); + +const hexNumber = /^[\da-fA-F]+$/; +const decimalNumber = /^\d+$/; + +// The map to `acorn-jsx` tokens from `acorn` namespace objects. +const acornJsxMap = new WeakMap(); + +// Get the original tokens for the given `acorn` namespace object. +function getJsxTokens(acorn) { + acorn = acorn.Parser.acorn || acorn; + let acornJsx = acornJsxMap.get(acorn); + if (!acornJsx) { + const tt = acorn.tokTypes; + const TokContext = acorn.TokContext; + const TokenType = acorn.TokenType; + const tc_oTag = new TokContext('...', true, true); + const tokContexts = { + tc_oTag: tc_oTag, + tc_cTag: tc_cTag, + tc_expr: tc_expr + }; + const tokTypes = { + jsxName: new TokenType('jsxName'), + jsxText: new TokenType('jsxText', {beforeExpr: true}), + jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}), + jsxTagEnd: new TokenType('jsxTagEnd') + }; + + tokTypes.jsxTagStart.updateContext = function() { + this.context.push(tc_expr); // treat as beginning of JSX expression + this.context.push(tc_oTag); // start opening tag context + this.exprAllowed = false; + }; + tokTypes.jsxTagEnd.updateContext = function(prevType) { + let out = this.context.pop(); + if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) { + this.context.pop(); + this.exprAllowed = this.curContext() === tc_expr; + } else { + this.exprAllowed = true; + } + }; + + acornJsx = { tokContexts: tokContexts, tokTypes: tokTypes }; + acornJsxMap.set(acorn, acornJsx); + } + + return acornJsx; +} + +// Transforms JSX element name to string. + +function getQualifiedJSXName(object) { + if (!object) + return object; + + if (object.type === 'JSXIdentifier') + return object.name; + + if (object.type === 'JSXNamespacedName') + return object.namespace.name + ':' + object.name.name; + + if (object.type === 'JSXMemberExpression') + return getQualifiedJSXName(object.object) + '.' + + getQualifiedJSXName(object.property); +} + +module.exports = function(options) { + options = options || {}; + return function(Parser) { + return plugin({ + allowNamespaces: options.allowNamespaces !== false, + allowNamespacedObjects: !!options.allowNamespacedObjects + }, Parser); + }; +}; + +// This is `tokTypes` of the peer dep. +// This can be different instances from the actual `tokTypes` this plugin uses. +Object.defineProperty(module.exports, "tokTypes", { + get: function get_tokTypes() { + return getJsxTokens(require("acorn")).tokTypes; + }, + configurable: true, + enumerable: true +}); + +function plugin(options, Parser) { + const acorn = Parser.acorn || require("acorn"); + const acornJsx = getJsxTokens(acorn); + const tt = acorn.tokTypes; + const tok = acornJsx.tokTypes; + const tokContexts = acorn.tokContexts; + const tc_oTag = acornJsx.tokContexts.tc_oTag; + const tc_cTag = acornJsx.tokContexts.tc_cTag; + const tc_expr = acornJsx.tokContexts.tc_expr; + const isNewLine = acorn.isNewLine; + const isIdentifierStart = acorn.isIdentifierStart; + const isIdentifierChar = acorn.isIdentifierChar; + + return class extends Parser { + // Expose actual `tokTypes` and `tokContexts` to other plugins. + static get acornJsx() { + return acornJsx; + } + + // Reads inline JSX contents token. + jsx_readToken() { + let out = '', chunkStart = this.pos; + for (;;) { + if (this.pos >= this.input.length) + this.raise(this.start, 'Unterminated JSX contents'); + let ch = this.input.charCodeAt(this.pos); + + switch (ch) { + case 60: // '<' + case 123: // '{' + if (this.pos === this.start) { + if (ch === 60 && this.exprAllowed) { + ++this.pos; + return this.finishToken(tok.jsxTagStart); + } + return this.getTokenFromCode(ch); + } + out += this.input.slice(chunkStart, this.pos); + return this.finishToken(tok.jsxText, out); + + case 38: // '&' + out += this.input.slice(chunkStart, this.pos); + out += this.jsx_readEntity(); + chunkStart = this.pos; + break; + + case 62: // '>' + case 125: // '}' + this.raise( + this.pos, + "Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + + (ch === 62 ? ">" : "}") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?" + ); + + default: + if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.pos); + out += this.jsx_readNewLine(true); + chunkStart = this.pos; + } else { + ++this.pos; + } + } + } + } + + jsx_readNewLine(normalizeCRLF) { + let ch = this.input.charCodeAt(this.pos); + let out; + ++this.pos; + if (ch === 13 && this.input.charCodeAt(this.pos) === 10) { + ++this.pos; + out = normalizeCRLF ? '\n' : '\r\n'; + } else { + out = String.fromCharCode(ch); + } + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + + return out; + } + + jsx_readString(quote) { + let out = '', chunkStart = ++this.pos; + for (;;) { + if (this.pos >= this.input.length) + this.raise(this.start, 'Unterminated string constant'); + let ch = this.input.charCodeAt(this.pos); + if (ch === quote) break; + if (ch === 38) { // '&' + out += this.input.slice(chunkStart, this.pos); + out += this.jsx_readEntity(); + chunkStart = this.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.pos); + out += this.jsx_readNewLine(false); + chunkStart = this.pos; + } else { + ++this.pos; + } + } + out += this.input.slice(chunkStart, this.pos++); + return this.finishToken(tt.string, out); + } + + jsx_readEntity() { + let str = '', count = 0, entity; + let ch = this.input[this.pos]; + if (ch !== '&') + this.raise(this.pos, 'Entity must start with an ampersand'); + let startPos = ++this.pos; + while (this.pos < this.input.length && count++ < 10) { + ch = this.input[this.pos++]; + if (ch === ';') { + if (str[0] === '#') { + if (str[1] === 'x') { + str = str.substr(2); + if (hexNumber.test(str)) + entity = String.fromCharCode(parseInt(str, 16)); + } else { + str = str.substr(1); + if (decimalNumber.test(str)) + entity = String.fromCharCode(parseInt(str, 10)); + } + } else { + entity = XHTMLEntities[str]; + } + break; + } + str += ch; + } + if (!entity) { + this.pos = startPos; + return '&'; + } + return entity; + } + + // Read a JSX identifier (valid tag or attribute name). + // + // Optimized version since JSX identifiers can't contain + // escape characters and so can be read as single slice. + // Also assumes that first character was already checked + // by isIdentifierStart in readToken. + + jsx_readWord() { + let ch, start = this.pos; + do { + ch = this.input.charCodeAt(++this.pos); + } while (isIdentifierChar(ch) || ch === 45); // '-' + return this.finishToken(tok.jsxName, this.input.slice(start, this.pos)); + } + + // Parse next token as JSX identifier + + jsx_parseIdentifier() { + let node = this.startNode(); + if (this.type === tok.jsxName) + node.name = this.value; + else if (this.type.keyword) + node.name = this.type.keyword; + else + this.unexpected(); + this.next(); + return this.finishNode(node, 'JSXIdentifier'); + } + + // Parse namespaced identifier. + + jsx_parseNamespacedName() { + let startPos = this.start, startLoc = this.startLoc; + let name = this.jsx_parseIdentifier(); + if (!options.allowNamespaces || !this.eat(tt.colon)) return name; + var node = this.startNodeAt(startPos, startLoc); + node.namespace = name; + node.name = this.jsx_parseIdentifier(); + return this.finishNode(node, 'JSXNamespacedName'); + } + + // Parses element name in any form - namespaced, member + // or single identifier. + + jsx_parseElementName() { + if (this.type === tok.jsxTagEnd) return ''; + let startPos = this.start, startLoc = this.startLoc; + let node = this.jsx_parseNamespacedName(); + if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !options.allowNamespacedObjects) { + this.unexpected(); + } + while (this.eat(tt.dot)) { + let newNode = this.startNodeAt(startPos, startLoc); + newNode.object = node; + newNode.property = this.jsx_parseIdentifier(); + node = this.finishNode(newNode, 'JSXMemberExpression'); + } + return node; + } + + // Parses any type of JSX attribute value. + + jsx_parseAttributeValue() { + switch (this.type) { + case tt.braceL: + let node = this.jsx_parseExpressionContainer(); + if (node.expression.type === 'JSXEmptyExpression') + this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression'); + return node; + + case tok.jsxTagStart: + case tt.string: + return this.parseExprAtom(); + + default: + this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text'); + } + } + + // JSXEmptyExpression is unique type since it doesn't actually parse anything, + // and so it should start at the end of last read token (left brace) and finish + // at the beginning of the next one (right brace). + + jsx_parseEmptyExpression() { + let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc); + return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc); + } + + // Parses JSX expression enclosed into curly brackets. + + jsx_parseExpressionContainer() { + let node = this.startNode(); + this.next(); + node.expression = this.type === tt.braceR + ? this.jsx_parseEmptyExpression() + : this.parseExpression(); + this.expect(tt.braceR); + return this.finishNode(node, 'JSXExpressionContainer'); + } + + // Parses following JSX attribute name-value pair. + + jsx_parseAttribute() { + let node = this.startNode(); + if (this.eat(tt.braceL)) { + this.expect(tt.ellipsis); + node.argument = this.parseMaybeAssign(); + this.expect(tt.braceR); + return this.finishNode(node, 'JSXSpreadAttribute'); + } + node.name = this.jsx_parseNamespacedName(); + node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null; + return this.finishNode(node, 'JSXAttribute'); + } + + // Parses JSX opening tag starting after '<'. + + jsx_parseOpeningElementAt(startPos, startLoc) { + let node = this.startNodeAt(startPos, startLoc); + node.attributes = []; + let nodeName = this.jsx_parseElementName(); + if (nodeName) node.name = nodeName; + while (this.type !== tt.slash && this.type !== tok.jsxTagEnd) + node.attributes.push(this.jsx_parseAttribute()); + node.selfClosing = this.eat(tt.slash); + this.expect(tok.jsxTagEnd); + return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment'); + } + + // Parses JSX closing tag starting after ''); + } + } + let fragmentOrElement = openingElement.name ? 'Element' : 'Fragment'; + + node['opening' + fragmentOrElement] = openingElement; + node['closing' + fragmentOrElement] = closingElement; + node.children = children; + if (this.type === tt.relational && this.value === "<") { + this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag"); + } + return this.finishNode(node, 'JSX' + fragmentOrElement); + } + + // Parse JSX text + + jsx_parseText() { + let node = this.parseLiteral(this.value); + node.type = "JSXText"; + return node; + } + + // Parses entire JSX element from current position. + + jsx_parseElement() { + let startPos = this.start, startLoc = this.startLoc; + this.next(); + return this.jsx_parseElementAt(startPos, startLoc); + } + + parseExprAtom(refShortHandDefaultPos) { + if (this.type === tok.jsxText) + return this.jsx_parseText(); + else if (this.type === tok.jsxTagStart) + return this.jsx_parseElement(); + else + return super.parseExprAtom(refShortHandDefaultPos); + } + + readToken(code) { + let context = this.curContext(); + + if (context === tc_expr) return this.jsx_readToken(); + + if (context === tc_oTag || context === tc_cTag) { + if (isIdentifierStart(code)) return this.jsx_readWord(); + + if (code == 62) { + ++this.pos; + return this.finishToken(tok.jsxTagEnd); + } + + if ((code === 34 || code === 39) && context == tc_oTag) + return this.jsx_readString(code); + } + + if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) { + ++this.pos; + return this.finishToken(tok.jsxTagStart); + } + return super.readToken(code); + } + + updateContext(prevType) { + if (this.type == tt.braceL) { + var curContext = this.curContext(); + if (curContext == tc_oTag) this.context.push(tokContexts.b_expr); + else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl); + else super.updateContext(prevType); + this.exprAllowed = true; + } else if (this.type === tt.slash && prevType === tok.jsxTagStart) { + this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore + this.context.push(tc_cTag); // reconsider as closing tag context + this.exprAllowed = false; + } else { + return super.updateContext(prevType); + } + } + }; +} diff --git a/node_modules/acorn-jsx/package.json b/node_modules/acorn-jsx/package.json new file mode 100644 index 0000000..6debde9 --- /dev/null +++ b/node_modules/acorn-jsx/package.json @@ -0,0 +1,27 @@ +{ + "name": "acorn-jsx", + "description": "Modern, fast React.js JSX parser", + "homepage": "https://github.com/acornjs/acorn-jsx", + "version": "5.3.2", + "maintainers": [ + { + "name": "Ingvar Stepanyan", + "email": "me@rreverser.com", + "web": "http://rreverser.com/" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/acornjs/acorn-jsx" + }, + "license": "MIT", + "scripts": { + "test": "node test/run.js" + }, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "devDependencies": { + "acorn": "^8.0.1" + } +} diff --git a/node_modules/acorn-jsx/xhtml.js b/node_modules/acorn-jsx/xhtml.js new file mode 100644 index 0000000..c152009 --- /dev/null +++ b/node_modules/acorn-jsx/xhtml.js @@ -0,0 +1,255 @@ +module.exports = { + quot: '\u0022', + amp: '&', + apos: '\u0027', + lt: '<', + gt: '>', + nbsp: '\u00A0', + iexcl: '\u00A1', + cent: '\u00A2', + pound: '\u00A3', + curren: '\u00A4', + yen: '\u00A5', + brvbar: '\u00A6', + sect: '\u00A7', + uml: '\u00A8', + copy: '\u00A9', + ordf: '\u00AA', + laquo: '\u00AB', + not: '\u00AC', + shy: '\u00AD', + reg: '\u00AE', + macr: '\u00AF', + deg: '\u00B0', + plusmn: '\u00B1', + sup2: '\u00B2', + sup3: '\u00B3', + acute: '\u00B4', + micro: '\u00B5', + para: '\u00B6', + middot: '\u00B7', + cedil: '\u00B8', + sup1: '\u00B9', + ordm: '\u00BA', + raquo: '\u00BB', + frac14: '\u00BC', + frac12: '\u00BD', + frac34: '\u00BE', + iquest: '\u00BF', + Agrave: '\u00C0', + Aacute: '\u00C1', + Acirc: '\u00C2', + Atilde: '\u00C3', + Auml: '\u00C4', + Aring: '\u00C5', + AElig: '\u00C6', + Ccedil: '\u00C7', + Egrave: '\u00C8', + Eacute: '\u00C9', + Ecirc: '\u00CA', + Euml: '\u00CB', + Igrave: '\u00CC', + Iacute: '\u00CD', + Icirc: '\u00CE', + Iuml: '\u00CF', + ETH: '\u00D0', + Ntilde: '\u00D1', + Ograve: '\u00D2', + Oacute: '\u00D3', + Ocirc: '\u00D4', + Otilde: '\u00D5', + Ouml: '\u00D6', + times: '\u00D7', + Oslash: '\u00D8', + Ugrave: '\u00D9', + Uacute: '\u00DA', + Ucirc: '\u00DB', + Uuml: '\u00DC', + Yacute: '\u00DD', + THORN: '\u00DE', + szlig: '\u00DF', + agrave: '\u00E0', + aacute: '\u00E1', + acirc: '\u00E2', + atilde: '\u00E3', + auml: '\u00E4', + aring: '\u00E5', + aelig: '\u00E6', + ccedil: '\u00E7', + egrave: '\u00E8', + eacute: '\u00E9', + ecirc: '\u00EA', + euml: '\u00EB', + igrave: '\u00EC', + iacute: '\u00ED', + icirc: '\u00EE', + iuml: '\u00EF', + eth: '\u00F0', + ntilde: '\u00F1', + ograve: '\u00F2', + oacute: '\u00F3', + ocirc: '\u00F4', + otilde: '\u00F5', + ouml: '\u00F6', + divide: '\u00F7', + oslash: '\u00F8', + ugrave: '\u00F9', + uacute: '\u00FA', + ucirc: '\u00FB', + uuml: '\u00FC', + yacute: '\u00FD', + thorn: '\u00FE', + yuml: '\u00FF', + OElig: '\u0152', + oelig: '\u0153', + Scaron: '\u0160', + scaron: '\u0161', + Yuml: '\u0178', + fnof: '\u0192', + circ: '\u02C6', + tilde: '\u02DC', + Alpha: '\u0391', + Beta: '\u0392', + Gamma: '\u0393', + Delta: '\u0394', + Epsilon: '\u0395', + Zeta: '\u0396', + Eta: '\u0397', + Theta: '\u0398', + Iota: '\u0399', + Kappa: '\u039A', + Lambda: '\u039B', + Mu: '\u039C', + Nu: '\u039D', + Xi: '\u039E', + Omicron: '\u039F', + Pi: '\u03A0', + Rho: '\u03A1', + Sigma: '\u03A3', + Tau: '\u03A4', + Upsilon: '\u03A5', + Phi: '\u03A6', + Chi: '\u03A7', + Psi: '\u03A8', + Omega: '\u03A9', + alpha: '\u03B1', + beta: '\u03B2', + gamma: '\u03B3', + delta: '\u03B4', + epsilon: '\u03B5', + zeta: '\u03B6', + eta: '\u03B7', + theta: '\u03B8', + iota: '\u03B9', + kappa: '\u03BA', + lambda: '\u03BB', + mu: '\u03BC', + nu: '\u03BD', + xi: '\u03BE', + omicron: '\u03BF', + pi: '\u03C0', + rho: '\u03C1', + sigmaf: '\u03C2', + sigma: '\u03C3', + tau: '\u03C4', + upsilon: '\u03C5', + phi: '\u03C6', + chi: '\u03C7', + psi: '\u03C8', + omega: '\u03C9', + thetasym: '\u03D1', + upsih: '\u03D2', + piv: '\u03D6', + ensp: '\u2002', + emsp: '\u2003', + thinsp: '\u2009', + zwnj: '\u200C', + zwj: '\u200D', + lrm: '\u200E', + rlm: '\u200F', + ndash: '\u2013', + mdash: '\u2014', + lsquo: '\u2018', + rsquo: '\u2019', + sbquo: '\u201A', + ldquo: '\u201C', + rdquo: '\u201D', + bdquo: '\u201E', + dagger: '\u2020', + Dagger: '\u2021', + bull: '\u2022', + hellip: '\u2026', + permil: '\u2030', + prime: '\u2032', + Prime: '\u2033', + lsaquo: '\u2039', + rsaquo: '\u203A', + oline: '\u203E', + frasl: '\u2044', + euro: '\u20AC', + image: '\u2111', + weierp: '\u2118', + real: '\u211C', + trade: '\u2122', + alefsym: '\u2135', + larr: '\u2190', + uarr: '\u2191', + rarr: '\u2192', + darr: '\u2193', + harr: '\u2194', + crarr: '\u21B5', + lArr: '\u21D0', + uArr: '\u21D1', + rArr: '\u21D2', + dArr: '\u21D3', + hArr: '\u21D4', + forall: '\u2200', + part: '\u2202', + exist: '\u2203', + empty: '\u2205', + nabla: '\u2207', + isin: '\u2208', + notin: '\u2209', + ni: '\u220B', + prod: '\u220F', + sum: '\u2211', + minus: '\u2212', + lowast: '\u2217', + radic: '\u221A', + prop: '\u221D', + infin: '\u221E', + ang: '\u2220', + and: '\u2227', + or: '\u2228', + cap: '\u2229', + cup: '\u222A', + 'int': '\u222B', + there4: '\u2234', + sim: '\u223C', + cong: '\u2245', + asymp: '\u2248', + ne: '\u2260', + equiv: '\u2261', + le: '\u2264', + ge: '\u2265', + sub: '\u2282', + sup: '\u2283', + nsub: '\u2284', + sube: '\u2286', + supe: '\u2287', + oplus: '\u2295', + otimes: '\u2297', + perp: '\u22A5', + sdot: '\u22C5', + lceil: '\u2308', + rceil: '\u2309', + lfloor: '\u230A', + rfloor: '\u230B', + lang: '\u2329', + rang: '\u232A', + loz: '\u25CA', + spades: '\u2660', + clubs: '\u2663', + hearts: '\u2665', + diams: '\u2666' +}; diff --git a/node_modules/acorn/CHANGELOG.md b/node_modules/acorn/CHANGELOG.md new file mode 100644 index 0000000..2b17518 --- /dev/null +++ b/node_modules/acorn/CHANGELOG.md @@ -0,0 +1,798 @@ +## 8.7.1 (2021-04-26) + +### Bug fixes + +Stop handling `"use strict"` directives in ECMAScript versions before 5. + +Fix an issue where duplicate quoted export names in `export *` syntax were incorrectly checked. + +Add missing type for `tokTypes`. + +## 8.7.0 (2021-12-27) + +### New features + +Support quoted export names. + +Upgrade to Unicode 14. + +Add support for Unicode 13 properties in regular expressions. + +### Bug fixes + +Use a loop to find line breaks, because the existing regexp search would overrun the end of the searched range and waste a lot of time in minified code. + +## 8.6.0 (2021-11-18) + +### Bug fixes + +Fix a bug where an object literal with multiple `__proto__` properties would incorrectly be accepted if a later property value held an assigment. + +### New features + +Support class private fields with the `in` operator. + +## 8.5.0 (2021-09-06) + +### Bug fixes + +Improve context-dependent tokenization in a number of corner cases. + +Fix location tracking after a 0x2028 or 0x2029 character in a string literal (which before did not increase the line number). + +Fix an issue where arrow function bodies in for loop context would inappropriately consume `in` operators. + +Fix wrong end locations stored on SequenceExpression nodes. + +Implement restriction that `for`/`of` loop LHS can't start with `let`. + +### New features + +Add support for ES2022 class static blocks. + +Allow multiple input files to be passed to the CLI tool. + +## 8.4.1 (2021-06-24) + +### Bug fixes + +Fix a bug where `allowAwaitOutsideFunction` would allow `await` in class field initializers, and setting `ecmaVersion` to 13 or higher would allow top-level await in non-module sources. + +## 8.4.0 (2021-06-11) + +### New features + +A new option, `allowSuperOutsideMethod`, can be used to suppress the error when `super` is used in the wrong context. + +## 8.3.0 (2021-05-31) + +### New features + +Default `allowAwaitOutsideFunction` to true for ECMAScript 2022 an higher. + +Add support for the `d` ([indices](https://github.com/tc39/proposal-regexp-match-indices)) regexp flag. + +## 8.2.4 (2021-05-04) + +### Bug fixes + +Fix spec conformity in corner case 'for await (async of ...)'. + +## 8.2.3 (2021-05-04) + +### Bug fixes + +Fix an issue where the library couldn't parse 'for (async of ...)'. + +Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances. + +## 8.2.2 (2021-04-29) + +### Bug fixes + +Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield. + +## 8.2.1 (2021-04-24) + +### Bug fixes + +Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse. + +## 8.2.0 (2021-04-24) + +### New features + +Add support for ES2022 class fields and private methods. + +## 8.1.1 (2021-04-12) + +### Various + +Stop shipping source maps in the NPM package. + +## 8.1.0 (2021-03-09) + +### Bug fixes + +Fix a spurious error in nested destructuring arrays. + +### New features + +Expose `allowAwaitOutsideFunction` in CLI interface. + +Make `allowImportExportAnywhere` also apply to `import.meta`. + +## 8.0.5 (2021-01-25) + +### Bug fixes + +Adjust package.json to work with Node 12.16.0 and 13.0-13.6. + +## 8.0.4 (2020-10-05) + +### Bug fixes + +Make `await x ** y` an error, following the spec. + +Fix potentially exponential regular expression. + +## 8.0.3 (2020-10-02) + +### Bug fixes + +Fix a wasteful loop during `Parser` creation when setting `ecmaVersion` to `"latest"`. + +## 8.0.2 (2020-09-30) + +### Bug fixes + +Make the TypeScript types reflect the current allowed values for `ecmaVersion`. + +Fix another regexp/division tokenizer issue. + +## 8.0.1 (2020-08-12) + +### Bug fixes + +Provide the correct value in the `version` export. + +## 8.0.0 (2020-08-12) + +### Bug fixes + +Disallow expressions like `(a = b) = c`. + +Make non-octal escape sequences a syntax error in strict mode. + +### New features + +The package can now be loaded directly as an ECMAScript module in node 13+. + +Update to the set of Unicode properties from ES2021. + +### Breaking changes + +The `ecmaVersion` option is now required. For the moment, omitting it will still work with a warning, but that will change in a future release. + +Some changes to method signatures that may be used by plugins. + +## 7.4.0 (2020-08-03) + +### New features + +Add support for logical assignment operators. + +Add support for numeric separators. + +## 7.3.1 (2020-06-11) + +### Bug fixes + +Make the string in the `version` export match the actual library version. + +## 7.3.0 (2020-06-11) + +### Bug fixes + +Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail. + +### New features + +Add support for optional chaining (`?.`). + +## 7.2.0 (2020-05-09) + +### Bug fixes + +Fix precedence issue in parsing of async arrow functions. + +### New features + +Add support for nullish coalescing. + +Add support for `import.meta`. + +Support `export * as ...` syntax. + +Upgrade to Unicode 13. + +## 6.4.1 (2020-03-09) + +### Bug fixes + +More carefully check for valid UTF16 surrogate pairs in regexp validator. + +## 7.1.1 (2020-03-01) + +### Bug fixes + +Treat `\8` and `\9` as invalid escapes in template strings. + +Allow unicode escapes in property names that are keywords. + +Don't error on an exponential operator expression as argument to `await`. + +More carefully check for valid UTF16 surrogate pairs in regexp validator. + +## 7.1.0 (2019-09-24) + +### Bug fixes + +Disallow trailing object literal commas when ecmaVersion is less than 5. + +### New features + +Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on. + +## 7.0.0 (2019-08-13) + +### Breaking changes + +Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression). + +Makes 10 (ES2019) the default value for the `ecmaVersion` option. + +## 6.3.0 (2019-08-12) + +### New features + +`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard. + +## 6.2.1 (2019-07-21) + +### Bug fixes + +Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such. + +Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances. + +## 6.2.0 (2019-07-04) + +### Bug fixes + +Improve valid assignment checking in `for`/`in` and `for`/`of` loops. + +Disallow binding `let` in patterns. + +### New features + +Support bigint syntax with `ecmaVersion` >= 11. + +Support dynamic `import` syntax with `ecmaVersion` >= 11. + +Upgrade to Unicode version 12. + +## 6.1.1 (2019-02-27) + +### Bug fixes + +Fix bug that caused parsing default exports of with names to fail. + +## 6.1.0 (2019-02-08) + +### Bug fixes + +Fix scope checking when redefining a `var` as a lexical binding. + +### New features + +Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins. + +## 6.0.7 (2019-02-04) + +### Bug fixes + +Check that exported bindings are defined. + +Don't treat `\u180e` as a whitespace character. + +Check for duplicate parameter names in methods. + +Don't allow shorthand properties when they are generators or async methods. + +Forbid binding `await` in async arrow function's parameter list. + +## 6.0.6 (2019-01-30) + +### Bug fixes + +The content of class declarations and expressions is now always parsed in strict mode. + +Don't allow `let` or `const` to bind the variable name `let`. + +Treat class declarations as lexical. + +Don't allow a generator function declaration as the sole body of an `if` or `else`. + +Ignore `"use strict"` when after an empty statement. + +Allow string line continuations with special line terminator characters. + +Treat `for` bodies as part of the `for` scope when checking for conflicting bindings. + +Fix bug with parsing `yield` in a `for` loop initializer. + +Implement special cases around scope checking for functions. + +## 6.0.5 (2019-01-02) + +### Bug fixes + +Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type. + +Don't treat `let` as a keyword when the next token is `{` on the next line. + +Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on. + +## 6.0.4 (2018-11-05) + +### Bug fixes + +Further improvements to tokenizing regular expressions in corner cases. + +## 6.0.3 (2018-11-04) + +### Bug fixes + +Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression. + +Remove stray symlink in the package tarball. + +## 6.0.2 (2018-09-26) + +### Bug fixes + +Fix bug where default expressions could fail to parse inside an object destructuring assignment expression. + +## 6.0.1 (2018-09-14) + +### Bug fixes + +Fix wrong value in `version` export. + +## 6.0.0 (2018-09-14) + +### Bug fixes + +Better handle variable-redefinition checks for catch bindings and functions directly under if statements. + +Forbid `new.target` in top-level arrow functions. + +Fix issue with parsing a regexp after `yield` in some contexts. + +### New features + +The package now comes with TypeScript definitions. + +### Breaking changes + +The default value of the `ecmaVersion` option is now 9 (2018). + +Plugins work differently, and will have to be rewritten to work with this version. + +The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`). + +## 5.7.3 (2018-09-10) + +### Bug fixes + +Fix failure to tokenize regexps after expressions like `x.of`. + +Better error message for unterminated template literals. + +## 5.7.2 (2018-08-24) + +### Bug fixes + +Properly handle `allowAwaitOutsideFunction` in for statements. + +Treat function declarations at the top level of modules like let bindings. + +Don't allow async function declarations as the only statement under a label. + +## 5.7.0 (2018-06-15) + +### New features + +Upgraded to Unicode 11. + +## 5.6.0 (2018-05-31) + +### New features + +Allow U+2028 and U+2029 in string when ECMAVersion >= 10. + +Allow binding-less catch statements when ECMAVersion >= 10. + +Add `allowAwaitOutsideFunction` option for parsing top-level `await`. + +## 5.5.3 (2018-03-08) + +### Bug fixes + +A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps. + +## 5.5.2 (2018-03-08) + +### Bug fixes + +A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0. + +## 5.5.1 (2018-03-06) + +### Bug fixes + +Fix misleading error message for octal escapes in template strings. + +## 5.5.0 (2018-02-27) + +### New features + +The identifier character categorization is now based on Unicode version 10. + +Acorn will now validate the content of regular expressions, including new ES9 features. + +## 5.4.0 (2018-02-01) + +### Bug fixes + +Disallow duplicate or escaped flags on regular expressions. + +Disallow octal escapes in strings in strict mode. + +### New features + +Add support for async iteration. + +Add support for object spread and rest. + +## 5.3.0 (2017-12-28) + +### Bug fixes + +Fix parsing of floating point literals with leading zeroes in loose mode. + +Allow duplicate property names in object patterns. + +Don't allow static class methods named `prototype`. + +Disallow async functions directly under `if` or `else`. + +Parse right-hand-side of `for`/`of` as an assignment expression. + +Stricter parsing of `for`/`in`. + +Don't allow unicode escapes in contextual keywords. + +### New features + +Parsing class members was factored into smaller methods to allow plugins to hook into it. + +## 5.2.1 (2017-10-30) + +### Bug fixes + +Fix a token context corruption bug. + +## 5.2.0 (2017-10-30) + +### Bug fixes + +Fix token context tracking for `class` and `function` in property-name position. + +Make sure `%*` isn't parsed as a valid operator. + +Allow shorthand properties `get` and `set` to be followed by default values. + +Disallow `super` when not in callee or object position. + +### New features + +Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements. + +## 5.1.2 (2017-09-04) + +### Bug fixes + +Disable parsing of legacy HTML-style comments in modules. + +Fix parsing of async methods whose names are keywords. + +## 5.1.1 (2017-07-06) + +### Bug fixes + +Fix problem with disambiguating regexp and division after a class. + +## 5.1.0 (2017-07-05) + +### Bug fixes + +Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`. + +Parse zero-prefixed numbers with non-octal digits as decimal. + +Allow object/array patterns in rest parameters. + +Don't error when `yield` is used as a property name. + +Allow `async` as a shorthand object property. + +### New features + +Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9. + +## 5.0.3 (2017-04-01) + +### Bug fixes + +Fix spurious duplicate variable definition errors for named functions. + +## 5.0.2 (2017-03-30) + +### Bug fixes + +A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error. + +## 5.0.0 (2017-03-28) + +### Bug fixes + +Raise an error for duplicated lexical bindings. + +Fix spurious error when an assignement expression occurred after a spread expression. + +Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions. + +Allow labels in front or `var` declarations, even in strict mode. + +### Breaking changes + +Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`. + +## 4.0.11 (2017-02-07) + +### Bug fixes + +Allow all forms of member expressions to be parenthesized as lvalue. + +## 4.0.10 (2017-02-07) + +### Bug fixes + +Don't expect semicolons after default-exported functions or classes, even when they are expressions. + +Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode. + +## 4.0.9 (2017-02-06) + +### Bug fixes + +Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again. + +## 4.0.8 (2017-02-03) + +### Bug fixes + +Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet. + +## 4.0.7 (2017-02-02) + +### Bug fixes + +Accept invalidly rejected code like `(x).y = 2` again. + +Don't raise an error when a function _inside_ strict code has a non-simple parameter list. + +## 4.0.6 (2017-02-02) + +### Bug fixes + +Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check. + +## 4.0.5 (2017-02-02) + +### Bug fixes + +Disallow parenthesized pattern expressions. + +Allow keywords as export names. + +Don't allow the `async` keyword to be parenthesized. + +Properly raise an error when a keyword contains a character escape. + +Allow `"use strict"` to appear after other string literal expressions. + +Disallow labeled declarations. + +## 4.0.4 (2016-12-19) + +### Bug fixes + +Fix crash when `export` was followed by a keyword that can't be +exported. + +## 4.0.3 (2016-08-16) + +### Bug fixes + +Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode. + +Properly parse properties named `async` in ES2017 mode. + +Fix bug where reserved words were broken in ES2017 mode. + +## 4.0.2 (2016-08-11) + +### Bug fixes + +Don't ignore period or 'e' characters after octal numbers. + +Fix broken parsing for call expressions in default parameter values of arrow functions. + +## 4.0.1 (2016-08-08) + +### Bug fixes + +Fix false positives in duplicated export name errors. + +## 4.0.0 (2016-08-07) + +### Breaking changes + +The default `ecmaVersion` option value is now 7. + +A number of internal method signatures changed, so plugins might need to be updated. + +### Bug fixes + +The parser now raises errors on duplicated export names. + +`arguments` and `eval` can now be used in shorthand properties. + +Duplicate parameter names in non-simple argument lists now always produce an error. + +### New features + +The `ecmaVersion` option now also accepts year-style version numbers +(2015, etc). + +Support for `async`/`await` syntax when `ecmaVersion` is >= 8. + +Support for trailing commas in call expressions when `ecmaVersion` is >= 8. + +## 3.3.0 (2016-07-25) + +### Bug fixes + +Fix bug in tokenizing of regexp operator after a function declaration. + +Fix parser crash when parsing an array pattern with a hole. + +### New features + +Implement check against complex argument lists in functions that enable strict mode in ES7. + +## 3.2.0 (2016-06-07) + +### Bug fixes + +Improve handling of lack of unicode regexp support in host +environment. + +Properly reject shorthand properties whose name is a keyword. + +### New features + +Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object. + +## 3.1.0 (2016-04-18) + +### Bug fixes + +Properly tokenize the division operator directly after a function expression. + +Allow trailing comma in destructuring arrays. + +## 3.0.4 (2016-02-25) + +### Fixes + +Allow update expressions as left-hand-side of the ES7 exponential operator. + +## 3.0.2 (2016-02-10) + +### Fixes + +Fix bug that accidentally made `undefined` a reserved word when parsing ES7. + +## 3.0.0 (2016-02-10) + +### Breaking changes + +The default value of the `ecmaVersion` option is now 6 (used to be 5). + +Support for comprehension syntax (which was dropped from the draft spec) has been removed. + +### Fixes + +`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code. + +A parenthesized class or function expression after `export default` is now parsed correctly. + +### New features + +When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`). + +The identifier character ranges are now based on Unicode 8.0.0. + +Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled. + +## 2.7.0 (2016-01-04) + +### Fixes + +Stop allowing rest parameters in setters. + +Disallow `y` rexexp flag in ES5. + +Disallow `\00` and `\000` escapes in strict mode. + +Raise an error when an import name is a reserved word. + +## 2.6.2 (2015-11-10) + +### Fixes + +Don't crash when no options object is passed. + +## 2.6.0 (2015-11-09) + +### Fixes + +Add `await` as a reserved word in module sources. + +Disallow `yield` in a parameter default value for a generator. + +Forbid using a comma after a rest pattern in an array destructuring. + +### New features + +Support parsing stdin in command-line tool. + +## 2.5.0 (2015-10-27) + +### Fixes + +Fix tokenizer support in the command-line tool. + +Stop allowing `new.target` outside of functions. + +Remove legacy `guard` and `guardedHandler` properties from try nodes. + +Stop allowing multiple `__proto__` properties on an object literal in strict mode. + +Don't allow rest parameters to be non-identifier patterns. + +Check for duplicate paramter names in arrow functions. diff --git a/node_modules/acorn/LICENSE b/node_modules/acorn/LICENSE new file mode 100644 index 0000000..9d71cc6 --- /dev/null +++ b/node_modules/acorn/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (C) 2012-2022 by various contributors (see AUTHORS) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +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/acorn/README.md b/node_modules/acorn/README.md new file mode 100644 index 0000000..9cbef21 --- /dev/null +++ b/node_modules/acorn/README.md @@ -0,0 +1,273 @@ +# Acorn + +A tiny, fast JavaScript parser written in JavaScript. + +## Community + +Acorn is open source software released under an +[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE). + +You are welcome to +[report bugs](https://github.com/acornjs/acorn/issues) or create pull +requests on [github](https://github.com/acornjs/acorn). For questions +and discussion, please use the +[Tern discussion forum](https://discuss.ternjs.net). + +## Installation + +The easiest way to install acorn is from [`npm`](https://www.npmjs.com/): + +```sh +npm install acorn +``` + +Alternately, you can download the source and build acorn yourself: + +```sh +git clone https://github.com/acornjs/acorn.git +cd acorn +npm install +``` + +## Interface + +**parse**`(input, options)` is the main interface to the library. The +`input` parameter is a string, `options` must be an object setting +some of the options listed below. The return value will be an abstract +syntax tree object as specified by the [ESTree +spec](https://github.com/estree/estree). + +```javascript +let acorn = require("acorn"); +console.log(acorn.parse("1 + 1", {ecmaVersion: 2020})); +``` + +When encountering a syntax error, the parser will raise a +`SyntaxError` object with a meaningful message. The error object will +have a `pos` property that indicates the string offset at which the +error occurred, and a `loc` object that contains a `{line, column}` +object referring to that same position. + +Options are provided by in a second argument, which should be an +object containing any of these fields (only `ecmaVersion` is +required): + +- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be + either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019), + 11 (2020), 12 (2021), 13 (2022, partial support) + or `"latest"` (the latest the library supports). This influences + support for strict mode, the set of reserved words, and support + for new syntax features. + + **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being + implemented by Acorn. Other proposed new features must be + implemented through plugins. + +- **sourceType**: Indicate the mode the code should be parsed in. Can be + either `"script"` or `"module"`. This influences global strict mode + and parsing of `import` and `export` declarations. + + **NOTE**: If set to `"module"`, then static `import` / `export` syntax + will be valid, even if `ecmaVersion` is less than 6. + +- **onInsertedSemicolon**: If given a callback, that callback will be + called whenever a missing semicolon is inserted by the parser. The + callback will be given the character offset of the point where the + semicolon is inserted as argument, and if `locations` is on, also a + `{line, column}` object representing this position. + +- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing + commas. + +- **allowReserved**: If `false`, using a reserved word will generate + an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher + versions. When given the value `"never"`, reserved words and + keywords can also not be used as property names (as in Internet + Explorer's old parser). + +- **allowReturnOutsideFunction**: By default, a return statement at + the top level raises an error. Set this to `true` to accept such + code. + +- **allowImportExportEverywhere**: By default, `import` and `export` + declarations can only appear at a program's top level. Setting this + option to `true` allows them anywhere where a statement is allowed, + and also allows `import.meta` expressions to appear in scripts + (when `sourceType` is not `"module"`). + +- **allowAwaitOutsideFunction**: If `false`, `await` expressions can + only appear inside `async` functions. Defaults to `true` for + `ecmaVersion` 2022 and later, `false` for lower versions. Setting this option to + `true` allows to have top-level `await` expressions. They are + still not allowed in non-`async` functions, though. + +- **allowSuperOutsideMethod**: By default, `super` outside a method + raises an error. Set this to `true` to accept such code. + +- **allowHashBang**: When this is enabled (off by default), if the + code starts with the characters `#!` (as in a shellscript), the + first line will be treated as a comment. + +- **locations**: When `true`, each node has a `loc` object attached + with `start` and `end` subobjects, each of which contains the + one-based line and zero-based column numbers in `{line, column}` + form. Default is `false`. + +- **onToken**: If a function is passed for this option, each found + token will be passed in same format as tokens returned from + `tokenizer().getToken()`. + + If array is passed, each found token is pushed to it. + + Note that you are not allowed to call the parser from the + callback—that will corrupt its internal state. + +- **onComment**: If a function is passed for this option, whenever a + comment is encountered the function will be called with the + following parameters: + + - `block`: `true` if the comment is a block comment, false if it + is a line comment. + - `text`: The content of the comment. + - `start`: Character offset of the start of the comment. + - `end`: Character offset of the end of the comment. + + When the `locations` options is on, the `{line, column}` locations + of the comment’s start and end are passed as two additional + parameters. + + If array is passed for this option, each found comment is pushed + to it as object in Esprima format: + + ```javascript + { + "type": "Line" | "Block", + "value": "comment text", + "start": Number, + "end": Number, + // If `locations` option is on: + "loc": { + "start": {line: Number, column: Number} + "end": {line: Number, column: Number} + }, + // If `ranges` option is on: + "range": [Number, Number] + } + ``` + + Note that you are not allowed to call the parser from the + callback—that will corrupt its internal state. + +- **ranges**: Nodes have their start and end characters offsets + recorded in `start` and `end` properties (directly on the node, + rather than the `loc` object, which holds line/column data. To also + add a + [semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678) + `range` property holding a `[start, end]` array with the same + numbers, set the `ranges` option to `true`. + +- **program**: It is possible to parse multiple files into a single + AST by passing the tree produced by parsing the first file as the + `program` option in subsequent parses. This will add the toplevel + forms of the parsed file to the "Program" (top) node of an existing + parse tree. + +- **sourceFile**: When the `locations` option is `true`, you can pass + this option to add a `source` attribute in every node’s `loc` + object. Note that the contents of this option are not examined or + processed in any way; you are free to use whatever format you + choose. + +- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property + will be added (regardless of the `location` option) directly to the + nodes, rather than the `loc` object. + +- **preserveParens**: If this option is `true`, parenthesized expressions + are represented by (non-standard) `ParenthesizedExpression` nodes + that have a single `expression` property containing the expression + inside parentheses. + +**parseExpressionAt**`(input, offset, options)` will parse a single +expression in a string, and return its AST. It will not complain if +there is more of the string left after the expression. + +**tokenizer**`(input, options)` returns an object with a `getToken` +method that can be called repeatedly to get the next token, a `{start, +end, type, value}` object (with added `loc` property when the +`locations` option is enabled and `range` property when the `ranges` +option is enabled). When the token's type is `tokTypes.eof`, you +should stop calling the method, since it will keep returning that same +token forever. + +In ES6 environment, returned result can be used as any other +protocol-compliant iterable: + +```javascript +for (let token of acorn.tokenizer(str)) { + // iterate over the tokens +} + +// transform code to array of tokens: +var tokens = [...acorn.tokenizer(str)]; +``` + +**tokTypes** holds an object mapping names to the token type objects +that end up in the `type` properties of tokens. + +**getLineInfo**`(input, offset)` can be used to get a `{line, +column}` object for a given program string and offset. + +### The `Parser` class + +Instances of the **`Parser`** class contain all the state and logic +that drives a parse. It has static methods `parse`, +`parseExpressionAt`, and `tokenizer` that match the top-level +functions by the same name. + +When extending the parser with plugins, you need to call these methods +on the extended version of the class. To extend a parser with plugins, +you can use its static `extend` method. + +```javascript +var acorn = require("acorn"); +var jsx = require("acorn-jsx"); +var JSXParser = acorn.Parser.extend(jsx()); +JSXParser.parse("foo()", {ecmaVersion: 2020}); +``` + +The `extend` method takes any number of plugin values, and returns a +new `Parser` class that includes the extra parser logic provided by +the plugins. + +## Command line interface + +The `bin/acorn` utility can be used to parse a file from the command +line. It accepts as arguments its input file and the following +options: + +- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version + to parse. Default is version 9. + +- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. + +- `--locations`: Attaches a "loc" object to each node with "start" and + "end" subobjects, each of which contains the one-based line and + zero-based column numbers in `{line, column}` form. + +- `--allow-hash-bang`: If the code starts with the characters #! (as + in a shellscript), the first line will be treated as a comment. + +- `--allow-await-outside-function`: Allows top-level `await` expressions. + See the `allowAwaitOutsideFunction` option for more information. + +- `--compact`: No whitespace is used in the AST output. + +- `--silent`: Do not output the AST, just return the exit status. + +- `--help`: Print the usage information and quit. + +The utility spits out the syntax tree as JSON data. + +## Existing plugins + + - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) diff --git a/node_modules/acorn/bin/acorn b/node_modules/acorn/bin/acorn new file mode 100755 index 0000000..3ef3c12 --- /dev/null +++ b/node_modules/acorn/bin/acorn @@ -0,0 +1,4 @@ +#!/usr/bin/env node +"use strict" + +require("../dist/bin.js") diff --git a/node_modules/acorn/dist/acorn.d.ts b/node_modules/acorn/dist/acorn.d.ts new file mode 100644 index 0000000..140f6ed --- /dev/null +++ b/node_modules/acorn/dist/acorn.d.ts @@ -0,0 +1,252 @@ +export as namespace acorn +export = acorn + +declare namespace acorn { + function parse(input: string, options: Options): Node + + function parseExpressionAt(input: string, pos: number, options: Options): Node + + function tokenizer(input: string, options: Options): { + getToken(): Token + [Symbol.iterator](): Iterator + } + + type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest' + + interface Options { + ecmaVersion: ecmaVersion + sourceType?: 'script' | 'module' + onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void + onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void + allowReserved?: boolean | 'never' + allowReturnOutsideFunction?: boolean + allowImportExportEverywhere?: boolean + allowAwaitOutsideFunction?: boolean + allowSuperOutsideMethod?: boolean + allowHashBang?: boolean + locations?: boolean + onToken?: ((token: Token) => any) | Token[] + onComment?: (( + isBlock: boolean, text: string, start: number, end: number, startLoc?: Position, + endLoc?: Position + ) => void) | Comment[] + ranges?: boolean + program?: Node + sourceFile?: string + directSourceFile?: string + preserveParens?: boolean + } + + class Parser { + // state.js + lineStart: number; + options: Options; + curLine: number; + start: number; + end: number; + input: string; + type: TokenType; + + // state.js + constructor(options: Options, input: string, startPos?: number) + parse(this: Parser): Node + + // tokenize.js + next(): void; + nextToken(): void; + + // statement.js + parseTopLevel(node: Node): Node; + + // node.js + finishNode(node: Node, type: string): Node; + finishNodeAt(node: Node, type: string, pos: number, loc: Position): Node; + + // location.js + raise(pos: number, message: string) : void; + raiseRecoverable?(pos: number, message: string) : void; + + // parseutils.js + unexpected(pos: number) : void; + + // index.js + static acorn: typeof acorn; + + // state.js + static parse(this: typeof Parser, input: string, options: Options): Node + static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node + static tokenizer(this: typeof Parser, input: string, options: Options): { + getToken(): Token + [Symbol.iterator](): Iterator + } + static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser + } + + interface Position { line: number; column: number; offset: number } + + const defaultOptions: Options + + function getLineInfo(input: string, offset: number): Position + + class SourceLocation { + start: Position + end: Position + source?: string | null + constructor(p: Parser, start: Position, end: Position) + } + + class Node { + type: string + start: number + end: number + loc?: SourceLocation + sourceFile?: string + range?: [number, number] + constructor(parser: Parser, pos: number, loc?: SourceLocation) + } + + class TokenType { + label: string + keyword: string + beforeExpr: boolean + startsExpr: boolean + isLoop: boolean + isAssign: boolean + prefix: boolean + postfix: boolean + binop: number + updateContext?: (prevType: TokenType) => void + constructor(label: string, conf?: any) + } + + const tokTypes: { + num: TokenType + regexp: TokenType + string: TokenType + name: TokenType + privateId: TokenType + eof: TokenType + bracketL: TokenType + bracketR: TokenType + braceL: TokenType + braceR: TokenType + parenL: TokenType + parenR: TokenType + comma: TokenType + semi: TokenType + colon: TokenType + dot: TokenType + question: TokenType + questionDot: TokenType + arrow: TokenType + template: TokenType + invalidTemplate: TokenType + ellipsis: TokenType + backQuote: TokenType + dollarBraceL: TokenType + eq: TokenType + assign: TokenType + incDec: TokenType + prefix: TokenType + logicalOR: TokenType + logicalAND: TokenType + bitwiseOR: TokenType + bitwiseXOR: TokenType + bitwiseAND: TokenType + equality: TokenType + relational: TokenType + bitShift: TokenType + plusMin: TokenType + modulo: TokenType + star: TokenType + slash: TokenType + starstar: TokenType + coalesce: TokenType + _break: TokenType + _case: TokenType + _catch: TokenType + _continue: TokenType + _debugger: TokenType + _default: TokenType + _do: TokenType + _else: TokenType + _finally: TokenType + _for: TokenType + _function: TokenType + _if: TokenType + _return: TokenType + _switch: TokenType + _throw: TokenType + _try: TokenType + _var: TokenType + _const: TokenType + _while: TokenType + _with: TokenType + _new: TokenType + _this: TokenType + _super: TokenType + _class: TokenType + _extends: TokenType + _export: TokenType + _import: TokenType + _null: TokenType + _true: TokenType + _false: TokenType + _in: TokenType + _instanceof: TokenType + _typeof: TokenType + _void: TokenType + _delete: TokenType + } + + class TokContext { + constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void) + } + + const tokContexts: { + b_stat: TokContext + b_expr: TokContext + b_tmpl: TokContext + p_stat: TokContext + p_expr: TokContext + q_tmpl: TokContext + f_expr: TokContext + f_stat: TokContext + f_expr_gen: TokContext + f_gen: TokContext + } + + function isIdentifierStart(code: number, astral?: boolean): boolean + + function isIdentifierChar(code: number, astral?: boolean): boolean + + interface AbstractToken { + } + + interface Comment extends AbstractToken { + type: string + value: string + start: number + end: number + loc?: SourceLocation + range?: [number, number] + } + + class Token { + type: TokenType + value: any + start: number + end: number + loc?: SourceLocation + range?: [number, number] + constructor(p: Parser) + } + + function isNewLine(code: number): boolean + + const lineBreak: RegExp + + const lineBreakG: RegExp + + const version: string +} diff --git a/node_modules/acorn/dist/acorn.js b/node_modules/acorn/dist/acorn.js new file mode 100644 index 0000000..1ccee20 --- /dev/null +++ b/node_modules/acorn/dist/acorn.js @@ -0,0 +1,5608 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {})); +})(this, (function (exports) { 'use strict'; + + // This file was generated. Do not modify manually! + var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + + // This file was generated. Do not modify manually! + var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; + + // This file was generated. Do not modify manually! + var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; + + // This file was generated. Do not modify manually! + var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u09fc\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\u0af9\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-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\uab70-\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"; + + // These are a run-length and offset encoded representation of the + + // Reserved word lists for various dialects of the language + + var reservedWords = { + 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", + 5: "class enum extends super const export import", + 6: "enum", + strict: "implements interface let package private protected public static yield", + strictBind: "eval arguments" + }; + + // And the keywords + + var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; + + var keywords$1 = { + 5: ecma5AndLessKeywords, + "5module": ecma5AndLessKeywords + " export import", + 6: ecma5AndLessKeywords + " const class extends export import super" + }; + + var keywordRelationalOperator = /^in(stanceof)?$/; + + // ## Character categories + + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + + // This has a complexity linear to the value of the code. The + // assumption is that looking up astral identifier characters is + // rare. + function isInAstralSet(code, set) { + var pos = 0x10000; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code) { return false } + pos += set[i + 1]; + if (pos >= code) { return true } + } + } + + // Test whether a given character code starts an identifier. + + function isIdentifierStart(code, astral) { + if (code < 65) { return code === 36 } + if (code < 91) { return true } + if (code < 97) { return code === 95 } + if (code < 123) { return true } + if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) } + if (astral === false) { return false } + return isInAstralSet(code, astralIdentifierStartCodes) + } + + // Test whether a given character is part of an identifier. + + function isIdentifierChar(code, astral) { + if (code < 48) { return code === 36 } + if (code < 58) { return true } + if (code < 65) { return false } + if (code < 91) { return true } + if (code < 97) { return code === 95 } + if (code < 123) { return true } + if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) } + if (astral === false) { return false } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes) + } + + // ## Token types + + // The assignment of fine-grained, information-carrying type objects + // allows the tokenizer to store the information it has about a + // token in a way that is very cheap for the parser to look up. + + // All token type variables start with an underscore, to make them + // easy to recognize. + + // The `beforeExpr` property is used to disambiguate between regular + // expressions and divisions. It is set on all token types that can + // be followed by an expression (thus, a slash after them would be a + // regular expression). + // + // The `startsExpr` property is used to check if the token ends a + // `yield` expression. It is set on all token types that either can + // directly start an expression (like a quotation mark) or can + // continue an expression (like the body of a string). + // + // `isLoop` marks a keyword as starting a loop, which is important + // to know when parsing a label, in order to allow or disallow + // continue jumps to that label. + + var TokenType = function TokenType(label, conf) { + if ( conf === void 0 ) conf = {}; + + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; + }; + + function binop(name, prec) { + return new TokenType(name, {beforeExpr: true, binop: prec}) + } + var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}; + + // Map keyword names to token types. + + var keywords = {}; + + // Succinct definitions of keyword token types + function kw(name, options) { + if ( options === void 0 ) options = {}; + + options.keyword = name; + return keywords[name] = new TokenType(name, options) + } + + var types$1 = { + num: new TokenType("num", startsExpr), + regexp: new TokenType("regexp", startsExpr), + string: new TokenType("string", startsExpr), + name: new TokenType("name", startsExpr), + privateId: new TokenType("privateId", startsExpr), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}), + bracketR: new TokenType("]"), + braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}), + braceR: new TokenType("}"), + parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}), + parenR: new TokenType(")"), + comma: new TokenType(",", beforeExpr), + semi: new TokenType(";", beforeExpr), + colon: new TokenType(":", beforeExpr), + dot: new TokenType("."), + question: new TokenType("?", beforeExpr), + questionDot: new TokenType("?."), + arrow: new TokenType("=>", beforeExpr), + template: new TokenType("template"), + invalidTemplate: new TokenType("invalidTemplate"), + ellipsis: new TokenType("...", beforeExpr), + backQuote: new TokenType("`", startsExpr), + dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", {beforeExpr: true, isAssign: true}), + assign: new TokenType("_=", {beforeExpr: true, isAssign: true}), + incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}), + prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}), + logicalOR: binop("||", 1), + logicalAND: binop("&&", 2), + bitwiseOR: binop("|", 3), + bitwiseXOR: binop("^", 4), + bitwiseAND: binop("&", 5), + equality: binop("==/!=/===/!==", 6), + relational: binop("/<=/>=", 7), + bitShift: binop("<>/>>>", 8), + plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}), + modulo: binop("%", 10), + star: binop("*", 10), + slash: binop("/", 10), + starstar: new TokenType("**", {beforeExpr: true}), + coalesce: binop("??", 1), + + // Keyword token types. + _break: kw("break"), + _case: kw("case", beforeExpr), + _catch: kw("catch"), + _continue: kw("continue"), + _debugger: kw("debugger"), + _default: kw("default", beforeExpr), + _do: kw("do", {isLoop: true, beforeExpr: true}), + _else: kw("else", beforeExpr), + _finally: kw("finally"), + _for: kw("for", {isLoop: true}), + _function: kw("function", startsExpr), + _if: kw("if"), + _return: kw("return", beforeExpr), + _switch: kw("switch"), + _throw: kw("throw", beforeExpr), + _try: kw("try"), + _var: kw("var"), + _const: kw("const"), + _while: kw("while", {isLoop: true}), + _with: kw("with"), + _new: kw("new", {beforeExpr: true, startsExpr: true}), + _this: kw("this", startsExpr), + _super: kw("super", startsExpr), + _class: kw("class", startsExpr), + _extends: kw("extends", beforeExpr), + _export: kw("export"), + _import: kw("import", startsExpr), + _null: kw("null", startsExpr), + _true: kw("true", startsExpr), + _false: kw("false", startsExpr), + _in: kw("in", {beforeExpr: true, binop: 7}), + _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}), + _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}), + _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}), + _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true}) + }; + + // Matches a whole line break (where CRLF is considered a single + // line break). Used to count lines. + + var lineBreak = /\r\n?|\n|\u2028|\u2029/; + var lineBreakG = new RegExp(lineBreak.source, "g"); + + function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029 + } + + function nextLineBreak(code, from, end) { + if ( end === void 0 ) end = code.length; + + for (var i = from; i < end; i++) { + var next = code.charCodeAt(i); + if (isNewLine(next)) + { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 } + } + return -1 + } + + var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + + var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; + + var ref = Object.prototype; + var hasOwnProperty = ref.hasOwnProperty; + var toString = ref.toString; + + var hasOwn = Object.hasOwn || (function (obj, propName) { return ( + hasOwnProperty.call(obj, propName) + ); }); + + var isArray = Array.isArray || (function (obj) { return ( + toString.call(obj) === "[object Array]" + ); }); + + function wordsRegexp(words) { + return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$") + } + + function codePointToString(code) { + // UTF-16 Decoding + if (code <= 0xFFFF) { return String.fromCharCode(code) } + code -= 0x10000; + return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00) + } + + var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; + + // These are used when `options.locations` is on, for the + // `startLoc` and `endLoc` properties. + + var Position = function Position(line, col) { + this.line = line; + this.column = col; + }; + + Position.prototype.offset = function offset (n) { + return new Position(this.line, this.column + n) + }; + + var SourceLocation = function SourceLocation(p, start, end) { + this.start = start; + this.end = end; + if (p.sourceFile !== null) { this.source = p.sourceFile; } + }; + + // The `getLineInfo` function is mostly useful when the + // `locations` option is off (for performance reasons) and you + // want to find the line/column position for a given character + // offset. `input` should be the code string that the offset refers + // into. + + function getLineInfo(input, offset) { + for (var line = 1, cur = 0;;) { + var nextBreak = nextLineBreak(input, cur, offset); + if (nextBreak < 0) { return new Position(line, offset - cur) } + ++line; + cur = nextBreak; + } + } + + // A second argument must be given to configure the parser process. + // These options are recognized (only `ecmaVersion` is required): + + var defaultOptions = { + // `ecmaVersion` indicates the ECMAScript version to parse. Must be + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the + // latest version the library supports). This influences support + // for strict mode, the set of reserved words, and support for + // new syntax features. + ecmaVersion: null, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"` or `"module"`. This influences global + // strict mode and parsing of `import` and `export` declarations. + sourceType: "script", + // `onInsertedSemicolon` can be a callback that will be called + // when a semicolon is automatically inserted. It will be passed + // the position of the comma as an offset, and if `locations` is + // enabled, it is given the location as a `{line, column}` object + // as second argument. + onInsertedSemicolon: null, + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for + // trailing commas. + onTrailingComma: null, + // By default, reserved words are only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. + allowReserved: null, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. + allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. + // When enabled, await identifiers are allowed to appear at the top-level scope, + // but they are still not allowed in non-async functions. + allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. + allowSuperOutsideMethod: null, + // When enabled, hashbang directive in the beginning of file + // is allowed and treated as a line comment. + allowHashBang: false, + // When `locations` is on, `loc` properties holding objects with + // `start` and `end` properties in `{line, column}` form (with + // line being 1-based and column 0-based) will be attached to the + // nodes. + locations: false, + // A function can be passed as `onToken` option, which will + // cause Acorn to call that function with object in the same + // format as tokens returned from `tokenizer().getToken()`. Note + // that you are not allowed to call the parser from the + // callback—that will corrupt its internal state. + onToken: null, + // A function can be passed as `onComment` option, which will + // cause Acorn to call that function with `(block, text, start, + // end)` parameters whenever a comment is skipped. `block` is a + // boolean indicating whether this is a block (`/* */`) comment, + // `text` is the content of the comment, and `start` and `end` are + // character offsets that denote the start and end of the comment. + // When the `locations` option is on, two more parameters are + // passed, the full `{line, column}` locations of the start and + // end of the comments. Note that you are not allowed to call the + // parser from the callback—that will corrupt its internal state. + onComment: null, + // Nodes have their start and end characters offsets recorded in + // `start` and `end` properties (directly on the node, rather than + // the `loc` object, which holds line/column data. To also add a + // [semi-standardized][range] `range` property holding a `[start, + // end]` array with the same numbers, set the `ranges` option to + // `true`. + // + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 + ranges: false, + // It is possible to parse multiple files into a single AST by + // passing the tree produced by parsing the first file as + // `program` option in subsequent parses. This will add the + // toplevel forms of the parsed file to the `Program` (top) node + // of an existing parse tree. + program: null, + // When `locations` is on, you can pass this to record the source + // file in every node's `loc` object. + sourceFile: null, + // This value, if given, is stored in every node, whether + // `locations` is on or off. + directSourceFile: null, + // When enabled, parenthesized expressions are represented by + // (non-standard) ParenthesizedExpression nodes + preserveParens: false + }; + + // Interpret and default an options object + + var warnedAboutEcmaVersion = false; + + function getOptions(opts) { + var options = {}; + + for (var opt in defaultOptions) + { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; } + + if (options.ecmaVersion === "latest") { + options.ecmaVersion = 1e8; + } else if (options.ecmaVersion == null) { + if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { + warnedAboutEcmaVersion = true; + console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); + } + options.ecmaVersion = 11; + } else if (options.ecmaVersion >= 2015) { + options.ecmaVersion -= 2009; + } + + if (options.allowReserved == null) + { options.allowReserved = options.ecmaVersion < 5; } + + if (isArray(options.onToken)) { + var tokens = options.onToken; + options.onToken = function (token) { return tokens.push(token); }; + } + if (isArray(options.onComment)) + { options.onComment = pushComment(options, options.onComment); } + + return options + } + + function pushComment(options, array) { + return function(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "Block" : "Line", + value: text, + start: start, + end: end + }; + if (options.locations) + { comment.loc = new SourceLocation(this, startLoc, endLoc); } + if (options.ranges) + { comment.range = [start, end]; } + array.push(comment); + } + } + + // Each scope gets a bitset that may contain these flags + var + SCOPE_TOP = 1, + SCOPE_FUNCTION = 2, + SCOPE_ASYNC = 4, + SCOPE_GENERATOR = 8, + SCOPE_ARROW = 16, + SCOPE_SIMPLE_CATCH = 32, + SCOPE_SUPER = 64, + SCOPE_DIRECT_SUPER = 128, + SCOPE_CLASS_STATIC_BLOCK = 256, + SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; + + function functionFlags(async, generator) { + return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0) + } + + // Used in checkLVal* and declareName to determine the type of a binding + var + BIND_NONE = 0, // Not a binding + BIND_VAR = 1, // Var-style binding + BIND_LEXICAL = 2, // Let- or const-style binding + BIND_FUNCTION = 3, // Function declaration + BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding + BIND_OUTSIDE = 5; // Special case for function names as bound inside the function + + var Parser = function Parser(options, input, startPos) { + this.options = options = getOptions(options); + this.sourceFile = options.sourceFile; + this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); + var reserved = ""; + if (options.allowReserved !== true) { + reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; + if (options.sourceType === "module") { reserved += " await"; } + } + this.reservedWords = wordsRegexp(reserved); + var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; + this.reservedWordsStrict = wordsRegexp(reservedStrict); + this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); + this.input = String(input); + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + this.containsEsc = false; + + // Set up token state + + // The current position of the tokenizer in the input. + if (startPos) { + this.pos = startPos; + this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1; + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; + } else { + this.pos = this.lineStart = 0; + this.curLine = 1; + } + + // Properties of the current token: + // Its type + this.type = types$1.eof; + // For tokens that include more information than their type, the value + this.value = null; + // Its start and end offset + this.start = this.end = this.pos; + // And, if locations are used, the {line, column} object + // corresponding to those offsets + this.startLoc = this.endLoc = this.curPosition(); + + // Position information for the previous token + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + + // The context stack is used to superficially track syntactic + // context to predict whether a regular expression is allowed in a + // given position. + this.context = this.initialContext(); + this.exprAllowed = true; + + // Figure out if it's a module code. + this.inModule = options.sourceType === "module"; + this.strict = this.inModule || this.strictDirective(this.pos); + + // Used to signify the start of a potential arrow function + this.potentialArrowAt = -1; + this.potentialArrowInForAwait = false; + + // Positions to delayed-check that yield/await does not exist in default parameters. + this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; + // Labels in scope. + this.labels = []; + // Thus-far undefined exports. + this.undefinedExports = Object.create(null); + + // If enabled, skip leading hashbang line. + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") + { this.skipLineComment(2); } + + // Scope tracking for duplicate variable names (see scope.js) + this.scopeStack = []; + this.enterScope(SCOPE_TOP); + + // For RegExp validation + this.regexpState = null; + + // The stack of private names. + // Each element has two properties: 'declared' and 'used'. + // When it exited from the outermost class definition, all used private names must be declared. + this.privateNameStack = []; + }; + + var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } }; + + Parser.prototype.parse = function parse () { + var node = this.options.program || this.startNode(); + this.nextToken(); + return this.parseTopLevel(node) + }; + + prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 }; + + prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit }; + + prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit }; + + prototypeAccessors.canAwait.get = function () { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var scope = this.scopeStack[i]; + if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false } + if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 } + } + return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction + }; + + prototypeAccessors.allowSuper.get = function () { + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod + }; + + prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 }; + + prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) }; + + prototypeAccessors.allowNewDotTarget.get = function () { + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit + }; + + prototypeAccessors.inClassStaticBlock.get = function () { + return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0 + }; + + Parser.extend = function extend () { + var plugins = [], len = arguments.length; + while ( len-- ) plugins[ len ] = arguments[ len ]; + + var cls = this; + for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); } + return cls + }; + + Parser.parse = function parse (input, options) { + return new this(options, input).parse() + }; + + Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) { + var parser = new this(options, input, pos); + parser.nextToken(); + return parser.parseExpression() + }; + + Parser.tokenizer = function tokenizer (input, options) { + return new this(options, input) + }; + + Object.defineProperties( Parser.prototype, prototypeAccessors ); + + var pp$9 = Parser.prototype; + + // ## Parser utilities + + var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; + pp$9.strictDirective = function(start) { + if (this.options.ecmaVersion < 5) { return false } + for (;;) { + // Try to find string literal. + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + var match = literal.exec(this.input.slice(start)); + if (!match) { return false } + if ((match[1] || match[2]) === "use strict") { + skipWhiteSpace.lastIndex = start + match[0].length; + var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; + var next = this.input.charAt(end); + return next === ";" || next === "}" || + (lineBreak.test(spaceAfter[0]) && + !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=")) + } + start += match[0].length; + + // Skip semicolon, if any. + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + if (this.input[start] === ";") + { start++; } + } + }; + + // Predicate that tests whether the next token is of the given + // type, and if yes, consumes it as a side effect. + + pp$9.eat = function(type) { + if (this.type === type) { + this.next(); + return true + } else { + return false + } + }; + + // Tests whether parsed token is a contextual keyword. + + pp$9.isContextual = function(name) { + return this.type === types$1.name && this.value === name && !this.containsEsc + }; + + // Consumes contextual keyword if possible. + + pp$9.eatContextual = function(name) { + if (!this.isContextual(name)) { return false } + this.next(); + return true + }; + + // Asserts that following token is given contextual keyword. + + pp$9.expectContextual = function(name) { + if (!this.eatContextual(name)) { this.unexpected(); } + }; + + // Test whether a semicolon can be inserted at the current position. + + pp$9.canInsertSemicolon = function() { + return this.type === types$1.eof || + this.type === types$1.braceR || + lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) + }; + + pp$9.insertSemicolon = function() { + if (this.canInsertSemicolon()) { + if (this.options.onInsertedSemicolon) + { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); } + return true + } + }; + + // Consume a semicolon, or, failing that, see if we are allowed to + // pretend that there is a semicolon at this position. + + pp$9.semicolon = function() { + if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); } + }; + + pp$9.afterTrailingComma = function(tokType, notNext) { + if (this.type === tokType) { + if (this.options.onTrailingComma) + { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); } + if (!notNext) + { this.next(); } + return true + } + }; + + // Expect a token of a given type. If found, consume it, otherwise, + // raise an unexpected token error. + + pp$9.expect = function(type) { + this.eat(type) || this.unexpected(); + }; + + // Raise an unexpected token error. + + pp$9.unexpected = function(pos) { + this.raise(pos != null ? pos : this.start, "Unexpected token"); + }; + + var DestructuringErrors = function DestructuringErrors() { + this.shorthandAssign = + this.trailingComma = + this.parenthesizedAssign = + this.parenthesizedBind = + this.doubleProto = + -1; + }; + + pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { + if (!refDestructuringErrors) { return } + if (refDestructuringErrors.trailingComma > -1) + { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); } + var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; + if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); } + }; + + pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { + if (!refDestructuringErrors) { return false } + var shorthandAssign = refDestructuringErrors.shorthandAssign; + var doubleProto = refDestructuringErrors.doubleProto; + if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 } + if (shorthandAssign >= 0) + { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); } + if (doubleProto >= 0) + { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); } + }; + + pp$9.checkYieldAwaitInDefaultParams = function() { + if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) + { this.raise(this.yieldPos, "Yield expression cannot be a default value"); } + if (this.awaitPos) + { this.raise(this.awaitPos, "Await expression cannot be a default value"); } + }; + + pp$9.isSimpleAssignTarget = function(expr) { + if (expr.type === "ParenthesizedExpression") + { return this.isSimpleAssignTarget(expr.expression) } + return expr.type === "Identifier" || expr.type === "MemberExpression" + }; + + var pp$8 = Parser.prototype; + + // ### Statement parsing + + // Parse a program. Initializes the parser, reads any number of + // statements, and wraps them in a Program node. Optionally takes a + // `program` argument. If present, the statements will be appended + // to its body instead of creating a new node. + + pp$8.parseTopLevel = function(node) { + var exports = Object.create(null); + if (!node.body) { node.body = []; } + while (this.type !== types$1.eof) { + var stmt = this.parseStatement(null, true, exports); + node.body.push(stmt); + } + if (this.inModule) + { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) + { + var name = list[i]; + + this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined")); + } } + this.adaptDirectivePrologue(node.body); + this.next(); + node.sourceType = this.options.sourceType; + return this.finishNode(node, "Program") + }; + + var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}; + + pp$8.isLet = function(context) { + if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + // For ambiguous cases, determine if a LexicalDeclaration (or only a + // Statement) is allowed here. If context is not empty then only a Statement + // is allowed. However, `let [` is an explicit negative lookahead for + // ExpressionStatement, so special-case it first. + if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '[', '/', astral + if (context) { return false } + + if (nextCh === 123) { return true } // '{' + if (isIdentifierStart(nextCh, true)) { + var pos = next + 1; + while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; } + if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } + var ident = this.input.slice(next, pos); + if (!keywordRelationalOperator.test(ident)) { return true } + } + return false + }; + + // check 'async [no LineTerminator here] function' + // - 'async /*foo*/ function' is OK. + // - 'async /*\n*/ function' is invalid. + pp$8.isAsyncFunction = function() { + if (this.options.ecmaVersion < 8 || !this.isContextual("async")) + { return false } + + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, after; + return !lineBreak.test(this.input.slice(this.pos, next)) && + this.input.slice(next, next + 8) === "function" && + (next + 8 === this.input.length || + !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)) + }; + + // Parse a single statement. + // + // If expecting a statement and finding a slash operator, parse a + // regular expression literal. This is to handle cases like + // `if (foo) /blah/.exec(foo)`, where looking at the previous token + // does not help. + + pp$8.parseStatement = function(context, topLevel, exports) { + var starttype = this.type, node = this.startNode(), kind; + + if (this.isLet(context)) { + starttype = types$1._var; + kind = "let"; + } + + // Most types of statements are recognized by the keyword they + // start with. Many are trivial to parse, some require a bit of + // complexity. + + switch (starttype) { + case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword) + case types$1._debugger: return this.parseDebuggerStatement(node) + case types$1._do: return this.parseDoStatement(node) + case types$1._for: return this.parseForStatement(node) + case types$1._function: + // Function as sole body of either an if statement or a labeled statement + // works, but not when it is part of a labeled statement that is the sole + // body of an if statement. + if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); } + return this.parseFunctionStatement(node, false, !context) + case types$1._class: + if (context) { this.unexpected(); } + return this.parseClass(node, true) + case types$1._if: return this.parseIfStatement(node) + case types$1._return: return this.parseReturnStatement(node) + case types$1._switch: return this.parseSwitchStatement(node) + case types$1._throw: return this.parseThrowStatement(node) + case types$1._try: return this.parseTryStatement(node) + case types$1._const: case types$1._var: + kind = kind || this.value; + if (context && kind !== "var") { this.unexpected(); } + return this.parseVarStatement(node, kind) + case types$1._while: return this.parseWhileStatement(node) + case types$1._with: return this.parseWithStatement(node) + case types$1.braceL: return this.parseBlock(true, node) + case types$1.semi: return this.parseEmptyStatement(node) + case types$1._export: + case types$1._import: + if (this.options.ecmaVersion > 10 && starttype === types$1._import) { + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + if (nextCh === 40 || nextCh === 46) // '(' or '.' + { return this.parseExpressionStatement(node, this.parseExpression()) } + } + + if (!this.options.allowImportExportEverywhere) { + if (!topLevel) + { this.raise(this.start, "'import' and 'export' may only appear at the top level"); } + if (!this.inModule) + { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); } + } + return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports) + + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + default: + if (this.isAsyncFunction()) { + if (context) { this.unexpected(); } + this.next(); + return this.parseFunctionStatement(node, true, !context) + } + + var maybeName = this.value, expr = this.parseExpression(); + if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) + { return this.parseLabeledStatement(node, maybeName, expr, context) } + else { return this.parseExpressionStatement(node, expr) } + } + }; + + pp$8.parseBreakContinueStatement = function(node, keyword) { + var isBreak = keyword === "break"; + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; } + else if (this.type !== types$1.name) { this.unexpected(); } + else { + node.label = this.parseIdent(); + this.semicolon(); + } + + // Verify that there is an actual destination to break or + // continue to. + var i = 0; + for (; i < this.labels.length; ++i) { + var lab = this.labels[i]; + if (node.label == null || lab.name === node.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) { break } + if (node.label && isBreak) { break } + } + } + if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); } + return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement") + }; + + pp$8.parseDebuggerStatement = function(node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement") + }; + + pp$8.parseDoStatement = function(node) { + this.next(); + this.labels.push(loopLabel); + node.body = this.parseStatement("do"); + this.labels.pop(); + this.expect(types$1._while); + node.test = this.parseParenExpression(); + if (this.options.ecmaVersion >= 6) + { this.eat(types$1.semi); } + else + { this.semicolon(); } + return this.finishNode(node, "DoWhileStatement") + }; + + // Disambiguating between a `for` and a `for`/`in` or `for`/`of` + // loop is non-trivial. Basically, we have to parse the init `var` + // statement or expression, disallowing the `in` operator (see + // the second parameter to `parseExpression`), and then check + // whether the next token is `in` or `of`. When there is no init + // part (semicolon immediately after the opening parenthesis), it + // is a regular `for` loop. + + pp$8.parseForStatement = function(node) { + this.next(); + var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1; + this.labels.push(loopLabel); + this.enterScope(0); + this.expect(types$1.parenL); + if (this.type === types$1.semi) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, null) + } + var isLet = this.isLet(); + if (this.type === types$1._var || this.type === types$1._const || isLet) { + var init$1 = this.startNode(), kind = isLet ? "let" : this.value; + this.next(); + this.parseVar(init$1, true, kind); + this.finishNode(init$1, "VariableDeclaration"); + if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + } else { node.await = awaitAt > -1; } + } + return this.parseForIn(node, init$1) + } + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, init$1) + } + var startsWithLet = this.isContextual("let"), isForOf = false; + var refDestructuringErrors = new DestructuringErrors; + var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); + if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + } else { node.await = awaitAt > -1; } + } + if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); } + this.toAssignable(init, false, refDestructuringErrors); + this.checkLValPattern(init); + return this.parseForIn(node, init) + } else { + this.checkExpressionErrors(refDestructuringErrors, true); + } + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, init) + }; + + pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { + this.next(); + return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync) + }; + + pp$8.parseIfStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + // allow function declarations in branches, but only in non-strict mode + node.consequent = this.parseStatement("if"); + node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; + return this.finishNode(node, "IfStatement") + }; + + pp$8.parseReturnStatement = function(node) { + if (!this.inFunction && !this.options.allowReturnOutsideFunction) + { this.raise(this.start, "'return' outside of function"); } + this.next(); + + // In `return` (and `break`/`continue`), the keywords with + // optional arguments, we eagerly look for a semicolon or the + // possibility to insert one. + + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; } + else { node.argument = this.parseExpression(); this.semicolon(); } + return this.finishNode(node, "ReturnStatement") + }; + + pp$8.parseSwitchStatement = function(node) { + this.next(); + node.discriminant = this.parseParenExpression(); + node.cases = []; + this.expect(types$1.braceL); + this.labels.push(switchLabel); + this.enterScope(0); + + // Statements under must be grouped (by label) in SwitchCase + // nodes. `cur` is used to keep the node that we are currently + // adding statements to. + + var cur; + for (var sawDefault = false; this.type !== types$1.braceR;) { + if (this.type === types$1._case || this.type === types$1._default) { + var isCase = this.type === types$1._case; + if (cur) { this.finishNode(cur, "SwitchCase"); } + node.cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); } + sawDefault = true; + cur.test = null; + } + this.expect(types$1.colon); + } else { + if (!cur) { this.unexpected(); } + cur.consequent.push(this.parseStatement(null)); + } + } + this.exitScope(); + if (cur) { this.finishNode(cur, "SwitchCase"); } + this.next(); // Closing brace + this.labels.pop(); + return this.finishNode(node, "SwitchStatement") + }; + + pp$8.parseThrowStatement = function(node) { + this.next(); + if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) + { this.raise(this.lastTokEnd, "Illegal newline after throw"); } + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement") + }; + + // Reused empty array added for node fields that are always empty. + + var empty$1 = []; + + pp$8.parseTryStatement = function(node) { + this.next(); + node.block = this.parseBlock(); + node.handler = null; + if (this.type === types$1._catch) { + var clause = this.startNode(); + this.next(); + if (this.eat(types$1.parenL)) { + clause.param = this.parseBindingAtom(); + var simple = clause.param.type === "Identifier"; + this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); + this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); + this.expect(types$1.parenR); + } else { + if (this.options.ecmaVersion < 10) { this.unexpected(); } + clause.param = null; + this.enterScope(0); + } + clause.body = this.parseBlock(false); + this.exitScope(); + node.handler = this.finishNode(clause, "CatchClause"); + } + node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; + if (!node.handler && !node.finalizer) + { this.raise(node.start, "Missing catch or finally clause"); } + return this.finishNode(node, "TryStatement") + }; + + pp$8.parseVarStatement = function(node, kind) { + this.next(); + this.parseVar(node, false, kind); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration") + }; + + pp$8.parseWhileStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + this.labels.push(loopLabel); + node.body = this.parseStatement("while"); + this.labels.pop(); + return this.finishNode(node, "WhileStatement") + }; + + pp$8.parseWithStatement = function(node) { + if (this.strict) { this.raise(this.start, "'with' in strict mode"); } + this.next(); + node.object = this.parseParenExpression(); + node.body = this.parseStatement("with"); + return this.finishNode(node, "WithStatement") + }; + + pp$8.parseEmptyStatement = function(node) { + this.next(); + return this.finishNode(node, "EmptyStatement") + }; + + pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { + for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) + { + var label = list[i$1]; + + if (label.name === maybeName) + { this.raise(expr.start, "Label '" + maybeName + "' is already declared"); + } } + var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; + for (var i = this.labels.length - 1; i >= 0; i--) { + var label$1 = this.labels[i]; + if (label$1.statementStart === node.start) { + // Update information about previous labels on this node + label$1.statementStart = this.start; + label$1.kind = kind; + } else { break } + } + this.labels.push({name: maybeName, kind: kind, statementStart: this.start}); + node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + this.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement") + }; + + pp$8.parseExpressionStatement = function(node, expr) { + node.expression = expr; + this.semicolon(); + return this.finishNode(node, "ExpressionStatement") + }; + + // Parse a semicolon-enclosed block of statements, handling `"use + // strict"` declarations when `allowStrict` is true (used for + // function bodies). + + pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { + if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true; + if ( node === void 0 ) node = this.startNode(); + + node.body = []; + this.expect(types$1.braceL); + if (createNewLexicalScope) { this.enterScope(0); } + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + if (exitStrict) { this.strict = false; } + this.next(); + if (createNewLexicalScope) { this.exitScope(); } + return this.finishNode(node, "BlockStatement") + }; + + // Parse a regular `for` loop. The disambiguation code in + // `parseStatement` will already have parsed the init statement or + // expression. + + pp$8.parseFor = function(node, init) { + node.init = init; + this.expect(types$1.semi); + node.test = this.type === types$1.semi ? null : this.parseExpression(); + this.expect(types$1.semi); + node.update = this.type === types$1.parenR ? null : this.parseExpression(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, "ForStatement") + }; + + // Parse a `for`/`in` and `for`/`of` loop, which are almost + // same from parser's perspective. + + pp$8.parseForIn = function(node, init) { + var isForIn = this.type === types$1._in; + this.next(); + + if ( + init.type === "VariableDeclaration" && + init.declarations[0].init != null && + ( + !isForIn || + this.options.ecmaVersion < 8 || + this.strict || + init.kind !== "var" || + init.declarations[0].id.type !== "Identifier" + ) + ) { + this.raise( + init.start, + ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer") + ); + } + node.left = init; + node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement") + }; + + // Parse a list of variable declarations. + + pp$8.parseVar = function(node, isFor, kind) { + node.declarations = []; + node.kind = kind; + for (;;) { + var decl = this.startNode(); + this.parseVarId(decl, kind); + if (this.eat(types$1.eq)) { + decl.init = this.parseMaybeAssign(isFor); + } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) { + this.unexpected(); + } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { + this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); + } else { + decl.init = null; + } + node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(types$1.comma)) { break } + } + return node + }; + + pp$8.parseVarId = function(decl, kind) { + decl.id = this.parseBindingAtom(); + this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); + }; + + var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4; + + // Parse a function declaration or literal (depending on the + // `statement & FUNC_STATEMENT`). + + // Remove `allowExpressionBody` for 7.0.0, as it is only called with false + pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node); + if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { + if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT)) + { this.unexpected(); } + node.generator = this.eat(types$1.star); + } + if (this.options.ecmaVersion >= 8) + { node.async = !!isAsync; } + + if (statement & FUNC_STATEMENT) { + node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent(); + if (node.id && !(statement & FUNC_HANGING_STATEMENT)) + // If it is a regular function declaration in sloppy mode, then it is + // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding + // mode depends on properties of the current scope (see + // treatFunctionsAsVar). + { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); } + } + + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(node.async, node.generator)); + + if (!(statement & FUNC_STATEMENT)) + { node.id = this.type === types$1.name ? this.parseIdent() : null; } + + this.parseFunctionParams(node); + this.parseFunctionBody(node, allowExpressionBody, false, forInit); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression") + }; + + pp$8.parseFunctionParams = function(node) { + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + }; + + // Parse a class declaration or literal (depending on the + // `isStatement` parameter). + + pp$8.parseClass = function(node, isStatement) { + this.next(); + + // ecma-262 14.6 Class Definitions + // A class definition is always strict mode code. + var oldStrict = this.strict; + this.strict = true; + + this.parseClassId(node, isStatement); + this.parseClassSuper(node); + var privateNameMap = this.enterClassBody(); + var classBody = this.startNode(); + var hadConstructor = false; + classBody.body = []; + this.expect(types$1.braceL); + while (this.type !== types$1.braceR) { + var element = this.parseClassElement(node.superClass !== null); + if (element) { + classBody.body.push(element); + if (element.type === "MethodDefinition" && element.kind === "constructor") { + if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); } + hadConstructor = true; + } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { + this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared")); + } + } + } + this.strict = oldStrict; + this.next(); + node.body = this.finishNode(classBody, "ClassBody"); + this.exitClassBody(); + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression") + }; + + pp$8.parseClassElement = function(constructorAllowsSuper) { + if (this.eat(types$1.semi)) { return null } + + var ecmaVersion = this.options.ecmaVersion; + var node = this.startNode(); + var keyName = ""; + var isGenerator = false; + var isAsync = false; + var kind = "method"; + var isStatic = false; + + if (this.eatContextual("static")) { + // Parse static init block + if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { + this.parseClassStaticBlock(node); + return node + } + if (this.isClassElementNameStart() || this.type === types$1.star) { + isStatic = true; + } else { + keyName = "static"; + } + } + node.static = isStatic; + if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { + if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { + isAsync = true; + } else { + keyName = "async"; + } + } + if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { + isGenerator = true; + } + if (!keyName && !isAsync && !isGenerator) { + var lastValue = this.value; + if (this.eatContextual("get") || this.eatContextual("set")) { + if (this.isClassElementNameStart()) { + kind = lastValue; + } else { + keyName = lastValue; + } + } + } + + // Parse element name + if (keyName) { + // 'async', 'get', 'set', or 'static' were not a keyword contextually. + // The last token is any of those. Make it the element name. + node.computed = false; + node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node.key.name = keyName; + this.finishNode(node.key, "Identifier"); + } else { + this.parseClassElementName(node); + } + + // Parse element value + if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { + var isConstructor = !node.static && checkKeyName(node, "constructor"); + var allowsDirectSuper = isConstructor && constructorAllowsSuper; + // Couldn't move this check into the 'parseClassMethod' method for backward compatibility. + if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); } + node.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + } else { + this.parseClassField(node); + } + + return node + }; + + pp$8.isClassElementNameStart = function() { + return ( + this.type === types$1.name || + this.type === types$1.privateId || + this.type === types$1.num || + this.type === types$1.string || + this.type === types$1.bracketL || + this.type.keyword + ) + }; + + pp$8.parseClassElementName = function(element) { + if (this.type === types$1.privateId) { + if (this.value === "constructor") { + this.raise(this.start, "Classes can't have an element named '#constructor'"); + } + element.computed = false; + element.key = this.parsePrivateIdent(); + } else { + this.parsePropertyName(element); + } + }; + + pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { + // Check key and flags + var key = method.key; + if (method.kind === "constructor") { + if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); } + if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); } + } else if (method.static && checkKeyName(method, "prototype")) { + this.raise(key.start, "Classes may not have a static property named prototype"); + } + + // Parse value + var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); + + // Check value + if (method.kind === "get" && value.params.length !== 0) + { this.raiseRecoverable(value.start, "getter should have no params"); } + if (method.kind === "set" && value.params.length !== 1) + { this.raiseRecoverable(value.start, "setter should have exactly one param"); } + if (method.kind === "set" && value.params[0].type === "RestElement") + { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); } + + return this.finishNode(method, "MethodDefinition") + }; + + pp$8.parseClassField = function(field) { + if (checkKeyName(field, "constructor")) { + this.raise(field.key.start, "Classes can't have a field named 'constructor'"); + } else if (field.static && checkKeyName(field, "prototype")) { + this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); + } + + if (this.eat(types$1.eq)) { + // To raise SyntaxError if 'arguments' exists in the initializer. + var scope = this.currentThisScope(); + var inClassFieldInit = scope.inClassFieldInit; + scope.inClassFieldInit = true; + field.value = this.parseMaybeAssign(); + scope.inClassFieldInit = inClassFieldInit; + } else { + field.value = null; + } + this.semicolon(); + + return this.finishNode(field, "PropertyDefinition") + }; + + pp$8.parseClassStaticBlock = function(node) { + node.body = []; + + var oldLabels = this.labels; + this.labels = []; + this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + this.next(); + this.exitScope(); + this.labels = oldLabels; + + return this.finishNode(node, "StaticBlock") + }; + + pp$8.parseClassId = function(node, isStatement) { + if (this.type === types$1.name) { + node.id = this.parseIdent(); + if (isStatement) + { this.checkLValSimple(node.id, BIND_LEXICAL, false); } + } else { + if (isStatement === true) + { this.unexpected(); } + node.id = null; + } + }; + + pp$8.parseClassSuper = function(node) { + node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; + }; + + pp$8.enterClassBody = function() { + var element = {declared: Object.create(null), used: []}; + this.privateNameStack.push(element); + return element.declared + }; + + pp$8.exitClassBody = function() { + var ref = this.privateNameStack.pop(); + var declared = ref.declared; + var used = ref.used; + var len = this.privateNameStack.length; + var parent = len === 0 ? null : this.privateNameStack[len - 1]; + for (var i = 0; i < used.length; ++i) { + var id = used[i]; + if (!hasOwn(declared, id.name)) { + if (parent) { + parent.used.push(id); + } else { + this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class")); + } + } + } + }; + + function isPrivateNameConflicted(privateNameMap, element) { + var name = element.key.name; + var curr = privateNameMap[name]; + + var next = "true"; + if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { + next = (element.static ? "s" : "i") + element.kind; + } + + // `class { get #a(){}; static set #a(_){} }` is also conflict. + if ( + curr === "iget" && next === "iset" || + curr === "iset" && next === "iget" || + curr === "sget" && next === "sset" || + curr === "sset" && next === "sget" + ) { + privateNameMap[name] = "true"; + return false + } else if (!curr) { + privateNameMap[name] = next; + return false + } else { + return true + } + } + + function checkKeyName(node, name) { + var computed = node.computed; + var key = node.key; + return !computed && ( + key.type === "Identifier" && key.name === name || + key.type === "Literal" && key.value === name + ) + } + + // Parses module export declaration. + + pp$8.parseExport = function(node, exports) { + this.next(); + // export * from '...' + if (this.eat(types$1.star)) { + if (this.options.ecmaVersion >= 11) { + if (this.eatContextual("as")) { + node.exported = this.parseModuleExportName(); + this.checkExport(exports, node.exported, this.lastTokStart); + } else { + node.exported = null; + } + } + this.expectContextual("from"); + if (this.type !== types$1.string) { this.unexpected(); } + node.source = this.parseExprAtom(); + this.semicolon(); + return this.finishNode(node, "ExportAllDeclaration") + } + if (this.eat(types$1._default)) { // export default ... + this.checkExport(exports, "default", this.lastTokStart); + var isAsync; + if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode(); + this.next(); + if (isAsync) { this.next(); } + node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); + } else if (this.type === types$1._class) { + var cNode = this.startNode(); + node.declaration = this.parseClass(cNode, "nullableID"); + } else { + node.declaration = this.parseMaybeAssign(); + this.semicolon(); + } + return this.finishNode(node, "ExportDefaultDeclaration") + } + // export var|const|let|function|class ... + if (this.shouldParseExportStatement()) { + node.declaration = this.parseStatement(null); + if (node.declaration.type === "VariableDeclaration") + { this.checkVariableExport(exports, node.declaration.declarations); } + else + { this.checkExport(exports, node.declaration.id, node.declaration.id.start); } + node.specifiers = []; + node.source = null; + } else { // export { x, y as z } [from '...'] + node.declaration = null; + node.specifiers = this.parseExportSpecifiers(exports); + if (this.eatContextual("from")) { + if (this.type !== types$1.string) { this.unexpected(); } + node.source = this.parseExprAtom(); + } else { + for (var i = 0, list = node.specifiers; i < list.length; i += 1) { + // check for keywords used as local names + var spec = list[i]; + + this.checkUnreserved(spec.local); + // check if export is defined + this.checkLocalExport(spec.local); + + if (spec.local.type === "Literal") { + this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); + } + } + + node.source = null; + } + this.semicolon(); + } + return this.finishNode(node, "ExportNamedDeclaration") + }; + + pp$8.checkExport = function(exports, name, pos) { + if (!exports) { return } + if (typeof name !== "string") + { name = name.type === "Identifier" ? name.name : name.value; } + if (hasOwn(exports, name)) + { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); } + exports[name] = true; + }; + + pp$8.checkPatternExport = function(exports, pat) { + var type = pat.type; + if (type === "Identifier") + { this.checkExport(exports, pat, pat.start); } + else if (type === "ObjectPattern") + { for (var i = 0, list = pat.properties; i < list.length; i += 1) + { + var prop = list[i]; + + this.checkPatternExport(exports, prop); + } } + else if (type === "ArrayPattern") + { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { + var elt = list$1[i$1]; + + if (elt) { this.checkPatternExport(exports, elt); } + } } + else if (type === "Property") + { this.checkPatternExport(exports, pat.value); } + else if (type === "AssignmentPattern") + { this.checkPatternExport(exports, pat.left); } + else if (type === "RestElement") + { this.checkPatternExport(exports, pat.argument); } + else if (type === "ParenthesizedExpression") + { this.checkPatternExport(exports, pat.expression); } + }; + + pp$8.checkVariableExport = function(exports, decls) { + if (!exports) { return } + for (var i = 0, list = decls; i < list.length; i += 1) + { + var decl = list[i]; + + this.checkPatternExport(exports, decl.id); + } + }; + + pp$8.shouldParseExportStatement = function() { + return this.type.keyword === "var" || + this.type.keyword === "const" || + this.type.keyword === "class" || + this.type.keyword === "function" || + this.isLet() || + this.isAsyncFunction() + }; + + // Parses a comma-separated list of module exports. + + pp$8.parseExportSpecifiers = function(exports) { + var nodes = [], first = true; + // export { x, y as z } [from '...'] + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var node = this.startNode(); + node.local = this.parseModuleExportName(); + node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; + this.checkExport( + exports, + node.exported, + node.exported.start + ); + nodes.push(this.finishNode(node, "ExportSpecifier")); + } + return nodes + }; + + // Parses import declaration. + + pp$8.parseImport = function(node) { + this.next(); + // import '...' + if (this.type === types$1.string) { + node.specifiers = empty$1; + node.source = this.parseExprAtom(); + } else { + node.specifiers = this.parseImportSpecifiers(); + this.expectContextual("from"); + node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); + } + this.semicolon(); + return this.finishNode(node, "ImportDeclaration") + }; + + // Parses a comma-separated list of module imports. + + pp$8.parseImportSpecifiers = function() { + var nodes = [], first = true; + if (this.type === types$1.name) { + // import defaultObj, { x, y as z } from '...' + var node = this.startNode(); + node.local = this.parseIdent(); + this.checkLValSimple(node.local, BIND_LEXICAL); + nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); + if (!this.eat(types$1.comma)) { return nodes } + } + if (this.type === types$1.star) { + var node$1 = this.startNode(); + this.next(); + this.expectContextual("as"); + node$1.local = this.parseIdent(); + this.checkLValSimple(node$1.local, BIND_LEXICAL); + nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); + return nodes + } + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var node$2 = this.startNode(); + node$2.imported = this.parseModuleExportName(); + if (this.eatContextual("as")) { + node$2.local = this.parseIdent(); + } else { + this.checkUnreserved(node$2.imported); + node$2.local = node$2.imported; + } + this.checkLValSimple(node$2.local, BIND_LEXICAL); + nodes.push(this.finishNode(node$2, "ImportSpecifier")); + } + return nodes + }; + + pp$8.parseModuleExportName = function() { + if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { + var stringLiteral = this.parseLiteral(this.value); + if (loneSurrogate.test(stringLiteral.value)) { + this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); + } + return stringLiteral + } + return this.parseIdent(true) + }; + + // Set `ExpressionStatement#directive` property for directive prologues. + pp$8.adaptDirectivePrologue = function(statements) { + for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { + statements[i].directive = statements[i].expression.raw.slice(1, -1); + } + }; + pp$8.isDirectiveCandidate = function(statement) { + return ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" && + typeof statement.expression.value === "string" && + // Reject parenthesized strings. + (this.input[statement.start] === "\"" || this.input[statement.start] === "'") + ) + }; + + var pp$7 = Parser.prototype; + + // Convert existing expression atom to assignable pattern + // if possible. + + pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node) { + switch (node.type) { + case "Identifier": + if (this.inAsync && node.name === "await") + { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); } + break + + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + break + + case "ObjectExpression": + node.type = "ObjectPattern"; + if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + for (var i = 0, list = node.properties; i < list.length; i += 1) { + var prop = list[i]; + + this.toAssignable(prop, isBinding); + // Early error: + // AssignmentRestProperty[Yield, Await] : + // `...` DestructuringAssignmentTarget[Yield, Await] + // + // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|. + if ( + prop.type === "RestElement" && + (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern") + ) { + this.raise(prop.argument.start, "Unexpected token"); + } + } + break + + case "Property": + // AssignmentProperty has type === "Property" + if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); } + this.toAssignable(node.value, isBinding); + break + + case "ArrayExpression": + node.type = "ArrayPattern"; + if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + this.toAssignableList(node.elements, isBinding); + break + + case "SpreadElement": + node.type = "RestElement"; + this.toAssignable(node.argument, isBinding); + if (node.argument.type === "AssignmentPattern") + { this.raise(node.argument.start, "Rest elements cannot have a default value"); } + break + + case "AssignmentExpression": + if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); } + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isBinding); + break + + case "ParenthesizedExpression": + this.toAssignable(node.expression, isBinding, refDestructuringErrors); + break + + case "ChainExpression": + this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); + break + + case "MemberExpression": + if (!isBinding) { break } + + default: + this.raise(node.start, "Assigning to rvalue"); + } + } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + return node + }; + + // Convert list of expression atoms to binding list. + + pp$7.toAssignableList = function(exprList, isBinding) { + var end = exprList.length; + for (var i = 0; i < end; i++) { + var elt = exprList[i]; + if (elt) { this.toAssignable(elt, isBinding); } + } + if (end) { + var last = exprList[end - 1]; + if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") + { this.unexpected(last.argument.start); } + } + return exprList + }; + + // Parses spread element. + + pp$7.parseSpread = function(refDestructuringErrors) { + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node, "SpreadElement") + }; + + pp$7.parseRestBinding = function() { + var node = this.startNode(); + this.next(); + + // RestElement inside of a function parameter must be an identifier + if (this.options.ecmaVersion === 6 && this.type !== types$1.name) + { this.unexpected(); } + + node.argument = this.parseBindingAtom(); + + return this.finishNode(node, "RestElement") + }; + + // Parses lvalue (assignable) atom. + + pp$7.parseBindingAtom = function() { + if (this.options.ecmaVersion >= 6) { + switch (this.type) { + case types$1.bracketL: + var node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(types$1.bracketR, true, true); + return this.finishNode(node, "ArrayPattern") + + case types$1.braceL: + return this.parseObj(true) + } + } + return this.parseIdent() + }; + + pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) { + var elts = [], first = true; + while (!this.eat(close)) { + if (first) { first = false; } + else { this.expect(types$1.comma); } + if (allowEmpty && this.type === types$1.comma) { + elts.push(null); + } else if (allowTrailingComma && this.afterTrailingComma(close)) { + break + } else if (this.type === types$1.ellipsis) { + var rest = this.parseRestBinding(); + this.parseBindingListItem(rest); + elts.push(rest); + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } + this.expect(close); + break + } else { + var elem = this.parseMaybeDefault(this.start, this.startLoc); + this.parseBindingListItem(elem); + elts.push(elem); + } + } + return elts + }; + + pp$7.parseBindingListItem = function(param) { + return param + }; + + // Parses assignment pattern around given atom if possible. + + pp$7.parseMaybeDefault = function(startPos, startLoc, left) { + left = left || this.parseBindingAtom(); + if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.right = this.parseMaybeAssign(); + return this.finishNode(node, "AssignmentPattern") + }; + + // The following three functions all verify that a node is an lvalue — + // something that can be bound, or assigned to. In order to do so, they perform + // a variety of checks: + // + // - Check that none of the bound/assigned-to identifiers are reserved words. + // - Record name declarations for bindings in the appropriate scope. + // - Check duplicate argument names, if checkClashes is set. + // + // If a complex binding pattern is encountered (e.g., object and array + // destructuring), the entire pattern is recursively checked. + // + // There are three versions of checkLVal*() appropriate for different + // circumstances: + // + // - checkLValSimple() shall be used if the syntactic construct supports + // nothing other than identifiers and member expressions. Parenthesized + // expressions are also correctly handled. This is generally appropriate for + // constructs for which the spec says + // + // > It is a Syntax Error if AssignmentTargetType of [the production] is not + // > simple. + // + // It is also appropriate for checking if an identifier is valid and not + // defined elsewhere, like import declarations or function/class identifiers. + // + // Examples where this is used include: + // a += …; + // import a from '…'; + // where a is the node to be checked. + // + // - checkLValPattern() shall be used if the syntactic construct supports + // anything checkLValSimple() supports, as well as object and array + // destructuring patterns. This is generally appropriate for constructs for + // which the spec says + // + // > It is a Syntax Error if [the production] is neither an ObjectLiteral nor + // > an ArrayLiteral and AssignmentTargetType of [the production] is not + // > simple. + // + // Examples where this is used include: + // (a = …); + // const a = …; + // try { … } catch (a) { … } + // where a is the node to be checked. + // + // - checkLValInnerPattern() shall be used if the syntactic construct supports + // anything checkLValPattern() supports, as well as default assignment + // patterns, rest elements, and other constructs that may appear within an + // object or array destructuring pattern. + // + // As a special case, function parameters also use checkLValInnerPattern(), + // as they also support defaults and rest constructs. + // + // These functions deliberately support both assignment and binding constructs, + // as the logic for both is exceedingly similar. If the node is the target of + // an assignment, then bindingType should be set to BIND_NONE. Otherwise, it + // should be set to the appropriate BIND_* constant, like BIND_VAR or + // BIND_LEXICAL. + // + // If the function is called with a non-BIND_NONE bindingType, then + // additionally a checkClashes object may be specified to allow checking for + // duplicate argument names. checkClashes is ignored if the provided construct + // is an assignment (i.e., bindingType is BIND_NONE). + + pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + var isBind = bindingType !== BIND_NONE; + + switch (expr.type) { + case "Identifier": + if (this.strict && this.reservedWordsStrictBind.test(expr.name)) + { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); } + if (isBind) { + if (bindingType === BIND_LEXICAL && expr.name === "let") + { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); } + if (checkClashes) { + if (hasOwn(checkClashes, expr.name)) + { this.raiseRecoverable(expr.start, "Argument name clash"); } + checkClashes[expr.name] = true; + } + if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); } + } + break + + case "ChainExpression": + this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); + break + + case "MemberExpression": + if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); } + break + + case "ParenthesizedExpression": + if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); } + return this.checkLValSimple(expr.expression, bindingType, checkClashes) + + default: + this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); + } + }; + + pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + switch (expr.type) { + case "ObjectPattern": + for (var i = 0, list = expr.properties; i < list.length; i += 1) { + var prop = list[i]; + + this.checkLValInnerPattern(prop, bindingType, checkClashes); + } + break + + case "ArrayPattern": + for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { + var elem = list$1[i$1]; + + if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); } + } + break + + default: + this.checkLValSimple(expr, bindingType, checkClashes); + } + }; + + pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + switch (expr.type) { + case "Property": + // AssignmentProperty has type === "Property" + this.checkLValInnerPattern(expr.value, bindingType, checkClashes); + break + + case "AssignmentPattern": + this.checkLValPattern(expr.left, bindingType, checkClashes); + break + + case "RestElement": + this.checkLValPattern(expr.argument, bindingType, checkClashes); + break + + default: + this.checkLValPattern(expr, bindingType, checkClashes); + } + }; + + // The algorithm used to determine whether a regexp can appear at a + + var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + this.generator = !!generator; + }; + + var types = { + b_stat: new TokContext("{", false), + b_expr: new TokContext("{", true), + b_tmpl: new TokContext("${", false), + p_stat: new TokContext("(", false), + p_expr: new TokContext("(", true), + q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }), + f_stat: new TokContext("function", false), + f_expr: new TokContext("function", true), + f_expr_gen: new TokContext("function", true, false, null, true), + f_gen: new TokContext("function", false, false, null, true) + }; + + var pp$6 = Parser.prototype; + + pp$6.initialContext = function() { + return [types.b_stat] + }; + + pp$6.curContext = function() { + return this.context[this.context.length - 1] + }; + + pp$6.braceIsBlock = function(prevType) { + var parent = this.curContext(); + if (parent === types.f_expr || parent === types.f_stat) + { return true } + if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) + { return !parent.isExpr } + + // The check for `tt.name && exprAllowed` detects whether we are + // after a `yield` or `of` construct. See the `updateContext` for + // `tt.name`. + if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) + { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) } + if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) + { return true } + if (prevType === types$1.braceL) + { return parent === types.b_stat } + if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) + { return false } + return !this.exprAllowed + }; + + pp$6.inGeneratorContext = function() { + for (var i = this.context.length - 1; i >= 1; i--) { + var context = this.context[i]; + if (context.token === "function") + { return context.generator } + } + return false + }; + + pp$6.updateContext = function(prevType) { + var update, type = this.type; + if (type.keyword && prevType === types$1.dot) + { this.exprAllowed = false; } + else if (update = type.updateContext) + { update.call(this, prevType); } + else + { this.exprAllowed = type.beforeExpr; } + }; + + // Used to handle egde case when token context could not be inferred correctly in tokenize phase + pp$6.overrideContext = function(tokenCtx) { + if (this.curContext() !== tokenCtx) { + this.context[this.context.length - 1] = tokenCtx; + } + }; + + // Token-specific context update code + + types$1.parenR.updateContext = types$1.braceR.updateContext = function() { + if (this.context.length === 1) { + this.exprAllowed = true; + return + } + var out = this.context.pop(); + if (out === types.b_stat && this.curContext().token === "function") { + out = this.context.pop(); + } + this.exprAllowed = !out.isExpr; + }; + + types$1.braceL.updateContext = function(prevType) { + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); + this.exprAllowed = true; + }; + + types$1.dollarBraceL.updateContext = function() { + this.context.push(types.b_tmpl); + this.exprAllowed = true; + }; + + types$1.parenL.updateContext = function(prevType) { + var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; + this.context.push(statementParens ? types.p_stat : types.p_expr); + this.exprAllowed = true; + }; + + types$1.incDec.updateContext = function() { + // tokExprAllowed stays unchanged + }; + + types$1._function.updateContext = types$1._class.updateContext = function(prevType) { + if (prevType.beforeExpr && prevType !== types$1._else && + !(prevType === types$1.semi && this.curContext() !== types.p_stat) && + !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && + !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) + { this.context.push(types.f_expr); } + else + { this.context.push(types.f_stat); } + this.exprAllowed = false; + }; + + types$1.backQuote.updateContext = function() { + if (this.curContext() === types.q_tmpl) + { this.context.pop(); } + else + { this.context.push(types.q_tmpl); } + this.exprAllowed = false; + }; + + types$1.star.updateContext = function(prevType) { + if (prevType === types$1._function) { + var index = this.context.length - 1; + if (this.context[index] === types.f_expr) + { this.context[index] = types.f_expr_gen; } + else + { this.context[index] = types.f_gen; } + } + this.exprAllowed = true; + }; + + types$1.name.updateContext = function(prevType) { + var allowed = false; + if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { + if (this.value === "of" && !this.exprAllowed || + this.value === "yield" && this.inGeneratorContext()) + { allowed = true; } + } + this.exprAllowed = allowed; + }; + + // A recursive descent parser operates by defining functions for all + + var pp$5 = Parser.prototype; + + // Check if property name clashes with already added. + // Object/class getters and setters are not allowed to clash — + // either with each other or with an init property — and in + // strict mode, init properties are also not allowed to be repeated. + + pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { + if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") + { return } + if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) + { return } + var key = prop.key; + var name; + switch (key.type) { + case "Identifier": name = key.name; break + case "Literal": name = String(key.value); break + default: return + } + var kind = prop.kind; + if (this.options.ecmaVersion >= 6) { + if (name === "__proto__" && kind === "init") { + if (propHash.proto) { + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) { + refDestructuringErrors.doubleProto = key.start; + } + } else { + this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); + } + } + propHash.proto = true; + } + return + } + name = "$" + name; + var other = propHash[name]; + if (other) { + var redefinition; + if (kind === "init") { + redefinition = this.strict && other.init || other.get || other.set; + } else { + redefinition = other.init || other[kind]; + } + if (redefinition) + { this.raiseRecoverable(key.start, "Redefinition of property"); } + } else { + other = propHash[name] = { + init: false, + get: false, + set: false + }; + } + other[kind] = true; + }; + + // ### Expression parsing + + // These nest, from the most general expression type at the top to + // 'atomic', nondivisible expression types at the bottom. Most of + // the functions will simply let the function(s) below them parse, + // and, *if* the syntactic construct they handle is present, wrap + // the AST node that the inner parser gave them in another node. + + // Parse a full expression. The optional arguments are used to + // forbid the `in` operator (in for loops initalization expressions) + // and provide reference for storing '=' operator inside shorthand + // property assignment in contexts where both object expression + // and object pattern might appear (so it's possible to raise + // delayed syntax error at correct position). + + pp$5.parseExpression = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); + if (this.type === types$1.comma) { + var node = this.startNodeAt(startPos, startLoc); + node.expressions = [expr]; + while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } + return this.finishNode(node, "SequenceExpression") + } + return expr + }; + + // Parse an assignment expression. This includes applications of + // operators like `+=`. + + pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { + if (this.isContextual("yield")) { + if (this.inGenerator) { return this.parseYield(forInit) } + // The tokenizer will assume an expression is allowed after + // `yield`, but this isn't that kind of yield + else { this.exprAllowed = false; } + } + + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; + if (refDestructuringErrors) { + oldParenAssign = refDestructuringErrors.parenthesizedAssign; + oldTrailingComma = refDestructuringErrors.trailingComma; + oldDoubleProto = refDestructuringErrors.doubleProto; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; + } else { + refDestructuringErrors = new DestructuringErrors; + ownDestructuringErrors = true; + } + + var startPos = this.start, startLoc = this.startLoc; + if (this.type === types$1.parenL || this.type === types$1.name) { + this.potentialArrowAt = this.start; + this.potentialArrowInForAwait = forInit === "await"; + } + var left = this.parseMaybeConditional(forInit, refDestructuringErrors); + if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); } + if (this.type.isAssign) { + var node = this.startNodeAt(startPos, startLoc); + node.operator = this.value; + if (this.type === types$1.eq) + { left = this.toAssignable(left, false, refDestructuringErrors); } + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= left.start) + { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly + if (this.type === types$1.eq) + { this.checkLValPattern(left); } + else + { this.checkLValSimple(left); } + node.left = left; + this.next(); + node.right = this.parseMaybeAssign(forInit); + if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; } + return this.finishNode(node, "AssignmentExpression") + } else { + if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); } + } + if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; } + if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; } + return left + }; + + // Parse a ternary conditional (`?:`) operator. + + pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprOps(forInit, refDestructuringErrors); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + if (this.eat(types$1.question)) { + var node = this.startNodeAt(startPos, startLoc); + node.test = expr; + node.consequent = this.parseMaybeAssign(); + this.expect(types$1.colon); + node.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node, "ConditionalExpression") + } + return expr + }; + + // Start the precedence parser. + + pp$5.parseExprOps = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit) + }; + + // Parse binary operators with the operator precedence parsing + // algorithm. `left` is the left-hand side of the operator. + // `minPrec` provides context that allows the function to stop and + // defer further parser to one of its callers when it encounters an + // operator that has a lower precedence than the set it is parsing. + + pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { + var prec = this.type.binop; + if (prec != null && (!forInit || this.type !== types$1._in)) { + if (prec > minPrec) { + var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; + var coalesce = this.type === types$1.coalesce; + if (coalesce) { + // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. + // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. + prec = types$1.logicalAND.binop; + } + var op = this.value; + this.next(); + var startPos = this.start, startLoc = this.startLoc; + var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); + var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) { + this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); + } + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit) + } + } + return left + }; + + pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { + if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.operator = op; + node.right = right; + return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression") + }; + + // Parse unary operators, both prefix and postfix. + + pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { + var startPos = this.start, startLoc = this.startLoc, expr; + if (this.isContextual("await") && this.canAwait) { + expr = this.parseAwait(forInit); + sawUnary = true; + } else if (this.type.prefix) { + var node = this.startNode(), update = this.type === types$1.incDec; + node.operator = this.value; + node.prefix = true; + this.next(); + node.argument = this.parseMaybeUnary(null, true, update, forInit); + this.checkExpressionErrors(refDestructuringErrors, true); + if (update) { this.checkLValSimple(node.argument); } + else if (this.strict && node.operator === "delete" && + node.argument.type === "Identifier") + { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); } + else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) + { this.raiseRecoverable(node.start, "Private fields can not be deleted"); } + else { sawUnary = true; } + expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + } else if (!sawUnary && this.type === types$1.privateId) { + if (forInit || this.privateNameStack.length === 0) { this.unexpected(); } + expr = this.parsePrivateIdent(); + // only could be private fields in 'in', such as #x in obj + if (this.type !== types$1._in) { this.unexpected(); } + } else { + expr = this.parseExprSubscripts(refDestructuringErrors, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + while (this.type.postfix && !this.canInsertSemicolon()) { + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.operator = this.value; + node$1.prefix = false; + node$1.argument = expr; + this.checkLValSimple(expr); + this.next(); + expr = this.finishNode(node$1, "UpdateExpression"); + } + } + + if (!incDec && this.eat(types$1.starstar)) { + if (sawUnary) + { this.unexpected(this.lastTokStart); } + else + { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) } + } else { + return expr + } + }; + + function isPrivateFieldAccess(node) { + return ( + node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || + node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) + ) + } + + // Parse call, dot, and `[]`-subscript expressions. + + pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprAtom(refDestructuringErrors, forInit); + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") + { return expr } + var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); + if (refDestructuringErrors && result.type === "MemberExpression") { + if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; } + if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; } + if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; } + } + return result + }; + + pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && + this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && + this.potentialArrowAt === base.start; + var optionalChained = false; + + while (true) { + var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + + if (element.optional) { optionalChained = true; } + if (element === base || element.type === "ArrowFunctionExpression") { + if (optionalChained) { + var chainNode = this.startNodeAt(startPos, startLoc); + chainNode.expression = element; + element = this.finishNode(chainNode, "ChainExpression"); + } + return element + } + + base = element; + } + }; + + pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { + var optionalSupported = this.options.ecmaVersion >= 11; + var optional = optionalSupported && this.eat(types$1.questionDot); + if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); } + + var computed = this.eat(types$1.bracketL); + if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) { + var node = this.startNodeAt(startPos, startLoc); + node.object = base; + if (computed) { + node.property = this.parseExpression(); + this.expect(types$1.bracketR); + } else if (this.type === types$1.privateId && base.type !== "Super") { + node.property = this.parsePrivateIdent(); + } else { + node.property = this.parseIdent(this.options.allowReserved !== "never"); + } + node.computed = !!computed; + if (optionalSupported) { + node.optional = optional; + } + base = this.finishNode(node, "MemberExpression"); + } else if (!noCalls && this.eat(types$1.parenL)) { + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + if (this.awaitIdentPos > 0) + { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); } + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit) + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.callee = base; + node$1.arguments = exprList; + if (optionalSupported) { + node$1.optional = optional; + } + base = this.finishNode(node$1, "CallExpression"); + } else if (this.type === types$1.backQuote) { + if (optional || optionalChained) { + this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); + } + var node$2 = this.startNodeAt(startPos, startLoc); + node$2.tag = base; + node$2.quasi = this.parseTemplate({isTagged: true}); + base = this.finishNode(node$2, "TaggedTemplateExpression"); + } + return base + }; + + // Parse an atomic expression — either a single token that is an + // expression, an expression started by a keyword like `function` or + // `new`, or an expression wrapped in punctuation like `()`, `[]`, + // or `{}`. + + pp$5.parseExprAtom = function(refDestructuringErrors, forInit) { + // If a division operator appears in an expression position, the + // tokenizer got confused, and we force it to read a regexp instead. + if (this.type === types$1.slash) { this.readRegexp(); } + + var node, canBeArrow = this.potentialArrowAt === this.start; + switch (this.type) { + case types$1._super: + if (!this.allowSuper) + { this.raise(this.start, "'super' keyword outside a method"); } + node = this.startNode(); + this.next(); + if (this.type === types$1.parenL && !this.allowDirectSuper) + { this.raise(node.start, "super() call outside constructor of a subclass"); } + // The `super` keyword can appear at below: + // SuperProperty: + // super [ Expression ] + // super . IdentifierName + // SuperCall: + // super ( Arguments ) + if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) + { this.unexpected(); } + return this.finishNode(node, "Super") + + case types$1._this: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression") + + case types$1.name: + var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; + var id = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + this.overrideContext(types.f_expr); + return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit) + } + if (canBeArrow && !this.canInsertSemicolon()) { + if (this.eat(types$1.arrow)) + { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) } + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && + (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { + id = this.parseIdent(false); + if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) + { this.unexpected(); } + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit) + } + } + return id + + case types$1.regexp: + var value = this.value; + node = this.parseLiteral(value.value); + node.regex = {pattern: value.pattern, flags: value.flags}; + return node + + case types$1.num: case types$1.string: + return this.parseLiteral(this.value) + + case types$1._null: case types$1._true: case types$1._false: + node = this.startNode(); + node.value = this.type === types$1._null ? null : this.type === types$1._true; + node.raw = this.type.keyword; + this.next(); + return this.finishNode(node, "Literal") + + case types$1.parenL: + var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); + if (refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) + { refDestructuringErrors.parenthesizedAssign = start; } + if (refDestructuringErrors.parenthesizedBind < 0) + { refDestructuringErrors.parenthesizedBind = start; } + } + return expr + + case types$1.bracketL: + node = this.startNode(); + this.next(); + node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node, "ArrayExpression") + + case types$1.braceL: + this.overrideContext(types.b_expr); + return this.parseObj(false, refDestructuringErrors) + + case types$1._function: + node = this.startNode(); + this.next(); + return this.parseFunction(node, 0) + + case types$1._class: + return this.parseClass(this.startNode(), false) + + case types$1._new: + return this.parseNew() + + case types$1.backQuote: + return this.parseTemplate() + + case types$1._import: + if (this.options.ecmaVersion >= 11) { + return this.parseExprImport() + } else { + return this.unexpected() + } + + default: + this.unexpected(); + } + }; + + pp$5.parseExprImport = function() { + var node = this.startNode(); + + // Consume `import` as an identifier for `import.meta`. + // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } + var meta = this.parseIdent(true); + + switch (this.type) { + case types$1.parenL: + return this.parseDynamicImport(node) + case types$1.dot: + node.meta = meta; + return this.parseImportMeta(node) + default: + this.unexpected(); + } + }; + + pp$5.parseDynamicImport = function(node) { + this.next(); // skip `(` + + // Parse node.source. + node.source = this.parseMaybeAssign(); + + // Verify ending. + if (!this.eat(types$1.parenR)) { + var errorPos = this.start; + if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { + this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); + } else { + this.unexpected(errorPos); + } + } + + return this.finishNode(node, "ImportExpression") + }; + + pp$5.parseImportMeta = function(node) { + this.next(); // skip `.` + + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + + if (node.property.name !== "meta") + { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); } + if (containsEsc) + { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); } + if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) + { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); } + + return this.finishNode(node, "MetaProperty") + }; + + pp$5.parseLiteral = function(value) { + var node = this.startNode(); + node.value = value; + node.raw = this.input.slice(this.start, this.end); + if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); } + this.next(); + return this.finishNode(node, "Literal") + }; + + pp$5.parseParenExpression = function() { + this.expect(types$1.parenL); + var val = this.parseExpression(); + this.expect(types$1.parenR); + return val + }; + + pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { + var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; + if (this.options.ecmaVersion >= 6) { + this.next(); + + var innerStartPos = this.start, innerStartLoc = this.startLoc; + var exprList = [], first = true, lastIsComma = false; + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; + this.yieldPos = 0; + this.awaitPos = 0; + // Do not save awaitIdentPos to allow checking awaits nested in parameters + while (this.type !== types$1.parenR) { + first ? first = false : this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { + lastIsComma = true; + break + } else if (this.type === types$1.ellipsis) { + spreadStart = this.start; + exprList.push(this.parseParenItem(this.parseRestBinding())); + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } + break + } else { + exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); + } + } + var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; + this.expect(types$1.parenR); + + if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + return this.parseParenArrowList(startPos, startLoc, exprList, forInit) + } + + if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); } + if (spreadStart) { this.unexpected(spreadStart); } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + } else { + val = this.parseParenExpression(); + } + + if (this.options.preserveParens) { + var par = this.startNodeAt(startPos, startLoc); + par.expression = val; + return this.finishNode(par, "ParenthesizedExpression") + } else { + return val + } + }; + + pp$5.parseParenItem = function(item) { + return item + }; + + pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit) + }; + + // New's precedence is slightly tricky. It must allow its argument to + // be a `[]` or dot subscript expression, but not a call — at least, + // not without wrapping it in parentheses. Thus, it uses the noCalls + // argument to parseSubscripts to prevent it from consuming the + // argument list. + + var empty = []; + + pp$5.parseNew = function() { + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } + var node = this.startNode(); + var meta = this.parseIdent(true); + if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { + node.meta = meta; + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + if (node.property.name !== "target") + { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); } + if (containsEsc) + { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); } + if (!this.allowNewDotTarget) + { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); } + return this.finishNode(node, "MetaProperty") + } + var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import; + node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); + if (isImport && node.callee.type === "ImportExpression") { + this.raise(startPos, "Cannot use new with import()"); + } + if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); } + else { node.arguments = empty; } + return this.finishNode(node, "NewExpression") + }; + + // Parse template expression. + + pp$5.parseTemplateElement = function(ref) { + var isTagged = ref.isTagged; + + var elem = this.startNode(); + if (this.type === types$1.invalidTemplate) { + if (!isTagged) { + this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); + } + elem.value = { + raw: this.value, + cooked: null + }; + } else { + elem.value = { + raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"), + cooked: this.value + }; + } + this.next(); + elem.tail = this.type === types$1.backQuote; + return this.finishNode(elem, "TemplateElement") + }; + + pp$5.parseTemplate = function(ref) { + if ( ref === void 0 ) ref = {}; + var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false; + + var node = this.startNode(); + this.next(); + node.expressions = []; + var curElt = this.parseTemplateElement({isTagged: isTagged}); + node.quasis = [curElt]; + while (!curElt.tail) { + if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); } + this.expect(types$1.dollarBraceL); + node.expressions.push(this.parseExpression()); + this.expect(types$1.braceR); + node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged})); + } + this.next(); + return this.finishNode(node, "TemplateLiteral") + }; + + pp$5.isAsyncProp = function(prop) { + return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && + (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) && + !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) + }; + + // Parse an object literal or binding pattern. + + pp$5.parseObj = function(isPattern, refDestructuringErrors) { + var node = this.startNode(), first = true, propHash = {}; + node.properties = []; + this.next(); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var prop = this.parseProperty(isPattern, refDestructuringErrors); + if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); } + node.properties.push(prop); + } + return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression") + }; + + pp$5.parseProperty = function(isPattern, refDestructuringErrors) { + var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; + if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { + if (isPattern) { + prop.argument = this.parseIdent(false); + if (this.type === types$1.comma) { + this.raise(this.start, "Comma is not permitted after the rest element"); + } + return this.finishNode(prop, "RestElement") + } + // To disallow parenthesized identifier via `this.toAssignable()`. + if (this.type === types$1.parenL && refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0) { + refDestructuringErrors.parenthesizedAssign = this.start; + } + if (refDestructuringErrors.parenthesizedBind < 0) { + refDestructuringErrors.parenthesizedBind = this.start; + } + } + // Parse argument. + prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); + // To disallow trailing comma via `this.toAssignable()`. + if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + // Finish + return this.finishNode(prop, "SpreadElement") + } + if (this.options.ecmaVersion >= 6) { + prop.method = false; + prop.shorthand = false; + if (isPattern || refDestructuringErrors) { + startPos = this.start; + startLoc = this.startLoc; + } + if (!isPattern) + { isGenerator = this.eat(types$1.star); } + } + var containsEsc = this.containsEsc; + this.parsePropertyName(prop); + if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { + isAsync = true; + isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); + this.parsePropertyName(prop, refDestructuringErrors); + } else { + isAsync = false; + } + this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); + return this.finishNode(prop, "Property") + }; + + pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { + if ((isGenerator || isAsync) && this.type === types$1.colon) + { this.unexpected(); } + + if (this.eat(types$1.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); + prop.kind = "init"; + } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { + if (isPattern) { this.unexpected(); } + prop.kind = "init"; + prop.method = true; + prop.value = this.parseMethod(isGenerator, isAsync); + } else if (!isPattern && !containsEsc && + this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && + (prop.key.name === "get" || prop.key.name === "set") && + (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { + if (isGenerator || isAsync) { this.unexpected(); } + prop.kind = prop.key.name; + this.parsePropertyName(prop); + prop.value = this.parseMethod(false); + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start = prop.value.start; + if (prop.kind === "get") + { this.raiseRecoverable(start, "getter should have no params"); } + else + { this.raiseRecoverable(start, "setter should have exactly one param"); } + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") + { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); } + } + } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (isGenerator || isAsync) { this.unexpected(); } + this.checkUnreserved(prop.key); + if (prop.key.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = startPos; } + prop.kind = "init"; + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else if (this.type === types$1.eq && refDestructuringErrors) { + if (refDestructuringErrors.shorthandAssign < 0) + { refDestructuringErrors.shorthandAssign = this.start; } + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else { + prop.value = this.copyNode(prop.key); + } + prop.shorthand = true; + } else { this.unexpected(); } + }; + + pp$5.parsePropertyName = function(prop) { + if (this.options.ecmaVersion >= 6) { + if (this.eat(types$1.bracketL)) { + prop.computed = true; + prop.key = this.parseMaybeAssign(); + this.expect(types$1.bracketR); + return prop.key + } else { + prop.computed = false; + } + } + return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never") + }; + + // Initialize empty function node. + + pp$5.initFunction = function(node) { + node.id = null; + if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; } + if (this.options.ecmaVersion >= 8) { node.async = false; } + }; + + // Parse object or class method. + + pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { + var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + + this.initFunction(node); + if (this.options.ecmaVersion >= 6) + { node.generator = isGenerator; } + if (this.options.ecmaVersion >= 8) + { node.async = !!isAsync; } + + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + this.parseFunctionBody(node, false, true, false); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "FunctionExpression") + }; + + // Parse arrow function expression with given parameters. + + pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + + this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); + this.initFunction(node); + if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; } + + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + + node.params = this.toAssignableList(params, true); + this.parseFunctionBody(node, true, false, forInit); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "ArrowFunctionExpression") + }; + + // Parse function body and check parameters. + + pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { + var isExpression = isArrowFunction && this.type !== types$1.braceL; + var oldStrict = this.strict, useStrict = false; + + if (isExpression) { + node.body = this.parseMaybeAssign(forInit); + node.expression = true; + this.checkParams(node, false); + } else { + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); + if (!oldStrict || nonSimple) { + useStrict = this.strictDirective(this.end); + // If this is a strict mode function, verify that argument names + // are not repeated, and it does not try to bind the words `eval` + // or `arguments`. + if (useStrict && nonSimple) + { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); } + } + // Start a new scope with regard to labels and the `inFunction` + // flag (restore them to their old value afterwards). + var oldLabels = this.labels; + this.labels = []; + if (useStrict) { this.strict = true; } + + // Add the params to varDeclaredNames to ensure that an error is thrown + // if a let/const declaration in the function clashes with one of the params. + this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); + // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' + if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); } + node.body = this.parseBlock(false, undefined, useStrict && !oldStrict); + node.expression = false; + this.adaptDirectivePrologue(node.body.body); + this.labels = oldLabels; + } + this.exitScope(); + }; + + pp$5.isSimpleParamList = function(params) { + for (var i = 0, list = params; i < list.length; i += 1) + { + var param = list[i]; + + if (param.type !== "Identifier") { return false + } } + return true + }; + + // Checks function params for various disallowed patterns such as using "eval" + // or "arguments" and duplicate parameters. + + pp$5.checkParams = function(node, allowDuplicates) { + var nameHash = Object.create(null); + for (var i = 0, list = node.params; i < list.length; i += 1) + { + var param = list[i]; + + this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); + } + }; + + // Parses a comma-separated list of expressions, and returns them as + // an array. `close` is the token type that ends the list, and + // `allowEmpty` can be turned on to allow subsequent commas with + // nothing in between them to be parsed as `null` (which is needed + // for array literals). + + pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + var elts = [], first = true; + while (!this.eat(close)) { + if (!first) { + this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(close)) { break } + } else { first = false; } + + var elt = (void 0); + if (allowEmpty && this.type === types$1.comma) + { elt = null; } + else if (this.type === types$1.ellipsis) { + elt = this.parseSpread(refDestructuringErrors); + if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) + { refDestructuringErrors.trailingComma = this.start; } + } else { + elt = this.parseMaybeAssign(false, refDestructuringErrors); + } + elts.push(elt); + } + return elts + }; + + pp$5.checkUnreserved = function(ref) { + var start = ref.start; + var end = ref.end; + var name = ref.name; + + if (this.inGenerator && name === "yield") + { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); } + if (this.inAsync && name === "await") + { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); } + if (this.currentThisScope().inClassFieldInit && name === "arguments") + { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); } + if (this.inClassStaticBlock && (name === "arguments" || name === "await")) + { this.raise(start, ("Cannot use " + name + " in class static initialization block")); } + if (this.keywords.test(name)) + { this.raise(start, ("Unexpected keyword '" + name + "'")); } + if (this.options.ecmaVersion < 6 && + this.input.slice(start, end).indexOf("\\") !== -1) { return } + var re = this.strict ? this.reservedWordsStrict : this.reservedWords; + if (re.test(name)) { + if (!this.inAsync && name === "await") + { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); } + this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved")); + } + }; + + // Parse the next token as an identifier. If `liberal` is true (used + // when parsing properties), it will also convert keywords into + // identifiers. + + pp$5.parseIdent = function(liberal, isBinding) { + var node = this.startNode(); + if (this.type === types$1.name) { + node.name = this.value; + } else if (this.type.keyword) { + node.name = this.type.keyword; + + // To fix https://github.com/acornjs/acorn/issues/575 + // `class` and `function` keywords push new context into this.context. + // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name. + // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword + if ((node.name === "class" || node.name === "function") && + (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + this.context.pop(); + } + } else { + this.unexpected(); + } + this.next(!!liberal); + this.finishNode(node, "Identifier"); + if (!liberal) { + this.checkUnreserved(node); + if (node.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = node.start; } + } + return node + }; + + pp$5.parsePrivateIdent = function() { + var node = this.startNode(); + if (this.type === types$1.privateId) { + node.name = this.value; + } else { + this.unexpected(); + } + this.next(); + this.finishNode(node, "PrivateIdentifier"); + + // For validating existence + if (this.privateNameStack.length === 0) { + this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class")); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + } + + return node + }; + + // Parses yield expression inside generator. + + pp$5.parseYield = function(forInit) { + if (!this.yieldPos) { this.yieldPos = this.start; } + + var node = this.startNode(); + this.next(); + if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) { + node.delegate = false; + node.argument = null; + } else { + node.delegate = this.eat(types$1.star); + node.argument = this.parseMaybeAssign(forInit); + } + return this.finishNode(node, "YieldExpression") + }; + + pp$5.parseAwait = function(forInit) { + if (!this.awaitPos) { this.awaitPos = this.start; } + + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node, "AwaitExpression") + }; + + var pp$4 = Parser.prototype; + + // This function is used to raise exceptions on parse errors. It + // takes an offset integer (into the current `input`) to indicate + // the location of the error, attaches the position to the end + // of the error message, and then raises a `SyntaxError` with that + // message. + + pp$4.raise = function(pos, message) { + var loc = getLineInfo(this.input, pos); + message += " (" + loc.line + ":" + loc.column + ")"; + var err = new SyntaxError(message); + err.pos = pos; err.loc = loc; err.raisedAt = this.pos; + throw err + }; + + pp$4.raiseRecoverable = pp$4.raise; + + pp$4.curPosition = function() { + if (this.options.locations) { + return new Position(this.curLine, this.pos - this.lineStart) + } + }; + + var pp$3 = Parser.prototype; + + var Scope = function Scope(flags) { + this.flags = flags; + // A list of var-declared names in the current lexical scope + this.var = []; + // A list of lexically-declared names in the current lexical scope + this.lexical = []; + // A list of lexically-declared FunctionDeclaration names in the current lexical scope + this.functions = []; + // A switch to disallow the identifier reference 'arguments' + this.inClassFieldInit = false; + }; + + // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. + + pp$3.enterScope = function(flags) { + this.scopeStack.push(new Scope(flags)); + }; + + pp$3.exitScope = function() { + this.scopeStack.pop(); + }; + + // The spec says: + // > At the top level of a function, or script, function declarations are + // > treated like var declarations rather than like lexical declarations. + pp$3.treatFunctionsAsVarInScope = function(scope) { + return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP) + }; + + pp$3.declareName = function(name, bindingType, pos) { + var redeclared = false; + if (bindingType === BIND_LEXICAL) { + var scope = this.currentScope(); + redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; + scope.lexical.push(name); + if (this.inModule && (scope.flags & SCOPE_TOP)) + { delete this.undefinedExports[name]; } + } else if (bindingType === BIND_SIMPLE_CATCH) { + var scope$1 = this.currentScope(); + scope$1.lexical.push(name); + } else if (bindingType === BIND_FUNCTION) { + var scope$2 = this.currentScope(); + if (this.treatFunctionsAsVar) + { redeclared = scope$2.lexical.indexOf(name) > -1; } + else + { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; } + scope$2.functions.push(name); + } else { + for (var i = this.scopeStack.length - 1; i >= 0; --i) { + var scope$3 = this.scopeStack[i]; + if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) || + !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { + redeclared = true; + break + } + scope$3.var.push(name); + if (this.inModule && (scope$3.flags & SCOPE_TOP)) + { delete this.undefinedExports[name]; } + if (scope$3.flags & SCOPE_VAR) { break } + } + } + if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); } + }; + + pp$3.checkLocalExport = function(id) { + // scope.functions must be empty as Module code is always strict. + if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && + this.scopeStack[0].var.indexOf(id.name) === -1) { + this.undefinedExports[id.name] = id; + } + }; + + pp$3.currentScope = function() { + return this.scopeStack[this.scopeStack.length - 1] + }; + + pp$3.currentVarScope = function() { + for (var i = this.scopeStack.length - 1;; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR) { return scope } + } + }; + + // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. + pp$3.currentThisScope = function() { + for (var i = this.scopeStack.length - 1;; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope } + } + }; + + var Node = function Node(parser, pos, loc) { + this.type = ""; + this.start = pos; + this.end = 0; + if (parser.options.locations) + { this.loc = new SourceLocation(parser, loc); } + if (parser.options.directSourceFile) + { this.sourceFile = parser.options.directSourceFile; } + if (parser.options.ranges) + { this.range = [pos, 0]; } + }; + + // Start an AST node, attaching a start offset. + + var pp$2 = Parser.prototype; + + pp$2.startNode = function() { + return new Node(this, this.start, this.startLoc) + }; + + pp$2.startNodeAt = function(pos, loc) { + return new Node(this, pos, loc) + }; + + // Finish an AST node, adding `type` and `end` properties. + + function finishNodeAt(node, type, pos, loc) { + node.type = type; + node.end = pos; + if (this.options.locations) + { node.loc.end = loc; } + if (this.options.ranges) + { node.range[1] = pos; } + return node + } + + pp$2.finishNode = function(node, type) { + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc) + }; + + // Finish node at given position + + pp$2.finishNodeAt = function(node, type, pos, loc) { + return finishNodeAt.call(this, node, type, pos, loc) + }; + + pp$2.copyNode = function(node) { + var newNode = new Node(this, node.start, this.startLoc); + for (var prop in node) { newNode[prop] = node[prop]; } + return newNode + }; + + // This file contains Unicode properties extracted from the ECMAScript + // specification. The lists are extracted like so: + // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) + + // #table-binary-unicode-properties + var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; + var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; + var ecma11BinaryProperties = ecma10BinaryProperties; + var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; + var ecma13BinaryProperties = ecma12BinaryProperties; + var unicodeBinaryProperties = { + 9: ecma9BinaryProperties, + 10: ecma10BinaryProperties, + 11: ecma11BinaryProperties, + 12: ecma12BinaryProperties, + 13: ecma13BinaryProperties + }; + + // #table-unicode-general-category-values + var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; + + // #table-unicode-script-values + var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; + var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; + var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; + var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; + var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; + var unicodeScriptValues = { + 9: ecma9ScriptValues, + 10: ecma10ScriptValues, + 11: ecma11ScriptValues, + 12: ecma12ScriptValues, + 13: ecma13ScriptValues + }; + + var data = {}; + function buildUnicodeData(ecmaVersion) { + var d = data[ecmaVersion] = { + binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), + nonBinary: { + General_Category: wordsRegexp(unicodeGeneralCategoryValues), + Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) + } + }; + d.nonBinary.Script_Extensions = d.nonBinary.Script; + + d.nonBinary.gc = d.nonBinary.General_Category; + d.nonBinary.sc = d.nonBinary.Script; + d.nonBinary.scx = d.nonBinary.Script_Extensions; + } + + for (var i = 0, list = [9, 10, 11, 12, 13]; i < list.length; i += 1) { + var ecmaVersion = list[i]; + + buildUnicodeData(ecmaVersion); + } + + var pp$1 = Parser.prototype; + + var RegExpValidationState = function RegExpValidationState(parser) { + this.parser = parser; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion]; + this.source = ""; + this.flags = ""; + this.start = 0; + this.switchU = false; + this.switchN = false; + this.pos = 0; + this.lastIntValue = 0; + this.lastStringValue = ""; + this.lastAssertionIsQuantifiable = false; + this.numCapturingParens = 0; + this.maxBackReference = 0; + this.groupNames = []; + this.backReferenceNames = []; + }; + + RegExpValidationState.prototype.reset = function reset (start, pattern, flags) { + var unicode = flags.indexOf("u") !== -1; + this.start = start | 0; + this.source = pattern + ""; + this.flags = flags; + this.switchU = unicode && this.parser.options.ecmaVersion >= 6; + this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + }; + + RegExpValidationState.prototype.raise = function raise (message) { + this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message)); + }; + + // If u flag is given, this returns the code point at the index (it combines a surrogate pair). + // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair). + RegExpValidationState.prototype.at = function at (i, forceU) { + if ( forceU === void 0 ) forceU = false; + + var s = this.source; + var l = s.length; + if (i >= l) { + return -1 + } + var c = s.charCodeAt(i); + if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { + return c + } + var next = s.charCodeAt(i + 1); + return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c + }; + + RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) { + if ( forceU === void 0 ) forceU = false; + + var s = this.source; + var l = s.length; + if (i >= l) { + return l + } + var c = s.charCodeAt(i), next; + if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || + (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { + return i + 1 + } + return i + 2 + }; + + RegExpValidationState.prototype.current = function current (forceU) { + if ( forceU === void 0 ) forceU = false; + + return this.at(this.pos, forceU) + }; + + RegExpValidationState.prototype.lookahead = function lookahead (forceU) { + if ( forceU === void 0 ) forceU = false; + + return this.at(this.nextIndex(this.pos, forceU), forceU) + }; + + RegExpValidationState.prototype.advance = function advance (forceU) { + if ( forceU === void 0 ) forceU = false; + + this.pos = this.nextIndex(this.pos, forceU); + }; + + RegExpValidationState.prototype.eat = function eat (ch, forceU) { + if ( forceU === void 0 ) forceU = false; + + if (this.current(forceU) === ch) { + this.advance(forceU); + return true + } + return false + }; + + /** + * Validate the flags part of a given RegExpLiteral. + * + * @param {RegExpValidationState} state The state to validate RegExp. + * @returns {void} + */ + pp$1.validateRegExpFlags = function(state) { + var validFlags = state.validFlags; + var flags = state.flags; + + for (var i = 0; i < flags.length; i++) { + var flag = flags.charAt(i); + if (validFlags.indexOf(flag) === -1) { + this.raise(state.start, "Invalid regular expression flag"); + } + if (flags.indexOf(flag, i + 1) > -1) { + this.raise(state.start, "Duplicate regular expression flag"); + } + } + }; + + /** + * Validate the pattern part of a given RegExpLiteral. + * + * @param {RegExpValidationState} state The state to validate RegExp. + * @returns {void} + */ + pp$1.validateRegExpPattern = function(state) { + this.regexp_pattern(state); + + // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of + // parsing contains a |GroupName|, reparse with the goal symbol + // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError* + // exception if _P_ did not conform to the grammar, if any elements of _P_ + // were not matched by the parse, or if any Early Error conditions exist. + if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) { + state.switchN = true; + this.regexp_pattern(state); + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern + pp$1.regexp_pattern = function(state) { + state.pos = 0; + state.lastIntValue = 0; + state.lastStringValue = ""; + state.lastAssertionIsQuantifiable = false; + state.numCapturingParens = 0; + state.maxBackReference = 0; + state.groupNames.length = 0; + state.backReferenceNames.length = 0; + + this.regexp_disjunction(state); + + if (state.pos !== state.source.length) { + // Make the same messages as V8. + if (state.eat(0x29 /* ) */)) { + state.raise("Unmatched ')'"); + } + if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) { + state.raise("Lone quantifier brackets"); + } + } + if (state.maxBackReference > state.numCapturingParens) { + state.raise("Invalid escape"); + } + for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) { + var name = list[i]; + + if (state.groupNames.indexOf(name) === -1) { + state.raise("Invalid named capture referenced"); + } + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction + pp$1.regexp_disjunction = function(state) { + this.regexp_alternative(state); + while (state.eat(0x7C /* | */)) { + this.regexp_alternative(state); + } + + // Make the same message as V8. + if (this.regexp_eatQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + if (state.eat(0x7B /* { */)) { + state.raise("Lone quantifier brackets"); + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative + pp$1.regexp_alternative = function(state) { + while (state.pos < state.source.length && this.regexp_eatTerm(state)) + { } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term + pp$1.regexp_eatTerm = function(state) { + if (this.regexp_eatAssertion(state)) { + // Handle `QuantifiableAssertion Quantifier` alternative. + // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion + // is a QuantifiableAssertion. + if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { + // Make the same message as V8. + if (state.switchU) { + state.raise("Invalid quantifier"); + } + } + return true + } + + if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { + this.regexp_eatQuantifier(state); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion + pp$1.regexp_eatAssertion = function(state) { + var start = state.pos; + state.lastAssertionIsQuantifiable = false; + + // ^, $ + if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) { + return true + } + + // \b \B + if (state.eat(0x5C /* \ */)) { + if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) { + return true + } + state.pos = start; + } + + // Lookahead / Lookbehind + if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) { + var lookbehind = false; + if (this.options.ecmaVersion >= 9) { + lookbehind = state.eat(0x3C /* < */); + } + if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) { + this.regexp_disjunction(state); + if (!state.eat(0x29 /* ) */)) { + state.raise("Unterminated group"); + } + state.lastAssertionIsQuantifiable = !lookbehind; + return true + } + } + + state.pos = start; + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier + pp$1.regexp_eatQuantifier = function(state, noError) { + if ( noError === void 0 ) noError = false; + + if (this.regexp_eatQuantifierPrefix(state, noError)) { + state.eat(0x3F /* ? */); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix + pp$1.regexp_eatQuantifierPrefix = function(state, noError) { + return ( + state.eat(0x2A /* * */) || + state.eat(0x2B /* + */) || + state.eat(0x3F /* ? */) || + this.regexp_eatBracedQuantifier(state, noError) + ) + }; + pp$1.regexp_eatBracedQuantifier = function(state, noError) { + var start = state.pos; + if (state.eat(0x7B /* { */)) { + var min = 0, max = -1; + if (this.regexp_eatDecimalDigits(state)) { + min = state.lastIntValue; + if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) { + max = state.lastIntValue; + } + if (state.eat(0x7D /* } */)) { + // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term + if (max !== -1 && max < min && !noError) { + state.raise("numbers out of order in {} quantifier"); + } + return true + } + } + if (state.switchU && !noError) { + state.raise("Incomplete quantifier"); + } + state.pos = start; + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom + pp$1.regexp_eatAtom = function(state) { + return ( + this.regexp_eatPatternCharacters(state) || + state.eat(0x2E /* . */) || + this.regexp_eatReverseSolidusAtomEscape(state) || + this.regexp_eatCharacterClass(state) || + this.regexp_eatUncapturingGroup(state) || + this.regexp_eatCapturingGroup(state) + ) + }; + pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { + var start = state.pos; + if (state.eat(0x5C /* \ */)) { + if (this.regexp_eatAtomEscape(state)) { + return true + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatUncapturingGroup = function(state) { + var start = state.pos; + if (state.eat(0x28 /* ( */)) { + if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) { + this.regexp_disjunction(state); + if (state.eat(0x29 /* ) */)) { + return true + } + state.raise("Unterminated group"); + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatCapturingGroup = function(state) { + if (state.eat(0x28 /* ( */)) { + if (this.options.ecmaVersion >= 9) { + this.regexp_groupSpecifier(state); + } else if (state.current() === 0x3F /* ? */) { + state.raise("Invalid group"); + } + this.regexp_disjunction(state); + if (state.eat(0x29 /* ) */)) { + state.numCapturingParens += 1; + return true + } + state.raise("Unterminated group"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom + pp$1.regexp_eatExtendedAtom = function(state) { + return ( + state.eat(0x2E /* . */) || + this.regexp_eatReverseSolidusAtomEscape(state) || + this.regexp_eatCharacterClass(state) || + this.regexp_eatUncapturingGroup(state) || + this.regexp_eatCapturingGroup(state) || + this.regexp_eatInvalidBracedQuantifier(state) || + this.regexp_eatExtendedPatternCharacter(state) + ) + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier + pp$1.regexp_eatInvalidBracedQuantifier = function(state) { + if (this.regexp_eatBracedQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter + pp$1.regexp_eatSyntaxCharacter = function(state) { + var ch = state.current(); + if (isSyntaxCharacter(ch)) { + state.lastIntValue = ch; + state.advance(); + return true + } + return false + }; + function isSyntaxCharacter(ch) { + return ( + ch === 0x24 /* $ */ || + ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ || + ch === 0x2E /* . */ || + ch === 0x3F /* ? */ || + ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ || + ch >= 0x7B /* { */ && ch <= 0x7D /* } */ + ) + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter + // But eat eager. + pp$1.regexp_eatPatternCharacters = function(state) { + var start = state.pos; + var ch = 0; + while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { + state.advance(); + } + return state.pos !== start + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter + pp$1.regexp_eatExtendedPatternCharacter = function(state) { + var ch = state.current(); + if ( + ch !== -1 && + ch !== 0x24 /* $ */ && + !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) && + ch !== 0x2E /* . */ && + ch !== 0x3F /* ? */ && + ch !== 0x5B /* [ */ && + ch !== 0x5E /* ^ */ && + ch !== 0x7C /* | */ + ) { + state.advance(); + return true + } + return false + }; + + // GroupSpecifier :: + // [empty] + // `?` GroupName + pp$1.regexp_groupSpecifier = function(state) { + if (state.eat(0x3F /* ? */)) { + if (this.regexp_eatGroupName(state)) { + if (state.groupNames.indexOf(state.lastStringValue) !== -1) { + state.raise("Duplicate capture group name"); + } + state.groupNames.push(state.lastStringValue); + return + } + state.raise("Invalid group"); + } + }; + + // GroupName :: + // `<` RegExpIdentifierName `>` + // Note: this updates `state.lastStringValue` property with the eaten name. + pp$1.regexp_eatGroupName = function(state) { + state.lastStringValue = ""; + if (state.eat(0x3C /* < */)) { + if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) { + return true + } + state.raise("Invalid capture group name"); + } + return false + }; + + // RegExpIdentifierName :: + // RegExpIdentifierStart + // RegExpIdentifierName RegExpIdentifierPart + // Note: this updates `state.lastStringValue` property with the eaten name. + pp$1.regexp_eatRegExpIdentifierName = function(state) { + state.lastStringValue = ""; + if (this.regexp_eatRegExpIdentifierStart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + while (this.regexp_eatRegExpIdentifierPart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + } + return true + } + return false + }; + + // RegExpIdentifierStart :: + // UnicodeIDStart + // `$` + // `_` + // `\` RegExpUnicodeEscapeSequence[+U] + pp$1.regexp_eatRegExpIdentifierStart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + + if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierStart(ch)) { + state.lastIntValue = ch; + return true + } + + state.pos = start; + return false + }; + function isRegExpIdentifierStart(ch) { + return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ + } + + // RegExpIdentifierPart :: + // UnicodeIDContinue + // `$` + // `_` + // `\` RegExpUnicodeEscapeSequence[+U] + // + // + pp$1.regexp_eatRegExpIdentifierPart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + + if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierPart(ch)) { + state.lastIntValue = ch; + return true + } + + state.pos = start; + return false + }; + function isRegExpIdentifierPart(ch) { + return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* */ || ch === 0x200D /* */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape + pp$1.regexp_eatAtomEscape = function(state) { + if ( + this.regexp_eatBackReference(state) || + this.regexp_eatCharacterClassEscape(state) || + this.regexp_eatCharacterEscape(state) || + (state.switchN && this.regexp_eatKGroupName(state)) + ) { + return true + } + if (state.switchU) { + // Make the same message as V8. + if (state.current() === 0x63 /* c */) { + state.raise("Invalid unicode escape"); + } + state.raise("Invalid escape"); + } + return false + }; + pp$1.regexp_eatBackReference = function(state) { + var start = state.pos; + if (this.regexp_eatDecimalEscape(state)) { + var n = state.lastIntValue; + if (state.switchU) { + // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape + if (n > state.maxBackReference) { + state.maxBackReference = n; + } + return true + } + if (n <= state.numCapturingParens) { + return true + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatKGroupName = function(state) { + if (state.eat(0x6B /* k */)) { + if (this.regexp_eatGroupName(state)) { + state.backReferenceNames.push(state.lastStringValue); + return true + } + state.raise("Invalid named reference"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape + pp$1.regexp_eatCharacterEscape = function(state) { + return ( + this.regexp_eatControlEscape(state) || + this.regexp_eatCControlLetter(state) || + this.regexp_eatZero(state) || + this.regexp_eatHexEscapeSequence(state) || + this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || + (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) || + this.regexp_eatIdentityEscape(state) + ) + }; + pp$1.regexp_eatCControlLetter = function(state) { + var start = state.pos; + if (state.eat(0x63 /* c */)) { + if (this.regexp_eatControlLetter(state)) { + return true + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatZero = function(state) { + if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) { + state.lastIntValue = 0; + state.advance(); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape + pp$1.regexp_eatControlEscape = function(state) { + var ch = state.current(); + if (ch === 0x74 /* t */) { + state.lastIntValue = 0x09; /* \t */ + state.advance(); + return true + } + if (ch === 0x6E /* n */) { + state.lastIntValue = 0x0A; /* \n */ + state.advance(); + return true + } + if (ch === 0x76 /* v */) { + state.lastIntValue = 0x0B; /* \v */ + state.advance(); + return true + } + if (ch === 0x66 /* f */) { + state.lastIntValue = 0x0C; /* \f */ + state.advance(); + return true + } + if (ch === 0x72 /* r */) { + state.lastIntValue = 0x0D; /* \r */ + state.advance(); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter + pp$1.regexp_eatControlLetter = function(state) { + var ch = state.current(); + if (isControlLetter(ch)) { + state.lastIntValue = ch % 0x20; + state.advance(); + return true + } + return false + }; + function isControlLetter(ch) { + return ( + (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) || + (ch >= 0x61 /* a */ && ch <= 0x7A /* z */) + ) + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence + pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { + if ( forceU === void 0 ) forceU = false; + + var start = state.pos; + var switchU = forceU || state.switchU; + + if (state.eat(0x75 /* u */)) { + if (this.regexp_eatFixedHexDigits(state, 4)) { + var lead = state.lastIntValue; + if (switchU && lead >= 0xD800 && lead <= 0xDBFF) { + var leadSurrogateEnd = state.pos; + if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) { + var trail = state.lastIntValue; + if (trail >= 0xDC00 && trail <= 0xDFFF) { + state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + return true + } + } + state.pos = leadSurrogateEnd; + state.lastIntValue = lead; + } + return true + } + if ( + switchU && + state.eat(0x7B /* { */) && + this.regexp_eatHexDigits(state) && + state.eat(0x7D /* } */) && + isValidUnicode(state.lastIntValue) + ) { + return true + } + if (switchU) { + state.raise("Invalid unicode escape"); + } + state.pos = start; + } + + return false + }; + function isValidUnicode(ch) { + return ch >= 0 && ch <= 0x10FFFF + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape + pp$1.regexp_eatIdentityEscape = function(state) { + if (state.switchU) { + if (this.regexp_eatSyntaxCharacter(state)) { + return true + } + if (state.eat(0x2F /* / */)) { + state.lastIntValue = 0x2F; /* / */ + return true + } + return false + } + + var ch = state.current(); + if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) { + state.lastIntValue = ch; + state.advance(); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape + pp$1.regexp_eatDecimalEscape = function(state) { + state.lastIntValue = 0; + var ch = state.current(); + if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) { + do { + state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */); + state.advance(); + } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape + pp$1.regexp_eatCharacterClassEscape = function(state) { + var ch = state.current(); + + if (isCharacterClassEscape(ch)) { + state.lastIntValue = -1; + state.advance(); + return true + } + + if ( + state.switchU && + this.options.ecmaVersion >= 9 && + (ch === 0x50 /* P */ || ch === 0x70 /* p */) + ) { + state.lastIntValue = -1; + state.advance(); + if ( + state.eat(0x7B /* { */) && + this.regexp_eatUnicodePropertyValueExpression(state) && + state.eat(0x7D /* } */) + ) { + return true + } + state.raise("Invalid property name"); + } + + return false + }; + function isCharacterClassEscape(ch) { + return ( + ch === 0x64 /* d */ || + ch === 0x44 /* D */ || + ch === 0x73 /* s */ || + ch === 0x53 /* S */ || + ch === 0x77 /* w */ || + ch === 0x57 /* W */ + ) + } + + // UnicodePropertyValueExpression :: + // UnicodePropertyName `=` UnicodePropertyValue + // LoneUnicodePropertyNameOrValue + pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { + var start = state.pos; + + // UnicodePropertyName `=` UnicodePropertyValue + if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) { + var name = state.lastStringValue; + if (this.regexp_eatUnicodePropertyValue(state)) { + var value = state.lastStringValue; + this.regexp_validateUnicodePropertyNameAndValue(state, name, value); + return true + } + } + state.pos = start; + + // LoneUnicodePropertyNameOrValue + if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { + var nameOrValue = state.lastStringValue; + this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); + return true + } + return false + }; + pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { + if (!hasOwn(state.unicodeProperties.nonBinary, name)) + { state.raise("Invalid property name"); } + if (!state.unicodeProperties.nonBinary[name].test(value)) + { state.raise("Invalid property value"); } + }; + pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { + if (!state.unicodeProperties.binary.test(nameOrValue)) + { state.raise("Invalid property name"); } + }; + + // UnicodePropertyName :: + // UnicodePropertyNameCharacters + pp$1.regexp_eatUnicodePropertyName = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyNameCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== "" + }; + function isUnicodePropertyNameCharacter(ch) { + return isControlLetter(ch) || ch === 0x5F /* _ */ + } + + // UnicodePropertyValue :: + // UnicodePropertyValueCharacters + pp$1.regexp_eatUnicodePropertyValue = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyValueCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== "" + }; + function isUnicodePropertyValueCharacter(ch) { + return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch) + } + + // LoneUnicodePropertyNameOrValue :: + // UnicodePropertyValueCharacters + pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { + return this.regexp_eatUnicodePropertyValue(state) + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass + pp$1.regexp_eatCharacterClass = function(state) { + if (state.eat(0x5B /* [ */)) { + state.eat(0x5E /* ^ */); + this.regexp_classRanges(state); + if (state.eat(0x5D /* ] */)) { + return true + } + // Unreachable since it threw "unterminated regular expression" error before. + state.raise("Unterminated character class"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges + // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges + // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash + pp$1.regexp_classRanges = function(state) { + while (this.regexp_eatClassAtom(state)) { + var left = state.lastIntValue; + if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) { + var right = state.lastIntValue; + if (state.switchU && (left === -1 || right === -1)) { + state.raise("Invalid character class"); + } + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + } + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash + pp$1.regexp_eatClassAtom = function(state) { + var start = state.pos; + + if (state.eat(0x5C /* \ */)) { + if (this.regexp_eatClassEscape(state)) { + return true + } + if (state.switchU) { + // Make the same message as V8. + var ch$1 = state.current(); + if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) { + state.raise("Invalid class escape"); + } + state.raise("Invalid escape"); + } + state.pos = start; + } + + var ch = state.current(); + if (ch !== 0x5D /* ] */) { + state.lastIntValue = ch; + state.advance(); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape + pp$1.regexp_eatClassEscape = function(state) { + var start = state.pos; + + if (state.eat(0x62 /* b */)) { + state.lastIntValue = 0x08; /* */ + return true + } + + if (state.switchU && state.eat(0x2D /* - */)) { + state.lastIntValue = 0x2D; /* - */ + return true + } + + if (!state.switchU && state.eat(0x63 /* c */)) { + if (this.regexp_eatClassControlLetter(state)) { + return true + } + state.pos = start; + } + + return ( + this.regexp_eatCharacterClassEscape(state) || + this.regexp_eatCharacterEscape(state) + ) + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter + pp$1.regexp_eatClassControlLetter = function(state) { + var ch = state.current(); + if (isDecimalDigit(ch) || ch === 0x5F /* _ */) { + state.lastIntValue = ch % 0x20; + state.advance(); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence + pp$1.regexp_eatHexEscapeSequence = function(state) { + var start = state.pos; + if (state.eat(0x78 /* x */)) { + if (this.regexp_eatFixedHexDigits(state, 2)) { + return true + } + if (state.switchU) { + state.raise("Invalid escape"); + } + state.pos = start; + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits + pp$1.regexp_eatDecimalDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isDecimalDigit(ch = state.current())) { + state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */); + state.advance(); + } + return state.pos !== start + }; + function isDecimalDigit(ch) { + return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits + pp$1.regexp_eatHexDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isHexDigit(ch = state.current())) { + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return state.pos !== start + }; + function isHexDigit(ch) { + return ( + (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) || + (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) || + (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) + ) + } + function hexToInt(ch) { + if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) { + return 10 + (ch - 0x41 /* A */) + } + if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) { + return 10 + (ch - 0x61 /* a */) + } + return ch - 0x30 /* 0 */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence + // Allows only 0-377(octal) i.e. 0-255(decimal). + pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { + if (this.regexp_eatOctalDigit(state)) { + var n1 = state.lastIntValue; + if (this.regexp_eatOctalDigit(state)) { + var n2 = state.lastIntValue; + if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { + state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; + } else { + state.lastIntValue = n1 * 8 + n2; + } + } else { + state.lastIntValue = n1; + } + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit + pp$1.regexp_eatOctalDigit = function(state) { + var ch = state.current(); + if (isOctalDigit(ch)) { + state.lastIntValue = ch - 0x30; /* 0 */ + state.advance(); + return true + } + state.lastIntValue = 0; + return false + }; + function isOctalDigit(ch) { + return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit + // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence + pp$1.regexp_eatFixedHexDigits = function(state, length) { + var start = state.pos; + state.lastIntValue = 0; + for (var i = 0; i < length; ++i) { + var ch = state.current(); + if (!isHexDigit(ch)) { + state.pos = start; + return false + } + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return true + }; + + // Object type used to represent tokens. Note that normally, tokens + // simply exist as properties on the parser object. This is only + // used for the onToken callback and the external tokenizer. + + var Token = function Token(p) { + this.type = p.type; + this.value = p.value; + this.start = p.start; + this.end = p.end; + if (p.options.locations) + { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); } + if (p.options.ranges) + { this.range = [p.start, p.end]; } + }; + + // ## Tokenizer + + var pp = Parser.prototype; + + // Move to the next token + + pp.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) + { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } + if (this.options.onToken) + { this.options.onToken(new Token(this)); } + + this.lastTokEnd = this.end; + this.lastTokStart = this.start; + this.lastTokEndLoc = this.endLoc; + this.lastTokStartLoc = this.startLoc; + this.nextToken(); + }; + + pp.getToken = function() { + this.next(); + return new Token(this) + }; + + // If we're in an ES6 environment, make parsers iterable + if (typeof Symbol !== "undefined") + { pp[Symbol.iterator] = function() { + var this$1$1 = this; + + return { + next: function () { + var token = this$1$1.getToken(); + return { + done: token.type === types$1.eof, + value: token + } + } + } + }; } + + // Toggle strict mode. Re-reads the next number or string to please + // pedantic tests (`"use strict"; 010;` should fail). + + // Read a single token, updating the parser object's token-related + // properties. + + pp.nextToken = function() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) { this.skipSpace(); } + + this.start = this.pos; + if (this.options.locations) { this.startLoc = this.curPosition(); } + if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) } + + if (curContext.override) { return curContext.override(this) } + else { this.readToken(this.fullCharCodeAtPos()); } + }; + + pp.readToken = function(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) + { return this.readWord() } + + return this.getTokenFromCode(code) + }; + + pp.fullCharCodeAtPos = function() { + var code = this.input.charCodeAt(this.pos); + if (code <= 0xd7ff || code >= 0xdc00) { return code } + var next = this.input.charCodeAt(this.pos + 1); + return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00 + }; + + pp.skipBlockComment = function() { + var startLoc = this.options.onComment && this.curPosition(); + var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); + if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); } + this.pos = end + 2; + if (this.options.locations) { + for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) { + ++this.curLine; + pos = this.lineStart = nextBreak; + } + } + if (this.options.onComment) + { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, + startLoc, this.curPosition()); } + }; + + pp.skipLineComment = function(startSkip) { + var start = this.pos; + var startLoc = this.options.onComment && this.curPosition(); + var ch = this.input.charCodeAt(this.pos += startSkip); + while (this.pos < this.input.length && !isNewLine(ch)) { + ch = this.input.charCodeAt(++this.pos); + } + if (this.options.onComment) + { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, + startLoc, this.curPosition()); } + }; + + // Called at the start of the parse and after every token. Skips + // whitespace and comments, and. + + pp.skipSpace = function() { + loop: while (this.pos < this.input.length) { + var ch = this.input.charCodeAt(this.pos); + switch (ch) { + case 32: case 160: // ' ' + ++this.pos; + break + case 13: + if (this.input.charCodeAt(this.pos + 1) === 10) { + ++this.pos; + } + case 10: case 8232: case 8233: + ++this.pos; + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + break + case 47: // '/' + switch (this.input.charCodeAt(this.pos + 1)) { + case 42: // '*' + this.skipBlockComment(); + break + case 47: + this.skipLineComment(2); + break + default: + break loop + } + break + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.pos; + } else { + break loop + } + } + } + }; + + // Called at the end of every token. Sets `end`, `val`, and + // maintains `context` and `exprAllowed`, and skips the space after + // the token, so that the next one's `start` will point at the + // right position. + + pp.finishToken = function(type, val) { + this.end = this.pos; + if (this.options.locations) { this.endLoc = this.curPosition(); } + var prevType = this.type; + this.type = type; + this.value = val; + + this.updateContext(prevType); + }; + + // ### Token reading + + // This is the function that is called to fetch the next token. It + // is somewhat obscure, because it works in character codes rather + // than characters, and because operator parsing has been inlined + // into it. + // + // All in the name of speed. + // + pp.readToken_dot = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next >= 48 && next <= 57) { return this.readNumber(true) } + var next2 = this.input.charCodeAt(this.pos + 2); + if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.' + this.pos += 3; + return this.finishToken(types$1.ellipsis) + } else { + ++this.pos; + return this.finishToken(types$1.dot) + } + }; + + pp.readToken_slash = function() { // '/' + var next = this.input.charCodeAt(this.pos + 1); + if (this.exprAllowed) { ++this.pos; return this.readRegexp() } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.slash, 1) + }; + + pp.readToken_mult_modulo_exp = function(code) { // '%*' + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + var tokentype = code === 42 ? types$1.star : types$1.modulo; + + // exponentiation operator ** and **= + if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { + ++size; + tokentype = types$1.starstar; + next = this.input.charCodeAt(this.pos + 2); + } + + if (next === 61) { return this.finishOp(types$1.assign, size + 1) } + return this.finishOp(tokentype, size) + }; + + pp.readToken_pipe_amp = function(code) { // '|&' + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { return this.finishOp(types$1.assign, 3) } + } + return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2) + } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1) + }; + + pp.readToken_caret = function() { // '^' + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.bitwiseXOR, 1) + }; + + pp.readToken_plus_min = function(code) { // '+-' + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && + (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { + // A `-->` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken() + } + return this.finishOp(types$1.incDec, 2) + } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.plusMin, 1) + }; + + pp.readToken_lt_gt = function(code) { // '<>' + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) } + return this.finishOp(types$1.bitShift, size) + } + if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && + this.input.charCodeAt(this.pos + 3) === 45) { + // `` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken() + } + return this.finishOp(types$1.incDec, 2) + } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.plusMin, 1) +}; + +pp.readToken_lt_gt = function(code) { // '<>' + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) } + return this.finishOp(types$1.bitShift, size) + } + if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && + this.input.charCodeAt(this.pos + 3) === 45) { + // ` Skip checking + if (!importPath.startsWith('.')) { + return; + } + + // Report rule violation if path is not the shortest possible + var resolvedPath = (0, _resolve2['default'])(importPath, context); + var normedPath = normalize(importPath); + var resolvedNormedPath = (0, _resolve2['default'])(normedPath, context); + if (normedPath !== importPath && resolvedPath === resolvedNormedPath) { + return reportWithProposedPath(normedPath); + } + + var fileExtensions = (0, _ignore.getFileExtensions)(context.settings); + var regexUnnecessaryIndex = new RegExp('.*\\/index(\\' + String( + Array.from(fileExtensions).join('|\\')) + ')?$'); + + + // Check if path contains unnecessary index (including a configured extension) + if (options && options.noUselessIndex && regexUnnecessaryIndex.test(importPath)) { + var parentDirectory = _path2['default'].dirname(importPath); + + // Try to find ambiguous imports + if (parentDirectory !== '.' && parentDirectory !== '..') {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = fileExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var fileExtension = _step.value; + if ((0, _resolve2['default'])('' + String(parentDirectory) + String(fileExtension), context)) { + return reportWithProposedPath(String(parentDirectory) + '/'); + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } + + return reportWithProposedPath(parentDirectory); + } + + // Path is shortest possible + starts from the current directory --> Return directly + if (importPath.startsWith('./')) { + return; + } + + // Path is not existing --> Return directly (following code requires path to be defined) + if (resolvedPath === undefined) { + return; + } + + var expected = _path2['default'].relative(currentDir, resolvedPath); // Expected import path + var expectedSplit = expected.split(_path2['default'].sep); // Split by / or \ (depending on OS) + var importPathSplit = importPath.replace(/^\.\//, '').split('/'); + var countImportPathRelativeParents = countRelativeParents(importPathSplit); + var countExpectedRelativeParents = countRelativeParents(expectedSplit); + var diff = countImportPathRelativeParents - countExpectedRelativeParents; + + // Same number of relative parents --> Paths are the same --> Return directly + if (diff <= 0) { + return; + } + + // Report and propose minimal number of required relative parents + return reportWithProposedPath( + toRelativePath( + importPathSplit. + slice(0, countExpectedRelativeParents). + concat(importPathSplit.slice(countImportPathRelativeParents + diff)). + join('/'))); + + + } + + return (0, _moduleVisitor2['default'])(checkSourceValue, options); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11c2VsZXNzLXBhdGgtc2VnbWVudHMuanMiXSwibmFtZXMiOlsidG9SZWxhdGl2ZVBhdGgiLCJyZWxhdGl2ZVBhdGgiLCJzdHJpcHBlZCIsInJlcGxhY2UiLCJ0ZXN0Iiwibm9ybWFsaXplIiwiZm4iLCJwYXRoIiwicG9zaXgiLCJjb3VudFJlbGF0aXZlUGFyZW50cyIsInBhdGhTZWdtZW50cyIsInJlZHVjZSIsInN1bSIsInBhdGhTZWdtZW50IiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsImZpeGFibGUiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiY29tbW9uanMiLCJub1VzZWxlc3NJbmRleCIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiY3JlYXRlIiwiY29udGV4dCIsImN1cnJlbnREaXIiLCJkaXJuYW1lIiwiZ2V0UGh5c2ljYWxGaWxlbmFtZSIsImdldEZpbGVuYW1lIiwib3B0aW9ucyIsImNoZWNrU291cmNlVmFsdWUiLCJzb3VyY2UiLCJpbXBvcnRQYXRoIiwidmFsdWUiLCJyZXBvcnRXaXRoUHJvcG9zZWRQYXRoIi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ByZXBvcnRXaXRoUHJvcG9zZWRQYXRoKFxuICAgICAgICB0b1JlbGF0aXZlUGF0aChcbiAgICAgICAgICBpbXBvcnRQYXRoU3BsaXRcbiAgICAgICAgICAgIC5zbGljZSgwLCBjb3VudEV4cGVjdGVkUmVsYXRpdmVQYXJlbnRzKVxuICAgICAgICAgICAgLmNvbmNhdChpbXBvcnRQYXRoU3BsaXQuc2xpY2UoY291bnRJbXBvcnRQYXRoUmVsYXRpdmVQYXJlbnRzICsgZGlmZikpXG4gICAgICAgICAgICAuam9pbignLycpLFxuICAgICAgICApLFxuICAgICAgKTtcbiAgICB9XG5cbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihjaGVja1NvdXJjZVZhbHVlLCBvcHRpb25zKTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js b/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js new file mode 100644 index 0000000..a7e57c0 --- /dev/null +++ b/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js @@ -0,0 +1,26 @@ +'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +function reportIfNonStandard(context, node, name) { + if (name && name.indexOf('!') !== -1) { + context.report(node, 'Unexpected \'!\' in \'' + String(name) + '\'. ' + + 'Do not use import syntax to configure webpack loaders.'); + + } +} + +module.exports = { + meta: { + type: 'problem', + docs: { + url: (0, _docsUrl2['default'])('no-webpack-loader-syntax') }, + + schema: [] }, + + + create: function () {function create(context) { + return (0, _moduleVisitor2['default'])(function (source, node) { + reportIfNonStandard(context, node, source.value); + }, { commonjs: true }); + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9u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wb3J0IG1vZHVsZVZpc2l0b3IgZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9tb2R1bGVWaXNpdG9yJztcbmltcG9ydCBkb2NzVXJsIGZyb20gJy4uL2RvY3NVcmwnO1xuXG5mdW5jdGlvbiByZXBvcnRJZk5vblN0YW5kYXJkKGNvbnRleHQsIG5vZGUsIG5hbWUpIHtcbiAgaWYgKG5hbWUgJiYgbmFtZS5pbmRleE9mKCchJykgIT09IC0xKSB7XG4gICAgY29udGV4dC5yZXBvcnQobm9kZSwgYFVuZXhwZWN0ZWQgJyEnIGluICcke25hbWV9Jy4gYCArXG4gICAgICAnRG8gbm90IHVzZSBpbXBvcnQgc3ludGF4IHRvIGNvbmZpZ3VyZSB3ZWJwYWNrIGxvYWRlcnMuJyxcbiAgICApO1xuICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0ge1xuICBtZXRhOiB7XG4gICAgdHlwZTogJ3Byb2JsZW0nLFxuICAgIGRvY3M6IHtcbiAgICAgIHVybDogZG9jc1VybCgnbm8td2VicGFjay1sb2FkZXItc3ludGF4JyksXG4gICAgfSxcbiAgICBzY2hlbWE6IFtdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IoKHNvdXJjZSwgbm9kZSkgPT4ge1xuICAgICAgcmVwb3J0SWZOb25TdGFuZGFyZChjb250ZXh0LCBub2RlLCBzb3VyY2UudmFsdWUpO1xuICAgIH0sIHsgY29tbW9uanM6IHRydWUgfSk7XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/node_modules/eslint-plugin-import/lib/rules/order.js b/node_modules/eslint-plugin-import/lib/rules/order.js new file mode 100644 index 0000000..e117043 --- /dev/null +++ b/node_modules/eslint-plugin-import/lib/rules/order.js @@ -0,0 +1,707 @@ +'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}(); + +var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch); +var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType); +var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +var defaultGroups = ['builtin', 'external', 'parent', 'sibling', 'index']; + +// REPORTING AND FIXING + +function reverse(array) { + return array.map(function (v) { + return Object.assign({}, v, { rank: -v.rank }); + }).reverse(); +} + +function getTokensOrCommentsAfter(sourceCode, node, count) { + var currentNodeOrToken = node; + var result = []; + for (var i = 0; i < count; i++) { + currentNodeOrToken = sourceCode.getTokenOrCommentAfter(currentNodeOrToken); + if (currentNodeOrToken == null) { + break; + } + result.push(currentNodeOrToken); + } + return result; +} + +function getTokensOrCommentsBefore(sourceCode, node, count) { + var currentNodeOrToken = node; + var result = []; + for (var i = 0; i < count; i++) { + currentNodeOrToken = sourceCode.getTokenOrCommentBefore(currentNodeOrToken); + if (currentNodeOrToken == null) { + break; + } + result.push(currentNodeOrToken); + } + return result.reverse(); +} + +function takeTokensAfterWhile(sourceCode, node, condition) { + var tokens = getTokensOrCommentsAfter(sourceCode, node, 100); + var result = []; + for (var i = 0; i < tokens.length; i++) { + if (condition(tokens[i])) { + result.push(tokens[i]); + } else { + break; + } + } + return result; +} + +function takeTokensBeforeWhile(sourceCode, node, condition) { + var tokens = getTokensOrCommentsBefore(sourceCode, node, 100); + var result = []; + for (var i = tokens.length - 1; i >= 0; i--) { + if (condition(tokens[i])) { + result.push(tokens[i]); + } else { + break; + } + } + return result.reverse(); +} + +function findOutOfOrder(imported) { + if (imported.length === 0) { + return []; + } + var maxSeenRankNode = imported[0]; + return imported.filter(function (importedModule) { + var res = importedModule.rank < maxSeenRankNode.rank; + if (maxSeenRankNode.rank < importedModule.rank) { + maxSeenRankNode = importedModule; + } + return res; + }); +} + +function findRootNode(node) { + var parent = node; + while (parent.parent != null && parent.parent.body == null) { + parent = parent.parent; + } + return parent; +} + +function findEndOfLineWithComments(sourceCode, node) { + var tokensToEndOfLine = takeTokensAfterWhile(sourceCode, node, commentOnSameLineAs(node)); + var endOfTokens = tokensToEndOfLine.length > 0 ? + tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1] : + node.range[1]; + var result = endOfTokens; + for (var i = endOfTokens; i < sourceCode.text.length; i++) { + if (sourceCode.text[i] === '\n') { + result = i + 1; + break; + } + if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t' && sourceCode.text[i] !== '\r') { + break; + } + result = i + 1; + } + return result; +} + +function commentOnSameLineAs(node) { + return function (token) {return (token.type === 'Block' || token.type === 'Line') && + token.loc.start.line === token.loc.end.line && + token.loc.end.line === node.loc.end.line;}; +} + +function findStartOfLineWithComments(sourceCode, node) { + var tokensToEndOfLine = takeTokensBeforeWhile(sourceCode, node, commentOnSameLineAs(node)); + var startOfTokens = tokensToEndOfLine.length > 0 ? tokensToEndOfLine[0].range[0] : node.range[0]; + var result = startOfTokens; + for (var i = startOfTokens - 1; i > 0; i--) { + if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t') { + break; + } + result = i; + } + return result; +} + +function isPlainRequireModule(node) { + if (node.type !== 'VariableDeclaration') { + return false; + } + if (node.declarations.length !== 1) { + return false; + } + var decl = node.declarations[0]; + var result = decl.id && ( + decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') && + decl.init != null && + decl.init.type === 'CallExpression' && + decl.init.callee != null && + decl.init.callee.name === 'require' && + decl.init.arguments != null && + decl.init.arguments.length === 1 && + decl.init.arguments[0].type === 'Literal'; + return result; +} + +function isPlainImportModule(node) { + return node.type === 'ImportDeclaration' && node.specifiers != null && node.specifiers.length > 0; +} + +function isPlainImportEquals(node) { + return node.type === 'TSImportEqualsDeclaration' && node.moduleReference.expression; +} + +function canCrossNodeWhileReorder(node) { + return isPlainRequireModule(node) || isPlainImportModule(node) || isPlainImportEquals(node); +} + +function canReorderItems(firstNode, secondNode) { + var parent = firstNode.parent;var _sort = + [ + parent.body.indexOf(firstNode), + parent.body.indexOf(secondNode)]. + sort(),_sort2 = _slicedToArray(_sort, 2),firstIndex = _sort2[0],secondIndex = _sort2[1]; + var nodesBetween = parent.body.slice(firstIndex, secondIndex + 1);var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = nodesBetween[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var nodeBetween = _step.value; + if (!canCrossNodeWhileReorder(nodeBetween)) { + return false; + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + return true; +} + +function fixOutOfOrder(context, firstNode, secondNode, order) { + var sourceCode = context.getSourceCode(); + + var firstRoot = findRootNode(firstNode.node); + var firstRootStart = findStartOfLineWithComments(sourceCode, firstRoot); + var firstRootEnd = findEndOfLineWithComments(sourceCode, firstRoot); + + var secondRoot = findRootNode(secondNode.node); + var secondRootStart = findStartOfLineWithComments(sourceCode, secondRoot); + var secondRootEnd = findEndOfLineWithComments(sourceCode, secondRoot); + var canFix = canReorderItems(firstRoot, secondRoot); + + var newCode = sourceCode.text.substring(secondRootStart, secondRootEnd); + if (newCode[newCode.length - 1] !== '\n') { + newCode = newCode + '\n'; + } + + var message = '`' + String(secondNode.displayName) + '` import should occur ' + String(order) + ' import of `' + String(firstNode.displayName) + '`'; + + if (order === 'before') { + context.report({ + node: secondNode.node, + message: message, + fix: canFix && function (fixer) {return ( + fixer.replaceTextRange( + [firstRootStart, secondRootEnd], + newCode + sourceCode.text.substring(firstRootStart, secondRootStart)));} }); + + + } else if (order === 'after') { + context.report({ + node: secondNode.node, + message: message, + fix: canFix && function (fixer) {return ( + fixer.replaceTextRange( + [secondRootStart, firstRootEnd], + sourceCode.text.substring(secondRootEnd, firstRootEnd) + newCode));} }); + + + } +} + +function reportOutOfOrder(context, imported, outOfOrder, order) { + outOfOrder.forEach(function (imp) { + var found = imported.find(function () {function hasHigherRank(importedItem) { + return importedItem.rank > imp.rank; + }return hasHigherRank;}()); + fixOutOfOrder(context, found, imp, order); + }); +} + +function makeOutOfOrderReport(context, imported) { + var outOfOrder = findOutOfOrder(imported); + if (!outOfOrder.length) { + return; + } + // There are things to report. Try to minimize the number of reported errors. + var reversedImported = reverse(imported); + var reversedOrder = findOutOfOrder(reversedImported); + if (reversedOrder.length < outOfOrder.length) { + reportOutOfOrder(context, reversedImported, reversedOrder, 'after'); + return; + } + reportOutOfOrder(context, imported, outOfOrder, 'before'); +} + +function getSorter(ascending) { + var multiplier = ascending ? 1 : -1; + + return function () {function importsSorter(importA, importB) { + var result = void 0; + + if (importA < importB) { + result = -1; + } else if (importA > importB) { + result = 1; + } else { + result = 0; + } + + return result * multiplier; + }return importsSorter;}(); +} + +function mutateRanksToAlphabetize(imported, alphabetizeOptions) { + var groupedByRanks = imported.reduce(function (acc, importedItem) { + if (!Array.isArray(acc[importedItem.rank])) { + acc[importedItem.rank] = []; + } + acc[importedItem.rank].push(importedItem); + return acc; + }, {}); + + var groupRanks = Object.keys(groupedByRanks); + + var sorterFn = getSorter(alphabetizeOptions.order === 'asc'); + var comparator = alphabetizeOptions.caseInsensitive ? + function (a, b) {return sorterFn(String(a.value).toLowerCase(), String(b.value).toLowerCase());} : + function (a, b) {return sorterFn(a.value, b.value);}; + + // sort imports locally within their group + groupRanks.forEach(function (groupRank) { + groupedByRanks[groupRank].sort(comparator); + }); + + // assign globally unique rank to each import + var newRank = 0; + var alphabetizedRanks = groupRanks.sort().reduce(function (acc, groupRank) { + groupedByRanks[groupRank].forEach(function (importedItem) { + acc[String(importedItem.value) + '|' + String(importedItem.node.importKind)] = parseInt(groupRank, 10) + newRank; + newRank += 1; + }); + return acc; + }, {}); + + // mutate the original group-rank with alphabetized-rank + imported.forEach(function (importedItem) { + importedItem.rank = alphabetizedRanks[String(importedItem.value) + '|' + String(importedItem.node.importKind)]; + }); +} + +// DETECTING + +function computePathRank(ranks, pathGroups, path, maxPosition) { + for (var i = 0, l = pathGroups.length; i < l; i++) {var _pathGroups$i = + pathGroups[i],pattern = _pathGroups$i.pattern,patternOptions = _pathGroups$i.patternOptions,group = _pathGroups$i.group,_pathGroups$i$positio = _pathGroups$i.position,position = _pathGroups$i$positio === undefined ? 1 : _pathGroups$i$positio; + if ((0, _minimatch2['default'])(path, pattern, patternOptions || { nocomment: true })) { + return ranks[group] + position / maxPosition; + } + } +} + +function computeRank(context, ranks, importEntry, excludedImportTypes) { + var impType = void 0; + var rank = void 0; + if (importEntry.type === 'import:object') { + impType = 'object'; + } else if (importEntry.node.importKind === 'type' && ranks.omittedTypes.indexOf('type') === -1) { + impType = 'type'; + } else { + impType = (0, _importType2['default'])(importEntry.value, context); + } + if (!excludedImportTypes.has(impType)) { + rank = computePathRank(ranks.groups, ranks.pathGroups, importEntry.value, ranks.maxPosition); + } + if (typeof rank === 'undefined') { + rank = ranks.groups[impType]; + } + if (importEntry.type !== 'import' && !importEntry.type.startsWith('import:')) { + rank += 100; + } + + return rank; +} + +function registerNode(context, importEntry, ranks, imported, excludedImportTypes) { + var rank = computeRank(context, ranks, importEntry, excludedImportTypes); + if (rank !== -1) { + imported.push(Object.assign({}, importEntry, { rank: rank })); + } +} + +function getRequireBlock(node) { + var n = node; + // Handle cases like `const baz = require('foo').bar.baz` + // and `const foo = require('foo')()` + while ( + n.parent.type === 'MemberExpression' && n.parent.object === n || + n.parent.type === 'CallExpression' && n.parent.callee === n) + { + n = n.parent; + } + if ( + n.parent.type === 'VariableDeclarator' && + n.parent.parent.type === 'VariableDeclaration' && + n.parent.parent.parent.type === 'Program') + { + return n.parent.parent.parent; + } +} + +var types = ['builtin', 'external', 'internal', 'unknown', 'parent', 'sibling', 'index', 'object', 'type']; + +// Creates an object with type-rank pairs. +// Example: { index: 0, sibling: 1, parent: 1, external: 1, builtin: 2, internal: 2 } +// Will throw an error if it contains a type that does not exist, or has a duplicate +function convertGroupsToRanks(groups) { + var rankObject = groups.reduce(function (res, group, index) { + if (typeof group === 'string') { + group = [group]; + } + group.forEach(function (groupItem) { + if (types.indexOf(groupItem) === -1) { + throw new Error('Incorrect configuration of the rule: Unknown type `' + + JSON.stringify(groupItem) + '`'); + } + if (res[groupItem] !== undefined) { + throw new Error('Incorrect configuration of the rule: `' + groupItem + '` is duplicated'); + } + res[groupItem] = index; + }); + return res; + }, {}); + + var omittedTypes = types.filter(function (type) { + return rankObject[type] === undefined; + }); + + var ranks = omittedTypes.reduce(function (res, type) { + res[type] = groups.length; + return res; + }, rankObject); + + return { groups: ranks, omittedTypes: omittedTypes }; +} + +function convertPathGroupsForRanks(pathGroups) { + var after = {}; + var before = {}; + + var transformed = pathGroups.map(function (pathGroup, index) {var + group = pathGroup.group,positionString = pathGroup.position; + var position = 0; + if (positionString === 'after') { + if (!after[group]) { + after[group] = 1; + } + position = after[group]++; + } else if (positionString === 'before') { + if (!before[group]) { + before[group] = []; + } + before[group].push(index); + } + + return Object.assign({}, pathGroup, { position: position }); + }); + + var maxPosition = 1; + + Object.keys(before).forEach(function (group) { + var groupLength = before[group].length; + before[group].forEach(function (groupIndex, index) { + transformed[groupIndex].position = -1 * (groupLength - index); + }); + maxPosition = Math.max(maxPosition, groupLength); + }); + + Object.keys(after).forEach(function (key) { + var groupNextPosition = after[key]; + maxPosition = Math.max(maxPosition, groupNextPosition - 1); + }); + + return { + pathGroups: transformed, + maxPosition: maxPosition > 10 ? Math.pow(10, Math.ceil(Math.log10(maxPosition))) : 10 }; + +} + +function fixNewLineAfterImport(context, previousImport) { + var prevRoot = findRootNode(previousImport.node); + var tokensToEndOfLine = takeTokensAfterWhile( + context.getSourceCode(), prevRoot, commentOnSameLineAs(prevRoot)); + + var endOfLine = prevRoot.range[1]; + if (tokensToEndOfLine.length > 0) { + endOfLine = tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1]; + } + return function (fixer) {return fixer.insertTextAfterRange([prevRoot.range[0], endOfLine], '\n');}; +} + +function removeNewLineAfterImport(context, currentImport, previousImport) { + var sourceCode = context.getSourceCode(); + var prevRoot = findRootNode(previousImport.node); + var currRoot = findRootNode(currentImport.node); + var rangeToRemove = [ + findEndOfLineWithComments(sourceCode, prevRoot), + findStartOfLineWithComments(sourceCode, currRoot)]; + + if (/^\s*$/.test(sourceCode.text.substring(rangeToRemove[0], rangeToRemove[1]))) { + return function (fixer) {return fixer.removeRange(rangeToRemove);}; + } + return undefined; +} + +function makeNewlinesBetweenReport(context, imported, newlinesBetweenImports) { + var getNumberOfEmptyLinesBetween = function getNumberOfEmptyLinesBetween(currentImport, previousImport) { + var linesBetweenImports = context.getSourceCode().lines.slice( + previousImport.node.loc.end.line, + currentImport.node.loc.start.line - 1); + + + return linesBetweenImports.filter(function (line) {return !line.trim().length;}).length; + }; + var previousImport = imported[0]; + + imported.slice(1).forEach(function (currentImport) { + var emptyLinesBetween = getNumberOfEmptyLinesBetween(currentImport, previousImport); + + if (newlinesBetweenImports === 'always' || + newlinesBetweenImports === 'always-and-inside-groups') { + if (currentImport.rank !== previousImport.rank && emptyLinesBetween === 0) { + context.report({ + node: previousImport.node, + message: 'There should be at least one empty line between import groups', + fix: fixNewLineAfterImport(context, previousImport) }); + + } else if (currentImport.rank === previousImport.rank && + emptyLinesBetween > 0 && + newlinesBetweenImports !== 'always-and-inside-groups') { + context.report({ + node: previousImport.node, + message: 'There should be no empty line within import group', + fix: removeNewLineAfterImport(context, currentImport, previousImport) }); + + } + } else if (emptyLinesBetween > 0) { + context.report({ + node: previousImport.node, + message: 'There should be no empty line between import groups', + fix: removeNewLineAfterImport(context, currentImport, previousImport) }); + + } + + previousImport = currentImport; + }); +} + +function getAlphabetizeConfig(options) { + var alphabetize = options.alphabetize || {}; + var order = alphabetize.order || 'ignore'; + var caseInsensitive = alphabetize.caseInsensitive || false; + + return { order: order, caseInsensitive: caseInsensitive }; +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: (0, _docsUrl2['default'])('order') }, + + + fixable: 'code', + schema: [ + { + type: 'object', + properties: { + groups: { + type: 'array' }, + + pathGroupsExcludedImportTypes: { + type: 'array' }, + + pathGroups: { + type: 'array', + items: { + type: 'object', + properties: { + pattern: { + type: 'string' }, + + patternOptions: { + type: 'object' }, + + group: { + type: 'string', + 'enum': types }, + + position: { + type: 'string', + 'enum': ['after', 'before'] } }, + + + required: ['pattern', 'group'] } }, + + + 'newlines-between': { + 'enum': [ + 'ignore', + 'always', + 'always-and-inside-groups', + 'never'] }, + + + alphabetize: { + type: 'object', + properties: { + caseInsensitive: { + type: 'boolean', + 'default': false }, + + order: { + 'enum': ['ignore', 'asc', 'desc'], + 'default': 'ignore' } }, + + + additionalProperties: false }, + + warnOnUnassignedImports: { + type: 'boolean', + 'default': false } }, + + + additionalProperties: false }] }, + + + + + create: function () {function importOrderRule(context) { + var options = context.options[0] || {}; + var newlinesBetweenImports = options['newlines-between'] || 'ignore'; + var pathGroupsExcludedImportTypes = new Set(options['pathGroupsExcludedImportTypes'] || ['builtin', 'external', 'object']); + var alphabetize = getAlphabetizeConfig(options); + var ranks = void 0; + + try {var _convertPathGroupsFor = + convertPathGroupsForRanks(options.pathGroups || []),pathGroups = _convertPathGroupsFor.pathGroups,maxPosition = _convertPathGroupsFor.maxPosition;var _convertGroupsToRanks = + convertGroupsToRanks(options.groups || defaultGroups),groups = _convertGroupsToRanks.groups,omittedTypes = _convertGroupsToRanks.omittedTypes; + ranks = { + groups: groups, + omittedTypes: omittedTypes, + pathGroups: pathGroups, + maxPosition: maxPosition }; + + } catch (error) { + // Malformed configuration + return { + Program: function () {function Program(node) { + context.report(node, error.message); + }return Program;}() }; + + } + var importMap = new Map(); + + function getBlockImports(node) { + if (!importMap.has(node)) { + importMap.set(node, []); + } + return importMap.get(node); + } + + return { + ImportDeclaration: function () {function handleImports(node) { + // Ignoring unassigned imports unless warnOnUnassignedImports is set + if (node.specifiers.length || options.warnOnUnassignedImports) { + var name = node.source.value; + registerNode( + context, + { + node: node, + value: name, + displayName: name, + type: 'import' }, + + ranks, + getBlockImports(node.parent), + pathGroupsExcludedImportTypes); + + } + }return handleImports;}(), + TSImportEqualsDeclaration: function () {function handleImports(node) { + var displayName = void 0; + var value = void 0; + var type = void 0; + // skip "export import"s + if (node.isExport) { + return; + } + if (node.moduleReference.type === 'TSExternalModuleReference') { + value = node.moduleReference.expression.value; + displayName = value; + type = 'import'; + } else { + value = ''; + displayName = context.getSourceCode().getText(node.moduleReference); + type = 'import:object'; + } + registerNode( + context, + { + node: node, + value: value, + displayName: displayName, + type: type }, + + ranks, + getBlockImports(node.parent), + pathGroupsExcludedImportTypes); + + }return handleImports;}(), + CallExpression: function () {function handleRequires(node) { + if (!(0, _staticRequire2['default'])(node)) { + return; + } + var block = getRequireBlock(node); + if (!block) { + return; + } + var name = node.arguments[0].value; + registerNode( + context, + { + node: node, + value: name, + displayName: name, + type: 'require' }, + + ranks, + getBlockImports(block), + pathGroupsExcludedImportTypes); + + }return handleRequires;}(), + 'Program:exit': function () {function reportAndReset() { + importMap.forEach(function (imported) { + if (newlinesBetweenImports !== 'ignore') { + makeNewlinesBetweenReport(context, imported, newlinesBetweenImports); + } + + if (alphabetize.order !== 'ignore') { + mutateRanksToAlphabetize(imported, alphabetize); + } + + makeOutOfOrderReport(context, imported); + }); + + importMap.clear(); + }return reportAndReset;}() }; + + }return importOrderRule;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9u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lIHx8IGZhbHNlO1xuXG4gIHJldHVybiB7IG9yZGVyLCBjYXNlSW5zZW5zaXRpdmUgfTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCdvcmRlcicpLFxuICAgIH0sXG5cbiAgICBmaXhhYmxlOiAnY29kZScsXG4gICAgc2NoZW1hOiBbXG4gICAgICB7XG4gICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgZ3JvdXBzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBwYXRoR3JvdXBzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICBwYXR0ZXJuOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHBhdHRlcm5PcHRpb25zOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGdyb3VwOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICAgIGVudW06IHR5cGVzLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcG9zaXRpb246IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgICAgZW51bTogWydhZnRlcicsICdiZWZvcmUnXSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICByZXF1aXJlZDogWydwYXR0ZXJuJywgJ2dyb3VwJ10sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0sXG4gICAgICAgICAgJ25ld2xpbmVzLWJldHdlZW4nOiB7XG4gICAgICAgICAgICBlbnVtOiBbXG4gICAgICAgICAgICAgICdpZ25vcmUnLFxuICAgICAgICAgICAgICAnYWx3YXlzJyxcbiAgICAgICAgICAgICAgJ2Fsd2F5cy1hbmQtaW5zaWRlLWdyb3VwcycsXG4gICAgICAgICAgICAgICduZXZlcicsXG4gICAgICAgICAgICBdLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgYWxwaGFiZXRpemU6IHtcbiAgICAgICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICBjYXNlSW5zZW5zaXRpdmU6IHtcbiAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgICAgICAgICAgICAgZGVmYXVsdDogZmFsc2UsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIG9yZGVyOiB7XG4gICAgICAgICAgICAgICAgZW51bTogWydpZ25vcmUnLCAnYXNjJywgJ2Rlc2MnXSxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OiAnaWdub3JlJyxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBhZGRpdGlvbmFsUHJvcGVydGllczogZmFsc2UsXG4gICAgICAgICAgfSxcbiAgICAgICAgICB3YXJuT25VbmFzc2lnbmVkSW1wb3J0czoge1xuICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICAgICAgZGVmYXVsdDogZmFsc2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ZWQgY29uZmlndXJhdGlvblxuICAgICAgcmV0dXJuIHtcbiAgICAgICAgUHJvZ3JhbShub2RlKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQobm9kZSwgZXJyb3IubWVzc2FnZSk7XG4gICAgICAgIH0sXG4gICAgICB9O1xuICAgIH1cbiAgICBjb25zdCBpbXBvcnRNYXAgPSBuZXcgTWFwKCk7XG5cbiAgICBmdW5jdGlvbiBnZXRCbG9ja0ltcG9ydHMobm9kZSkge1xuICAgICAgaWYgKCFpbXBvcnRNYXAuaGFzKG5vZGUpKSB7XG4gICAgICAgIGltcG9ydE1hcC5zZXQobm9kZSwgW10pO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGltcG9ydE1hcC5nZXQobm9kZSk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIEltcG9ydERlY2xhcmF0aW9uOiBmdW5jdGlvbiBoYW5kbGVJbXBvcnRzKG5vZGUpIHtcbiAgICAgICAgLy8gSWdub3JpbmcgdW5hc3NpZ25lZCBpbXBvcnRzIHVubGVzcyB3YXJuT25VbmFzc2lnbmVkSW1wb3J0cyBpcyBzZXRcbiAgICAgICAgaWYgKG5vZGUuc3BlY2lmaWVycy5sZW5ndGggfHwgb3B0aW9ucy53YXJuT25VbmFzc2lnbmVkSW1wb3J0cykge1xuICAgICAgICAgIGNvbnN0IG5hbWUgPSBub2RlLnNvdXJjZS52YWx1ZTtcbiAgICAgICAgICByZWdpc3Rlck5vZGUoXG4gICAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICB2YWx1ZTogbmFtZSxcbiAgICAgICAgICAgICAgZGlzcGxheU5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgIHR5cGU6ICdpbXBvcnQnLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHJhbmtzLFxuICAgICAgICAgICAgZ2V0QmxvY2tJbXBvcnRzKG5vZGUucGFyZW50KSxcbiAgICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzLFxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBUU0ltcG9ydEVxdWFsc0RlY2xhcmF0aW9uOiBmdW5jdGlvbiBoYW5kbGVJbXBvcnRzKG5vZGUpIHtcbiAgICAgICAgbGV0IGRpc3BsYXlOYW1lO1xuICAgICAgICBsZXQgdmFsdWU7XG4gICAgICAgIGxldCB0eXBlO1xuICAgICAgICAvLyBza2lwIFwiZXhwb3J0IGltcG9ydFwic1xuICAgICAgICBpZiAobm9kZS5pc0V4cG9ydCkge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAobm9kZS5tb2R1bGVSZWZlcmVuY2UudHlwZSA9PT0gJ1RTRXh0ZXJuYWxNb2R1bGVSZWZlcmVuY2UnKSB7XG4gICAgICAgICAgdmFsdWUgPSBub2RlLm1vZHVsZVJlZmVyZW5jZS5leHByZXNzaW9uLnZhbHVlO1xuICAgICAgICAgIGRpc3BsYXlOYW1lID0gdmFsdWU7XG4gICAgICAgICAgdHlwZSA9ICdpbXBvcnQnO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhbHVlID0gJyc7XG4gICAgICAgICAgZGlzcGxheU5hbWUgPSBjb250ZXh0LmdldFNvdXJjZUNvZGUoKS5nZXRUZXh0KG5vZGUubW9kdWxlUmVmZXJlbmNlKTtcbiAgICAgICAgICB0eXBlID0gJ2ltcG9ydDpvYmplY3QnO1xuICAgICAgICB9XG4gICAgICAgIHJlZ2lzdGVyTm9kZShcbiAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICB2YWx1ZSxcbiAgICAgICAgICAgIGRpc3BsYXlOYW1lLFxuICAgICAgICAgICAgdHlwZSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHJhbmtzLFxuICAgICAgIC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BvcnQoY29udGV4dCwgaW1wb3J0ZWQsIG5ld2xpbmVzQmV0d2VlbkltcG9ydHMpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChhbHBoYWJldGl6ZS5vcmRlciAhPT0gJ2lnbm9yZScpIHtcbiAgICAgICAgICAgIG11dGF0ZVJhbmtzVG9BbHBoYWJldGl6ZShpbXBvcnRlZCwgYWxwaGFiZXRpemUpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIG1ha2VPdXRPZk9yZGVyUmVwb3J0KGNvbnRleHQsIGltcG9ydGVkKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgaW1wb3J0TWFwLmNsZWFyKCk7XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19 \ No newline at end of file diff --git a/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js b/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js new file mode 100644 index 0000000..19370a5 --- /dev/null +++ b/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js @@ -0,0 +1,95 @@ +'use strict'; + +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: (0, _docsUrl2['default'])('prefer-default-export') }, + + schema: [] }, + + + create: function () {function create(context) { + var specifierExportCount = 0; + var hasDefaultExport = false; + var hasStarExport = false; + var hasTypeExport = false; + var namedExportNode = null; + + function captureDeclaration(identifierOrPattern) { + if (identifierOrPattern && identifierOrPattern.type === 'ObjectPattern') { + // recursively capture + identifierOrPattern.properties. + forEach(function (property) { + captureDeclaration(property.value); + }); + } else if (identifierOrPattern && identifierOrPattern.type === 'ArrayPattern') { + identifierOrPattern.elements. + forEach(captureDeclaration); + } else { + // assume it's a single standard identifier + specifierExportCount++; + } + } + + return { + 'ExportDefaultSpecifier': function () {function ExportDefaultSpecifier() { + hasDefaultExport = true; + }return ExportDefaultSpecifier;}(), + + 'ExportSpecifier': function () {function ExportSpecifier(node) { + if ((node.exported.name || node.exported.value) === 'default') { + hasDefaultExport = true; + } else { + specifierExportCount++; + namedExportNode = node; + } + }return ExportSpecifier;}(), + + 'ExportNamedDeclaration': function () {function ExportNamedDeclaration(node) { + // if there are specifiers, node.declaration should be null + if (!node.declaration) return;var + + type = node.declaration.type; + + if ( + type === 'TSTypeAliasDeclaration' || + type === 'TypeAlias' || + type === 'TSInterfaceDeclaration' || + type === 'InterfaceDeclaration') + { + specifierExportCount++; + hasTypeExport = true; + return; + } + + if (node.declaration.declarations) { + node.declaration.declarations.forEach(function (declaration) { + captureDeclaration(declaration.id); + }); + } else { + // captures 'export function foo() {}' syntax + specifierExportCount++; + } + + namedExportNode = node; + }return ExportNamedDeclaration;}(), + + 'ExportDefaultDeclaration': function () {function ExportDefaultDeclaration() { + hasDefaultExport = true; + }return ExportDefaultDeclaration;}(), + + 'ExportAllDeclaration': function () {function ExportAllDeclaration() { + hasStarExport = true; + }return ExportAllDeclaration;}(), + + 'Program:exit': function () {function ProgramExit() { + if (specifierExportCount === 1 && !hasDefaultExport && !hasStarExport && !hasTypeExport) { + context.report(namedExportNode, 'Prefer default export.'); + } + }return ProgramExit;}() }; + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9wcmVmZXItZGVmYXVsdC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJzcGVjaWZpZXJFeHBvcnRDb3VudCIsImhhc0RlZmF1bHRFeHBvcnQiLCJoYXNTdGFyRXhwb3J0IiwiaGFzVHlwZUV4cG9ydCIsIm5hbWVkRXhwb3J0Tm9kZSIsImNhcHR1cmVEZWNsYXJhdGlvbiIs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3J0Tm9kZSA9IG5vZGU7XG4gICAgICB9LFxuXG4gICAgICAnRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uJzogZnVuY3Rpb24gKCkge1xuICAgICAgICBoYXNEZWZhdWx0RXhwb3J0ID0gdHJ1ZTtcbiAgICAgIH0sXG5cbiAgICAgICdFeHBvcnRBbGxEZWNsYXJhdGlvbic6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgaGFzU3RhckV4cG9ydCA9IHRydWU7XG4gICAgICB9LFxuXG4gICAgICAnUHJvZ3JhbTpleGl0JzogZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAoc3BlY2lmaWVyRXhwb3J0Q291bnQgPT09IDEgJiYgIWhhc0RlZmF1bHRFeHBvcnQgJiYgIWhhc1N0YXJFeHBvcnQgJiYgIWhhc1R5cGVFeHBvcnQpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydChuYW1lZEV4cG9ydE5vZGUsICdQcmVmZXIgZGVmYXVsdCBleHBvcnQuJyk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/node_modules/eslint-plugin-import/lib/rules/unambiguous.js b/node_modules/eslint-plugin-import/lib/rules/unambiguous.js new file mode 100644 index 0000000..87370d0 --- /dev/null +++ b/node_modules/eslint-plugin-import/lib/rules/unambiguous.js @@ -0,0 +1,36 @@ +'use strict'; + + + + +var _unambiguous = require('eslint-module-utils/unambiguous'); +var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** + * @fileOverview Report modules that could parse incorrectly as scripts. + * @author Ben Mosher + */module.exports = { meta: { + type: 'suggestion', + docs: { + url: (0, _docsUrl2['default'])('unambiguous') }, + + schema: [] }, + + + create: function () {function create(context) { + // ignore non-modules + if (context.parserOptions.sourceType !== 'module') { + return {}; + } + + return { + Program: function () {function Program(ast) { + if (!(0, _unambiguous.isModule)(ast)) { + context.report({ + node: ast, + message: 'This module could be parsed as a valid script.' }); + + } + }return Program;}() }; + + + }return create;}() }; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwiUHJvZ3JhbSIsImFzdCIsInJlcG9ydCIsIm5vZGUiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiOzs7OztBQUtBO0FBQ0EscUMsaUpBTkE7Ozt5TEFRQUEsT0FBT0MsT0FBUCxHQUFpQixFQUNmQyxNQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssMEJBQVEsYUFBUixDQURELEVBRkY7O0FBS0pDLFlBQVEsRUFMSixFQURTOzs7QUFTZkMsUUFUZSwrQkFTUkMsT0FUUSxFQVNDO0FBQ2Q7QUFDQSxVQUFJQSxRQUFRQyxhQUFSLENBQXNCQyxVQUF0QixLQUFxQyxRQUF6QyxFQUFtRDtBQUNqRCxlQUFPLEVBQVA7QUFDRDs7QUFFRCxhQUFPO0FBQ0xDLGVBREssZ0NBQ0dDLEdBREgsRUFDUTtBQUNYLGdCQUFJLENBQUMsMkJBQVNBLEdBQVQsQ0FBTCxFQUFvQjtBQUNsQkosc0JBQVFLLE1BQVIsQ0FBZTtBQUNiQyxzQkFBTUYsR0FETztBQUViRyx5QkFBUyxnREFGSSxFQUFmOztBQUlEO0FBQ0YsV0FSSSxvQkFBUDs7O0FBV0QsS0ExQmMsbUJBQWpCIiwiZmlsZSI6InVuYW1iaWd1b3VzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAZmlsZU92ZXJ2aWV3IFJlcG9ydCBtb2R1bGVzIHRoYXQgY291bGQgcGFyc2UgaW5jb3JyZWN0bHkgYXMgc2NyaXB0cy5cbiAqIEBhdXRob3IgQmVuIE1vc2hlclxuICovXG5cbmltcG9ydCB7IGlzTW9kdWxlIH0gZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy91bmFtYmlndW91cyc7XG5pbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJztcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCd1bmFtYmlndW91cycpLFxuICAgIH0sXG4gICAgc2NoZW1hOiBbXSxcbiAgfSxcblxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIC8vIGlnbm9yZSBub24tbW9kdWxlc1xuICAgIGlmIChjb250ZXh0LnBhcnNlck9wdGlvbnMuc291cmNlVHlwZSAhPT0gJ21vZHVsZScpIHtcbiAgICAgIHJldHVybiB7fTtcbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgUHJvZ3JhbShhc3QpIHtcbiAgICAgICAgaWYgKCFpc01vZHVsZShhc3QpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZTogYXN0LFxuICAgICAgICAgICAgbWVzc2FnZTogJ1RoaXMgbW9kdWxlIGNvdWxkIGJlIHBhcnNlZCBhcyBhIHZhbGlkIHNjcmlwdC4nLFxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9LFxuICAgIH07XG5cbiAgfSxcbn07XG4iXX0= \ No newline at end of file diff --git a/node_modules/eslint-plugin-import/memo-parser/LICENSE b/node_modules/eslint-plugin-import/memo-parser/LICENSE new file mode 100644 index 0000000..c6ade2a --- /dev/null +++ b/node_modules/eslint-plugin-import/memo-parser/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ben Mosher + +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/eslint-plugin-import/memo-parser/README.md b/node_modules/eslint-plugin-import/memo-parser/README.md new file mode 100644 index 0000000..8a2a3cb --- /dev/null +++ b/node_modules/eslint-plugin-import/memo-parser/README.md @@ -0,0 +1,23 @@ +# eslint-plugin-import/memo-parser + + +## NOTE! + +This used to improve performance, but as of ESLint 5 and v2 of this plugin, it seems to just consume a bunch of memory and slightly increase lint times. + +**Not recommended for use at this time!** + + +This parser is just a memoizing wrapper around some actual parser. + +To configure, just add your _actual_ parser to the `parserOptions`, like so: + +```yaml +parser: eslint-plugin-import/memo-parser +# parser: babel-eslint + +parserOptions: + parser: babel-eslint + sourceType: module + ecmaVersion: 6 +``` diff --git a/node_modules/eslint-plugin-import/memo-parser/index.js b/node_modules/eslint-plugin-import/memo-parser/index.js new file mode 100644 index 0000000..de558ff --- /dev/null +++ b/node_modules/eslint-plugin-import/memo-parser/index.js @@ -0,0 +1,41 @@ +'use strict'; + +const crypto = require('crypto'); +const moduleRequire = require('eslint-module-utils/module-require').default; +const hashObject = require('eslint-module-utils/hash').hashObject; + +const cache = new Map(); + +// must match ESLint default options or we'll miss the cache every time +const parserOptions = { + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + attachComment: true, +}; + +exports.parse = function parse(content, options) { + options = Object.assign({}, options, parserOptions); + + if (!options.filePath) { + throw new Error('no file path provided!'); + } + + const keyHash = crypto.createHash('sha256'); + keyHash.update(content); + hashObject(options, keyHash); + + const key = keyHash.digest('hex'); + + let ast = cache.get(key); + if (ast != null) return ast; + + const realParser = moduleRequire(options.parser); + + ast = realParser.parse(content, options); + cache.set(key, ast); + + return ast; +}; diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md b/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md new file mode 100644 index 0000000..57140d0 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md @@ -0,0 +1,94 @@ +v2.1.0 - January 6, 2018 + +* 827f314 Update: support node ranges (fixes #89) (#190) (Teddy Katz) + +v2.0.2 - November 25, 2017 + +* 5049ee3 Fix: Remove redundant LICENSE/README names from files (#203) (Kevin Partington) + +v2.0.1 - November 10, 2017 + +* 009f33d Fix: Making sure union type stringification respects compact flag (#199) (Mitermayer Reis) +* 19da935 Use native String.prototype.trim instead of a custom implementation. (#201) (Rouven Weßling) +* e3a011b chore: add mocha.opts to restore custom mocha config (Jason Kurian) +* d888200 chore: adds nyc and a newer version of mocha to accurately report coverage (Jason Kurian) +* 6b210a8 fix: support type expression for @this tag (fixes #181) (#182) (Frédéric Junod) +* 1c4a4c7 fix: Allow array indexes in names (#193) (Tom MacWright) +* 9aed54d Fix incorrect behavior when arrow functions are used as default values (#189) (Gaurab Paul) +* 9efb6ca Upgrade: Use Array.isArray instead of isarray package (#195) (medanat) + +v2.0.0 - November 15, 2016 + +* 7d7c5f1 Breaking: Re-license to Apache 2 (fixes #176) (#178) (Nicholas C. Zakas) +* 5496132 Docs: Update license copyright (Nicholas C. Zakas) + +v1.5.0 - October 13, 2016 + +* e33c6bb Update: Add support for BooleanLiteralType (#173) (Erik Arvidsson) + +v1.4.0 - September 13, 2016 + +* d7426e5 Update: add ability to parse optional properties in typedefs (refs #5) (#174) (ikokostya) + +v1.3.0 - August 22, 2016 + +* 12c7ad9 Update: Add support for numeric and string literal types (fixes #156) (#172) (Andrew Walter) + +v1.2.3 - August 16, 2016 + +* b96a884 Build: Add CI release script (Nicholas C. Zakas) +* 8d9b3c7 Upgrade: Upgrade esutils to v2.0.2 (fixes #170) (#171) (Emeegeemee) + +v1.2.2 - May 19, 2016 + +* ebe0b08 Fix: Support case insensitive tags (fixes #163) (#164) (alberto) +* 8e6d81e Chore: Remove copyright and license from headers (Nicholas C. Zakas) +* 79035c6 Chore: Include jQuery Foundation copyright (Nicholas C. Zakas) +* 06910a7 Fix: Preserve whitespace in default param string values (fixes #157) (Kai Cataldo) + +v1.2.1 - March 29, 2016 + +* 1f54014 Fix: allow hyphens in names (fixes #116) (Kai Cataldo) +* bbee469 Docs: Add issue template (Nicholas C. Zakas) + +v1.2.0 - February 19, 2016 + +* 18136c5 Build: Cleanup build system (Nicholas C. Zakas) +* b082f85 Update: Add support for slash in namepaths (fixes #100) (Ryan Duffy) +* def53a2 Docs: Fix typo in option lineNumbers (Daniel Tschinder) +* e2cbbc5 Update: Bump isarray to v1.0.0 (Shinnosuke Watanabe) +* ae07aa8 Fix: Allow whitespace in optional param with default value (fixes #141) (chris) + +v1.1.0 - January 6, 2016 + +* Build: Switch to Makefile.js (Nicholas C. Zakas) +* New: support name expression for @this tag (fixes #143) (Tim Schaub) +* Build: Update ESLint settings (Nicholas C. Zakas) + +v1.0.0 - December 21, 2015 + +* New: parse caption tags in examples into separate property. (fixes #131) (Tom MacWright) + +v0.7.2 - November 27, 2015 + +* Fix: Line numbers for some tags (fixes #138) Fixing issue where input was not consumed via advance() but was skipped when parsing tags resulting in sometimes incorrect reported lineNumber. (TEHEK) +* Build: Add missing linefix package (Nicholas C. Zakas) + +v0.7.1 - November 13, 2015 + +* Update: Begin switch to Makefile.js (Nicholas C. Zakas) +* Fix: permit return tag without type (fixes #136) (Tom MacWright) +* Fix: package.json homepage field (Bogdan Chadkin) +* Fix: Parse array default syntax. Fixes #133 (Tom MacWright) +* Fix: Last tag always has \n in the description (fixes #87) (Burak Yigit Kaya) +* Docs: Add changelog (Nicholas C. Zakas) + +v0.7.0 - September 21, 2015 + +* Docs: Update README with new info (fixes #127) (Nicholas C. Zakas) +* Fix: Parsing fix for param with arrays and properties (fixes #111) (Gyandeep Singh) +* Build: Add travis build (fixes #123) (Gyandeep Singh) +* Fix: Parsing of parameter name without a type (fixes #120) (Gyandeep Singh) +* New: added preserveWhitespace option (Aleks Totic) +* New: Add "files" entry to only deploy select files (Rob Loach) +* New: Add support and tests for typedefs. Refs #5 (Tom MacWright) diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE new file mode 100644 index 0000000..3e8ba72 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima new file mode 100644 index 0000000..3e580c3 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/README.md b/node_modules/eslint-plugin-import/node_modules/doctrine/README.md new file mode 100644 index 0000000..26fad18 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/README.md @@ -0,0 +1,165 @@ +[![NPM version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Downloads][downloads-image]][downloads-url] +[![Join the chat at https://gitter.im/eslint/doctrine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +# Doctrine + +Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file). + +## Installation + +You can install Doctrine using [npm](https://npmjs.com): + +``` +$ npm install doctrine --save-dev +``` + +Doctrine can also be used in web browsers using [Browserify](http://browserify.org). + +## Usage + +Require doctrine inside of your JavaScript: + +```js +var doctrine = require("doctrine"); +``` + +### parse() + +The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are: + +* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`. +* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`. +* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`. +* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`. +* `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`. +* `range` - set to `true` to add `range` to each node, specifying the start and end index of the node in the original comment. Default: `false`. + +Here's a simple example: + +```js +var ast = doctrine.parse( + [ + "/**", + " * This function comment is parsed by doctrine", + " * @param {{ok:String}} userName", + "*/" + ].join('\n'), { unwrap: true }); +``` + +This example returns the following AST: + + { + "description": "This function comment is parsed by doctrine", + "tags": [ + { + "title": "param", + "description": null, + "type": { + "type": "RecordType", + "fields": [ + { + "type": "FieldType", + "key": "ok", + "value": { + "type": "NameExpression", + "name": "String" + } + } + ] + }, + "name": "userName" + } + ] + } + +See the [demo page](http://eslint.org/doctrine/demo/) more detail. + +## Team + +These folks keep the project moving and are resources for help: + +* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead +* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues). + +## Frequently Asked Questions + +### Can I pass a whole JavaScript file to Doctrine? + +No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work. + + +### License + +#### doctrine + +Copyright JS Foundation and other contributors, https://js.foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +#### esprima + +some of functions is derived from esprima + +Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about) + (twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#### closure-compiler + +some of extensions is derived from closure-compiler + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + + +### Where to ask for help? + +Join our [Chatroom](https://gitter.im/eslint/doctrine) + +[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/doctrine +[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square +[travis-url]: https://travis-ci.org/eslint/doctrine +[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master +[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square +[downloads-url]: https://www.npmjs.com/package/doctrine diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js new file mode 100644 index 0000000..1665afe --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js @@ -0,0 +1,899 @@ +/* + * @fileoverview Main Doctrine object + * @author Yusuke Suzuki + * @author Dan Tao + * @author Andrew Eisenberg + */ + +(function () { + 'use strict'; + + var typed, + utility, + jsdoc, + esutils, + hasOwnProperty; + + esutils = require('esutils'); + typed = require('./typed'); + utility = require('./utility'); + + function sliceSource(source, index, last) { + return source.slice(index, last); + } + + hasOwnProperty = (function () { + var func = Object.prototype.hasOwnProperty; + return function hasOwnProperty(obj, name) { + return func.call(obj, name); + }; + }()); + + function shallowCopy(obj) { + var ret = {}, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + + function isASCIIAlphanumeric(ch) { + return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) || + (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) || + (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */); + } + + function isParamTitle(title) { + return title === 'param' || title === 'argument' || title === 'arg'; + } + + function isReturnTitle(title) { + return title === 'return' || title === 'returns'; + } + + function isProperty(title) { + return title === 'property' || title === 'prop'; + } + + function isNameParameterRequired(title) { + return isParamTitle(title) || isProperty(title) || + title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires'; + } + + function isAllowedName(title) { + return isNameParameterRequired(title) || title === 'const' || title === 'constant'; + } + + function isAllowedNested(title) { + return isProperty(title) || isParamTitle(title); + } + + function isAllowedOptional(title) { + return isProperty(title) || isParamTitle(title); + } + + function isTypeParameterRequired(title) { + return isParamTitle(title) || isReturnTitle(title) || + title === 'define' || title === 'enum' || + title === 'implements' || title === 'this' || + title === 'type' || title === 'typedef' || isProperty(title); + } + + // Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required + // This would require changes to 'parseType' + function isAllowedType(title) { + return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' || + title === 'namespace' || title === 'member' || title === 'var' || title === 'module' || + title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' || + title === 'public' || title === 'private' || title === 'protected'; + } + + // A regex character class that contains all whitespace except linebreak characters (\r, \n, \u2028, \u2029) + var WHITESPACE = '[ \\f\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]'; + + var STAR_MATCHER = '(' + WHITESPACE + '*(?:\\*' + WHITESPACE + '?)?)(.+|[\r\n\u2028\u2029])'; + + function unwrapComment(doc) { + // JSDoc comment is following form + // /** + // * ....... + // */ + + return doc. + // remove /** + replace(/^\/\*\*?/, ''). + // remove */ + replace(/\*\/$/, ''). + // remove ' * ' at the beginning of a line + replace(new RegExp(STAR_MATCHER, 'g'), '$2'). + // remove trailing whitespace + replace(/\s*$/, ''); + } + + /** + * Converts an index in an "unwrapped" JSDoc comment to the corresponding index in the original "wrapped" version + * @param {string} originalSource The original wrapped comment + * @param {number} unwrappedIndex The index of a character in the unwrapped string + * @returns {number} The index of the corresponding character in the original wrapped string + */ + function convertUnwrappedCommentIndex(originalSource, unwrappedIndex) { + var replacedSource = originalSource.replace(/^\/\*\*?/, ''); + var numSkippedChars = 0; + var matcher = new RegExp(STAR_MATCHER, 'g'); + var match; + + while ((match = matcher.exec(replacedSource))) { + numSkippedChars += match[1].length; + + if (match.index + match[0].length > unwrappedIndex + numSkippedChars) { + return unwrappedIndex + numSkippedChars + originalSource.length - replacedSource.length; + } + } + + return originalSource.replace(/\*\/$/, '').replace(/\s*$/, '').length; + } + + // JSDoc Tag Parser + + (function (exports) { + var Rules, + index, + lineNumber, + length, + source, + originalSource, + recoverable, + sloppy, + strict; + + function advance() { + var ch = source.charCodeAt(index); + index += 1; + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) { + lineNumber += 1; + } + return String.fromCharCode(ch); + } + + function scanTitle() { + var title = ''; + // waste '@' + advance(); + + while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) { + title += advance(); + } + + return title; + } + + function seekContent() { + var ch, waiting, last = index; + + waiting = false; + while (last < length) { + ch = source.charCodeAt(last); + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) { + waiting = true; + } else if (waiting) { + if (ch === 0x40 /* '@' */) { + break; + } + if (!esutils.code.isWhiteSpace(ch)) { + waiting = false; + } + } + last += 1; + } + return last; + } + + // type expression may have nest brace, such as, + // { { ok: string } } + // + // therefore, scanning type expression with balancing braces. + function parseType(title, last, addRange) { + var ch, brace, type, startIndex, direct = false; + + + // search '{' + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isWhiteSpace(ch)) { + advance(); + } else if (ch === 0x7B /* '{' */) { + advance(); + break; + } else { + // this is direct pattern + direct = true; + break; + } + } + + + if (direct) { + return null; + } + + // type expression { is found + brace = 1; + type = ''; + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isLineTerminator(ch)) { + advance(); + } else { + if (ch === 0x7D /* '}' */) { + brace -= 1; + if (brace === 0) { + advance(); + break; + } + } else if (ch === 0x7B /* '{' */) { + brace += 1; + } + if (type === '') { + startIndex = index; + } + type += advance(); + } + } + + if (brace !== 0) { + // braces is not balanced + return utility.throwError('Braces are not balanced'); + } + + if (isAllowedOptional(title)) { + return typed.parseParamType(type, {startIndex: convertIndex(startIndex), range: addRange}); + } + + return typed.parseType(type, {startIndex: convertIndex(startIndex), range: addRange}); + } + + function scanIdentifier(last) { + var identifier; + if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index)) && !source[index].match(/[0-9]/)) { + return null; + } + identifier = advance(); + while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) { + identifier += advance(); + } + return identifier; + } + + function skipWhiteSpace(last) { + while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) { + advance(); + } + } + + function parseName(last, allowBrackets, allowNestedParams) { + var name = '', + useBrackets, + insideString; + + + skipWhiteSpace(last); + + if (index >= last) { + return null; + } + + if (source.charCodeAt(index) === 0x5B /* '[' */) { + if (allowBrackets) { + useBrackets = true; + name = advance(); + } else { + return null; + } + } + + name += scanIdentifier(last); + + if (allowNestedParams) { + if (source.charCodeAt(index) === 0x3A /* ':' */ && ( + name === 'module' || + name === 'external' || + name === 'event')) { + name += advance(); + name += scanIdentifier(last); + + } + if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){ + name += advance(); + name += advance(); + } + while (source.charCodeAt(index) === 0x2E /* '.' */ || + source.charCodeAt(index) === 0x2F /* '/' */ || + source.charCodeAt(index) === 0x23 /* '#' */ || + source.charCodeAt(index) === 0x2D /* '-' */ || + source.charCodeAt(index) === 0x7E /* '~' */) { + name += advance(); + name += scanIdentifier(last); + } + } + + if (useBrackets) { + skipWhiteSpace(last); + // do we have a default value for this? + if (source.charCodeAt(index) === 0x3D /* '=' */) { + // consume the '='' symbol + name += advance(); + skipWhiteSpace(last); + + var ch; + var bracketDepth = 1; + + // scan in the default value + while (index < last) { + ch = source.charCodeAt(index); + + if (esutils.code.isWhiteSpace(ch)) { + if (!insideString) { + skipWhiteSpace(last); + ch = source.charCodeAt(index); + } + } + + if (ch === 0x27 /* ''' */) { + if (!insideString) { + insideString = '\''; + } else { + if (insideString === '\'') { + insideString = ''; + } + } + } + + if (ch === 0x22 /* '"' */) { + if (!insideString) { + insideString = '"'; + } else { + if (insideString === '"') { + insideString = ''; + } + } + } + + if (ch === 0x5B /* '[' */) { + bracketDepth++; + } else if (ch === 0x5D /* ']' */ && + --bracketDepth === 0) { + break; + } + + name += advance(); + } + } + + skipWhiteSpace(last); + + if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) { + // we never found a closing ']' + return null; + } + + // collect the last ']' + name += advance(); + } + + return name; + } + + function skipToTag() { + while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) { + advance(); + } + if (index >= length) { + return false; + } + utility.assert(source.charCodeAt(index) === 0x40 /* '@' */); + return true; + } + + function convertIndex(rangeIndex) { + if (source === originalSource) { + return rangeIndex; + } + return convertUnwrappedCommentIndex(originalSource, rangeIndex); + } + + function TagParser(options, title) { + this._options = options; + this._title = title.toLowerCase(); + this._tag = { + title: title, + description: null + }; + if (this._options.lineNumbers) { + this._tag.lineNumber = lineNumber; + } + this._first = index - title.length - 1; + this._last = 0; + // space to save special information for title parsers. + this._extra = { }; + } + + // addError(err, ...) + TagParser.prototype.addError = function addError(errorText) { + var args = Array.prototype.slice.call(arguments, 1), + msg = errorText.replace( + /%(\d)/g, + function (whole, index) { + utility.assert(index < args.length, 'Message reference must be in range'); + return args[index]; + } + ); + + if (!this._tag.errors) { + this._tag.errors = []; + } + if (strict) { + utility.throwError(msg); + } + this._tag.errors.push(msg); + return recoverable; + }; + + TagParser.prototype.parseType = function () { + // type required titles + if (isTypeParameterRequired(this._title)) { + try { + this._tag.type = parseType(this._title, this._last, this._options.range); + if (!this._tag.type) { + if (!isParamTitle(this._title) && !isReturnTitle(this._title)) { + if (!this.addError('Missing or invalid tag type')) { + return false; + } + } + } + } catch (error) { + this._tag.type = null; + if (!this.addError(error.message)) { + return false; + } + } + } else if (isAllowedType(this._title)) { + // optional types + try { + this._tag.type = parseType(this._title, this._last, this._options.range); + } catch (e) { + //For optional types, lets drop the thrown error when we hit the end of the file + } + } + return true; + }; + + TagParser.prototype._parseNamePath = function (optional) { + var name; + name = parseName(this._last, sloppy && isAllowedOptional(this._title), true); + if (!name) { + if (!optional) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + this._tag.name = name; + return true; + }; + + TagParser.prototype.parseNamePath = function () { + return this._parseNamePath(false); + }; + + TagParser.prototype.parseNamePathOptional = function () { + return this._parseNamePath(true); + }; + + + TagParser.prototype.parseName = function () { + var assign, name; + + // param, property requires name + if (isAllowedName(this._title)) { + this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title)); + if (!this._tag.name) { + if (!isNameParameterRequired(this._title)) { + return true; + } + + // it's possible the name has already been parsed but interpreted as a type + // it's also possible this is a sloppy declaration, in which case it will be + // fixed at the end + if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) { + this._extra.name = this._tag.type; + this._tag.name = this._tag.type.name; + this._tag.type = null; + } else { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } else { + name = this._tag.name; + if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') { + // extract the default value if there is one + // example: @param {string} [somebody=John Doe] description + assign = name.substring(1, name.length - 1).split('='); + if (assign.length > 1) { + this._tag['default'] = assign.slice(1).join('='); + } + this._tag.name = assign[0]; + + // convert to an optional type + if (this._tag.type && this._tag.type.type !== 'OptionalType') { + this._tag.type = { + type: 'OptionalType', + expression: this._tag.type + }; + } + } + } + } + + + return true; + }; + + TagParser.prototype.parseDescription = function parseDescription() { + var description = sliceSource(source, index, this._last).trim(); + if (description) { + if ((/^-\s+/).test(description)) { + description = description.substring(2); + } + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseCaption = function parseDescription() { + var description = sliceSource(source, index, this._last).trim(); + var captionStartTag = ''; + var captionEndTag = ''; + var captionStart = description.indexOf(captionStartTag); + var captionEnd = description.indexOf(captionEndTag); + if (captionStart >= 0 && captionEnd >= 0) { + this._tag.caption = description.substring( + captionStart + captionStartTag.length, captionEnd).trim(); + this._tag.description = description.substring(captionEnd + captionEndTag.length).trim(); + } else { + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseKind = function parseKind() { + var kind, kinds; + kinds = { + 'class': true, + 'constant': true, + 'event': true, + 'external': true, + 'file': true, + 'function': true, + 'member': true, + 'mixin': true, + 'module': true, + 'namespace': true, + 'typedef': true + }; + kind = sliceSource(source, index, this._last).trim(); + this._tag.kind = kind; + if (!hasOwnProperty(kinds, kind)) { + if (!this.addError('Invalid kind name \'%0\'', kind)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseAccess = function parseAccess() { + var access; + access = sliceSource(source, index, this._last).trim(); + this._tag.access = access; + if (access !== 'private' && access !== 'protected' && access !== 'public') { + if (!this.addError('Invalid access name \'%0\'', access)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseThis = function parseThis() { + // this name may be a name expression (e.g. {foo.bar}), + // an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar) + var value = sliceSource(source, index, this._last).trim(); + if (value && value.charAt(0) === '{') { + var gotType = this.parseType(); + if (gotType && this._tag.type.type === 'NameExpression' || this._tag.type.type === 'UnionType') { + this._tag.name = this._tag.type.name; + return true; + } else { + return this.addError('Invalid name for this'); + } + } else { + return this.parseNamePath(); + } + }; + + TagParser.prototype.parseVariation = function parseVariation() { + var variation, text; + text = sliceSource(source, index, this._last).trim(); + variation = parseFloat(text, 10); + this._tag.variation = variation; + if (isNaN(variation)) { + if (!this.addError('Invalid variation \'%0\'', text)) { + return false; + } + } + return true; + }; + + TagParser.prototype.ensureEnd = function () { + var shouldBeEmpty = sliceSource(source, index, this._last).trim(); + if (shouldBeEmpty) { + if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) { + return false; + } + } + return true; + }; + + TagParser.prototype.epilogue = function epilogue() { + var description; + + description = this._tag.description; + // un-fix potentially sloppy declaration + if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') { + this._tag.type = this._extra.name; + if (!this._tag.name) { + this._tag.name = undefined; + } + + if (!sloppy) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + + return true; + }; + + Rules = { + // http://usejsdoc.org/tags-access.html + 'access': ['parseAccess'], + // http://usejsdoc.org/tags-alias.html + 'alias': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-augments.html + 'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-constructor.html + 'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-constructor.html + 'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-extends.html + 'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-example.html + 'example': ['parseCaption'], + // http://usejsdoc.org/tags-deprecated.html + 'deprecated': ['parseDescription'], + // http://usejsdoc.org/tags-global.html + 'global': ['ensureEnd'], + // http://usejsdoc.org/tags-inner.html + 'inner': ['ensureEnd'], + // http://usejsdoc.org/tags-instance.html + 'instance': ['ensureEnd'], + // http://usejsdoc.org/tags-kind.html + 'kind': ['parseKind'], + // http://usejsdoc.org/tags-mixes.html + 'mixes': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-mixin.html + 'mixin': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-member.html + 'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-method.html + 'method': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-module.html + 'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'func': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'function': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-member.html + 'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-name.html + 'name': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-namespace.html + 'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-private.html + 'private': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-protected.html + 'protected': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-public.html + 'public': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-readonly.html + 'readonly': ['ensureEnd'], + // http://usejsdoc.org/tags-requires.html + 'requires': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-since.html + 'since': ['parseDescription'], + // http://usejsdoc.org/tags-static.html + 'static': ['ensureEnd'], + // http://usejsdoc.org/tags-summary.html + 'summary': ['parseDescription'], + // http://usejsdoc.org/tags-this.html + 'this': ['parseThis', 'ensureEnd'], + // http://usejsdoc.org/tags-todo.html + 'todo': ['parseDescription'], + // http://usejsdoc.org/tags-typedef.html + 'typedef': ['parseType', 'parseNamePathOptional'], + // http://usejsdoc.org/tags-variation.html + 'variation': ['parseVariation'], + // http://usejsdoc.org/tags-version.html + 'version': ['parseDescription'] + }; + + TagParser.prototype.parse = function parse() { + var i, iz, sequences, method; + + + // empty title + if (!this._title) { + if (!this.addError('Missing or invalid title')) { + return null; + } + } + + // Seek to content last index. + this._last = seekContent(this._title); + + if (this._options.range) { + this._tag.range = [this._first, source.slice(0, this._last).replace(/\s*$/, '').length].map(convertIndex); + } + + if (hasOwnProperty(Rules, this._title)) { + sequences = Rules[this._title]; + } else { + // default sequences + sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue']; + } + + for (i = 0, iz = sequences.length; i < iz; ++i) { + method = sequences[i]; + if (!this[method]()) { + return null; + } + } + + return this._tag; + }; + + function parseTag(options) { + var title, parser, tag; + + // skip to tag + if (!skipToTag()) { + return null; + } + + // scan title + title = scanTitle(); + + // construct tag parser + parser = new TagParser(options, title); + tag = parser.parse(); + + // Seek global index to end of this tag. + while (index < parser._last) { + advance(); + } + + return tag; + } + + // + // Parse JSDoc + // + + function scanJSDocDescription(preserveWhitespace) { + var description = '', ch, atAllowed; + + atAllowed = true; + while (index < length) { + ch = source.charCodeAt(index); + + if (atAllowed && ch === 0x40 /* '@' */) { + break; + } + + if (esutils.code.isLineTerminator(ch)) { + atAllowed = true; + } else if (atAllowed && !esutils.code.isWhiteSpace(ch)) { + atAllowed = false; + } + + description += advance(); + } + + return preserveWhitespace ? description : description.trim(); + } + + function parse(comment, options) { + var tags = [], tag, description, interestingTags, i, iz; + + if (options === undefined) { + options = {}; + } + + if (typeof options.unwrap === 'boolean' && options.unwrap) { + source = unwrapComment(comment); + } else { + source = comment; + } + + originalSource = comment; + + // array of relevant tags + if (options.tags) { + if (Array.isArray(options.tags)) { + interestingTags = { }; + for (i = 0, iz = options.tags.length; i < iz; i++) { + if (typeof options.tags[i] === 'string') { + interestingTags[options.tags[i]] = true; + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + + length = source.length; + index = 0; + lineNumber = 0; + recoverable = options.recoverable; + sloppy = options.sloppy; + strict = options.strict; + + description = scanJSDocDescription(options.preserveWhitespace); + + while (true) { + tag = parseTag(options); + if (!tag) { + break; + } + if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) { + tags.push(tag); + } + } + + return { + description: description, + tags: tags + }; + } + exports.parse = parse; + }(jsdoc = {})); + + exports.version = utility.VERSION; + exports.parse = jsdoc.parse; + exports.parseType = typed.parseType; + exports.parseParamType = typed.parseParamType; + exports.unwrapComment = unwrapComment; + exports.Syntax = shallowCopy(typed.Syntax); + exports.Error = utility.DoctrineError; + exports.type = { + Syntax: exports.Syntax, + parseType: typed.parseType, + parseParamType: typed.parseParamType, + stringify: typed.stringify + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js new file mode 100644 index 0000000..bdd3c39 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js @@ -0,0 +1,1305 @@ +/* + * @fileoverview Type expression parser. + * @author Yusuke Suzuki + * @author Dan Tao + * @author Andrew Eisenberg + */ + +// "typed", the Type Expression Parser for doctrine. + +(function () { + 'use strict'; + + var Syntax, + Token, + source, + length, + index, + previous, + token, + value, + esutils, + utility, + rangeOffset, + addRange; + + esutils = require('esutils'); + utility = require('./utility'); + + Syntax = { + NullableLiteral: 'NullableLiteral', + AllLiteral: 'AllLiteral', + NullLiteral: 'NullLiteral', + UndefinedLiteral: 'UndefinedLiteral', + VoidLiteral: 'VoidLiteral', + UnionType: 'UnionType', + ArrayType: 'ArrayType', + RecordType: 'RecordType', + FieldType: 'FieldType', + FunctionType: 'FunctionType', + ParameterType: 'ParameterType', + RestType: 'RestType', + NonNullableType: 'NonNullableType', + OptionalType: 'OptionalType', + NullableType: 'NullableType', + NameExpression: 'NameExpression', + TypeApplication: 'TypeApplication', + StringLiteralType: 'StringLiteralType', + NumericLiteralType: 'NumericLiteralType', + BooleanLiteralType: 'BooleanLiteralType' + }; + + Token = { + ILLEGAL: 0, // ILLEGAL + DOT_LT: 1, // .< + REST: 2, // ... + LT: 3, // < + GT: 4, // > + LPAREN: 5, // ( + RPAREN: 6, // ) + LBRACE: 7, // { + RBRACE: 8, // } + LBRACK: 9, // [ + RBRACK: 10, // ] + COMMA: 11, // , + COLON: 12, // : + STAR: 13, // * + PIPE: 14, // | + QUESTION: 15, // ? + BANG: 16, // ! + EQUAL: 17, // = + NAME: 18, // name token + STRING: 19, // string + NUMBER: 20, // number + EOF: 21 + }; + + function isTypeName(ch) { + return '><(){}[],:*|?!='.indexOf(String.fromCharCode(ch)) === -1 && !esutils.code.isWhiteSpace(ch) && !esutils.code.isLineTerminator(ch); + } + + function Context(previous, index, token, value) { + this._previous = previous; + this._index = index; + this._token = token; + this._value = value; + } + + Context.prototype.restore = function () { + previous = this._previous; + index = this._index; + token = this._token; + value = this._value; + }; + + Context.save = function () { + return new Context(previous, index, token, value); + }; + + function maybeAddRange(node, range) { + if (addRange) { + node.range = [range[0] + rangeOffset, range[1] + rangeOffset]; + } + return node; + } + + function advance() { + var ch = source.charAt(index); + index += 1; + return ch; + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && esutils.code.isHexDigit(source.charCodeAt(index))) { + ch = advance(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanString() { + var str = '', quote, ch, code, unescaped, restore; //TODO review removal octal = false + quote = source.charAt(index); + ++index; + + while (index < length) { + ch = advance(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = advance(); + if (!esutils.code.isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (esutils.code.isOctalDigit(ch.charCodeAt(0))) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + // Deprecating unused code. TODO review removal + //if (code !== 0) { + // octal = true; + //} + + if (index < length && esutils.code.isOctalDigit(source.charCodeAt(index))) { + //TODO Review Removal octal = true; + code = code * 8 + '01234567'.indexOf(advance()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + esutils.code.isOctalDigit(source.charCodeAt(index))) { + code = code * 8 + '01234567'.indexOf(advance()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + if (ch === '\r' && source.charCodeAt(index) === 0x0A /* '\n' */) { + ++index; + } + } + } else if (esutils.code.isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + utility.throwError('unexpected quote'); + } + + value = str; + return Token.STRING; + } + + function scanNumber() { + var number, ch; + + number = ''; + ch = source.charCodeAt(index); + + if (ch !== 0x2E /* '.' */) { + number = advance(); + ch = source.charCodeAt(index); + + if (number === '0') { + if (ch === 0x78 /* 'x' */ || ch === 0x58 /* 'X' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isHexDigit(ch)) { + break; + } + number += advance(); + } + + if (number.length <= 2) { + // only 0x + utility.throwError('unexpected token'); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 16); + return Token.NUMBER; + } + + if (esutils.code.isOctalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isOctalDigit(ch)) { + break; + } + number += advance(); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch) || esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 8); + return Token.NUMBER; + } + + if (esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x2E /* '.' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x65 /* 'e' */ || ch === 0x45 /* 'E' */) { + number += advance(); + + ch = source.charCodeAt(index); + if (ch === 0x2B /* '+' */ || ch === 0x2D /* '-' */) { + number += advance(); + } + + ch = source.charCodeAt(index); + if (esutils.code.isDecimalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } else { + utility.throwError('unexpected token'); + } + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStartES5(ch)) { + utility.throwError('unexpected token'); + } + } + + value = parseFloat(number); + return Token.NUMBER; + } + + + function scanTypeName() { + var ch, ch2; + + value = advance(); + while (index < length && isTypeName(source.charCodeAt(index))) { + ch = source.charCodeAt(index); + if (ch === 0x2E /* '.' */) { + if ((index + 1) >= length) { + return Token.ILLEGAL; + } + ch2 = source.charCodeAt(index + 1); + if (ch2 === 0x3C /* '<' */) { + break; + } + } + value += advance(); + } + return Token.NAME; + } + + function next() { + var ch; + + previous = index; + + while (index < length && esutils.code.isWhiteSpace(source.charCodeAt(index))) { + advance(); + } + if (index >= length) { + token = Token.EOF; + return token; + } + + ch = source.charCodeAt(index); + switch (ch) { + case 0x27: /* ''' */ + case 0x22: /* '"' */ + token = scanString(); + return token; + + case 0x3A: /* ':' */ + advance(); + token = Token.COLON; + return token; + + case 0x2C: /* ',' */ + advance(); + token = Token.COMMA; + return token; + + case 0x28: /* '(' */ + advance(); + token = Token.LPAREN; + return token; + + case 0x29: /* ')' */ + advance(); + token = Token.RPAREN; + return token; + + case 0x5B: /* '[' */ + advance(); + token = Token.LBRACK; + return token; + + case 0x5D: /* ']' */ + advance(); + token = Token.RBRACK; + return token; + + case 0x7B: /* '{' */ + advance(); + token = Token.LBRACE; + return token; + + case 0x7D: /* '}' */ + advance(); + token = Token.RBRACE; + return token; + + case 0x2E: /* '.' */ + if (index + 1 < length) { + ch = source.charCodeAt(index + 1); + if (ch === 0x3C /* '<' */) { + advance(); // '.' + advance(); // '<' + token = Token.DOT_LT; + return token; + } + + if (ch === 0x2E /* '.' */ && index + 2 < length && source.charCodeAt(index + 2) === 0x2E /* '.' */) { + advance(); // '.' + advance(); // '.' + advance(); // '.' + token = Token.REST; + return token; + } + + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + } + token = Token.ILLEGAL; + return token; + + case 0x3C: /* '<' */ + advance(); + token = Token.LT; + return token; + + case 0x3E: /* '>' */ + advance(); + token = Token.GT; + return token; + + case 0x2A: /* '*' */ + advance(); + token = Token.STAR; + return token; + + case 0x7C: /* '|' */ + advance(); + token = Token.PIPE; + return token; + + case 0x3F: /* '?' */ + advance(); + token = Token.QUESTION; + return token; + + case 0x21: /* '!' */ + advance(); + token = Token.BANG; + return token; + + case 0x3D: /* '=' */ + advance(); + token = Token.EQUAL; + return token; + + case 0x2D: /* '-' */ + token = scanNumber(); + return token; + + default: + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + + // type string permits following case, + // + // namespace.module.MyClass + // + // this reduced 1 token TK_NAME + utility.assert(isTypeName(ch)); + token = scanTypeName(); + return token; + } + } + + function consume(target, text) { + utility.assert(token === target, text || 'consumed token not matched'); + next(); + } + + function expect(target, message) { + if (token !== target) { + utility.throwError(message || 'unexpected token'); + } + next(); + } + + // UnionType := '(' TypeUnionList ')' + // + // TypeUnionList := + // <> + // | NonemptyTypeUnionList + // + // NonemptyTypeUnionList := + // TypeExpression + // | TypeExpression '|' NonemptyTypeUnionList + function parseUnionType() { + var elements, startIndex = index - 1; + consume(Token.LPAREN, 'UnionType should start with ('); + elements = []; + if (token !== Token.RPAREN) { + while (true) { + elements.push(parseTypeExpression()); + if (token === Token.RPAREN) { + break; + } + expect(Token.PIPE); + } + } + consume(Token.RPAREN, 'UnionType should end with )'); + return maybeAddRange({ + type: Syntax.UnionType, + elements: elements + }, [startIndex, previous]); + } + + // ArrayType := '[' ElementTypeList ']' + // + // ElementTypeList := + // <> + // | TypeExpression + // | '...' TypeExpression + // | TypeExpression ',' ElementTypeList + function parseArrayType() { + var elements, startIndex = index - 1, restStartIndex; + consume(Token.LBRACK, 'ArrayType should start with ['); + elements = []; + while (token !== Token.RBRACK) { + if (token === Token.REST) { + restStartIndex = index - 3; + consume(Token.REST); + elements.push(maybeAddRange({ + type: Syntax.RestType, + expression: parseTypeExpression() + }, [restStartIndex, previous])); + break; + } else { + elements.push(parseTypeExpression()); + } + if (token !== Token.RBRACK) { + expect(Token.COMMA); + } + } + expect(Token.RBRACK); + return maybeAddRange({ + type: Syntax.ArrayType, + elements: elements + }, [startIndex, previous]); + } + + function parseFieldName() { + var v = value; + if (token === Token.NAME || token === Token.STRING) { + next(); + return v; + } + + if (token === Token.NUMBER) { + consume(Token.NUMBER); + return String(v); + } + + utility.throwError('unexpected token'); + } + + // FieldType := + // FieldName + // | FieldName ':' TypeExpression + // + // FieldName := + // NameExpression + // | StringLiteral + // | NumberLiteral + // | ReservedIdentifier + function parseFieldType() { + var key, rangeStart = previous; + + key = parseFieldName(); + if (token === Token.COLON) { + consume(Token.COLON); + return maybeAddRange({ + type: Syntax.FieldType, + key: key, + value: parseTypeExpression() + }, [rangeStart, previous]); + } + return maybeAddRange({ + type: Syntax.FieldType, + key: key, + value: null + }, [rangeStart, previous]); + } + + // RecordType := '{' FieldTypeList '}' + // + // FieldTypeList := + // <> + // | FieldType + // | FieldType ',' FieldTypeList + function parseRecordType() { + var fields, rangeStart = index - 1, rangeEnd; + + consume(Token.LBRACE, 'RecordType should start with {'); + fields = []; + if (token === Token.COMMA) { + consume(Token.COMMA); + } else { + while (token !== Token.RBRACE) { + fields.push(parseFieldType()); + if (token !== Token.RBRACE) { + expect(Token.COMMA); + } + } + } + rangeEnd = index; + expect(Token.RBRACE); + return maybeAddRange({ + type: Syntax.RecordType, + fields: fields + }, [rangeStart, rangeEnd]); + } + + // NameExpression := + // Identifier + // | TagIdentifier ':' Identifier + // + // Tag identifier is one of "module", "external" or "event" + // Identifier is the same as Token.NAME, including any dots, something like + // namespace.module.MyClass + function parseNameExpression() { + var name = value, rangeStart = index - name.length; + expect(Token.NAME); + + if (token === Token.COLON && ( + name === 'module' || + name === 'external' || + name === 'event')) { + consume(Token.COLON); + name += ':' + value; + expect(Token.NAME); + } + + return maybeAddRange({ + type: Syntax.NameExpression, + name: name + }, [rangeStart, previous]); + } + + // TypeExpressionList := + // TopLevelTypeExpression + // | TopLevelTypeExpression ',' TypeExpressionList + function parseTypeExpressionList() { + var elements = []; + + elements.push(parseTop()); + while (token === Token.COMMA) { + consume(Token.COMMA); + elements.push(parseTop()); + } + return elements; + } + + // TypeName := + // NameExpression + // | NameExpression TypeApplication + // + // TypeApplication := + // '.<' TypeExpressionList '>' + // | '<' TypeExpressionList '>' // this is extension of doctrine + function parseTypeName() { + var expr, applications, startIndex = index - value.length; + + expr = parseNameExpression(); + if (token === Token.DOT_LT || token === Token.LT) { + next(); + applications = parseTypeExpressionList(); + expect(Token.GT); + return maybeAddRange({ + type: Syntax.TypeApplication, + expression: expr, + applications: applications + }, [startIndex, previous]); + } + return expr; + } + + // ResultType := + // <> + // | ':' void + // | ':' TypeExpression + // + // BNF is above + // but, we remove <> pattern, so token is always TypeToken::COLON + function parseResultType() { + consume(Token.COLON, 'ResultType should start with :'); + if (token === Token.NAME && value === 'void') { + consume(Token.NAME); + return { + type: Syntax.VoidLiteral + }; + } + return parseTypeExpression(); + } + + // ParametersType := + // RestParameterType + // | NonRestParametersType + // | NonRestParametersType ',' RestParameterType + // + // RestParameterType := + // '...' + // '...' Identifier + // + // NonRestParametersType := + // ParameterType ',' NonRestParametersType + // | ParameterType + // | OptionalParametersType + // + // OptionalParametersType := + // OptionalParameterType + // | OptionalParameterType, OptionalParametersType + // + // OptionalParameterType := ParameterType= + // + // ParameterType := TypeExpression | Identifier ':' TypeExpression + // + // Identifier is "new" or "this" + function parseParametersType() { + var params = [], optionalSequence = false, expr, rest = false, startIndex, restStartIndex = index - 3, nameStartIndex; + + while (token !== Token.RPAREN) { + if (token === Token.REST) { + // RestParameterType + consume(Token.REST); + rest = true; + } + + startIndex = previous; + + expr = parseTypeExpression(); + if (expr.type === Syntax.NameExpression && token === Token.COLON) { + nameStartIndex = previous - expr.name.length; + // Identifier ':' TypeExpression + consume(Token.COLON); + expr = maybeAddRange({ + type: Syntax.ParameterType, + name: expr.name, + expression: parseTypeExpression() + }, [nameStartIndex, previous]); + } + if (token === Token.EQUAL) { + consume(Token.EQUAL); + expr = maybeAddRange({ + type: Syntax.OptionalType, + expression: expr + }, [startIndex, previous]); + optionalSequence = true; + } else { + if (optionalSequence) { + utility.throwError('unexpected token'); + } + } + if (rest) { + expr = maybeAddRange({ + type: Syntax.RestType, + expression: expr + }, [restStartIndex, previous]); + } + params.push(expr); + if (token !== Token.RPAREN) { + expect(Token.COMMA); + } + } + return params; + } + + // FunctionType := 'function' FunctionSignatureType + // + // FunctionSignatureType := + // | TypeParameters '(' ')' ResultType + // | TypeParameters '(' ParametersType ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ',' ParametersType ')' ResultType + function parseFunctionType() { + var isNew, thisBinding, params, result, fnType, startIndex = index - value.length; + utility.assert(token === Token.NAME && value === 'function', 'FunctionType should start with \'function\''); + consume(Token.NAME); + + // Google Closure Compiler is not implementing TypeParameters. + // So we do not. if we don't get '(', we see it as error. + expect(Token.LPAREN); + + isNew = false; + params = []; + thisBinding = null; + if (token !== Token.RPAREN) { + // ParametersType or 'this' + if (token === Token.NAME && + (value === 'this' || value === 'new')) { + // 'this' or 'new' + // 'new' is Closure Compiler extension + isNew = value === 'new'; + consume(Token.NAME); + expect(Token.COLON); + thisBinding = parseTypeName(); + if (token === Token.COMMA) { + consume(Token.COMMA); + params = parseParametersType(); + } + } else { + params = parseParametersType(); + } + } + + expect(Token.RPAREN); + + result = null; + if (token === Token.COLON) { + result = parseResultType(); + } + + fnType = maybeAddRange({ + type: Syntax.FunctionType, + params: params, + result: result + }, [startIndex, previous]); + if (thisBinding) { + // avoid adding null 'new' and 'this' properties + fnType['this'] = thisBinding; + if (isNew) { + fnType['new'] = true; + } + } + return fnType; + } + + // BasicTypeExpression := + // '*' + // | 'null' + // | 'undefined' + // | TypeName + // | FunctionType + // | UnionType + // | RecordType + // | ArrayType + function parseBasicTypeExpression() { + var context, startIndex; + switch (token) { + case Token.STAR: + consume(Token.STAR); + return maybeAddRange({ + type: Syntax.AllLiteral + }, [previous - 1, previous]); + + case Token.LPAREN: + return parseUnionType(); + + case Token.LBRACK: + return parseArrayType(); + + case Token.LBRACE: + return parseRecordType(); + + case Token.NAME: + startIndex = index - value.length; + + if (value === 'null') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.NullLiteral + }, [startIndex, previous]); + } + + if (value === 'undefined') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.UndefinedLiteral + }, [startIndex, previous]); + } + + if (value === 'true' || value === 'false') { + consume(Token.NAME); + return maybeAddRange({ + type: Syntax.BooleanLiteralType, + value: value === 'true' + }, [startIndex, previous]); + } + + context = Context.save(); + if (value === 'function') { + try { + return parseFunctionType(); + } catch (e) { + context.restore(); + } + } + + return parseTypeName(); + + case Token.STRING: + next(); + return maybeAddRange({ + type: Syntax.StringLiteralType, + value: value + }, [previous - value.length - 2, previous]); + + case Token.NUMBER: + next(); + return maybeAddRange({ + type: Syntax.NumericLiteralType, + value: value + }, [previous - String(value).length, previous]); + + default: + utility.throwError('unexpected token'); + } + } + + // TypeExpression := + // BasicTypeExpression + // | '?' BasicTypeExpression + // | '!' BasicTypeExpression + // | BasicTypeExpression '?' + // | BasicTypeExpression '!' + // | '?' + // | BasicTypeExpression '[]' + function parseTypeExpression() { + var expr, rangeStart; + + if (token === Token.QUESTION) { + rangeStart = index - 1; + consume(Token.QUESTION); + if (token === Token.COMMA || token === Token.EQUAL || token === Token.RBRACE || + token === Token.RPAREN || token === Token.PIPE || token === Token.EOF || + token === Token.RBRACK || token === Token.GT) { + return maybeAddRange({ + type: Syntax.NullableLiteral + }, [rangeStart, previous]); + } + return maybeAddRange({ + type: Syntax.NullableType, + expression: parseBasicTypeExpression(), + prefix: true + }, [rangeStart, previous]); + } else if (token === Token.BANG) { + rangeStart = index - 1; + consume(Token.BANG); + return maybeAddRange({ + type: Syntax.NonNullableType, + expression: parseBasicTypeExpression(), + prefix: true + }, [rangeStart, previous]); + } else { + rangeStart = previous; + } + + expr = parseBasicTypeExpression(); + if (token === Token.BANG) { + consume(Token.BANG); + return maybeAddRange({ + type: Syntax.NonNullableType, + expression: expr, + prefix: false + }, [rangeStart, previous]); + } + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + return maybeAddRange({ + type: Syntax.NullableType, + expression: expr, + prefix: false + }, [rangeStart, previous]); + } + + if (token === Token.LBRACK) { + consume(Token.LBRACK); + expect(Token.RBRACK, 'expected an array-style type declaration (' + value + '[])'); + return maybeAddRange({ + type: Syntax.TypeApplication, + expression: maybeAddRange({ + type: Syntax.NameExpression, + name: 'Array' + }, [rangeStart, previous]), + applications: [expr] + }, [rangeStart, previous]); + } + + return expr; + } + + // TopLevelTypeExpression := + // TypeExpression + // | TypeUnionList + // + // This rule is Google Closure Compiler extension, not ES4 + // like, + // { number | string } + // If strict to ES4, we should write it as + // { (number|string) } + function parseTop() { + var expr, elements; + + expr = parseTypeExpression(); + if (token !== Token.PIPE) { + return expr; + } + + elements = [expr]; + consume(Token.PIPE); + while (true) { + elements.push(parseTypeExpression()); + if (token !== Token.PIPE) { + break; + } + consume(Token.PIPE); + } + + return maybeAddRange({ + type: Syntax.UnionType, + elements: elements + }, [0, index]); + } + + function parseTopParamType() { + var expr; + + if (token === Token.REST) { + consume(Token.REST); + return maybeAddRange({ + type: Syntax.RestType, + expression: parseTop() + }, [0, index]); + } + + expr = parseTop(); + if (token === Token.EQUAL) { + consume(Token.EQUAL); + return maybeAddRange({ + type: Syntax.OptionalType, + expression: expr + }, [0, index]); + } + + return expr; + } + + function parseType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + addRange = opt && opt.range; + rangeOffset = opt && opt.startIndex || 0; + + next(); + expr = parseTop(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function parseParamType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + addRange = opt && opt.range; + rangeOffset = opt && opt.startIndex || 0; + + next(); + expr = parseTopParamType(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function stringifyImpl(node, compact, topLevel) { + var result, i, iz; + + switch (node.type) { + case Syntax.NullableLiteral: + result = '?'; + break; + + case Syntax.AllLiteral: + result = '*'; + break; + + case Syntax.NullLiteral: + result = 'null'; + break; + + case Syntax.UndefinedLiteral: + result = 'undefined'; + break; + + case Syntax.VoidLiteral: + result = 'void'; + break; + + case Syntax.UnionType: + if (!topLevel) { + result = '('; + } else { + result = ''; + } + + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? '|' : ' | '; + } + } + + if (!topLevel) { + result += ')'; + } + break; + + case Syntax.ArrayType: + result = '['; + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += ']'; + break; + + case Syntax.RecordType: + result = '{'; + for (i = 0, iz = node.fields.length; i < iz; ++i) { + result += stringifyImpl(node.fields[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '}'; + break; + + case Syntax.FieldType: + if (node.value) { + result = node.key + (compact ? ':' : ': ') + stringifyImpl(node.value, compact); + } else { + result = node.key; + } + break; + + case Syntax.FunctionType: + result = compact ? 'function(' : 'function ('; + + if (node['this']) { + if (node['new']) { + result += (compact ? 'new:' : 'new: '); + } else { + result += (compact ? 'this:' : 'this: '); + } + + result += stringifyImpl(node['this'], compact); + + if (node.params.length !== 0) { + result += compact ? ',' : ', '; + } + } + + for (i = 0, iz = node.params.length; i < iz; ++i) { + result += stringifyImpl(node.params[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + + result += ')'; + + if (node.result) { + result += (compact ? ':' : ': ') + stringifyImpl(node.result, compact); + } + break; + + case Syntax.ParameterType: + result = node.name + (compact ? ':' : ': ') + stringifyImpl(node.expression, compact); + break; + + case Syntax.RestType: + result = '...'; + if (node.expression) { + result += stringifyImpl(node.expression, compact); + } + break; + + case Syntax.NonNullableType: + if (node.prefix) { + result = '!' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '!'; + } + break; + + case Syntax.OptionalType: + result = stringifyImpl(node.expression, compact) + '='; + break; + + case Syntax.NullableType: + if (node.prefix) { + result = '?' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '?'; + } + break; + + case Syntax.NameExpression: + result = node.name; + break; + + case Syntax.TypeApplication: + result = stringifyImpl(node.expression, compact) + '.<'; + for (i = 0, iz = node.applications.length; i < iz; ++i) { + result += stringifyImpl(node.applications[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '>'; + break; + + case Syntax.StringLiteralType: + result = '"' + node.value + '"'; + break; + + case Syntax.NumericLiteralType: + result = String(node.value); + break; + + case Syntax.BooleanLiteralType: + result = String(node.value); + break; + + default: + utility.throwError('Unknown type ' + node.type); + } + + return result; + } + + function stringify(node, options) { + if (options == null) { + options = {}; + } + return stringifyImpl(node, options.compact, options.topLevel); + } + + exports.parseType = parseType; + exports.parseParamType = parseParamType; + exports.stringify = stringify; + exports.Syntax = Syntax; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js new file mode 100644 index 0000000..381580e --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js @@ -0,0 +1,35 @@ +/* + * @fileoverview Utilities for Doctrine + * @author Yusuke Suzuki + */ + + +(function () { + 'use strict'; + + var VERSION; + + VERSION = require('../package.json').version; + exports.VERSION = VERSION; + + function DoctrineError(message) { + this.name = 'DoctrineError'; + this.message = message; + } + DoctrineError.prototype = (function () { + var Middle = function () { }; + Middle.prototype = Error.prototype; + return new Middle(); + }()); + DoctrineError.prototype.constructor = DoctrineError; + exports.DoctrineError = DoctrineError; + + function throwError(message) { + throw new DoctrineError(message); + } + exports.throwError = throwError; + + exports.assert = require('assert'); +}()); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-plugin-import/node_modules/doctrine/package.json b/node_modules/eslint-plugin-import/node_modules/doctrine/package.json new file mode 100644 index 0000000..92667d3 --- /dev/null +++ b/node_modules/eslint-plugin-import/node_modules/doctrine/package.json @@ -0,0 +1,57 @@ +{ + "name": "doctrine", + "description": "JSDoc parser", + "homepage": "https://github.com/eslint/doctrine", + "main": "lib/doctrine.js", + "version": "2.1.0", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "lib" + ], + "maintainers": [ + { + "name": "Nicholas C. Zakas", + "email": "nicholas+npm@nczconsulting.com", + "web": "https://www.nczonline.net" + }, + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "https://github.com/Constellation" + } + ], + "repository": "eslint/doctrine", + "devDependencies": { + "coveralls": "^2.11.2", + "dateformat": "^1.0.11", + "eslint": "^1.10.3", + "eslint-release": "^0.10.0", + "linefix": "^0.1.1", + "mocha": "^3.4.2", + "npm-license": "^0.3.1", + "nyc": "^10.3.2", + "semver": "^5.0.3", + "shelljs": "^0.5.3", + "shelljs-nodecli": "^0.1.1", + "should": "^5.0.1" + }, + "license": "Apache-2.0", + "scripts": { + "pretest": "npm run lint", + "test": "nyc mocha", + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "lint": "eslint lib/", + "release": "eslint-release", + "ci-release": "eslint-ci-release", + "alpharelease": "eslint-prerelease alpha", + "betarelease": "eslint-prerelease beta" + }, + "dependencies": { + "esutils": "^2.0.2" + } +} diff --git a/node_modules/eslint-plugin-import/package.json b/node_modules/eslint-plugin-import/package.json new file mode 100644 index 0000000..fcfa9b1 --- /dev/null +++ b/node_modules/eslint-plugin-import/package.json @@ -0,0 +1,116 @@ +{ + "name": "eslint-plugin-import", + "version": "2.26.0", + "description": "Import with sanity.", + "engines": { + "node": ">=4" + }, + "main": "lib/index.js", + "directories": { + "test": "tests" + }, + "files": [ + "*.md", + "LICENSE", + "docs", + "lib", + "config", + "memo-parser/{*.js,LICENSE,*.md}" + ], + "scripts": { + "prebuild": "rimraf lib", + "build": "babel --quiet --out-dir lib src", + "postbuild": "npm run copy-metafiles", + "copy-metafiles": "node --require babel-register ./scripts/copyMetafiles", + "watch": "npm run tests-only -- -- --watch", + "pretest": "linklocal", + "posttest": "eslint .", + "mocha": "cross-env BABEL_ENV=test nyc mocha", + "tests-only": "npm run mocha tests/src", + "test": "npm run tests-only", + "test-compiled": "npm run prepublish && BABEL_ENV=testCompiled mocha --compilers js:babel-register tests/src", + "test-all": "node --require babel-register ./scripts/testAll", + "prepublishOnly": "safe-publish-latest && npm run build", + "prepublish": "not-in-publish || npm run prepublishOnly" + }, + "repository": { + "type": "git", + "url": "https://github.com/import-js/eslint-plugin-import" + }, + "keywords": [ + "eslint", + "eslintplugin", + "es6", + "jsnext", + "modules", + "import", + "export" + ], + "author": "Ben Mosher ", + "license": "MIT", + "bugs": { + "url": "https://github.com/import-js/eslint-plugin-import/issues" + }, + "homepage": "https://github.com/import-js/eslint-plugin-import", + "devDependencies": { + "@angular-eslint/template-parser": "^13.1.0", + "@eslint/import-test-order-redirect-scoped": "file:./tests/files/order-redirect-scoped", + "@test-scope/some-module": "file:./tests/files/symlinked-module", + "@typescript-eslint/parser": "^2.23.0 || ^3.3.0 || ^4.29.3 || ^5.10.0", + "array.prototype.flatmap": "^1.2.5", + "babel-cli": "^6.26.0", + "babel-core": "^6.26.3", + "babel-eslint": "=8.0.3 || ^8.2.6", + "babel-plugin-istanbul": "^4.1.6", + "babel-plugin-module-resolver": "^2.7.1", + "babel-preset-airbnb": "^2.6.0", + "babel-preset-flow": "^6.23.0", + "babel-register": "^6.26.0", + "babylon": "^6.18.0", + "chai": "^4.3.6", + "cross-env": "^4.0.0", + "escope": "^3.6.0", + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8", + "eslint-import-resolver-node": "file:./resolvers/node", + "eslint-import-resolver-typescript": "^1.0.2 || ^1.1.1", + "eslint-import-resolver-webpack": "file:./resolvers/webpack", + "eslint-import-test-order-redirect": "file:./tests/files/order-redirect", + "eslint-module-utils": "file:./utils", + "eslint-plugin-eslint-plugin": "^2.3.0", + "eslint-plugin-import": "2.x", + "eslint-plugin-json": "^2.1.2", + "fs-copy-file-sync": "^1.1.1", + "glob": "^7.2.0", + "in-publish": "^2.0.1", + "linklocal": "^2.8.2", + "lodash.isarray": "^4.0.0", + "mocha": "^3.5.3", + "npm-which": "^3.0.1", + "nyc": "^11.9.0", + "redux": "^3.7.2", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "sinon": "^2.4.1", + "typescript": "^2.8.1 || ~3.9.5", + "typescript-eslint-parser": "^15 || ^20 || ^22" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + }, + "dependencies": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" + } +} diff --git a/node_modules/eslint-plugin-n/LICENSE b/node_modules/eslint-plugin-n/LICENSE new file mode 100644 index 0000000..c39e694 --- /dev/null +++ b/node_modules/eslint-plugin-n/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Toru Nagashima + +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/eslint-plugin-n/README.md b/node_modules/eslint-plugin-n/README.md new file mode 100644 index 0000000..260e3d7 --- /dev/null +++ b/node_modules/eslint-plugin-n/README.md @@ -0,0 +1,182 @@ +# eslint-plugin-n + +> forked from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node) v11.1.0. as the original repository seems [no longer maintained](https://github.com/mysticatea/eslint-plugin-node/issues/300). + +[![npm version](https://img.shields.io/npm/v/eslint-plugin-n.svg)](https://www.npmjs.com/package/eslint-plugin-n) [![Downloads/month](https://img.shields.io/npm/dm/eslint-plugin-n.svg)](http://www.npmtrends.com/eslint-plugin-n) [![Build Status](https://github.com/weiran-zsd/eslint-plugin-node/workflows/CI/badge.svg)](https://github.com/weiran-zsd/eslint-plugin-node/actions) [![Coverage Status](https://codecov.io/gh/weiran-zsd/eslint-plugin-node/branch/master/graph/badge.svg)](https://codecov.io/gh/weiran-zsd/eslint-plugin-node) [![Dependency Status](https://david-dm.org/weiran-zsd/eslint-plugin-node.svg)](https://david-dm.org/weiran-zsd/eslint-plugin-node) + +Additional ESLint's rules for Node.js + +## 💿 Install & Usage + +``` +$ npm install --save-dev eslint eslint-plugin-n +``` + +- Requires Node.js `>=12.22.0` +- Requires ESLint `>=7.0.0` + +**Note:** It recommends a use of [the "engines" field of package.json](https://docs.npmjs.com/files/package.json#engines). The "engines" field is used by `n/no-unsupported-features/*` rules. + +**.eslintrc.json** (An example) + +```jsonc +{ + "extends": ["eslint:recommended", "plugin:n/recommended"], + "parserOptions": { + // Only ESLint 6.2.0 and later support ES2020. + "ecmaVersion": 2020 + }, + "rules": { + "n/exports-style": ["error", "module.exports"], + "n/file-extension-in-import": ["error", "always"], + "n/prefer-global/buffer": ["error", "always"], + "n/prefer-global/console": ["error", "always"], + "n/prefer-global/process": ["error", "always"], + "n/prefer-global/url-search-params": ["error", "always"], + "n/prefer-global/url": ["error", "always"], + "n/prefer-promises/dns": "error", + "n/prefer-promises/fs": "error" + } +} +``` + +**package.json** (An example) + +```json +{ + "name": "your-module", + "version": "1.0.0", + "type": "commonjs", + "engines": { + "node": ">=8.10.0" + } +} +``` + +## 📖 Rules + +- ⭐️ - the mark of recommended rules. +- ✒️ - the mark of fixable rules. + + +### Possible Errors + +| Rule ID | Description | | +|:--------|:------------|:--:| +| [n/handle-callback-err](./docs/rules/handle-callback-err.md) | require error handling in callbacks | | +| [n/no-callback-literal](./docs/rules/no-callback-literal.md) | ensure Node.js-style error-first callback pattern is followed | | +| [n/no-exports-assign](./docs/rules/no-exports-assign.md) | disallow the assignment to `exports` | ⭐️ | +| [n/no-extraneous-import](./docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules | ⭐️ | +| [n/no-extraneous-require](./docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules | ⭐️ | +| [n/no-missing-import](./docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules | ⭐️ | +| [n/no-missing-require](./docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules | ⭐️ | +| [n/no-new-require](./docs/rules/no-new-require.md) | disallow `new` operators with calls to `require` | | +| [n/no-path-concat](./docs/rules/no-path-concat.md) | disallow string concatenation with `__dirname` and `__filename` | | +| [n/no-process-exit](./docs/rules/no-process-exit.md) | disallow the use of `process.exit()` | | +| [n/no-unpublished-bin](./docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores | ⭐️ | +| [n/no-unpublished-import](./docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules | ⭐️ | +| [n/no-unpublished-require](./docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules | ⭐️ | +| [n/no-unsupported-features/es-builtins](./docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version | ⭐️ | +| [n/no-unsupported-features/es-syntax](./docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version | ⭐️ | +| [n/no-unsupported-features/node-builtins](./docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version | ⭐️ | +| [n/process-exit-as-throw](./docs/rules/process-exit-as-throw.md) | make `process.exit()` expressions the same code path as `throw` | ⭐️ | +| [n/shebang](./docs/rules/shebang.md) | suggest correct usage of shebang | ⭐️✒️ | + +### Best Practices + +| Rule ID | Description | | +|:--------|:------------|:--:| +| [n/no-deprecated-api](./docs/rules/no-deprecated-api.md) | disallow deprecated APIs | ⭐️ | + +### Stylistic Issues + +| Rule ID | Description | | +|:--------|:------------|:--:| +| [n/callback-return](./docs/rules/callback-return.md) | require `return` statements after callbacks | | +| [n/exports-style](./docs/rules/exports-style.md) | enforce either `module.exports` or `exports` | ✒️ | +| [n/file-extension-in-import](./docs/rules/file-extension-in-import.md) | enforce the style of file extensions in `import` declarations | ✒️ | +| [n/global-require](./docs/rules/global-require.md) | require `require()` calls to be placed at top-level module scope | | +| [n/no-mixed-requires](./docs/rules/no-mixed-requires.md) | disallow `require` calls to be mixed with regular variable declarations | | +| [n/no-process-env](./docs/rules/no-process-env.md) | disallow the use of `process.env` | | +| [n/no-restricted-import](./docs/rules/no-restricted-import.md) | disallow specified modules when loaded by `import` declarations | | +| [n/no-restricted-require](./docs/rules/no-restricted-require.md) | disallow specified modules when loaded by `require` | | +| [n/no-sync](./docs/rules/no-sync.md) | disallow synchronous methods | | +| [n/prefer-global/buffer](./docs/rules/prefer-global/buffer.md) | enforce either `Buffer` or `require("buffer").Buffer` | | +| [n/prefer-global/console](./docs/rules/prefer-global/console.md) | enforce either `console` or `require("console")` | | +| [n/prefer-global/process](./docs/rules/prefer-global/process.md) | enforce either `process` or `require("process")` | | +| [n/prefer-global/text-decoder](./docs/rules/prefer-global/text-decoder.md) | enforce either `TextDecoder` or `require("util").TextDecoder` | | +| [n/prefer-global/text-encoder](./docs/rules/prefer-global/text-encoder.md) | enforce either `TextEncoder` or `require("util").TextEncoder` | | +| [n/prefer-global/url-search-params](./docs/rules/prefer-global/url-search-params.md) | enforce either `URLSearchParams` or `require("url").URLSearchParams` | | +| [n/prefer-global/url](./docs/rules/prefer-global/url.md) | enforce either `URL` or `require("url").URL` | | +| [n/prefer-promises/dns](./docs/rules/prefer-promises/dns.md) | enforce `require("dns").promises` | | +| [n/prefer-promises/fs](./docs/rules/prefer-promises/fs.md) | enforce `require("fs").promises` | | + +### Deprecated rules + +These rules have been deprecated in accordance with the [deprecation policy](https://eslint.org/docs/user-guide/rule-deprecation), and replaced by newer rules: + +| Rule ID | Replaced by | +|:--------|:------------| +| [n/no-hide-core-modules](./docs/rules/no-hide-core-modules.md) | (nothing) | +| [n/no-unsupported-features](./docs/rules/no-unsupported-features.md) | [n/no-unsupported-features/es-syntax](./docs/rules/no-unsupported-features/es-syntax.md) and [n/no-unsupported-features/es-builtins](./docs/rules/no-unsupported-features/es-builtins.md) | + + + +## 🔧 Configs + +This plugin provides three configs: + +- `plugin:n/recommended` considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS. +- `plugin:n/recommended-module` considers all files as ES Modules. +- `plugin:n/recommended-script` considers all files as CommonJS. + +Those preset config: + +- enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule because [the official document](https://nodejs.org/api/process.html#process_process_exit_code) does not recommend a use of `process.exit()`. +- enable plugin rules which are given :star: in the above table. +- add `{ecmaVersion: 2019}` and etc into `parserOptions`. +- add proper globals into `globals`. +- add this plugin into `plugins`. + +## 👫 FAQ + +- Q: The `no-missing-import` / `no-missing-require` rules don't work with nested folders in SublimeLinter-eslint +- A: See [context.getFilename() in rule returns relative path](https://github.com/roadhump/SublimeLinter-eslint#contextgetfilename-in-rule-returns-relative-path) in the SublimeLinter-eslint FAQ. + +## 🚥 Semantic Versioning Policy + +`eslint-plugin-n` follows [semantic versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy). + +- Patch release (intended to not break your lint build) + - A bug fix in a rule that results in it reporting fewer errors. + - Improvements to documentation. + - Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage. + - Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone). +- Minor release (might break your lint build) + - A bug fix in a rule that results in it reporting more errors. + - A new rule is created. + - A new option to an existing rule is created. + - An existing rule is deprecated. +- Major release (likely to break your lint build) + - A support for old Node version is dropped. + - A support for old ESLint version is dropped. + - An existing rule is changed in it reporting more errors. + - An existing rule is removed. + - An existing option of a rule is removed. + - An existing config is updated. + +## 📰 Changelog + +- [GitHub Releases](https://github.com/weiran-zsd/eslint-plugin-node/releases) + +## ❤️ Contributing + +Welcome contributing! + +Please use GitHub's Issues/PRs. + +### Development Tools + +- `npm test` runs tests and measures coverage. +- `npm run coverage` shows the coverage result of `npm test` command. +- `npm run clean` removes the coverage result of `npm test` command. diff --git a/node_modules/eslint-plugin-n/lib/configs/_commons.js b/node_modules/eslint-plugin-n/lib/configs/_commons.js new file mode 100644 index 0000000..0fb6568 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/configs/_commons.js @@ -0,0 +1,76 @@ +"use strict" + +module.exports = { + commonGlobals: { + // ECMAScript + ArrayBuffer: "readonly", + Atomics: "readonly", + BigInt: "readonly", + BigInt64Array: "readonly", + BigUint64Array: "readonly", + DataView: "readonly", + Float32Array: "readonly", + Float64Array: "readonly", + Int16Array: "readonly", + Int32Array: "readonly", + Int8Array: "readonly", + Map: "readonly", + Promise: "readonly", + Proxy: "readonly", + Reflect: "readonly", + Set: "readonly", + SharedArrayBuffer: "readonly", + Symbol: "readonly", + Uint16Array: "readonly", + Uint32Array: "readonly", + Uint8Array: "readonly", + Uint8ClampedArray: "readonly", + WeakMap: "readonly", + WeakSet: "readonly", + + // ECMAScript (experimental) + globalThis: "readonly", + + // ECMA-402 + Intl: "readonly", + + // Web Standard + TextDecoder: "readonly", + TextEncoder: "readonly", + URL: "readonly", + URLSearchParams: "readonly", + WebAssembly: "readonly", + clearInterval: "readonly", + clearTimeout: "readonly", + console: "readonly", + queueMicrotask: "readonly", + setInterval: "readonly", + setTimeout: "readonly", + + // Node.js + Buffer: "readonly", + GLOBAL: "readonly", + clearImmediate: "readonly", + global: "readonly", + process: "readonly", + root: "readonly", + setImmediate: "readonly", + }, + commonRules: { + "n/no-deprecated-api": "error", + "n/no-extraneous-import": "error", + "n/no-extraneous-require": "error", + "n/no-exports-assign": "error", + "n/no-missing-import": "error", + "n/no-missing-require": "error", + "n/no-process-exit": "error", + "n/no-unpublished-bin": "error", + "n/no-unpublished-import": "error", + "n/no-unpublished-require": "error", + "n/no-unsupported-features/es-builtins": "error", + "n/no-unsupported-features/es-syntax": "error", + "n/no-unsupported-features/node-builtins": "error", + "n/process-exit-as-throw": "error", + "n/shebang": "error", + }, +} diff --git a/node_modules/eslint-plugin-n/lib/configs/recommended-module.js b/node_modules/eslint-plugin-n/lib/configs/recommended-module.js new file mode 100644 index 0000000..4b7ebaa --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/configs/recommended-module.js @@ -0,0 +1,27 @@ +"use strict" + +const { commonGlobals, commonRules } = require("./_commons") + +module.exports = { + globals: { + ...commonGlobals, + __dirname: "off", + __filename: "off", + exports: "off", + module: "off", + require: "off", + }, + parserOptions: { + ecmaFeatures: { globalReturn: false }, + ecmaVersion: 2019, + sourceType: "module", + }, + plugins: ["n"], + rules: { + ...commonRules, + "n/no-unsupported-features/es-syntax": [ + "error", + { ignores: ["modules"] }, + ], + }, +} diff --git a/node_modules/eslint-plugin-n/lib/configs/recommended-script.js b/node_modules/eslint-plugin-n/lib/configs/recommended-script.js new file mode 100644 index 0000000..fba7570 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/configs/recommended-script.js @@ -0,0 +1,24 @@ +"use strict" + +const { commonGlobals, commonRules } = require("./_commons") + +module.exports = { + globals: { + ...commonGlobals, + __dirname: "readonly", + __filename: "readonly", + exports: "writable", + module: "readonly", + require: "readonly", + }, + parserOptions: { + ecmaFeatures: { globalReturn: true }, + ecmaVersion: 2019, + sourceType: "script", + }, + plugins: ["n"], + rules: { + ...commonRules, + "n/no-unsupported-features/es-syntax": ["error", { ignores: [] }], + }, +} diff --git a/node_modules/eslint-plugin-n/lib/configs/recommended.js b/node_modules/eslint-plugin-n/lib/configs/recommended.js new file mode 100644 index 0000000..830c766 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/configs/recommended.js @@ -0,0 +1,18 @@ +"use strict" + +const getPackageJson = require("../util/get-package-json") +const moduleConfig = require("./recommended-module") +const scriptConfig = require("./recommended-script") + +module.exports = () => { + const packageJson = getPackageJson() + const isModule = (packageJson && packageJson.type) === "module" + + return { + ...(isModule ? moduleConfig : scriptConfig), + overrides: [ + { files: ["*.cjs", ".*.cjs"], ...scriptConfig }, + { files: ["*.mjs", ".*.mjs"], ...moduleConfig }, + ], + } +} diff --git a/node_modules/eslint-plugin-n/lib/converted-esm/import-meta-resolve.js b/node_modules/eslint-plugin-n/lib/converted-esm/import-meta-resolve.js new file mode 100644 index 0000000..6e12280 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/converted-esm/import-meta-resolve.js @@ -0,0 +1,761 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __reExport = (target, module2, copyDefault, desc) => { + if (module2 && typeof module2 === "object" || typeof module2 === "function") { + for (let key of __getOwnPropNames(module2)) + if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) + __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); + } + return target; +}; +var __toESM = (module2, isNodeMode) => { + return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); +}; +var __toCommonJS = /* @__PURE__ */ ((cache) => { + return (module2, temp) => { + return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp); + }; +})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); + +// node_modules/import-meta-resolve/lib/resolve.js +var resolve_exports = {}; +__export(resolve_exports, { + defaultResolve: () => defaultResolve, + getPackageType: () => getPackageType, + moduleResolve: () => moduleResolve +}); +var import_url2 = require("url"); +var import_fs2 = require("fs"); +var import_path3 = __toESM(require("path"), 1); +var import_builtins = __toESM(require("builtins"), 1); + +// node_modules/import-meta-resolve/lib/package-json-reader.js +var import_fs = __toESM(require("fs"), 1); +var import_path = __toESM(require("path"), 1); +var reader = { read }; +var package_json_reader_default = reader; +function read(jsonPath) { + return find(import_path.default.dirname(jsonPath)); +} +function find(dir) { + try { + const string = import_fs.default.readFileSync(import_path.default.toNamespacedPath(import_path.default.join(dir, "package.json")), "utf8"); + return { string }; + } catch (error) { + if (error.code === "ENOENT") { + const parent = import_path.default.dirname(dir); + if (dir !== parent) + return find(parent); + return { string: void 0 }; + } + throw error; + } +} + +// node_modules/import-meta-resolve/lib/get-format.js +var import_path2 = __toESM(require("path"), 1); +var import_url = require("url"); + +// node_modules/import-meta-resolve/lib/errors.js +var import_assert = __toESM(require("assert"), 1); +var import_util = require("util"); +var isWindows = process.platform === "win32"; +var own = {}.hasOwnProperty; +var codes = {}; +var messages = /* @__PURE__ */ new Map(); +var nodeInternalPrefix = "__node_internal_"; +var userStackTraceLimit; +codes.ERR_INVALID_MODULE_SPECIFIER = createError("ERR_INVALID_MODULE_SPECIFIER", (request, reason, base = void 0) => { + return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`; +}, TypeError); +codes.ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path4, base, message) => { + return `Invalid package config ${path4}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`; +}, Error); +codes.ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (pkgPath, key, target, isImport = false, base = void 0) => { + const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./"); + if (key === ".") { + (0, import_assert.default)(isImport === false); + return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; + } + return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; +}, Error); +codes.ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path4, base, type = "package") => { + return `Cannot find ${type} '${path4}' imported from ${base}`; +}, Error); +codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => { + return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`; +}, TypeError); +codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError("ERR_PACKAGE_PATH_NOT_EXPORTED", (pkgPath, subpath, base = void 0) => { + if (subpath === ".") + return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; + return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; +}, Error); +codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error); +codes.ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", 'Unknown file extension "%s" for %s', TypeError); +codes.ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => { + let inspected = (0, import_util.inspect)(value); + if (inspected.length > 128) { + inspected = `${inspected.slice(0, 128)}...`; + } + const type = name.includes(".") ? "property" : "argument"; + return `The ${type} '${name}' ${reason}. Received ${inspected}`; +}, TypeError); +codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError("ERR_UNSUPPORTED_ESM_URL_SCHEME", (url) => { + let message = "Only file and data URLs are supported by the default ESM loader"; + if (isWindows && url.protocol.length === 2) { + message += ". On Windows, absolute paths must be valid file:// URLs"; + } + message += `. Received protocol '${url.protocol}'`; + return message; +}, Error); +function createError(sym, value, def) { + messages.set(sym, value); + return makeNodeErrorWithCode(def, sym); +} +function makeNodeErrorWithCode(Base, key) { + return NodeError; + function NodeError(...args) { + const limit = Error.stackTraceLimit; + if (isErrorStackTraceLimitWritable()) + Error.stackTraceLimit = 0; + const error = new Base(); + if (isErrorStackTraceLimitWritable()) + Error.stackTraceLimit = limit; + const message = getMessage(key, args, error); + Object.defineProperty(error, "message", { + value: message, + enumerable: false, + writable: true, + configurable: true + }); + Object.defineProperty(error, "toString", { + value() { + return `${this.name} [${key}]: ${this.message}`; + }, + enumerable: false, + writable: true, + configurable: true + }); + addCodeToName(error, Base.name, key); + error.code = key; + return error; + } +} +var addCodeToName = hideStackFrames(function(error, name, code) { + error = captureLargerStackTrace(error); + error.name = `${name} [${code}]`; + error.stack; + if (name === "SystemError") { + Object.defineProperty(error, "name", { + value: name, + enumerable: false, + writable: true, + configurable: true + }); + } else { + delete error.name; + } +}); +function isErrorStackTraceLimitWritable() { + const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit"); + if (desc === void 0) { + return Object.isExtensible(Error); + } + return own.call(desc, "writable") ? desc.writable : desc.set !== void 0; +} +function hideStackFrames(fn) { + const hidden = nodeInternalPrefix + fn.name; + Object.defineProperty(fn, "name", { value: hidden }); + return fn; +} +var captureLargerStackTrace = hideStackFrames(function(error) { + const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); + if (stackTraceLimitIsWritable) { + userStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Number.POSITIVE_INFINITY; + } + Error.captureStackTrace(error); + if (stackTraceLimitIsWritable) + Error.stackTraceLimit = userStackTraceLimit; + return error; +}); +function getMessage(key, args, self) { + const message = messages.get(key); + if (typeof message === "function") { + (0, import_assert.default)(message.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`); + return Reflect.apply(message, self, args); + } + const expectedLength = (message.match(/%[dfijoOs]/g) || []).length; + (0, import_assert.default)(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`); + if (args.length === 0) + return message; + args.unshift(message); + return Reflect.apply(import_util.format, null, args); +} + +// node_modules/import-meta-resolve/lib/get-format.js +var { ERR_UNKNOWN_FILE_EXTENSION } = codes; +var extensionFormatMap = { + __proto__: null, + ".cjs": "commonjs", + ".js": "module", + ".mjs": "module" +}; +function defaultGetFormat(url) { + if (url.startsWith("node:")) { + return { format: "builtin" }; + } + const parsed = new import_url.URL(url); + if (parsed.protocol === "data:") { + const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null]; + const format2 = mime === "text/javascript" ? "module" : null; + return { format: format2 }; + } + if (parsed.protocol === "file:") { + const ext = import_path2.default.extname(parsed.pathname); + let format2; + if (ext === ".js") { + format2 = getPackageType(parsed.href) === "module" ? "module" : "commonjs"; + } else { + format2 = extensionFormatMap[ext]; + } + if (!format2) { + throw new ERR_UNKNOWN_FILE_EXTENSION(ext, (0, import_url.fileURLToPath)(url)); + } + return { format: format2 || null }; + } + return { format: null }; +} + +// node_modules/import-meta-resolve/lib/resolve.js +var listOfBuiltins = (0, import_builtins.default)(); +var { + ERR_INVALID_MODULE_SPECIFIER, + ERR_INVALID_PACKAGE_CONFIG, + ERR_INVALID_PACKAGE_TARGET, + ERR_MODULE_NOT_FOUND, + ERR_PACKAGE_IMPORT_NOT_DEFINED, + ERR_PACKAGE_PATH_NOT_EXPORTED, + ERR_UNSUPPORTED_DIR_IMPORT, + ERR_UNSUPPORTED_ESM_URL_SCHEME, + ERR_INVALID_ARG_VALUE +} = codes; +var own2 = {}.hasOwnProperty; +var DEFAULT_CONDITIONS = Object.freeze(["node", "import"]); +var DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS); +var invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; +var patternRegEx = /\*/g; +var encodedSepRegEx = /%2f|%2c/i; +var emittedPackageWarnings = /* @__PURE__ */ new Set(); +var packageJsonCache = /* @__PURE__ */ new Map(); +function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { + const pjsonPath = (0, import_url2.fileURLToPath)(pjsonUrl); + if (emittedPackageWarnings.has(pjsonPath + "|" + match)) + return; + emittedPackageWarnings.add(pjsonPath + "|" + match); + process.emitWarning(`Use of deprecated folder mapping "${match}" in the ${isExports ? '"exports"' : '"imports"'} field module resolution of the package at ${pjsonPath}${base ? ` imported from ${(0, import_url2.fileURLToPath)(base)}` : ""}. +Update this package.json to use a subpath pattern like "${match}*".`, "DeprecationWarning", "DEP0148"); +} +function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) { + const { format: format2 } = defaultGetFormat(url.href); + if (format2 !== "module") + return; + const path4 = (0, import_url2.fileURLToPath)(url.href); + const pkgPath = (0, import_url2.fileURLToPath)(new import_url2.URL(".", packageJsonUrl)); + const basePath = (0, import_url2.fileURLToPath)(base); + if (main) + process.emitWarning(`Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, excluding the full filename and extension to the resolved file at "${path4.slice(pkgPath.length)}", imported from ${basePath}. + Automatic extension resolution of the "main" field isdeprecated for ES modules.`, "DeprecationWarning", "DEP0151"); + else + process.emitWarning(`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path4.slice(pkgPath.length)}", imported from ${basePath}. +Default "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151"); +} +function getConditionsSet(conditions) { + if (conditions !== void 0 && conditions !== DEFAULT_CONDITIONS) { + if (!Array.isArray(conditions)) { + throw new ERR_INVALID_ARG_VALUE("conditions", conditions, "expected an array"); + } + return new Set(conditions); + } + return DEFAULT_CONDITIONS_SET; +} +function tryStatSync(path4) { + try { + return (0, import_fs2.statSync)(path4); + } catch { + return new import_fs2.Stats(); + } +} +function getPackageConfig(path4, specifier, base) { + const existing = packageJsonCache.get(path4); + if (existing !== void 0) { + return existing; + } + const source = package_json_reader_default.read(path4).string; + if (source === void 0) { + const packageConfig2 = { + pjsonPath: path4, + exists: false, + main: void 0, + name: void 0, + type: "none", + exports: void 0, + imports: void 0 + }; + packageJsonCache.set(path4, packageConfig2); + return packageConfig2; + } + let packageJson; + try { + packageJson = JSON.parse(source); + } catch (error) { + throw new ERR_INVALID_PACKAGE_CONFIG(path4, (base ? `"${specifier}" from ` : "") + (0, import_url2.fileURLToPath)(base || specifier), error.message); + } + const { exports, imports, main, name, type } = packageJson; + const packageConfig = { + pjsonPath: path4, + exists: true, + main: typeof main === "string" ? main : void 0, + name: typeof name === "string" ? name : void 0, + type: type === "module" || type === "commonjs" ? type : "none", + exports, + imports: imports && typeof imports === "object" ? imports : void 0 + }; + packageJsonCache.set(path4, packageConfig); + return packageConfig; +} +function getPackageScopeConfig(resolved) { + let packageJsonUrl = new import_url2.URL("./package.json", resolved); + while (true) { + const packageJsonPath2 = packageJsonUrl.pathname; + if (packageJsonPath2.endsWith("node_modules/package.json")) + break; + const packageConfig2 = getPackageConfig((0, import_url2.fileURLToPath)(packageJsonUrl), resolved); + if (packageConfig2.exists) + return packageConfig2; + const lastPackageJsonUrl = packageJsonUrl; + packageJsonUrl = new import_url2.URL("../package.json", packageJsonUrl); + if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) + break; + } + const packageJsonPath = (0, import_url2.fileURLToPath)(packageJsonUrl); + const packageConfig = { + pjsonPath: packageJsonPath, + exists: false, + main: void 0, + name: void 0, + type: "none", + exports: void 0, + imports: void 0 + }; + packageJsonCache.set(packageJsonPath, packageConfig); + return packageConfig; +} +function fileExists(url) { + return tryStatSync((0, import_url2.fileURLToPath)(url)).isFile(); +} +function legacyMainResolve(packageJsonUrl, packageConfig, base) { + let guess; + if (packageConfig.main !== void 0) { + guess = new import_url2.URL(`./${packageConfig.main}`, packageJsonUrl); + if (fileExists(guess)) + return guess; + const tries2 = [ + `./${packageConfig.main}.js`, + `./${packageConfig.main}.json`, + `./${packageConfig.main}.node`, + `./${packageConfig.main}/index.js`, + `./${packageConfig.main}/index.json`, + `./${packageConfig.main}/index.node` + ]; + let i2 = -1; + while (++i2 < tries2.length) { + guess = new import_url2.URL(tries2[i2], packageJsonUrl); + if (fileExists(guess)) + break; + guess = void 0; + } + if (guess) { + emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); + return guess; + } + } + const tries = ["./index.js", "./index.json", "./index.node"]; + let i = -1; + while (++i < tries.length) { + guess = new import_url2.URL(tries[i], packageJsonUrl); + if (fileExists(guess)) + break; + guess = void 0; + } + if (guess) { + emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); + return guess; + } + throw new ERR_MODULE_NOT_FOUND((0, import_url2.fileURLToPath)(new import_url2.URL(".", packageJsonUrl)), (0, import_url2.fileURLToPath)(base)); +} +function finalizeResolution(resolved, base) { + if (encodedSepRegEx.test(resolved.pathname)) + throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', (0, import_url2.fileURLToPath)(base)); + const path4 = (0, import_url2.fileURLToPath)(resolved); + const stats = tryStatSync(path4.endsWith("/") ? path4.slice(-1) : path4); + if (stats.isDirectory()) { + const error = new ERR_UNSUPPORTED_DIR_IMPORT(path4, (0, import_url2.fileURLToPath)(base)); + error.url = String(resolved); + throw error; + } + if (!stats.isFile()) { + throw new ERR_MODULE_NOT_FOUND(path4 || resolved.pathname, base && (0, import_url2.fileURLToPath)(base), "module"); + } + return resolved; +} +function throwImportNotDefined(specifier, packageJsonUrl, base) { + throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && (0, import_url2.fileURLToPath)(new import_url2.URL(".", packageJsonUrl)), (0, import_url2.fileURLToPath)(base)); +} +function throwExportsNotFound(subpath, packageJsonUrl, base) { + throw new ERR_PACKAGE_PATH_NOT_EXPORTED((0, import_url2.fileURLToPath)(new import_url2.URL(".", packageJsonUrl)), subpath, base && (0, import_url2.fileURLToPath)(base)); +} +function throwInvalidSubpath(subpath, packageJsonUrl, internal, base) { + const reason = `request is not a valid subpath for the "${internal ? "imports" : "exports"}" resolution of ${(0, import_url2.fileURLToPath)(packageJsonUrl)}`; + throw new ERR_INVALID_MODULE_SPECIFIER(subpath, reason, base && (0, import_url2.fileURLToPath)(base)); +} +function throwInvalidPackageTarget(subpath, target, packageJsonUrl, internal, base) { + target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`; + throw new ERR_INVALID_PACKAGE_TARGET((0, import_url2.fileURLToPath)(new import_url2.URL(".", packageJsonUrl)), subpath, target, internal, base && (0, import_url2.fileURLToPath)(base)); +} +function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, conditions) { + if (subpath !== "" && !pattern && target[target.length - 1] !== "/") + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + if (!target.startsWith("./")) { + if (internal && !target.startsWith("../") && !target.startsWith("/")) { + let isURL = false; + try { + new import_url2.URL(target); + isURL = true; + } catch { + } + if (!isURL) { + const exportTarget = pattern ? target.replace(patternRegEx, subpath) : target + subpath; + return packageResolve(exportTarget, packageJsonUrl, conditions); + } + } + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + } + if (invalidSegmentRegEx.test(target.slice(2))) + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + const resolved = new import_url2.URL(target, packageJsonUrl); + const resolvedPath = resolved.pathname; + const packagePath = new import_url2.URL(".", packageJsonUrl).pathname; + if (!resolvedPath.startsWith(packagePath)) + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + if (subpath === "") + return resolved; + if (invalidSegmentRegEx.test(subpath)) + throwInvalidSubpath(match + subpath, packageJsonUrl, internal, base); + if (pattern) + return new import_url2.URL(resolved.href.replace(patternRegEx, subpath)); + return new import_url2.URL(subpath, resolved); +} +function isArrayIndex(key) { + const keyNumber = Number(key); + if (`${keyNumber}` !== key) + return false; + return keyNumber >= 0 && keyNumber < 4294967295; +} +function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, conditions) { + if (typeof target === "string") { + return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, conditions); + } + if (Array.isArray(target)) { + const targetList = target; + if (targetList.length === 0) + return null; + let lastException; + let i = -1; + while (++i < targetList.length) { + const targetItem = targetList[i]; + let resolved; + try { + resolved = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, conditions); + } catch (error) { + lastException = error; + if (error.code === "ERR_INVALID_PACKAGE_TARGET") + continue; + throw error; + } + if (resolved === void 0) + continue; + if (resolved === null) { + lastException = null; + continue; + } + return resolved; + } + if (lastException === void 0 || lastException === null) { + return lastException; + } + throw lastException; + } + if (typeof target === "object" && target !== null) { + const keys = Object.getOwnPropertyNames(target); + let i = -1; + while (++i < keys.length) { + const key = keys[i]; + if (isArrayIndex(key)) { + throw new ERR_INVALID_PACKAGE_CONFIG((0, import_url2.fileURLToPath)(packageJsonUrl), base, '"exports" cannot contain numeric property keys.'); + } + } + i = -1; + while (++i < keys.length) { + const key = keys[i]; + if (key === "default" || conditions && conditions.has(key)) { + const conditionalTarget = target[key]; + const resolved = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, conditions); + if (resolved === void 0) + continue; + return resolved; + } + } + return void 0; + } + if (target === null) { + return null; + } + throwInvalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base); +} +function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { + if (typeof exports === "string" || Array.isArray(exports)) + return true; + if (typeof exports !== "object" || exports === null) + return false; + const keys = Object.getOwnPropertyNames(exports); + let isConditionalSugar = false; + let i = 0; + let j = -1; + while (++j < keys.length) { + const key = keys[j]; + const curIsConditionalSugar = key === "" || key[0] !== "."; + if (i++ === 0) { + isConditionalSugar = curIsConditionalSugar; + } else if (isConditionalSugar !== curIsConditionalSugar) { + throw new ERR_INVALID_PACKAGE_CONFIG((0, import_url2.fileURLToPath)(packageJsonUrl), base, `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`); + } + } + return isConditionalSugar; +} +function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) { + let exports = packageConfig.exports; + if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) + exports = { ".": exports }; + if (own2.call(exports, packageSubpath)) { + const target = exports[packageSubpath]; + const resolved = resolvePackageTarget(packageJsonUrl, target, "", packageSubpath, base, false, false, conditions); + if (resolved === null || resolved === void 0) + throwExportsNotFound(packageSubpath, packageJsonUrl, base); + return { resolved, exact: true }; + } + let bestMatch = ""; + const keys = Object.getOwnPropertyNames(exports); + let i = -1; + while (++i < keys.length) { + const key = keys[i]; + if (key[key.length - 1] === "*" && packageSubpath.startsWith(key.slice(0, -1)) && packageSubpath.length >= key.length && key.length > bestMatch.length) { + bestMatch = key; + } else if (key[key.length - 1] === "/" && packageSubpath.startsWith(key) && key.length > bestMatch.length) { + bestMatch = key; + } + } + if (bestMatch) { + const target = exports[bestMatch]; + const pattern = bestMatch[bestMatch.length - 1] === "*"; + const subpath = packageSubpath.slice(bestMatch.length - (pattern ? 1 : 0)); + const resolved = resolvePackageTarget(packageJsonUrl, target, subpath, bestMatch, base, pattern, false, conditions); + if (resolved === null || resolved === void 0) + throwExportsNotFound(packageSubpath, packageJsonUrl, base); + if (!pattern) + emitFolderMapDeprecation(bestMatch, packageJsonUrl, true, base); + return { resolved, exact: pattern }; + } + throwExportsNotFound(packageSubpath, packageJsonUrl, base); +} +function packageImportsResolve(name, base, conditions) { + if (name === "#" || name.startsWith("#/")) { + const reason = "is not a valid internal imports specifier name"; + throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, (0, import_url2.fileURLToPath)(base)); + } + let packageJsonUrl; + const packageConfig = getPackageScopeConfig(base); + if (packageConfig.exists) { + packageJsonUrl = (0, import_url2.pathToFileURL)(packageConfig.pjsonPath); + const imports = packageConfig.imports; + if (imports) { + if (own2.call(imports, name)) { + const resolved = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, false, true, conditions); + if (resolved !== null) + return { resolved, exact: true }; + } else { + let bestMatch = ""; + const keys = Object.getOwnPropertyNames(imports); + let i = -1; + while (++i < keys.length) { + const key = keys[i]; + if (key[key.length - 1] === "*" && name.startsWith(key.slice(0, -1)) && name.length >= key.length && key.length > bestMatch.length) { + bestMatch = key; + } else if (key[key.length - 1] === "/" && name.startsWith(key) && key.length > bestMatch.length) { + bestMatch = key; + } + } + if (bestMatch) { + const target = imports[bestMatch]; + const pattern = bestMatch[bestMatch.length - 1] === "*"; + const subpath = name.slice(bestMatch.length - (pattern ? 1 : 0)); + const resolved = resolvePackageTarget(packageJsonUrl, target, subpath, bestMatch, base, pattern, true, conditions); + if (resolved !== null) { + if (!pattern) + emitFolderMapDeprecation(bestMatch, packageJsonUrl, false, base); + return { resolved, exact: pattern }; + } + } + } + } + } + throwImportNotDefined(name, packageJsonUrl, base); +} +function getPackageType(url) { + const packageConfig = getPackageScopeConfig(url); + return packageConfig.type; +} +function parsePackageName(specifier, base) { + let separatorIndex = specifier.indexOf("/"); + let validPackageName = true; + let isScoped = false; + if (specifier[0] === "@") { + isScoped = true; + if (separatorIndex === -1 || specifier.length === 0) { + validPackageName = false; + } else { + separatorIndex = specifier.indexOf("/", separatorIndex + 1); + } + } + const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); + let i = -1; + while (++i < packageName.length) { + if (packageName[i] === "%" || packageName[i] === "\\") { + validPackageName = false; + break; + } + } + if (!validPackageName) { + throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", (0, import_url2.fileURLToPath)(base)); + } + const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)); + return { packageName, packageSubpath, isScoped }; +} +function packageResolve(specifier, base, conditions) { + const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); + const packageConfig = getPackageScopeConfig(base); + if (packageConfig.exists) { + const packageJsonUrl2 = (0, import_url2.pathToFileURL)(packageConfig.pjsonPath); + if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) { + return packageExportsResolve(packageJsonUrl2, packageSubpath, packageConfig, base, conditions).resolved; + } + } + let packageJsonUrl = new import_url2.URL("./node_modules/" + packageName + "/package.json", base); + let packageJsonPath = (0, import_url2.fileURLToPath)(packageJsonUrl); + let lastPath; + do { + const stat = tryStatSync(packageJsonPath.slice(0, -13)); + if (!stat.isDirectory()) { + lastPath = packageJsonPath; + packageJsonUrl = new import_url2.URL((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl); + packageJsonPath = (0, import_url2.fileURLToPath)(packageJsonUrl); + continue; + } + const packageConfig2 = getPackageConfig(packageJsonPath, specifier, base); + if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) + return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig2, base, conditions).resolved; + if (packageSubpath === ".") + return legacyMainResolve(packageJsonUrl, packageConfig2, base); + return new import_url2.URL(packageSubpath, packageJsonUrl); + } while (packageJsonPath.length !== lastPath.length); + throw new ERR_MODULE_NOT_FOUND(packageName, (0, import_url2.fileURLToPath)(base)); +} +function isRelativeSpecifier(specifier) { + if (specifier[0] === ".") { + if (specifier.length === 1 || specifier[1] === "/") + return true; + if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) { + return true; + } + } + return false; +} +function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { + if (specifier === "") + return false; + if (specifier[0] === "/") + return true; + return isRelativeSpecifier(specifier); +} +function moduleResolve(specifier, base, conditions) { + let resolved; + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + resolved = new import_url2.URL(specifier, base); + } else if (specifier[0] === "#") { + ; + ({ resolved } = packageImportsResolve(specifier, base, conditions)); + } else { + try { + resolved = new import_url2.URL(specifier); + } catch { + resolved = packageResolve(specifier, base, conditions); + } + } + return finalizeResolution(resolved, base); +} +function defaultResolve(specifier, context = {}) { + const { parentURL } = context; + let parsed; + try { + parsed = new import_url2.URL(specifier); + if (parsed.protocol === "data:") { + return { url: specifier }; + } + } catch { + } + if (parsed && parsed.protocol === "node:") + return { url: specifier }; + if (parsed && parsed.protocol !== "file:" && parsed.protocol !== "data:") + throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); + if (listOfBuiltins.includes(specifier)) { + return { url: "node:" + specifier }; + } + if (parentURL.startsWith("data:")) { + new import_url2.URL(specifier, parentURL); + } + const conditions = getConditionsSet(context.conditions); + let url = moduleResolve(specifier, new import_url2.URL(parentURL), conditions); + const urlPath = (0, import_url2.fileURLToPath)(url); + const real = (0, import_fs2.realpathSync)(urlPath); + const old = url; + url = (0, import_url2.pathToFileURL)(real + (urlPath.endsWith(import_path3.default.sep) ? "/" : "")); + url.search = old.search; + url.hash = old.hash; + return { url: `${url}` }; +} +module.exports = __toCommonJS(resolve_exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + defaultResolve, + getPackageType, + moduleResolve +}); diff --git a/node_modules/eslint-plugin-n/lib/index.js b/node_modules/eslint-plugin-n/lib/index.js new file mode 100644 index 0000000..fb0ebce --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/index.js @@ -0,0 +1,55 @@ +/* DON'T EDIT THIS FILE. This is generated by 'scripts/update-lib-index.js' */ +"use strict" + +module.exports = { + configs: { + "recommended-module": require("./configs/recommended-module"), + "recommended-script": require("./configs/recommended-script"), + get recommended() { + return require("./configs/recommended")() + }, + }, + rules: { + "callback-return": require("./rules/callback-return"), + "exports-style": require("./rules/exports-style"), + "file-extension-in-import": require("./rules/file-extension-in-import"), + "global-require": require("./rules/global-require"), + "handle-callback-err": require("./rules/handle-callback-err"), + "no-callback-literal": require("./rules/no-callback-literal"), + "no-deprecated-api": require("./rules/no-deprecated-api"), + "no-exports-assign": require("./rules/no-exports-assign"), + "no-extraneous-import": require("./rules/no-extraneous-import"), + "no-extraneous-require": require("./rules/no-extraneous-require"), + "no-missing-import": require("./rules/no-missing-import"), + "no-missing-require": require("./rules/no-missing-require"), + "no-mixed-requires": require("./rules/no-mixed-requires"), + "no-new-require": require("./rules/no-new-require"), + "no-path-concat": require("./rules/no-path-concat"), + "no-process-env": require("./rules/no-process-env"), + "no-process-exit": require("./rules/no-process-exit"), + "no-restricted-import": require("./rules/no-restricted-import"), + "no-restricted-require": require("./rules/no-restricted-require"), + "no-sync": require("./rules/no-sync"), + "no-unpublished-bin": require("./rules/no-unpublished-bin"), + "no-unpublished-import": require("./rules/no-unpublished-import"), + "no-unpublished-require": require("./rules/no-unpublished-require"), + "no-unsupported-features/es-builtins": require("./rules/no-unsupported-features/es-builtins"), + "no-unsupported-features/es-syntax": require("./rules/no-unsupported-features/es-syntax"), + "no-unsupported-features/node-builtins": require("./rules/no-unsupported-features/node-builtins"), + "prefer-global/buffer": require("./rules/prefer-global/buffer"), + "prefer-global/console": require("./rules/prefer-global/console"), + "prefer-global/process": require("./rules/prefer-global/process"), + "prefer-global/text-decoder": require("./rules/prefer-global/text-decoder"), + "prefer-global/text-encoder": require("./rules/prefer-global/text-encoder"), + "prefer-global/url-search-params": require("./rules/prefer-global/url-search-params"), + "prefer-global/url": require("./rules/prefer-global/url"), + "prefer-promises/dns": require("./rules/prefer-promises/dns"), + "prefer-promises/fs": require("./rules/prefer-promises/fs"), + "process-exit-as-throw": require("./rules/process-exit-as-throw"), + "shebang": require("./rules/shebang"), + + // Deprecated rules. + "no-hide-core-modules": require("./rules/no-hide-core-modules"), + "no-unsupported-features": require("./rules/no-unsupported-features"), + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/callback-return.js b/node_modules/eslint-plugin-n/lib/rules/callback-return.js new file mode 100644 index 0000000..d064491 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/callback-return.js @@ -0,0 +1,184 @@ +/** + * @author Jamund Ferguson + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "require `return` statements after callbacks", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/callback-return.md", + }, + schema: [ + { + type: "array", + items: { type: "string" }, + }, + ], + fixable: null, + messages: { + missingReturn: "Expected return with your callback function.", + }, + }, + + create(context) { + const callbacks = context.options[0] || ["callback", "cb", "next"] + const sourceCode = context.getSourceCode() + + /** + * Find the closest parent matching a list of types. + * @param {ASTNode} node The node whose parents we are searching + * @param {Array} types The node types to match + * @returns {ASTNode} The matched node or undefined. + */ + function findClosestParentOfType(node, types) { + if (!node.parent) { + return null + } + if (types.indexOf(node.parent.type) === -1) { + return findClosestParentOfType(node.parent, types) + } + return node.parent + } + + /** + * Check to see if a node contains only identifers + * @param {ASTNode} node The node to check + * @returns {boolean} Whether or not the node contains only identifers + */ + function containsOnlyIdentifiers(node) { + if (node.type === "Identifier") { + return true + } + + if (node.type === "MemberExpression") { + if (node.object.type === "Identifier") { + return true + } + if (node.object.type === "MemberExpression") { + return containsOnlyIdentifiers(node.object) + } + } + + return false + } + + /** + * Check to see if a CallExpression is in our callback list. + * @param {ASTNode} node The node to check against our callback names list. + * @returns {boolean} Whether or not this function matches our callback name. + */ + function isCallback(node) { + return ( + containsOnlyIdentifiers(node.callee) && + callbacks.indexOf(sourceCode.getText(node.callee)) > -1 + ) + } + + /** + * Determines whether or not the callback is part of a callback expression. + * @param {ASTNode} node The callback node + * @param {ASTNode} parentNode The expression node + * @returns {boolean} Whether or not this is part of a callback expression + */ + function isCallbackExpression(node, parentNode) { + // ensure the parent node exists and is an expression + if (!parentNode || parentNode.type !== "ExpressionStatement") { + return false + } + + // cb() + if (parentNode.expression === node) { + return true + } + + // special case for cb && cb() and similar + if ( + parentNode.expression.type === "BinaryExpression" || + parentNode.expression.type === "LogicalExpression" + ) { + if (parentNode.expression.right === node) { + return true + } + } + + return false + } + + return { + CallExpression(node) { + // if we're not a callback we can return + if (!isCallback(node)) { + return + } + + // find the closest block, return or loop + const closestBlock = + findClosestParentOfType(node, [ + "BlockStatement", + "ReturnStatement", + "ArrowFunctionExpression", + ]) || {} + + // if our parent is a return we know we're ok + if (closestBlock.type === "ReturnStatement") { + return + } + + // arrow functions don't always have blocks and implicitly return + if (closestBlock.type === "ArrowFunctionExpression") { + return + } + + // block statements are part of functions and most if statements + if (closestBlock.type === "BlockStatement") { + // find the last item in the block + const lastItem = + closestBlock.body[closestBlock.body.length - 1] + + // if the callback is the last thing in a block that might be ok + if (isCallbackExpression(node, lastItem)) { + const parentType = closestBlock.parent.type + + // but only if the block is part of a function + if ( + parentType === "FunctionExpression" || + parentType === "FunctionDeclaration" || + parentType === "ArrowFunctionExpression" + ) { + return + } + } + + // ending a block with a return is also ok + if (lastItem.type === "ReturnStatement") { + // but only if the callback is immediately before + if ( + isCallbackExpression( + node, + closestBlock.body[closestBlock.body.length - 2] + ) + ) { + return + } + } + } + + // as long as you're the child of a function at this point you should be asked to return + if ( + findClosestParentOfType(node, [ + "FunctionDeclaration", + "FunctionExpression", + "ArrowFunctionExpression", + ]) + ) { + context.report({ node, messageId: "missingReturn" }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/exports-style.js b/node_modules/eslint-plugin-n/lib/rules/exports-style.js new file mode 100644 index 0000000..bbcebcf --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/exports-style.js @@ -0,0 +1,383 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +/*istanbul ignore next */ +/** + * This function is copied from https://github.com/eslint/eslint/blob/2355f8d0de1d6732605420d15ddd4f1eee3c37b6/lib/ast-utils.js#L648-L684 + * + * @param {ASTNode} node - The node to get. + * @returns {string|null} The property name if static. Otherwise, null. + * @private + */ +function getStaticPropertyName(node) { + let prop = null + + switch (node && node.type) { + case "Property": + case "MethodDefinition": + prop = node.key + break + + case "MemberExpression": + prop = node.property + break + + // no default + } + + switch (prop && prop.type) { + case "Literal": + return String(prop.value) + + case "TemplateLiteral": + if (prop.expressions.length === 0 && prop.quasis.length === 1) { + return prop.quasis[0].value.cooked + } + break + + case "Identifier": + if (!node.computed) { + return prop.name + } + break + + // no default + } + + return null +} + +/** + * Checks whether the given node is assignee or not. + * + * @param {ASTNode} node - The node to check. + * @returns {boolean} `true` if the node is assignee. + */ +function isAssignee(node) { + return ( + node.parent.type === "AssignmentExpression" && node.parent.left === node + ) +} + +/** + * Gets the top assignment expression node if the given node is an assignee. + * + * This is used to distinguish 2 assignees belong to the same assignment. + * If the node is not an assignee, this returns null. + * + * @param {ASTNode} leafNode - The node to get. + * @returns {ASTNode|null} The top assignment expression node, or null. + */ +function getTopAssignment(leafNode) { + let node = leafNode + + // Skip MemberExpressions. + while ( + node.parent.type === "MemberExpression" && + node.parent.object === node + ) { + node = node.parent + } + + // Check assignments. + if (!isAssignee(node)) { + return null + } + + // Find the top. + while (node.parent.type === "AssignmentExpression") { + node = node.parent + } + + return node +} + +/** + * Gets top assignment nodes of the given node list. + * + * @param {ASTNode[]} nodes - The node list to get. + * @returns {ASTNode[]} Gotten top assignment nodes. + */ +function createAssignmentList(nodes) { + return nodes.map(getTopAssignment).filter(Boolean) +} + +/** + * Gets the reference of `module.exports` from the given scope. + * + * @param {escope.Scope} scope - The scope to get. + * @returns {ASTNode[]} Gotten MemberExpression node list. + */ +function getModuleExportsNodes(scope) { + const variable = scope.set.get("module") + if (variable == null) { + return [] + } + return variable.references + .map(reference => reference.identifier.parent) + .filter( + node => + node.type === "MemberExpression" && + getStaticPropertyName(node) === "exports" + ) +} + +/** + * Gets the reference of `exports` from the given scope. + * + * @param {escope.Scope} scope - The scope to get. + * @returns {ASTNode[]} Gotten Identifier node list. + */ +function getExportsNodes(scope) { + const variable = scope.set.get("exports") + if (variable == null) { + return [] + } + return variable.references.map(reference => reference.identifier) +} + +function getReplacementForProperty(property, sourceCode) { + if (property.type !== "Property" || property.kind !== "init") { + // We don't have a nice syntax for adding these directly on the exports object. Give up on fixing the whole thing: + // property.kind === 'get': + // module.exports = { get foo() { ... } } + // property.kind === 'set': + // module.exports = { set foo() { ... } } + // property.type === 'SpreadElement': + // module.exports = { ...foo } + return null + } + + let fixedValue = sourceCode.getText(property.value) + if (property.method) { + fixedValue = `function${ + property.value.generator ? "*" : "" + } ${fixedValue}` + if (property.value.async) { + fixedValue = `async ${fixedValue}` + } + } + const lines = sourceCode + .getCommentsBefore(property) + .map(comment => sourceCode.getText(comment)) + if (property.key.type === "Literal" || property.computed) { + // String or dynamic key: + // module.exports = { [ ... ]: ... } or { "foo": ... } + lines.push( + `exports[${sourceCode.getText(property.key)}] = ${fixedValue};` + ) + } else if (property.key.type === "Identifier") { + // Regular identifier: + // module.exports = { foo: ... } + lines.push(`exports.${property.key.name} = ${fixedValue};`) + } else { + // Some other unknown property type. Conservatively give up on fixing the whole thing. + return null + } + lines.push( + ...sourceCode + .getCommentsAfter(property) + .map(comment => sourceCode.getText(comment)) + ) + return lines.join("\n") +} + +// Check for a top level module.exports = { ... } +function isModuleExportsObjectAssignment(node) { + return ( + node.parent.type === "AssignmentExpression" && + node.parent.parent.type === "ExpressionStatement" && + node.parent.parent.parent.type === "Program" && + node.parent.right.type === "ObjectExpression" + ) +} + +// Check for module.exports.foo or module.exports.bar reference or assignment +function isModuleExportsReference(node) { + return ( + node.parent.type === "MemberExpression" && node.parent.object === node + ) +} + +function fixModuleExports(node, sourceCode, fixer) { + if (isModuleExportsReference(node)) { + return fixer.replaceText(node, "exports") + } + if (!isModuleExportsObjectAssignment(node)) { + return null + } + const statements = [] + const properties = node.parent.right.properties + for (const property of properties) { + const statement = getReplacementForProperty(property, sourceCode) + if (statement) { + statements.push(statement) + } else { + // No replacement available, give up on the whole thing + return null + } + } + return fixer.replaceText(node.parent, statements.join("\n\n")) +} + +module.exports = { + meta: { + docs: { + description: "enforce either `module.exports` or `exports`", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/exports-style.md", + }, + type: "suggestion", + fixable: "code", + schema: [ + { + // + enum: ["module.exports", "exports"], + }, + { + type: "object", + properties: { allowBatchAssign: { type: "boolean" } }, + additionalProperties: false, + }, + ], + }, + + create(context) { + const mode = context.options[0] || "module.exports" + const batchAssignAllowed = Boolean( + context.options[1] != null && context.options[1].allowBatchAssign + ) + const sourceCode = context.getSourceCode() + + /** + * Gets the location info of reports. + * + * exports = foo + * ^^^^^^^^^ + * + * module.exports = foo + * ^^^^^^^^^^^^^^^^ + * + * @param {ASTNode} node - The node of `exports`/`module.exports`. + * @returns {Location} The location info of reports. + */ + function getLocation(node) { + const token = sourceCode.getTokenAfter(node) + return { + start: node.loc.start, + end: token.loc.end, + } + } + + /** + * Enforces `module.exports`. + * This warns references of `exports`. + * + * @returns {void} + */ + function enforceModuleExports() { + const globalScope = context.getScope() + const exportsNodes = getExportsNodes(globalScope) + const assignList = batchAssignAllowed + ? createAssignmentList(getModuleExportsNodes(globalScope)) + : [] + + for (const node of exportsNodes) { + // Skip if it's a batch assignment. + if ( + assignList.length > 0 && + assignList.indexOf(getTopAssignment(node)) !== -1 + ) { + continue + } + + // Report. + context.report({ + node, + loc: getLocation(node), + message: + "Unexpected access to 'exports'. Use 'module.exports' instead.", + }) + } + } + + /** + * Enforces `exports`. + * This warns references of `module.exports`. + * + * @returns {void} + */ + function enforceExports() { + const globalScope = context.getScope() + const exportsNodes = getExportsNodes(globalScope) + const moduleExportsNodes = getModuleExportsNodes(globalScope) + const assignList = batchAssignAllowed + ? createAssignmentList(exportsNodes) + : [] + const batchAssignList = [] + + for (const node of moduleExportsNodes) { + // Skip if it's a batch assignment. + if (assignList.length > 0) { + const found = assignList.indexOf(getTopAssignment(node)) + if (found !== -1) { + batchAssignList.push(assignList[found]) + assignList.splice(found, 1) + continue + } + } + + // Report. + context.report({ + node, + loc: getLocation(node), + message: + "Unexpected access to 'module.exports'. Use 'exports' instead.", + fix(fixer) { + return fixModuleExports(node, sourceCode, fixer) + }, + }) + } + + // Disallow direct assignment to `exports`. + for (const node of exportsNodes) { + // Skip if it's not assignee. + if (!isAssignee(node)) { + continue + } + + // Check if it's a batch assignment. + if (batchAssignList.indexOf(getTopAssignment(node)) !== -1) { + continue + } + + // Report. + context.report({ + node, + loc: getLocation(node), + message: + "Unexpected assignment to 'exports'. Don't modify 'exports' itself.", + }) + } + } + + return { + "Program:exit"() { + switch (mode) { + case "module.exports": + enforceModuleExports() + break + case "exports": + enforceExports() + break + + // no default + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/file-extension-in-import.js b/node_modules/eslint-plugin-n/lib/rules/file-extension-in-import.js new file mode 100644 index 0000000..db3aa0a --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/file-extension-in-import.js @@ -0,0 +1,130 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const fs = require("fs") +const mapTypescriptExtension = require("../util/map-typescript-extension") +const visitImport = require("../util/visit-import") +const packageNamePattern = /^(?:@[^/\\]+[/\\])?[^/\\]+$/u +const corePackageOverridePattern = + /^(?:assert|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|http2|https|inspector|module|net|os|path|perf_hooks|process|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|trace_events|tty|url|util|v8|vm|worker_threads|zlib)[/\\]$/u + +/** + * Get all file extensions of the files which have the same basename. + * @param {string} filePath The path to the original file to check. + * @returns {string[]} File extensions. + */ +function getExistingExtensions(filePath) { + const basename = path.basename(filePath, path.extname(filePath)) + try { + return fs + .readdirSync(path.dirname(filePath)) + .filter( + filename => + path.basename(filename, path.extname(filename)) === basename + ) + .map(filename => path.extname(filename)) + } catch (_error) { + return [] + } +} + +module.exports = { + meta: { + docs: { + description: + "enforce the style of file extensions in `import` declarations", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/file-extension-in-import.md", + }, + fixable: "code", + messages: { + requireExt: "require file extension '{{ext}}'.", + forbidExt: "forbid file extension '{{ext}}'.", + }, + schema: [ + { + enum: ["always", "never"], + }, + { + type: "object", + properties: {}, + additionalProperties: { + enum: ["always", "never"], + }, + }, + ], + type: "suggestion", + }, + create(context) { + if (context.getFilename().startsWith("<")) { + return {} + } + const defaultStyle = context.options[0] || "always" + const overrideStyle = context.options[1] || {} + + function verify({ filePath, name, node }) { + // Ignore if it's not resolved to a file or it's a bare module. + if ( + !filePath || + packageNamePattern.test(name) || + corePackageOverridePattern.test(name) + ) { + return + } + + // Get extension. + const originalExt = path.extname(name) + const existingExts = getExistingExtensions(filePath) + const ext = path.extname(filePath) || existingExts.join(" or ") + const style = overrideStyle[ext] || defaultStyle + + // Verify. + if (style === "always" && ext !== originalExt) { + const fileExtensionToAdd = mapTypescriptExtension( + context, + filePath, + ext + ) + context.report({ + node, + messageId: "requireExt", + data: { ext: fileExtensionToAdd }, + fix(fixer) { + if (existingExts.length !== 1) { + return null + } + const index = node.range[1] - 1 + return fixer.insertTextBeforeRange( + [index, index], + fileExtensionToAdd + ) + }, + }) + } else if (style === "never" && ext === originalExt) { + context.report({ + node, + messageId: "forbidExt", + data: { ext }, + fix(fixer) { + if (existingExts.length !== 1) { + return null + } + const index = name.lastIndexOf(ext) + const start = node.range[0] + 1 + index + const end = start + ext.length + return fixer.removeRange([start, end]) + }, + }) + } + } + + return visitImport(context, { optionIndex: 1 }, targets => { + targets.forEach(verify) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/global-require.js b/node_modules/eslint-plugin-n/lib/rules/global-require.js new file mode 100644 index 0000000..c4142f4 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/global-require.js @@ -0,0 +1,90 @@ +/** + * @author Jamund Ferguson + * See LICENSE file in root directory for full license. + */ +"use strict" + +const ACCEPTABLE_PARENTS = [ + "AssignmentExpression", + "VariableDeclarator", + "MemberExpression", + "ExpressionStatement", + "CallExpression", + "ConditionalExpression", + "Program", + "VariableDeclaration", +] + +/** + * Finds the eslint-scope reference in the given scope. + * @param {Object} scope The scope to search. + * @param {ASTNode} node The identifier node. + * @returns {Reference|null} Returns the found reference or null if none were found. + */ +function findReference(scope, node) { + const references = scope.references.filter( + reference => + reference.identifier.range[0] === node.range[0] && + reference.identifier.range[1] === node.range[1] + ) + + /* istanbul ignore else: correctly returns null */ + if (references.length === 1) { + return references[0] + } + return null +} + +/** + * Checks if the given identifier node is shadowed in the given scope. + * @param {Object} scope The current scope. + * @param {ASTNode} node The identifier node to check. + * @returns {boolean} Whether or not the name is shadowed. + */ +function isShadowed(scope, node) { + const reference = findReference(scope, node) + + return reference && reference.resolved && reference.resolved.defs.length > 0 +} + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: + "require `require()` calls to be placed at top-level module scope", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/global-require.md", + }, + fixable: null, + schema: [], + messages: { + unexpected: "Unexpected require().", + }, + }, + + create(context) { + return { + CallExpression(node) { + const currentScope = context.getScope() + + if ( + node.callee.name === "require" && + !isShadowed(currentScope, node.callee) + ) { + const isGoodRequire = context + .getAncestors() + .every( + parent => + ACCEPTABLE_PARENTS.indexOf(parent.type) > -1 + ) + + if (!isGoodRequire) { + context.report({ node, messageId: "unexpected" }) + } + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/handle-callback-err.js b/node_modules/eslint-plugin-n/lib/rules/handle-callback-err.js new file mode 100644 index 0000000..17f1f6b --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/handle-callback-err.js @@ -0,0 +1,93 @@ +/** + * @author Jamund Ferguson + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "require error handling in callbacks", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/handle-callback-err.md", + }, + fixable: null, + schema: [ + { + type: "string", + }, + ], + messages: { + expected: "Expected error to be handled.", + }, + }, + + create(context) { + const errorArgument = context.options[0] || "err" + + /** + * Checks if the given argument should be interpreted as a regexp pattern. + * @param {string} stringToCheck The string which should be checked. + * @returns {boolean} Whether or not the string should be interpreted as a pattern. + */ + function isPattern(stringToCheck) { + const firstChar = stringToCheck[0] + + return firstChar === "^" + } + + /** + * Checks if the given name matches the configured error argument. + * @param {string} name The name which should be compared. + * @returns {boolean} Whether or not the given name matches the configured error variable name. + */ + function matchesConfiguredErrorName(name) { + if (isPattern(errorArgument)) { + const regexp = new RegExp(errorArgument, "u") + + return regexp.test(name) + } + return name === errorArgument + } + + /** + * Get the parameters of a given function scope. + * @param {Object} scope The function scope. + * @returns {Array} All parameters of the given scope. + */ + function getParameters(scope) { + return scope.variables.filter( + variable => + variable.defs[0] && variable.defs[0].type === "Parameter" + ) + } + + /** + * Check to see if we're handling the error object properly. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function checkForError(node) { + const scope = context.getScope() + const parameters = getParameters(scope) + const firstParameter = parameters[0] + + if ( + firstParameter && + matchesConfiguredErrorName(firstParameter.name) + ) { + if (firstParameter.references.length === 0) { + context.report({ node, messageId: "expected" }) + } + } + } + + return { + FunctionDeclaration: checkForError, + FunctionExpression: checkForError, + ArrowFunctionExpression: checkForError, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-callback-literal.js b/node_modules/eslint-plugin-n/lib/rules/no-callback-literal.js new file mode 100644 index 0000000..d143ee2 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-callback-literal.js @@ -0,0 +1,81 @@ +/** + * @author Jamund Ferguson + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + docs: { + description: + "ensure Node.js-style error-first callback pattern is followed", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-callback-literal.md", + }, + type: "problem", + fixable: null, + schema: [], + }, + + create(context) { + const callbackNames = ["callback", "cb"] + + function isCallback(name) { + return callbackNames.indexOf(name) > -1 + } + + return { + CallExpression(node) { + const errorArg = node.arguments[0] + const calleeName = node.callee.name + + if ( + errorArg && + !couldBeError(errorArg) && + isCallback(calleeName) + ) { + context.report({ + node, + message: + "Unexpected literal in error position of callback.", + }) + } + }, + } + }, +} + +/** + * Determine if a node has a possiblity to be an Error object + * @param {ASTNode} node ASTNode to check + * @returns {boolean} True if there is a chance it contains an Error obj + */ +function couldBeError(node) { + switch (node.type) { + case "Identifier": + case "CallExpression": + case "NewExpression": + case "MemberExpression": + case "TaggedTemplateExpression": + case "YieldExpression": + return true // possibly an error object. + + case "AssignmentExpression": + return couldBeError(node.right) + + case "SequenceExpression": { + const exprs = node.expressions + return exprs.length !== 0 && couldBeError(exprs[exprs.length - 1]) + } + + case "LogicalExpression": + return couldBeError(node.left) || couldBeError(node.right) + + case "ConditionalExpression": + return couldBeError(node.consequent) || couldBeError(node.alternate) + + default: + return node.value === null + } +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-deprecated-api.js b/node_modules/eslint-plugin-n/lib/rules/no-deprecated-api.js new file mode 100644 index 0000000..3db6c14 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-deprecated-api.js @@ -0,0 +1,778 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { CALL, CONSTRUCT, READ, ReferenceTracker } = require("eslint-utils") +const enumeratePropertyNames = require("../util/enumerate-property-names") +const getConfiguredNodeVersion = require("../util/get-configured-node-version") +const getSemverRange = require("../util/get-semver-range") + +const modules = { + _linklist: { + [READ]: { since: "5.0.0", replacedBy: null }, + }, + + _stream_wrap: { + [READ]: { since: "12.0.0", replacedBy: null }, + }, + + async_hooks: { + currentId: { + [READ]: { + since: "8.2.0", + replacedBy: [ + { + name: "'async_hooks.executionAsyncId()'", + supported: "8.1.0", + }, + ], + }, + }, + triggerId: { + [READ]: { + since: "8.2.0", + replacedBy: "'async_hooks.triggerAsyncId()'", + }, + }, + }, + buffer: { + Buffer: { + [CONSTRUCT]: { + since: "6.0.0", + replacedBy: [ + { name: "'buffer.Buffer.alloc()'", supported: "5.10.0" }, + { name: "'buffer.Buffer.from()'", supported: "5.10.0" }, + ], + }, + [CALL]: { + since: "6.0.0", + replacedBy: [ + { name: "'buffer.Buffer.alloc()'", supported: "5.10.0" }, + { name: "'buffer.Buffer.from()'", supported: "5.10.0" }, + ], + }, + }, + SlowBuffer: { + [READ]: { + since: "6.0.0", + replacedBy: [ + { + name: "'buffer.Buffer.allocUnsafeSlow()'", + supported: "5.12.0", + }, + ], + }, + }, + }, + constants: { + [READ]: { + since: "6.3.0", + replacedBy: "'constants' property of each module", + }, + }, + crypto: { + _toBuf: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + Credentials: { + [READ]: { since: "0.12.0", replacedBy: "'tls.SecureContext'" }, + }, + DEFAULT_ENCODING: { + [READ]: { since: "10.0.0", replacedBy: null }, + }, + createCipher: { + [READ]: { + since: "10.0.0", + replacedBy: [ + { name: "'crypto.createCipheriv()'", supported: "0.1.94" }, + ], + }, + }, + createCredentials: { + [READ]: { + since: "0.12.0", + replacedBy: [ + { + name: "'tls.createSecureContext()'", + supported: "0.11.13", + }, + ], + }, + }, + createDecipher: { + [READ]: { + since: "10.0.0", + replacedBy: [ + { + name: "'crypto.createDecipheriv()'", + supported: "0.1.94", + }, + ], + }, + }, + fips: { + [READ]: { + since: "10.0.0", + replacedBy: [ + { + name: "'crypto.getFips()' and 'crypto.setFips()'", + supported: "10.0.0", + }, + ], + }, + }, + prng: { + [READ]: { + since: "11.0.0", + replacedBy: [ + { name: "'crypto.randomBytes()'", supported: "0.5.8" }, + ], + }, + }, + pseudoRandomBytes: { + [READ]: { + since: "11.0.0", + replacedBy: [ + { name: "'crypto.randomBytes()'", supported: "0.5.8" }, + ], + }, + }, + rng: { + [READ]: { + since: "11.0.0", + replacedBy: [ + { name: "'crypto.randomBytes()'", supported: "0.5.8" }, + ], + }, + }, + }, + domain: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + events: { + EventEmitter: { + listenerCount: { + [READ]: { + since: "4.0.0", + replacedBy: [ + { + name: "'events.EventEmitter#listenerCount()'", + supported: "3.2.0", + }, + ], + }, + }, + }, + listenerCount: { + [READ]: { + since: "4.0.0", + replacedBy: [ + { + name: "'events.EventEmitter#listenerCount()'", + supported: "3.2.0", + }, + ], + }, + }, + }, + freelist: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + fs: { + SyncWriteStream: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + exists: { + [READ]: { + since: "4.0.0", + replacedBy: [ + { name: "'fs.stat()'", supported: "0.0.2" }, + { name: "'fs.access()'", supported: "0.11.15" }, + ], + }, + }, + lchmod: { + [READ]: { since: "0.4.0", replacedBy: null }, + }, + lchmodSync: { + [READ]: { since: "0.4.0", replacedBy: null }, + }, + }, + http: { + createClient: { + [READ]: { + since: "0.10.0", + replacedBy: [{ name: "'http.request()'", supported: "0.3.6" }], + }, + }, + }, + module: { + Module: { + createRequireFromPath: { + [READ]: { + since: "12.2.0", + replacedBy: [ + { + name: "'module.createRequire()'", + supported: "12.2.0", + }, + ], + }, + }, + requireRepl: { + [READ]: { + since: "6.0.0", + replacedBy: "'require(\"repl\")'", + }, + }, + _debug: { + [READ]: { since: "9.0.0", replacedBy: null }, + }, + }, + createRequireFromPath: { + [READ]: { + since: "12.2.0", + replacedBy: [ + { + name: "'module.createRequire()'", + supported: "12.2.0", + }, + ], + }, + }, + requireRepl: { + [READ]: { + since: "6.0.0", + replacedBy: "'require(\"repl\")'", + }, + }, + _debug: { + [READ]: { since: "9.0.0", replacedBy: null }, + }, + }, + net: { + _setSimultaneousAccepts: { + [READ]: { since: "12.0.0", replacedBy: null }, + }, + }, + os: { + getNetworkInterfaces: { + [READ]: { + since: "0.6.0", + replacedBy: [ + { name: "'os.networkInterfaces()'", supported: "0.6.0" }, + ], + }, + }, + tmpDir: { + [READ]: { + since: "7.0.0", + replacedBy: [{ name: "'os.tmpdir()'", supported: "0.9.9" }], + }, + }, + }, + path: { + _makeLong: { + [READ]: { + since: "9.0.0", + replacedBy: [ + { name: "'path.toNamespacedPath()'", supported: "9.0.0" }, + ], + }, + }, + }, + process: { + EventEmitter: { + [READ]: { + since: "0.6.0", + replacedBy: "'require(\"events\")'", + }, + }, + assert: { + [READ]: { + since: "10.0.0", + replacedBy: "'require(\"assert\")'", + }, + }, + binding: { + [READ]: { since: "10.9.0", replacedBy: null }, + }, + env: { + NODE_REPL_HISTORY_FILE: { + [READ]: { + since: "4.0.0", + replacedBy: "'NODE_REPL_HISTORY'", + }, + }, + }, + report: { + triggerReport: { + [READ]: { + since: "11.12.0", + replacedBy: "'process.report.writeReport()'", + }, + }, + }, + }, + punycode: { + [READ]: { + since: "7.0.0", + replacedBy: "'https://www.npmjs.com/package/punycode'", + }, + }, + readline: { + codePointAt: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + getStringWidth: { + [READ]: { since: "6.0.0", replacedBy: null }, + }, + isFullWidthCodePoint: { + [READ]: { since: "6.0.0", replacedBy: null }, + }, + stripVTControlCharacters: { + [READ]: { since: "6.0.0", replacedBy: null }, + }, + }, + // safe-buffer.Buffer function/constructror is just a re-export of buffer.Buffer + // and should be deprecated likewise. + "safe-buffer": { + Buffer: { + [CONSTRUCT]: { + since: "6.0.0", + replacedBy: [ + { name: "'buffer.Buffer.alloc()'", supported: "5.10.0" }, + { name: "'buffer.Buffer.from()'", supported: "5.10.0" }, + ], + }, + [CALL]: { + since: "6.0.0", + replacedBy: [ + { name: "'buffer.Buffer.alloc()'", supported: "5.10.0" }, + { name: "'buffer.Buffer.from()'", supported: "5.10.0" }, + ], + }, + }, + SlowBuffer: { + [READ]: { + since: "6.0.0", + replacedBy: [ + { + name: "'buffer.Buffer.allocUnsafeSlow()'", + supported: "5.12.0", + }, + ], + }, + }, + }, + sys: { + [READ]: { + since: "0.3.0", + replacedBy: "'util' module", + }, + }, + timers: { + enroll: { + [READ]: { + since: "10.0.0", + replacedBy: [ + { name: "'setTimeout()'", supported: "0.0.1" }, + { name: "'setInterval()'", supported: "0.0.1" }, + ], + }, + }, + unenroll: { + [READ]: { + since: "10.0.0", + replacedBy: [ + { name: "'clearTimeout()'", supported: "0.0.1" }, + { name: "'clearInterval()'", supported: "0.0.1" }, + ], + }, + }, + }, + tls: { + CleartextStream: { + [READ]: { since: "0.10.0", replacedBy: null }, + }, + CryptoStream: { + [READ]: { + since: "0.12.0", + replacedBy: [{ name: "'tls.TLSSocket'", supported: "0.11.4" }], + }, + }, + SecurePair: { + [READ]: { + since: "6.0.0", + replacedBy: [{ name: "'tls.TLSSocket'", supported: "0.11.4" }], + }, + }, + convertNPNProtocols: { + [READ]: { since: "10.0.0", replacedBy: null }, + }, + createSecurePair: { + [READ]: { + since: "6.0.0", + replacedBy: [{ name: "'tls.TLSSocket'", supported: "0.11.4" }], + }, + }, + parseCertString: { + [READ]: { + since: "8.6.0", + replacedBy: [ + { name: "'querystring.parse()'", supported: "0.1.25" }, + ], + }, + }, + }, + tty: { + setRawMode: { + [READ]: { + since: "0.10.0", + replacedBy: + "'tty.ReadStream#setRawMode()' (e.g. 'process.stdin.setRawMode()')", + }, + }, + }, + url: { + parse: { + [READ]: { + since: "11.0.0", + replacedBy: [ + { name: "'url.URL' constructor", supported: "6.13.0" }, + ], + }, + }, + resolve: { + [READ]: { + since: "11.0.0", + replacedBy: [ + { name: "'url.URL' constructor", supported: "6.13.0" }, + ], + }, + }, + }, + util: { + debug: { + [READ]: { + since: "0.12.0", + replacedBy: [ + { name: "'console.error()'", supported: "0.1.100" }, + ], + }, + }, + error: { + [READ]: { + since: "0.12.0", + replacedBy: [ + { name: "'console.error()'", supported: "0.1.100" }, + ], + }, + }, + isArray: { + [READ]: { + since: "4.0.0", + replacedBy: [ + { name: "'Array.isArray()'", supported: "0.1.100" }, + ], + }, + }, + isBoolean: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isBuffer: { + [READ]: { + since: "4.0.0", + replacedBy: [ + { name: "'Buffer.isBuffer()'", supported: "0.1.101" }, + ], + }, + }, + isDate: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isError: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isFunction: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isNull: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isNullOrUndefined: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isNumber: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isObject: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isPrimitive: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isRegExp: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isString: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isSymbol: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + isUndefined: { + [READ]: { since: "4.0.0", replacedBy: null }, + }, + log: { + [READ]: { since: "6.0.0", replacedBy: "a third party module" }, + }, + print: { + [READ]: { + since: "0.12.0", + replacedBy: [{ name: "'console.log()'", supported: "0.1.100" }], + }, + }, + pump: { + [READ]: { + since: "0.10.0", + replacedBy: [ + { name: "'stream.Readable#pipe()'", supported: "0.9.4" }, + ], + }, + }, + puts: { + [READ]: { + since: "0.12.0", + replacedBy: [{ name: "'console.log()'", supported: "0.1.100" }], + }, + }, + _extend: { + [READ]: { + since: "6.0.0", + replacedBy: [{ name: "'Object.assign()'", supported: "4.0.0" }], + }, + }, + }, + vm: { + runInDebugContext: { + [READ]: { since: "8.0.0", replacedBy: null }, + }, + }, +} +const globals = { + Buffer: { + [CONSTRUCT]: { + since: "6.0.0", + replacedBy: [ + { name: "'Buffer.alloc()'", supported: "5.10.0" }, + { name: "'Buffer.from()'", supported: "5.10.0" }, + ], + }, + [CALL]: { + since: "6.0.0", + replacedBy: [ + { name: "'Buffer.alloc()'", supported: "5.10.0" }, + { name: "'Buffer.from()'", supported: "5.10.0" }, + ], + }, + }, + COUNTER_NET_SERVER_CONNECTION: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + COUNTER_NET_SERVER_CONNECTION_CLOSE: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + COUNTER_HTTP_SERVER_REQUEST: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + COUNTER_HTTP_SERVER_RESPONSE: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + COUNTER_HTTP_CLIENT_REQUEST: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + COUNTER_HTTP_CLIENT_RESPONSE: { + [READ]: { since: "11.0.0", replacedBy: null }, + }, + GLOBAL: { + [READ]: { + since: "6.0.0", + replacedBy: [{ name: "'global'", supported: "0.1.27" }], + }, + }, + Intl: { + v8BreakIterator: { + [READ]: { since: "7.0.0", replacedBy: null }, + }, + }, + require: { + extensions: { + [READ]: { + since: "0.12.0", + replacedBy: "compiling them ahead of time", + }, + }, + }, + root: { + [READ]: { + since: "6.0.0", + replacedBy: [{ name: "'global'", supported: "0.1.27" }], + }, + }, + process: modules.process, +} + +/** + * Makes a replacement message. + * + * @param {string|array|null} replacedBy - The text of substitute way. + * @param {Range} version - The configured version range + * @returns {string} Replacement message. + */ +function toReplaceMessage(replacedBy, version) { + let message = replacedBy + + if (Array.isArray(replacedBy)) { + message = replacedBy + .filter( + ({ supported }) => + !version.intersects(getSemverRange(`<${supported}`)) + ) + .map(({ name }) => name) + .join(" or ") + } + + return message ? `. Use ${message} instead` : "" +} + +/** + * Convert a given path to name. + * @param {symbol} type The report type. + * @param {string[]} path The property access path. + * @returns {string} The name. + */ +function toName(type, path) { + const baseName = path.join(".") + return type === ReferenceTracker.CALL + ? `${baseName}()` + : type === ReferenceTracker.CONSTRUCT + ? `new ${baseName}()` + : baseName +} + +/** + * Parses the options. + * @param {RuleContext} context The rule context. + * @returns {{version:Range,ignoredGlobalItems:Set,ignoredModuleItems:Set}} Parsed + * value. + */ +function parseOptions(context) { + const raw = context.options[0] || {} + const filePath = context.getFilename() + const version = getConfiguredNodeVersion(raw.version, filePath) + const ignoredModuleItems = new Set(raw.ignoreModuleItems || []) + const ignoredGlobalItems = new Set(raw.ignoreGlobalItems || []) + + return Object.freeze({ version, ignoredGlobalItems, ignoredModuleItems }) +} + +module.exports = { + meta: { + docs: { + description: "disallow deprecated APIs", + category: "Best Practices", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-deprecated-api.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + version: { + type: "string", + }, + ignoreModuleItems: { + type: "array", + items: { + enum: Array.from(enumeratePropertyNames(modules)), + }, + additionalItems: false, + uniqueItems: true, + }, + ignoreGlobalItems: { + type: "array", + items: { + enum: Array.from(enumeratePropertyNames(globals)), + }, + additionalItems: false, + uniqueItems: true, + }, + + // Deprecated since v4.2.0 + ignoreIndirectDependencies: { type: "boolean" }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const { ignoredModuleItems, ignoredGlobalItems, version } = + parseOptions(context) + + /** + * Reports a use of a deprecated API. + * + * @param {ASTNode} node - A node to report. + * @param {string} name - The name of a deprecated API. + * @param {{since: number, replacedBy: string}} info - Information of the API. + * @returns {void} + */ + function reportItem(node, name, info) { + context.report({ + node, + loc: node.loc, + message: + "{{name}} was deprecated since v{{version}}{{replace}}.", + data: { + name, + version: info.since, + replace: toReplaceMessage(info.replacedBy, version), + }, + }) + } + + return { + "Program:exit"() { + const tracker = new ReferenceTracker(context.getScope(), { + mode: "legacy", + }) + + for (const report of tracker.iterateGlobalReferences(globals)) { + const { node, path, type, info } = report + const name = toName(type, path) + + if (!ignoredGlobalItems.has(name)) { + reportItem(node, `'${name}'`, info) + } + } + for (const report of [ + ...tracker.iterateCjsReferences(modules), + ...tracker.iterateEsmReferences(modules), + ]) { + const { node, path, type, info } = report + const name = toName(type, path) + const suffix = path.length === 1 ? " module" : "" + + if (!ignoredModuleItems.has(name)) { + reportItem(node, `'${name}'${suffix}`, info) + } + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-exports-assign.js b/node_modules/eslint-plugin-n/lib/rules/no-exports-assign.js new file mode 100644 index 0000000..d533f16 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-exports-assign.js @@ -0,0 +1,74 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { findVariable } = require("eslint-utils") + +function isExports(node, scope) { + let variable = null + + return ( + node != null && + node.type === "Identifier" && + node.name === "exports" && + (variable = findVariable(scope, node)) != null && + variable.scope.type === "global" + ) +} + +function isModuleExports(node, scope) { + let variable = null + + return ( + node != null && + node.type === "MemberExpression" && + !node.computed && + node.object.type === "Identifier" && + node.object.name === "module" && + node.property.type === "Identifier" && + node.property.name === "exports" && + (variable = findVariable(scope, node.object)) != null && + variable.scope.type === "global" + ) +} + +module.exports = { + meta: { + docs: { + description: "disallow the assignment to `exports`", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-exports-assign.md", + }, + fixable: null, + messages: { + forbidden: + "Unexpected assignment to 'exports' variable. Use 'module.exports' instead.", + }, + schema: [], + type: "problem", + }, + create(context) { + return { + AssignmentExpression(node) { + const scope = context.getScope() + if ( + !isExports(node.left, scope) || + // module.exports = exports = {} + (node.parent.type === "AssignmentExpression" && + node.parent.right === node && + isModuleExports(node.parent.left, scope)) || + // exports = module.exports = {} + (node.right.type === "AssignmentExpression" && + isModuleExports(node.right.left, scope)) + ) { + return + } + + context.report({ node, messageId: "forbidden" }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-extraneous-import.js b/node_modules/eslint-plugin-n/lib/rules/no-extraneous-import.js new file mode 100644 index 0000000..45086e9 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-extraneous-import.js @@ -0,0 +1,46 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkExtraneous = require("../util/check-extraneous") +const getAllowModules = require("../util/get-allow-modules") +const getConvertPath = require("../util/get-convert-path") +const getResolvePaths = require("../util/get-resolve-paths") +const visitImport = require("../util/visit-import") + +module.exports = { + meta: { + docs: { + description: + "disallow `import` declarations which import extraneous modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-import.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + convertPath: getConvertPath.schema, + resolvePaths: getResolvePaths.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitImport(context, {}, targets => { + checkExtraneous(context, filePath, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-extraneous-require.js b/node_modules/eslint-plugin-n/lib/rules/no-extraneous-require.js new file mode 100644 index 0000000..e0da613 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-extraneous-require.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkExtraneous = require("../util/check-extraneous") +const getAllowModules = require("../util/get-allow-modules") +const getConvertPath = require("../util/get-convert-path") +const getResolvePaths = require("../util/get-resolve-paths") +const getTryExtensions = require("../util/get-try-extensions") +const visitRequire = require("../util/visit-require") + +module.exports = { + meta: { + docs: { + description: + "disallow `require()` expressions which import extraneous modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-require.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + convertPath: getConvertPath.schema, + resolvePaths: getResolvePaths.schema, + tryExtensions: getTryExtensions.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitRequire(context, {}, targets => { + checkExtraneous(context, filePath, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-hide-core-modules.js b/node_modules/eslint-plugin-n/lib/rules/no-hide-core-modules.js new file mode 100644 index 0000000..3dd432c --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-hide-core-modules.js @@ -0,0 +1,169 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + * + * @deprecated since v4.2.0 + * This rule was based on an invalid assumption. + * No meaning. + */ +"use strict" + +const path = require("path") +const resolve = require("resolve") +const { pathToFileURL, fileURLToPath } = require("url") +const { + defaultResolve: importResolve, +} = require("../converted-esm/import-meta-resolve") +const getPackageJson = require("../util/get-package-json") +const mergeVisitorsInPlace = require("../util/merge-visitors-in-place") +const visitImport = require("../util/visit-import") +const visitRequire = require("../util/visit-require") + +const CORE_MODULES = new Set([ + "assert", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "dns", + /* "domain", */ "events", + "fs", + "http", + "https", + "module", + "net", + "os", + "path", + /* "punycode", */ "querystring", + "readline", + "repl", + "stream", + "string_decoder", + "timers", + "tls", + "tty", + "url", + "util", + "vm", + "zlib", +]) +const BACK_SLASH = /\\/gu + +module.exports = { + meta: { + docs: { + description: + "disallow third-party modules which are hiding core modules", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-hide-core-modules.md", + }, + type: "problem", + deprecated: true, + fixable: null, + schema: [ + { + type: "object", + properties: { + allow: { + type: "array", + items: { enum: Array.from(CORE_MODULES) }, + additionalItems: false, + uniqueItems: true, + }, + ignoreDirectDependencies: { type: "boolean" }, + ignoreIndirectDependencies: { type: "boolean" }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + if (context.getFilename() === "") { + return {} + } + const filePath = path.resolve(context.getFilename()) + const dirPath = path.dirname(filePath) + const packageJson = getPackageJson(filePath) + const deps = new Set( + [].concat( + Object.keys((packageJson && packageJson.dependencies) || {}), + Object.keys((packageJson && packageJson.devDependencies) || {}) + ) + ) + const options = context.options[0] || {} + const allow = options.allow || [] + const ignoreDirectDependencies = Boolean( + options.ignoreDirectDependencies + ) + const ignoreIndirectDependencies = Boolean( + options.ignoreIndirectDependencies + ) + const targets = [] + + return [ + visitImport(context, { includeCore: true }, importTargets => + targets.push(...importTargets) + ), + visitRequire(context, { includeCore: true }, requireTargets => + targets.push(...requireTargets) + ), + { + "Program:exit"() { + for (const target of targets.filter( + t => + CORE_MODULES.has(t.moduleName) && + t.moduleName === t.name + )) { + const name = target.moduleName + const allowed = + allow.indexOf(name) !== -1 || + (ignoreDirectDependencies && deps.has(name)) || + (ignoreIndirectDependencies && !deps.has(name)) + + if (allowed) { + continue + } + + let resolved = "" + const moduleId = `${name}/` + try { + resolved = resolve.sync(moduleId, { + basedir: dirPath, + }) + } catch (_error) { + try { + const { url } = importResolve(moduleId, { + parentURL: pathToFileURL(dirPath).href, + }) + + resolved = fileURLToPath(url) + } catch (_error) { + continue + } + } + + context.report({ + node: target.node, + loc: target.node.loc, + message: + "Unexpected import of third-party module '{{name}}'.", + data: { + name: path + .relative(dirPath, resolved) + .replace(BACK_SLASH, "/"), + }, + }) + } + }, + }, + ].reduce( + (mergedVisitor, thisVisitor) => + mergeVisitorsInPlace(mergedVisitor, thisVisitor), + {} + ) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-missing-import.js b/node_modules/eslint-plugin-n/lib/rules/no-missing-import.js new file mode 100644 index 0000000..df0b25a --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-missing-import.js @@ -0,0 +1,44 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkExistence = require("../util/check-existence") +const getAllowModules = require("../util/get-allow-modules") +const getResolvePaths = require("../util/get-resolve-paths") +const visitImport = require("../util/visit-import") + +module.exports = { + meta: { + docs: { + description: + "disallow `import` declarations which import non-existence modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-import.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + resolvePaths: getResolvePaths.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitImport(context, {}, targets => { + checkExistence(context, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-missing-require.js b/node_modules/eslint-plugin-n/lib/rules/no-missing-require.js new file mode 100644 index 0000000..e2781bb --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-missing-require.js @@ -0,0 +1,46 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkExistence = require("../util/check-existence") +const getAllowModules = require("../util/get-allow-modules") +const getResolvePaths = require("../util/get-resolve-paths") +const getTryExtensions = require("../util/get-try-extensions") +const visitRequire = require("../util/visit-require") + +module.exports = { + meta: { + docs: { + description: + "disallow `require()` expressions which import non-existence modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-require.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + tryExtensions: getTryExtensions.schema, + resolvePaths: getResolvePaths.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitRequire(context, {}, targets => { + checkExistence(context, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-mixed-requires.js b/node_modules/eslint-plugin-n/lib/rules/no-mixed-requires.js new file mode 100644 index 0000000..5223829 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-mixed-requires.js @@ -0,0 +1,254 @@ +/** + * @author Raphael Pigulla + * See LICENSE file in root directory for full license. + */ +"use strict" + +// This list is generated using: +// `require("module").builtinModules` +// +// This was last updated using Node v13.8.0. +const BUILTIN_MODULES = [ + "_http_agent", + "_http_client", + "_http_common", + "_http_incoming", + "_http_outgoing", + "_http_server", + "_stream_duplex", + "_stream_passthrough", + "_stream_readable", + "_stream_transform", + "_stream_wrap", + "_stream_writable", + "_tls_common", + "_tls_wrap", + "assert", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "dns", + "domain", + "events", + "fs", + "http", + "http2", + "https", + "inspector", + "module", + "net", + "os", + "path", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "string_decoder", + "sys", + "timers", + "tls", + "trace_events", + "tty", + "url", + "util", + "v8", + "vm", + "worker_threads", + "zlib", +] + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: + "disallow `require` calls to be mixed with regular variable declarations", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-mixed-requires.md", + }, + fixable: null, + schema: [ + { + oneOf: [ + { + type: "boolean", + }, + { + type: "object", + properties: { + grouping: { + type: "boolean", + }, + allowCall: { + type: "boolean", + }, + }, + additionalProperties: false, + }, + ], + }, + ], + messages: { + noMixRequire: "Do not mix 'require' and other declarations.", + noMixCoreModuleFileComputed: + "Do not mix core, module, file and computed requires.", + }, + }, + + create(context) { + const options = context.options[0] + let grouping = false + let allowCall = false + + if (typeof options === "object") { + grouping = options.grouping + allowCall = options.allowCall + } else { + grouping = Boolean(options) + } + + const DECL_REQUIRE = "require" + const DECL_UNINITIALIZED = "uninitialized" + const DECL_OTHER = "other" + + const REQ_CORE = "core" + const REQ_FILE = "file" + const REQ_MODULE = "module" + const REQ_COMPUTED = "computed" + + /** + * Determines the type of a declaration statement. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The type of declaration represented by the expression. + */ + function getDeclarationType(initExpression) { + if (!initExpression) { + // "var x;" + return DECL_UNINITIALIZED + } + + if ( + initExpression.type === "CallExpression" && + initExpression.callee.type === "Identifier" && + initExpression.callee.name === "require" + ) { + // "var x = require('util');" + return DECL_REQUIRE + } + if ( + allowCall && + initExpression.type === "CallExpression" && + initExpression.callee.type === "CallExpression" + ) { + // "var x = require('diagnose')('sub-module');" + return getDeclarationType(initExpression.callee) + } + if (initExpression.type === "MemberExpression") { + // "var x = require('glob').Glob;" + return getDeclarationType(initExpression.object) + } + + // "var x = 42;" + return DECL_OTHER + } + + /** + * Determines the type of module that is loaded via require. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The module type. + */ + function inferModuleType(initExpression) { + if (initExpression.type === "MemberExpression") { + // "var x = require('glob').Glob;" + return inferModuleType(initExpression.object) + } + if (initExpression.arguments.length === 0) { + // "var x = require();" + return REQ_COMPUTED + } + + const arg = initExpression.arguments[0] + + if (arg.type !== "Literal" || typeof arg.value !== "string") { + // "var x = require(42);" + return REQ_COMPUTED + } + + if (BUILTIN_MODULES.indexOf(arg.value) !== -1) { + // "var fs = require('fs');" + return REQ_CORE + } + if (/^\.{0,2}\//u.test(arg.value)) { + // "var utils = require('./utils');" + return REQ_FILE + } + + // "var async = require('async');" + return REQ_MODULE + } + + /** + * Check if the list of variable declarations is mixed, i.e. whether it + * contains both require and other declarations. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are mixed, false if not. + */ + function isMixed(declarations) { + const contains = {} + + for (const declaration of declarations) { + const type = getDeclarationType(declaration.init) + + contains[type] = true + } + + return Boolean( + contains[DECL_REQUIRE] && + (contains[DECL_UNINITIALIZED] || contains[DECL_OTHER]) + ) + } + + /** + * Check if all require declarations in the given list are of the same + * type. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are grouped, false if not. + */ + function isGrouped(declarations) { + const found = {} + + for (const declaration of declarations) { + if (getDeclarationType(declaration.init) === DECL_REQUIRE) { + found[inferModuleType(declaration.init)] = true + } + } + + return Object.keys(found).length <= 1 + } + + return { + VariableDeclaration(node) { + if (isMixed(node.declarations)) { + context.report({ + node, + messageId: "noMixRequire", + }) + } else if (grouping && !isGrouped(node.declarations)) { + context.report({ + node, + messageId: "noMixCoreModuleFileComputed", + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-new-require.js b/node_modules/eslint-plugin-n/lib/rules/no-new-require.js new file mode 100644 index 0000000..fc34efc --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-new-require.js @@ -0,0 +1,38 @@ +/** + * @author Wil Moore III + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "disallow `new` operators with calls to `require`", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-new-require.md", + }, + fixable: null, + schema: [], + messages: { + noNewRequire: "Unexpected use of new with require.", + }, + }, + + create(context) { + return { + NewExpression(node) { + if ( + node.callee.type === "Identifier" && + node.callee.name === "require" + ) { + context.report({ + node, + messageId: "noNewRequire", + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-path-concat.js b/node_modules/eslint-plugin-n/lib/rules/no-path-concat.js new file mode 100644 index 0000000..99810d7 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-path-concat.js @@ -0,0 +1,211 @@ +/** + * @author Nicholas C. Zakas + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const { READ, ReferenceTracker, getStringIfConstant } = require("eslint-utils") + +/** + * Get the first char of the specified template element. + * @param {TemplateLiteral} node The `TemplateLiteral` node to get. + * @param {number} i The number of template elements to get first char. + * @param {Set} sepNodes The nodes of `path.sep`. + * @param {import("escope").Scope} globalScope The global scope object. + * @param {string[]} outNextChars The array to collect chars. + * @returns {void} + */ +function collectFirstCharsOfTemplateElement( + node, + i, + sepNodes, + globalScope, + outNextChars +) { + const element = node.quasis[i].value.cooked + + if (element == null) { + return + } + if (element !== "") { + outNextChars.push(element[0]) + return + } + if (node.expressions.length > i) { + collectFirstChars( + node.expressions[i], + sepNodes, + globalScope, + outNextChars + ) + } +} + +/** + * Get the first char of a given node. + * @param {TemplateLiteral} node The `TemplateLiteral` node to get. + * @param {Set} sepNodes The nodes of `path.sep`. + * @param {import("escope").Scope} globalScope The global scope object. + * @param {string[]} outNextChars The array to collect chars. + * @returns {void} + */ +function collectFirstChars(node, sepNodes, globalScope, outNextChars) { + switch (node.type) { + case "AssignmentExpression": + collectFirstChars(node.right, sepNodes, globalScope, outNextChars) + break + case "BinaryExpression": + collectFirstChars(node.left, sepNodes, globalScope, outNextChars) + break + case "ConditionalExpression": + collectFirstChars( + node.consequent, + sepNodes, + globalScope, + outNextChars + ) + collectFirstChars( + node.alternate, + sepNodes, + globalScope, + outNextChars + ) + break + case "LogicalExpression": + collectFirstChars(node.left, sepNodes, globalScope, outNextChars) + collectFirstChars(node.right, sepNodes, globalScope, outNextChars) + break + case "SequenceExpression": + collectFirstChars( + node.expressions[node.expressions.length - 1], + sepNodes, + globalScope, + outNextChars + ) + break + case "TemplateLiteral": + collectFirstCharsOfTemplateElement( + node, + 0, + sepNodes, + globalScope, + outNextChars + ) + break + + case "Identifier": + case "MemberExpression": + if (sepNodes.has(node)) { + outNextChars.push(path.sep) + break + } + // fallthrough + default: { + const str = getStringIfConstant(node, globalScope) + if (str) { + outNextChars.push(str[0]) + } + } + } +} + +/** + * Check if a char is a path separator or not. + * @param {string} c The char to check. + * @returns {boolean} `true` if the char is a path separator. + */ +function isPathSeparator(c) { + return c === "/" || c === path.sep +} + +/** + * Check if the given Identifier node is followed by string concatenation with a + * path separator. + * @param {Identifier} node The `__dirname` or `__filename` node to check. + * @param {Set} sepNodes The nodes of `path.sep`. + * @param {import("escope").Scope} globalScope The global scope object. + * @returns {boolean} `true` if the given Identifier node is followed by string + * concatenation with a path separator. + */ +function isConcat(node, sepNodes, globalScope) { + const parent = node.parent + const nextChars = [] + + if ( + parent.type === "BinaryExpression" && + parent.operator === "+" && + parent.left === node + ) { + collectFirstChars( + parent.right, + sepNodes, + globalScope, + /* out */ nextChars + ) + } else if (parent.type === "TemplateLiteral") { + collectFirstCharsOfTemplateElement( + parent, + parent.expressions.indexOf(node) + 1, + sepNodes, + globalScope, + /* out */ nextChars + ) + } + + return nextChars.some(isPathSeparator) +} + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: + "disallow string concatenation with `__dirname` and `__filename`", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-path-concat.md", + }, + fixable: null, + schema: [], + messages: { + usePathFunctions: + "Use path.join() or path.resolve() instead of string concatenation.", + }, + }, + + create(context) { + return { + "Program:exit"() { + const globalScope = context.getScope() + const tracker = new ReferenceTracker(globalScope) + const sepNodes = new Set() + + // Collect `paht.sep` references + for (const { node } of tracker.iterateCjsReferences({ + path: { sep: { [READ]: true } }, + })) { + sepNodes.add(node) + } + for (const { node } of tracker.iterateEsmReferences({ + path: { sep: { [READ]: true } }, + })) { + sepNodes.add(node) + } + + // Verify `__dirname` and `__filename` + for (const { node } of tracker.iterateGlobalReferences({ + __dirname: { [READ]: true }, + __filename: { [READ]: true }, + })) { + if (isConcat(node, sepNodes, globalScope)) { + context.report({ + node: node.parent, + messageId: "usePathFunctions", + }) + } + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-process-env.js b/node_modules/eslint-plugin-n/lib/rules/no-process-env.js new file mode 100644 index 0000000..b4ed061 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-process-env.js @@ -0,0 +1,44 @@ +/** + * @author Vignesh Anand + * See LICENSE file in root directory for full license. + */ +"use strict" + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "disallow the use of `process.env`", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-process-env.md", + }, + fixable: null, + schema: [], + messages: { + unexpectedProcessEnv: "Unexpected use of process.env.", + }, + }, + + create(context) { + return { + MemberExpression(node) { + const objectName = node.object.name + const propertyName = node.property.name + + if ( + objectName === "process" && + !node.computed && + propertyName && + propertyName === "env" + ) { + context.report({ node, messageId: "unexpectedProcessEnv" }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-process-exit.js b/node_modules/eslint-plugin-n/lib/rules/no-process-exit.js new file mode 100644 index 0000000..bcde3c6 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-process-exit.js @@ -0,0 +1,35 @@ +/** + * @author Nicholas C. Zakas + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "disallow the use of `process.exit()`", + category: "Possible Errors", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-process-exit.md", + }, + fixable: null, + schema: [], + messages: { + noProcessExit: "Don't use process.exit(); throw an error instead.", + }, + }, + + create(context) { + return { + "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"( + node + ) { + context.report({ + node: node.parent, + messageId: "noProcessExit", + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-restricted-import.js b/node_modules/eslint-plugin-n/lib/rules/no-restricted-import.js new file mode 100644 index 0000000..28fa7b3 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-restricted-import.js @@ -0,0 +1,60 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const check = require("../util/check-restricted") +const visit = require("../util/visit-import") + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: + "disallow specified modules when loaded by `import` declarations", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-restricted-import.md", + }, + fixable: null, + schema: [ + { + type: "array", + items: { + anyOf: [ + { type: "string" }, + { + type: "object", + properties: { + name: { + anyOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + }, + ], + }, + message: { type: "string" }, + }, + additionalProperties: false, + required: ["name"], + }, + ], + }, + additionalItems: false, + }, + ], + messages: { + restricted: + "'{{name}}' module is restricted from being used.{{customMessage}}", + }, + }, + + create(context) { + const opts = { includeCore: true } + return visit(context, opts, targets => check(context, targets)) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-restricted-require.js b/node_modules/eslint-plugin-n/lib/rules/no-restricted-require.js new file mode 100644 index 0000000..43b73b8 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-restricted-require.js @@ -0,0 +1,60 @@ +/** + * @author Christian Schulz + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const check = require("../util/check-restricted") +const visit = require("../util/visit-require") + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "disallow specified modules when loaded by `require`", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-restricted-require.md", + }, + fixable: null, + schema: [ + { + type: "array", + items: { + anyOf: [ + { type: "string" }, + { + type: "object", + properties: { + name: { + anyOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + }, + ], + }, + message: { type: "string" }, + }, + additionalProperties: false, + required: ["name"], + }, + ], + }, + additionalItems: false, + }, + ], + messages: { + restricted: + "'{{name}}' module is restricted from being used.{{customMessage}}", + }, + }, + + create(context) { + const opts = { includeCore: true } + return visit(context, opts, targets => check(context, targets)) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-sync.js b/node_modules/eslint-plugin-n/lib/rules/no-sync.js new file mode 100644 index 0000000..5a9997c --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-sync.js @@ -0,0 +1,52 @@ +/** + * @author Matt DuVall + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = { + meta: { + type: "suggestion", + docs: { + description: "disallow synchronous methods", + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-sync.md", + }, + fixable: null, + schema: [ + { + type: "object", + properties: { + allowAtRootLevel: { + type: "boolean", + default: false, + }, + }, + additionalProperties: false, + }, + ], + messages: { + noSync: "Unexpected sync method: '{{propertyName}}'.", + }, + }, + + create(context) { + const selector = + context.options[0] && context.options[0].allowAtRootLevel + ? ":function MemberExpression[property.name=/.*Sync$/]" + : "MemberExpression[property.name=/.*Sync$/]" + + return { + [selector](node) { + context.report({ + node, + messageId: "noSync", + data: { + propertyName: node.property.name, + }, + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unpublished-bin.js b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-bin.js new file mode 100644 index 0000000..d14e4d7 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-bin.js @@ -0,0 +1,96 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const getConvertPath = require("../util/get-convert-path") +const getNpmignore = require("../util/get-npmignore") +const getPackageJson = require("../util/get-package-json") + +/** + * Checks whether or not a given path is a `bin` file. + * + * @param {string} filePath - A file path to check. + * @param {string|object|undefined} binField - A value of the `bin` field of `package.json`. + * @param {string} basedir - A directory path that `package.json` exists. + * @returns {boolean} `true` if the file is a `bin` file. + */ +function isBinFile(filePath, binField, basedir) { + if (!binField) { + return false + } + if (typeof binField === "string") { + return filePath === path.resolve(basedir, binField) + } + return Object.keys(binField).some( + key => filePath === path.resolve(basedir, binField[key]) + ) +} + +module.exports = { + meta: { + docs: { + description: "disallow `bin` files that npm ignores", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-bin.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + // + convertPath: getConvertPath.schema, + }, + }, + ], + }, + create(context) { + return { + Program(node) { + // Check file path. + let rawFilePath = context.getFilename() + if (rawFilePath === "") { + return + } + rawFilePath = path.resolve(rawFilePath) + + // Find package.json + const p = getPackageJson(rawFilePath) + if (!p) { + return + } + + // Convert by convertPath option + const basedir = path.dirname(p.filePath) + const relativePath = getConvertPath(context)( + path.relative(basedir, rawFilePath).replace(/\\/gu, "/") + ) + const filePath = path.join(basedir, relativePath) + + // Check this file is bin. + if (!isBinFile(filePath, p.bin, basedir)) { + return + } + + // Check ignored or not + const npmignore = getNpmignore(filePath) + if (!npmignore.match(relativePath)) { + return + } + + // Report. + context.report({ + node, + message: + "npm ignores '{{name}}'. Check 'files' field of 'package.json' or '.npmignore'.", + data: { name: relativePath }, + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unpublished-import.js b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-import.js new file mode 100644 index 0000000..654b6b1 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-import.js @@ -0,0 +1,46 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkPublish = require("../util/check-publish") +const getAllowModules = require("../util/get-allow-modules") +const getConvertPath = require("../util/get-convert-path") +const getResolvePaths = require("../util/get-resolve-paths") +const visitImport = require("../util/visit-import") + +module.exports = { + meta: { + docs: { + description: + "disallow `import` declarations which import private modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-import.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + convertPath: getConvertPath.schema, + resolvePaths: getResolvePaths.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitImport(context, {}, targets => { + checkPublish(context, filePath, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unpublished-require.js b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-require.js new file mode 100644 index 0000000..fd402c8 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unpublished-require.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const checkPublish = require("../util/check-publish") +const getAllowModules = require("../util/get-allow-modules") +const getConvertPath = require("../util/get-convert-path") +const getResolvePaths = require("../util/get-resolve-paths") +const getTryExtensions = require("../util/get-try-extensions") +const visitRequire = require("../util/visit-require") + +module.exports = { + meta: { + docs: { + description: + "disallow `require()` expressions which import private modules", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-require.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + allowModules: getAllowModules.schema, + convertPath: getConvertPath.schema, + resolvePaths: getResolvePaths.schema, + tryExtensions: getTryExtensions.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const filePath = context.getFilename() + if (filePath === "") { + return {} + } + + return visitRequire(context, {}, targets => { + checkPublish(context, filePath, targets) + }) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features.js b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features.js new file mode 100644 index 0000000..456636c --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features.js @@ -0,0 +1,1542 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const semver = require("semver") +const { getInnermostScope, getPropertyName } = require("eslint-utils") +const getPackageJson = require("../util/get-package-json") + +const VERSION_MAP = new Map([ + [0.1, "0.10.0"], + [0.12, "0.12.0"], + [4, "4.0.0"], + [5, "5.0.0"], + [6, "6.0.0"], + [6.5, "6.5.0"], + [7, "7.0.0"], + [7.6, "7.6.0"], + [8, "8.0.0"], + [8.3, "8.3.0"], + [9, "9.0.0"], + [10, "10.0.0"], +]) +const VERSION_SCHEMA = { + anyOf: [ + { enum: Array.from(VERSION_MAP.keys()) }, + { + type: "string", + pattern: "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$", + }, + ], +} +const DEFAULT_VERSION = "4.0.0" +const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/u +const CLASS_TYPE = /^Class(?:Declaration|Expression)$/u +const DESTRUCTURING_PARENT_TYPE = + /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/u +const TOPLEVEL_SCOPE_TYPE = /^(?:global|function|module)$/u +const BINARY_NUMBER = /^0[bB]/u +const OCTAL_NUMBER = /^0[oO]/u +const UNICODE_ESC = /(\\+)u\{[0-9a-fA-F]+?\}/gu +const GET_OR_SET = /^(?:g|s)et$/u +const NEW_BUILTIN_TYPES = [ + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "DataView", + "Map", + "Set", + "WeakMap", + "WeakSet", + "Proxy", + "Reflect", + "Promise", + "Symbol", + "SharedArrayBuffer", + "Atomics", +] +const SUBCLASSING_TEST_TARGETS = [ + "Array", + "RegExp", + "Function", + "Promise", + "Boolean", + "Number", + "String", + "Map", + "Set", +] +const PROPERTY_TEST_TARGETS = { + Object: [ + "assign", + "is", + "getOwnPropertySymbols", + "setPrototypeOf", + "values", + "entries", + "getOwnPropertyDescriptors", + ], + String: ["raw", "fromCodePoint"], + Array: ["from", "of"], + Number: [ + "isFinite", + "isInteger", + "isSafeInteger", + "isNaN", + "EPSILON", + "MIN_SAFE_INTEGER", + "MAX_SAFE_INTEGER", + ], + Math: [ + "clz32", + "imul", + "sign", + "log10", + "log2", + "log1p", + "expm1", + "cosh", + "sinh", + "tanh", + "acosh", + "asinh", + "atanh", + "trunc", + "fround", + "cbrt", + "hypot", + ], + Symbol: [ + "hasInstance", + "isConcatSpreadablec", + "iterator", + "species", + "replace", + "search", + "split", + "match", + "toPrimitive", + "toStringTag", + "unscopables", + ], + Atomics: [ + "add", + "and", + "compareExchange", + "exchange", + "wait", + "wake", + "isLockFree", + "load", + "or", + "store", + "sub", + "xor", + ], +} +const REGEXP_NAMED_GROUP = /(\\*)\(\?<[_$\w]/u +const REGEXP_LOOKBEHIND = /(\\*)\(\?<[=!]/u +const REGEXP_UNICODE_PROPERTY = /(\\*)\\[pP]\{.+?\}/u +const FEATURES = { + defaultParameters: { + alias: ["syntax"], + name: "Default parameters", + node: "6.0.0", + }, + restParameters: { + alias: ["syntax"], + name: "Rest parameters", + node: "6.0.0", + }, + spreadOperators: { + alias: ["syntax"], + name: "Spread operators", + node: "5.0.0", + }, + objectLiteralExtensions: { + alias: ["syntax"], + name: "Object literal extensions", + node: "4.0.0", + }, + objectPropertyShorthandOfGetSet: { + alias: ["syntax", "objectLiteralExtensions"], + name: "Property shorthand of 'get' and 'set'", + node: "6.0.0", + }, + forOf: { + alias: ["syntax"], + name: "'for..of' loops", + node: "0.12.0", + }, + binaryNumberLiterals: { + alias: ["syntax"], + name: "Binary number literals", + node: "4.0.0", + }, + octalNumberLiterals: { + alias: ["syntax"], + name: "Octal number literals", + node: "4.0.0", + }, + templateStrings: { + alias: ["syntax"], + name: "Template strings", + node: "4.0.0", + }, + regexpY: { + alias: ["syntax"], + name: "RegExp 'y' flags", + node: "6.0.0", + }, + regexpU: { + alias: ["syntax"], + name: "RegExp 'u' flags", + node: "6.0.0", + }, + destructuring: { + alias: ["syntax"], + name: "Destructuring", + node: "6.0.0", + }, + unicodeCodePointEscapes: { + alias: ["syntax"], + name: "Unicode code point escapes", + node: "4.0.0", + }, + "new.target": { + alias: ["syntax"], + name: "'new.target'", + node: "5.0.0", + }, + const: { + alias: ["syntax"], + name: "'const' declarations", + node: { + sloppy: "6.0.0", + strict: "4.0.0", + }, + }, + let: { + alias: ["syntax"], + name: "'let' declarations", + node: { + sloppy: "6.0.0", + strict: "4.0.0", + }, + }, + blockScopedFunctions: { + alias: ["syntax"], + name: "Block-scoped functions", + node: { + sloppy: "6.0.0", + strict: "4.0.0", + }, + }, + arrowFunctions: { + alias: ["syntax"], + name: "Arrow functions", + node: "4.0.0", + }, + generatorFunctions: { + alias: ["syntax"], + name: "Generator functions", + node: "4.0.0", + }, + classes: { + alias: ["syntax"], + name: "Classes", + node: { + sloppy: "6.0.0", + strict: "4.0.0", + }, + }, + modules: { + alias: ["syntax"], + name: "Import and export declarations", + node: null, + }, + exponentialOperators: { + alias: ["syntax"], + name: "Exponential operators (**)", + node: "7.0.0", + }, + asyncAwait: { + alias: ["syntax"], + name: "Async functions", + node: "7.6.0", + }, + trailingCommasInFunctions: { + alias: ["syntax"], + name: "Trailing commas in functions", + node: "8.0.0", + }, + //------------------------------------------ + templateLiteralRevision: { + alias: ["syntax"], + name: "Illegal escape sequences in taggled templates", + node: "9.0.0", + }, + regexpS: { + alias: ["syntax"], + name: "RegExp 's' flags", + node: "9.0.0", + }, + regexpNamedCaptureGroups: { + alias: ["syntax"], + name: "RegExp named capture groups", + node: "10.0.0", + }, + regexpLookbehind: { + alias: ["syntax"], + name: "RegExp lookbehind assertions", + node: "9.0.0", + }, + regexpUnicodeProperties: { + alias: ["syntax"], + name: "RegExp Unicode property escapes", + node: "10.0.0", + }, + restProperties: { + alias: ["syntax"], + name: "Rest properties", + node: "8.3.0", + }, + spreadProperties: { + alias: ["syntax"], + name: "Spread properties", + node: "8.3.0", + }, + asyncGenerators: { + alias: ["syntax"], + name: "Async generators", + node: "10.0.0", + }, + forAwaitOf: { + alias: ["syntax"], + name: "for-await-of loops", + node: "10.0.0", + }, + + Int8Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Int8Array'", + singular: true, + node: "0.12.0", + }, + Uint8Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Uint8Array'", + singular: true, + node: "0.12.0", + }, + Uint8ClampedArray: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Uint8ClampedArray'", + singular: true, + node: "0.12.0", + }, + Int16Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Int16Array'", + singular: true, + node: "0.12.0", + }, + Uint16Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Uint16Array'", + singular: true, + node: "0.12.0", + }, + Int32Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Int32Array'", + singular: true, + node: "0.12.0", + }, + Uint32Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Uint32Array'", + singular: true, + node: "0.12.0", + }, + Float32Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Float32Array'", + singular: true, + node: "0.12.0", + }, + Float64Array: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'Float64Array'", + singular: true, + node: "0.12.0", + }, + DataView: { + alias: ["runtime", "globalObjects", "typedArrays"], + name: "'DataView'", + singular: true, + node: "0.12.0", + }, + Map: { + alias: ["runtime", "globalObjects"], + name: "'Map'", + singular: true, + node: "0.12.0", + }, + Set: { + alias: ["runtime", "globalObjects"], + name: "'Set'", + singular: true, + node: "0.12.0", + }, + WeakMap: { + alias: ["runtime", "globalObjects"], + name: "'WeakMap'", + singular: true, + node: "0.12.0", + }, + WeakSet: { + alias: ["runtime", "globalObjects"], + name: "'WeakSet'", + singular: true, + node: "0.12.0", + }, + Proxy: { + alias: ["runtime", "globalObjects"], + name: "'Proxy'", + singular: true, + node: "6.0.0", + }, + Reflect: { + alias: ["runtime", "globalObjects"], + name: "'Reflect'", + singular: true, + node: "6.0.0", + }, + Promise: { + alias: ["runtime", "globalObjects"], + name: "'Promise'", + singular: true, + node: "0.12.0", + }, + Symbol: { + alias: ["runtime", "globalObjects"], + name: "'Symbol'", + singular: true, + node: "0.12.0", + }, + SharedArrayBuffer: { + alias: ["runtime", "globalObjects"], + name: "'SharedArrayBuffer'", + singular: true, + node: "9.0.0", + }, + Atomics: { + alias: ["runtime", "globalObjects"], + name: "'Atomics'", + singular: true, + node: "9.0.0", + }, + + "Object.assign": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.assign'", + singular: true, + node: "4.0.0", + }, + "Object.is": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.is'", + singular: true, + node: "0.12.0", + }, + "Object.getOwnPropertySymbols": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.getOwnPropertySymbols'", + singular: true, + node: "0.12.0", + }, + "Object.setPrototypeOf": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.setPrototypeOf'", + singular: true, + node: "0.12.0", + }, + "Object.values": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.values'", + singular: true, + node: "7.0.0", + }, + "Object.entries": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.entries'", + singular: true, + node: "7.0.0", + }, + "Object.getOwnPropertyDescriptors": { + alias: ["runtime", "staticMethods", "Object.*"], + name: "'Object.getOwnPropertyDescriptors'", + singular: true, + node: "7.0.0", + }, + + "String.raw": { + alias: ["runtime", "staticMethods", "String.*"], + name: "'String.raw'", + singular: true, + node: "4.0.0", + }, + "String.fromCodePoint": { + alias: ["runtime", "staticMethods", "String.*"], + name: "'String.fromCodePoint'", + singular: true, + node: "4.0.0", + }, + + "Array.from": { + alias: ["runtime", "staticMethods", "Array.*"], + name: "'Array.from'", + singular: true, + node: "4.0.0", + }, + "Array.of": { + alias: ["runtime", "staticMethods", "Array.*"], + name: "'Array.of'", + singular: true, + node: "4.0.0", + }, + + "Number.isFinite": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.isFinite'", + singular: true, + node: "0.10.0", + }, + "Number.isInteger": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.isInteger'", + singular: true, + node: "0.12.0", + }, + "Number.isSafeInteger": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.isSafeInteger'", + singular: true, + node: "0.12.0", + }, + "Number.isNaN": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.isNaN'", + singular: true, + node: "0.10.0", + }, + "Number.EPSILON": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.EPSILON'", + singular: true, + node: "0.12.0", + }, + "Number.MIN_SAFE_INTEGER": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.MIN_SAFE_INTEGER'", + singular: true, + node: "0.12.0", + }, + "Number.MAX_SAFE_INTEGER": { + alias: ["runtime", "staticMethods", "Number.*"], + name: "'Number.MAX_SAFE_INTEGER'", + singular: true, + node: "0.12.0", + }, + + "Math.clz32": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.clz32'", + singular: true, + node: "0.12.0", + }, + "Math.imul": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.imul'", + singular: true, + node: "0.12.0", + }, + "Math.sign": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.sign'", + singular: true, + node: "0.12.0", + }, + "Math.log10": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.log10'", + singular: true, + node: "0.12.0", + }, + "Math.log2": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.log2'", + singular: true, + node: "0.12.0", + }, + "Math.log1p": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.log1p'", + singular: true, + node: "0.12.0", + }, + "Math.expm1": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.expm1'", + singular: true, + node: "0.12.0", + }, + "Math.cosh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.cosh'", + singular: true, + node: "0.12.0", + }, + "Math.sinh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.sinh'", + singular: true, + node: "0.12.0", + }, + "Math.tanh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.tanh'", + singular: true, + node: "0.12.0", + }, + "Math.acosh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.acosh'", + singular: true, + node: "0.12.0", + }, + "Math.asinh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.asinh'", + singular: true, + node: "0.12.0", + }, + "Math.atanh": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.atanh'", + singular: true, + node: "0.12.0", + }, + "Math.trunc": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.trunc'", + singular: true, + node: "0.12.0", + }, + "Math.fround": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.fround'", + singular: true, + node: "0.12.0", + }, + "Math.cbrt": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.cbrt'", + singular: true, + node: "0.12.0", + }, + "Math.hypot": { + alias: ["runtime", "staticMethods", "Math.*"], + name: "'Math.hypot'", + singular: true, + node: "0.12.0", + }, + + "Symbol.hasInstance": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.hasInstance'", + singular: true, + node: "6.5.0", + }, + "Symbol.isConcatSpreadablec": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.isConcatSpreadablec'", + singular: true, + node: "6.0.0", + }, + "Symbol.iterator": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.iterator'", + singular: true, + node: "0.12.0", + }, + "Symbol.species": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.species'", + singular: true, + node: "6.5.0", + }, + "Symbol.replace": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.replace'", + singular: true, + node: "6.0.0", + }, + "Symbol.search": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.search'", + singular: true, + node: "6.0.0", + }, + "Symbol.split": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.split'", + singular: true, + node: "6.0.0", + }, + "Symbol.match": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.match'", + singular: true, + node: "6.0.0", + }, + "Symbol.toPrimitive": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.toPrimitive'", + singular: true, + node: "6.0.0", + }, + "Symbol.toStringTag": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.toStringTag'", + singular: true, + node: "6.0.0", + }, + "Symbol.unscopables": { + alias: ["runtime", "staticMethods", "Symbol.*"], + name: "'Symbol.unscopables'", + singular: true, + node: "4.0.0", + }, + + "Atomics.add": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.add'", + singular: true, + node: "9.0.0", + }, + "Atomics.and": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.and'", + singular: true, + node: "9.0.0", + }, + "Atomics.compareExchange": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.compareExchange'", + singular: true, + node: "9.0.0", + }, + "Atomics.exchange": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.exchange'", + singular: true, + node: "9.0.0", + }, + "Atomics.wait": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.wait'", + singular: true, + node: "9.0.0", + }, + "Atomics.wake": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.wake'", + singular: true, + node: "9.0.0", + }, + "Atomics.isLockFree": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.isLockFree'", + singular: true, + node: "9.0.0", + }, + "Atomics.load": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.load'", + singular: true, + node: "9.0.0", + }, + "Atomics.or": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.or'", + singular: true, + node: "9.0.0", + }, + "Atomics.store": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.store'", + singular: true, + node: "9.0.0", + }, + "Atomics.sub": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.sub'", + singular: true, + node: "9.0.0", + }, + "Atomics.xor": { + alias: ["runtime", "staticMethods", "Atomics.*"], + name: "'Atomics.xor'", + singular: true, + node: "9.0.0", + }, + + extendsArray: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Array'", + singular: true, + node: "6.0.0", + }, + extendsRegExp: { + alias: ["runtime", "extends"], + name: "Subclassing of 'RegExp'", + singular: true, + node: "5.0.0", + }, + extendsFunction: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Function'", + singular: true, + node: "6.0.0", + }, + extendsPromise: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Promise'", + singular: true, + node: "5.0.0", + }, + extendsBoolean: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Boolean'", + singular: true, + node: "4.0.0", + }, + extendsNumber: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Number'", + singular: true, + node: "4.0.0", + }, + extendsString: { + alias: ["runtime", "extends"], + name: "Subclassing of 'String'", + singular: true, + node: "4.0.0", + }, + extendsMap: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Map'", + singular: true, + node: "4.0.0", + }, + extendsSet: { + alias: ["runtime", "extends"], + name: "Subclassing of 'Set'", + singular: true, + node: "4.0.0", + }, + extendsNull: { + alias: ["runtime", "extends"], + name: "'extends null'", + singular: true, + node: null, + }, +} +const OPTIONS = Object.keys(FEATURES) + +/** + * Gets default version configuration of this rule. + * + * This finds and reads 'package.json' file, then parses 'engines.node' field. + * If it's nothing, this returns null. + * + * @param {string} filename - The file name of the current linting file. + * @returns {string} The default version configuration. + */ +function getDefaultVersion(filename) { + const info = getPackageJson(filename) + const nodeVersion = info && info.engines && info.engines.node + + return semver.validRange(nodeVersion) || DEFAULT_VERSION +} + +/** + * Gets values of the `ignores` option. + * + * @returns {string[]} Values of the `ignores` option. + */ +function getIgnoresEnum() { + return Object.keys( + OPTIONS.reduce((retv, key) => { + for (const alias of FEATURES[key].alias) { + retv[alias] = true + } + retv[key] = true + return retv + }, Object.create(null)) + ) +} + +/** + * Checks whether a given key should be ignored or not. + * + * @param {string} key - A key to check. + * @param {string[]} ignores - An array of keys and aliases to be ignored. + * @returns {boolean} `true` if the key should be ignored. + */ +function isIgnored(key, ignores) { + return ( + ignores.indexOf(key) !== -1 || + FEATURES[key].alias.some(alias => ignores.indexOf(alias) !== -1) + ) +} + +/** + * Parses the options. + * + * @param {number|string|object|undefined} options - An option object to parse. + * @param {number} defaultVersion - The default version to use if the version option was omitted. + * @returns {object} Parsed value. + */ +function parseOptions(options, defaultVersion) { + let version = null + let range = null + let ignores = [] + + if (typeof options === "number") { + version = VERSION_MAP.get(options) + } else if (typeof options === "string") { + version = options + } else if (typeof options === "object") { + version = + typeof options.version === "number" + ? VERSION_MAP.get(options.version) + : options.version + + ignores = options.ignores || [] + } + + range = semver.validRange(version ? `>=${version}` : defaultVersion) + if (!version) { + version = defaultVersion + } + + return Object.freeze({ + version, + features: Object.freeze( + OPTIONS.reduce((retv, key) => { + const feature = FEATURES[key] + + if (isIgnored(key, ignores)) { + retv[key] = Object.freeze({ + name: feature.name, + singular: Boolean(feature.singular), + supported: true, + supportedInStrict: true, + }) + } else if (typeof feature.node === "string") { + retv[key] = Object.freeze({ + name: feature.name, + singular: Boolean(feature.singular), + supported: !semver.intersects( + range, + `<${feature.node}` + ), + supportedInStrict: !semver.intersects( + range, + `<${feature.node}` + ), + }) + } else { + retv[key] = Object.freeze({ + name: feature.name, + singular: Boolean(feature.singular), + supported: + feature.node != null && + feature.node.sloppy != null && + !semver.intersects( + range, + `<${feature.node.sloppy}` + ), + supportedInStrict: + feature.node != null && + feature.node.strict != null && + !semver.intersects( + range, + `<${feature.node.strict}` + ), + }) + } + + return retv + }, Object.create(null)) + ), + }) +} + +/** + * Find the scope that a given node belongs to. + * @param {Scope} initialScope The initial scope to find. + * @param {Node} node The AST node. + * @returns {Scope} The scope that the node belongs to. + */ +function normalizeScope(initialScope, node) { + let scope = getInnermostScope(initialScope, node) + + while (scope && scope.block === node) { + scope = scope.upper + } + + return scope +} + +/** + * Checks whether the given string has `\u{90ABCDEF}`-like escapes. + * + * @param {string} raw - The string to check. + * @returns {boolean} `true` if the string has Unicode code point escapes. + */ +function hasUnicodeCodePointEscape(raw) { + let match = null + + UNICODE_ESC.lastIndex = 0 + while ((match = UNICODE_ESC.exec(raw)) != null) { + if (match[1].length % 2 === 1) { + return true + } + } + + return false +} + +/** + * Check a given string has a given pattern. + * @param {string} s A string to check. + * @param {RegExp} pattern A RegExp object to check. + * @returns {boolean} `true` if the string has the pattern. + */ +function hasPattern(s, pattern) { + const m = pattern.exec(s) + return m != null && (m[1] || "").length % 2 === 0 +} + +module.exports = { + meta: { + docs: { + description: + "disallow unsupported ECMAScript features on the specified version", + category: "Possible Errors", + recommended: false, + replacedBy: [ + "n/no-unsupported-features/es-syntax", + "n/no-unsupported-features/es-builtins", + ], + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unsupported-features.md", + }, + type: "problem", + deprecated: true, + fixable: null, + schema: [ + { + anyOf: [ + VERSION_SCHEMA.anyOf[0], + VERSION_SCHEMA.anyOf[1], + { + type: "object", + properties: { + version: VERSION_SCHEMA, + ignores: { + type: "array", + items: { enum: getIgnoresEnum() }, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + }, + ], + }, + create(context) { + const sourceCode = context.getSourceCode() + const supportInfo = parseOptions( + context.options[0], + getDefaultVersion(context.getFilename()) + ) + + /** + * Gets the references of the specified global variables. + * + * @param {string[]} names - Variable names to get. + * @returns {void} + */ + function* getReferences(names) { + const globalScope = context.getScope() + + for (const name of names) { + const variable = globalScope.set.get(name) + + if (variable && variable.defs.length === 0) { + yield* variable.references + } + } + } + + /** + * Checks whether the given function has trailing commas or not. + * + * @param {ASTNode} node - The function node to check. + * @returns {boolean} `true` if the function has trailing commas. + */ + function hasTrailingCommaForFunction(node) { + const length = node.params.length + + return ( + length >= 1 && + sourceCode.getTokenAfter(node.params[length - 1]).value === "," + ) + } + + /** + * Checks whether the given call expression has trailing commas or not. + * + * @param {ASTNode} node - The call expression node to check. + * @returns {boolean} `true` if the call expression has trailing commas. + */ + function hasTrailingCommaForCall(node) { + return ( + node.arguments.length >= 1 && + sourceCode.getLastToken(node, 1).value === "," + ) + } + + /** + * Checks whether the given class extends from null or not. + * + * @param {ASTNode} node - The class node to check. + * @returns {boolean} `true` if the class extends from null. + */ + function extendsNull(node) { + return ( + node.superClass != null && + node.superClass.type === "Literal" && + node.superClass.value === null + ) + } + + /** + * Reports a given node if the specified feature is not supported. + * + * @param {ASTNode} node - A node to be reported. + * @param {string} key - A feature name to report. + * @returns {void} + */ + function report(node, key) { + const version = supportInfo.version + const feature = supportInfo.features[key] + if (feature.supported) { + return + } + + if (!feature.supportedInStrict) { + context.report({ + node, + message: + "{{feature}} {{be}} not supported yet on Node {{version}}.", + data: { + feature: feature.name, + be: feature.singular ? "is" : "are", + version, + }, + }) + } else if (!normalizeScope(context.getScope(), node).isStrict) { + context.report({ + node, + message: + "{{feature}} {{be}} not supported yet on Node {{version}}.", + data: { + feature: `${feature.name} in non-strict mode`, + be: feature.singular ? "is" : "are", + version, + }, + }) + } + } + + /** + * Validate RegExp syntax. + * @param {string} pattern A RegExp pattern to check. + * @param {string} flags A RegExp flags to check. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function validateRegExp(pattern, flags, node) { + if (typeof pattern === "string") { + if (hasPattern(pattern, REGEXP_NAMED_GROUP)) { + report(node, "regexpNamedCaptureGroups") + } + if (hasPattern(pattern, REGEXP_LOOKBEHIND)) { + report(node, "regexpLookbehind") + } + if (hasPattern(pattern, REGEXP_UNICODE_PROPERTY)) { + report(node, "regexpUnicodeProperties") + } + } + if (typeof flags === "string") { + if (flags.indexOf("y") !== -1) { + report(node, "regexpY") + } + if (flags.indexOf("u") !== -1) { + report(node, "regexpU") + } + if (flags.indexOf("s") !== -1) { + report(node, "regexpS") + } + } + } + + /** + * Validate RegExp syntax in a RegExp literal. + * @param {ASTNode} node A Literal node to check. + * @returns {void} + */ + function validateRegExpLiteral(node) { + validateRegExp(node.regex.pattern, node.regex.flags, node) + } + + /** + * Validate RegExp syntax in the first argument of `new RegExp()`. + * @param {ASTNode} node A NewExpression node to check. + * @returns {void} + */ + function validateRegExpString(node) { + const patternNode = node.arguments[0] + const flagsNode = node.arguments[1] + const pattern = + patternNode && + patternNode.type === "Literal" && + typeof patternNode.value === "string" + ? patternNode.value + : null + const flags = + flagsNode && + flagsNode.type === "Literal" && + typeof flagsNode.value === "string" + ? flagsNode.value + : null + validateRegExp(pattern, flags, node) + } + + return { + "Program:exit"() { + // Check new global variables. + for (const name of NEW_BUILTIN_TYPES) { + for (const reference of getReferences([name])) { + // Ignore if it's using new static methods. + const node = reference.identifier + const parentNode = node.parent + const properties = PROPERTY_TEST_TARGETS[name] + if ( + properties && + parentNode.type === "MemberExpression" + ) { + const propertyName = getPropertyName(parentNode) + if (properties.indexOf(propertyName) !== -1) { + continue + } + } + + report(reference.identifier, name) + } + } + + // Check static methods. + for (const reference of getReferences( + Object.keys(PROPERTY_TEST_TARGETS) + )) { + const node = reference.identifier + const parentNode = node.parent + if ( + parentNode.type !== "MemberExpression" || + parentNode.object !== node + ) { + continue + } + + const objectName = node.name + const properties = PROPERTY_TEST_TARGETS[objectName] + const propertyName = getPropertyName(parentNode) + if ( + propertyName && + properties.indexOf(propertyName) !== -1 + ) { + report(parentNode, `${objectName}.${propertyName}`) + } + } + + // Check subclassing + for (const reference of getReferences( + SUBCLASSING_TEST_TARGETS + )) { + const node = reference.identifier + const parentNode = node.parent + if ( + CLASS_TYPE.test(parentNode.type) && + parentNode.superClass === node + ) { + report(node, `extends${node.name}`) + } + } + }, + + ArrowFunctionExpression(node) { + report(node, "arrowFunctions") + if (node.async) { + report(node, "asyncAwait") + } + if (hasTrailingCommaForFunction(node)) { + report(node, "trailingCommasInFunctions") + } + }, + + AssignmentPattern(node) { + if (FUNC_TYPE.test(node.parent.type)) { + report(node, "defaultParameters") + } + }, + + FunctionDeclaration(node) { + const scope = context.getScope().upper + if (!TOPLEVEL_SCOPE_TYPE.test(scope.type)) { + report(node, "blockScopedFunctions") + } + if (node.generator) { + report(node, "generatorFunctions") + } + if (node.async) { + report(node, "asyncAwait") + } + if (hasTrailingCommaForFunction(node)) { + report(node, "trailingCommasInFunctions") + } + if (node.async && node.generator) { + report(node, "asyncGenerators") + } + }, + + FunctionExpression(node) { + if (node.generator) { + report(node, "generatorFunctions") + } + if (node.async) { + report(node, "asyncAwait") + } + if (hasTrailingCommaForFunction(node)) { + report(node, "trailingCommasInFunctions") + } + if (node.async && node.generator) { + report(node, "asyncGenerators") + } + }, + + MetaProperty(node) { + const meta = node.meta.name || node.meta + const property = node.property.name || node.property + if (meta === "new" && property === "target") { + report(node, "new.target") + } + }, + + ClassDeclaration(node) { + report(node, "classes") + + if (extendsNull(node)) { + report(node, "extendsNull") + } + }, + + ClassExpression(node) { + report(node, "classes") + + if (extendsNull(node)) { + report(node, "extendsNull") + } + }, + + ForOfStatement(node) { + report(node, "forOf") + if (node.await) { + report(node, "forAwaitOf") + } + }, + + VariableDeclaration(node) { + if (node.kind === "const") { + report(node, "const") + } else if (node.kind === "let") { + report(node, "let") + } + }, + + ArrayPattern(node) { + if (DESTRUCTURING_PARENT_TYPE.test(node.parent.type)) { + report(node, "destructuring") + } + }, + + AssignmentExpression(node) { + if (node.operator === "**=") { + report(node, "exponentialOperators") + } + }, + + AwaitExpression(node) { + report(node, "asyncAwait") + }, + + BinaryExpression(node) { + if (node.operator === "**") { + report(node, "exponentialOperators") + } + }, + + CallExpression(node) { + if (hasTrailingCommaForCall(node)) { + report(node, "trailingCommasInFunctions") + } + }, + + Identifier(node) { + const raw = sourceCode.getText(node) + if (hasUnicodeCodePointEscape(raw)) { + report(node, "unicodeCodePointEscapes") + } + }, + + Literal(node) { + if (typeof node.value === "number") { + if (BINARY_NUMBER.test(node.raw)) { + report(node, "binaryNumberLiterals") + } else if (OCTAL_NUMBER.test(node.raw)) { + report(node, "octalNumberLiterals") + } + } else if (typeof node.value === "string") { + if (hasUnicodeCodePointEscape(node.raw)) { + report(node, "unicodeCodePointEscapes") + } + } else if (node.regex) { + validateRegExpLiteral(node) + } + }, + + NewExpression(node) { + if ( + node.callee.type === "Identifier" && + node.callee.name === "RegExp" + ) { + validateRegExpString(node) + } + if (hasTrailingCommaForCall(node)) { + report(node, "trailingCommasInFunctions") + } + }, + + ObjectPattern(node) { + if (DESTRUCTURING_PARENT_TYPE.test(node.parent.type)) { + report(node, "destructuring") + } + }, + + Property(node) { + if ( + node.parent.type === "ObjectExpression" && + (node.computed || node.shorthand || node.method) + ) { + if (node.shorthand && GET_OR_SET.test(node.key.name)) { + report(node, "objectPropertyShorthandOfGetSet") + } else { + report(node, "objectLiteralExtensions") + } + } + }, + + RestElement(node) { + if (FUNC_TYPE.test(node.parent.type)) { + report(node, "restParameters") + } else if (node.parent.type === "ObjectPattern") { + report(node, "restProperties") + } + }, + + SpreadElement(node) { + if (node.parent.type === "ObjectExpression") { + report(node, "spreadProperties") + } else { + report(node, "spreadOperators") + } + }, + + TemplateElement(node) { + if (node.value.cooked == null) { + report(node, "templateLiteralRevision") + } + }, + + TemplateLiteral(node) { + report(node, "templateStrings") + }, + + ExperimentalRestProperty(node) { + report(node, "restProperties") + }, + + ExperimentalSpreadProperty(node) { + report(node, "spreadProperties") + }, + + RestProperty(node) { + report(node, "restProperties") + }, + + SpreadProperty(node) { + report(node, "spreadProperties") + }, + + ExportAllDeclaration(node) { + report(node, "modules") + }, + + ExportDefaultDeclaration(node) { + report(node, "modules") + }, + + ExportNamedDeclaration(node) { + report(node, "modules") + }, + + ImportDeclaration(node) { + report(node, "modules") + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js new file mode 100644 index 0000000..3dc7cf2 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js @@ -0,0 +1,180 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkUnsupportedBuiltins = require("../../util/check-unsupported-builtins") +const enumeratePropertyNames = require("../../util/enumerate-property-names") + +const trackMap = { + globals: { + Array: { + from: { [READ]: { supported: "4.0.0" } }, + of: { [READ]: { supported: "4.0.0" } }, + }, + BigInt: { + [READ]: { supported: "10.4.0" }, + }, + Map: { + [READ]: { supported: "0.12.0" }, + }, + Math: { + acosh: { [READ]: { supported: "0.12.0" } }, + asinh: { [READ]: { supported: "0.12.0" } }, + atanh: { [READ]: { supported: "0.12.0" } }, + cbrt: { [READ]: { supported: "0.12.0" } }, + clz32: { [READ]: { supported: "0.12.0" } }, + cosh: { [READ]: { supported: "0.12.0" } }, + expm1: { [READ]: { supported: "0.12.0" } }, + fround: { [READ]: { supported: "0.12.0" } }, + hypot: { [READ]: { supported: "0.12.0" } }, + imul: { [READ]: { supported: "0.12.0" } }, + log10: { [READ]: { supported: "0.12.0" } }, + log1p: { [READ]: { supported: "0.12.0" } }, + log2: { [READ]: { supported: "0.12.0" } }, + sign: { [READ]: { supported: "0.12.0" } }, + sinh: { [READ]: { supported: "0.12.0" } }, + tanh: { [READ]: { supported: "0.12.0" } }, + trunc: { [READ]: { supported: "0.12.0" } }, + }, + Number: { + EPSILON: { [READ]: { supported: "0.12.0" } }, + isFinite: { [READ]: { supported: "0.10.0" } }, + isInteger: { [READ]: { supported: "0.12.0" } }, + isNaN: { [READ]: { supported: "0.10.0" } }, + isSafeInteger: { [READ]: { supported: "0.12.0" } }, + MAX_SAFE_INTEGER: { [READ]: { supported: "0.12.0" } }, + MIN_SAFE_INTEGER: { [READ]: { supported: "0.12.0" } }, + parseFloat: { [READ]: { supported: "0.12.0" } }, + parseInt: { [READ]: { supported: "0.12.0" } }, + }, + Object: { + assign: { [READ]: { supported: "4.0.0" } }, + fromEntries: { [READ]: { supported: "12.0.0" } }, + getOwnPropertySymbols: { [READ]: { supported: "0.12.0" } }, + is: { [READ]: { supported: "0.10.0" } }, + setPrototypeOf: { [READ]: { supported: "0.12.0" } }, + values: { [READ]: { supported: "7.0.0" } }, + entries: { [READ]: { supported: "7.0.0" } }, + getOwnPropertyDescriptors: { [READ]: { supported: "7.0.0" } }, + }, + Promise: { + [READ]: { supported: "0.12.0" }, + allSettled: { [READ]: { supported: "12.9.0" } }, + }, + Proxy: { + [READ]: { supported: "6.0.0" }, + }, + Reflect: { + [READ]: { supported: "6.0.0" }, + }, + Set: { + [READ]: { supported: "0.12.0" }, + }, + String: { + fromCodePoint: { [READ]: { supported: "4.0.0" } }, + raw: { [READ]: { supported: "4.0.0" } }, + }, + Symbol: { + [READ]: { supported: "0.12.0" }, + }, + Int8Array: { + [READ]: { supported: "0.10.0" }, + }, + Uint8Array: { + [READ]: { supported: "0.10.0" }, + }, + Uint8ClampedArray: { + [READ]: { supported: "0.10.0" }, + }, + Int16Array: { + [READ]: { supported: "0.10.0" }, + }, + Uint16Array: { + [READ]: { supported: "0.10.0" }, + }, + Int32Array: { + [READ]: { supported: "0.10.0" }, + }, + Uint32Array: { + [READ]: { supported: "0.10.0" }, + }, + BigInt64Array: { + [READ]: { supported: "10.4.0" }, + }, + BigUint64Array: { + [READ]: { supported: "10.4.0" }, + }, + Float32Array: { + [READ]: { supported: "0.10.0" }, + }, + Float64Array: { + [READ]: { supported: "0.10.0" }, + }, + DataView: { + [READ]: { supported: "0.10.0" }, + }, + WeakMap: { + [READ]: { supported: "0.12.0" }, + }, + WeakSet: { + [READ]: { supported: "0.12.0" }, + }, + Atomics: { + [READ]: { supported: "8.10.0" }, + }, + SharedArrayBuffer: { + [READ]: { supported: "8.10.0" }, + }, + globalThis: { + [READ]: { supported: "12.0.0" }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: + "disallow unsupported ECMAScript built-ins on the specified version", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unsupported-features/es-builtins.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + version: { + type: "string", + }, + ignores: { + type: "array", + items: { + enum: Array.from( + enumeratePropertyNames(trackMap.globals) + ), + }, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + messages: { + unsupported: + "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + }, + }, + create(context) { + return { + "Program:exit"() { + checkUnsupportedBuiltins(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js new file mode 100644 index 0000000..0eb6862 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js @@ -0,0 +1,663 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { rules: esRules } = require("eslint-plugin-es") +const { getInnermostScope } = require("eslint-utils") +const { Range } = require("semver") +const getConfiguredNodeVersion = require("../../util/get-configured-node-version") +const getSemverRange = require("../../util/get-semver-range") +const mergeVisitorsInPlace = require("../../util/merge-visitors-in-place") + +const getOrSet = /^(?:g|s)et$/u +const features = { + //-------------------------------------------------------------------------- + // ES2015 + //-------------------------------------------------------------------------- + arrowFunctions: { + ruleId: "no-arrow-functions", + cases: [ + { + supported: "4.0.0", + messageId: "no-arrow-functions", + }, + ], + }, + binaryNumericLiterals: { + ruleId: "no-binary-numeric-literals", + cases: [ + { + supported: "4.0.0", + messageId: "no-binary-numeric-literals", + }, + ], + }, + blockScopedFunctions: { + ruleId: "no-block-scoped-functions", + cases: [ + { + supported: "6.0.0", + test: info => !info.isStrict, + messageId: "no-block-scoped-functions-sloppy", + }, + { + supported: "4.0.0", + messageId: "no-block-scoped-functions-strict", + }, + ], + }, + blockScopedVariables: { + ruleId: "no-block-scoped-variables", + cases: [ + { + supported: "6.0.0", + test: info => !info.isStrict, + messageId: "no-block-scoped-variables-sloppy", + }, + { + supported: "4.0.0", + messageId: "no-block-scoped-variables-strict", + }, + ], + }, + classes: { + ruleId: "no-classes", + cases: [ + { + supported: "6.0.0", + test: info => !info.isStrict, + messageId: "no-classes-sloppy", + }, + { + supported: "4.0.0", + messageId: "no-classes-strict", + }, + ], + }, + computedProperties: { + ruleId: "no-computed-properties", + cases: [ + { + supported: "4.0.0", + messageId: "no-computed-properties", + }, + ], + }, + defaultParameters: { + ruleId: "no-default-parameters", + cases: [ + { + supported: "6.0.0", + messageId: "no-default-parameters", + }, + ], + }, + destructuring: { + ruleId: "no-destructuring", + cases: [ + { + supported: "6.0.0", + messageId: "no-destructuring", + }, + ], + }, + forOfLoops: { + ruleId: "no-for-of-loops", + cases: [ + { + supported: "0.12.0", + messageId: "no-for-of-loops", + }, + ], + }, + generators: { + ruleId: "no-generators", + cases: [ + { + supported: "4.0.0", + messageId: "no-generators", + }, + ], + }, + modules: { + ruleId: "no-modules", + cases: [ + { + supported: null, + messageId: "no-modules", + }, + ], + }, + "new.target": { + ruleId: "no-new-target", + cases: [ + { + supported: "5.0.0", + messageId: "no-new-target", + }, + ], + }, + objectSuperProperties: { + ruleId: "no-object-super-properties", + cases: [ + { + supported: "4.0.0", + messageId: "no-object-super-properties", + }, + ], + }, + octalNumericLiterals: { + ruleId: "no-octal-numeric-literals", + cases: [ + { + supported: "4.0.0", + messageId: "no-octal-numeric-literals", + }, + ], + }, + propertyShorthands: { + ruleId: "no-property-shorthands", + cases: [ + { + supported: "6.0.0", + test: info => + info.node.shorthand && getOrSet.test(info.node.key.name), + messageId: "no-property-shorthands-getset", + }, + { + supported: "4.0.0", + messageId: "no-property-shorthands", + }, + ], + }, + regexpU: { + ruleId: "no-regexp-u-flag", + cases: [ + { + supported: "6.0.0", + messageId: "no-regexp-u-flag", + }, + ], + }, + regexpY: { + ruleId: "no-regexp-y-flag", + cases: [ + { + supported: "6.0.0", + messageId: "no-regexp-y-flag", + }, + ], + }, + restParameters: { + ruleId: "no-rest-parameters", + cases: [ + { + supported: "6.0.0", + messageId: "no-rest-parameters", + }, + ], + }, + spreadElements: { + ruleId: "no-spread-elements", + cases: [ + { + supported: "5.0.0", + messageId: "no-spread-elements", + }, + ], + }, + templateLiterals: { + ruleId: "no-template-literals", + cases: [ + { + supported: "4.0.0", + messageId: "no-template-literals", + }, + ], + }, + unicodeCodePointEscapes: { + ruleId: "no-unicode-codepoint-escapes", + cases: [ + { + supported: "4.0.0", + messageId: "no-unicode-codepoint-escapes", + }, + ], + }, + + //-------------------------------------------------------------------------- + // ES2016 + //-------------------------------------------------------------------------- + exponentialOperators: { + ruleId: "no-exponential-operators", + cases: [ + { + supported: "7.0.0", + messageId: "no-exponential-operators", + }, + ], + }, + + //-------------------------------------------------------------------------- + // ES2017 + //-------------------------------------------------------------------------- + asyncFunctions: { + ruleId: "no-async-functions", + cases: [ + { + supported: "7.6.0", + messageId: "no-async-functions", + }, + ], + }, + trailingCommasInFunctions: { + ruleId: "no-trailing-function-commas", + cases: [ + { + supported: "8.0.0", + messageId: "no-trailing-function-commas", + }, + ], + }, + + //-------------------------------------------------------------------------- + // ES2018 + //-------------------------------------------------------------------------- + asyncIteration: { + ruleId: "no-async-iteration", + cases: [ + { + supported: "10.0.0", + messageId: "no-async-iteration", + }, + ], + }, + malformedTemplateLiterals: { + ruleId: "no-malformed-template-literals", + cases: [ + { + supported: "8.10.0", + messageId: "no-malformed-template-literals", + }, + ], + }, + regexpLookbehind: { + ruleId: "no-regexp-lookbehind-assertions", + cases: [ + { + supported: "8.10.0", + messageId: "no-regexp-lookbehind-assertions", + }, + ], + }, + regexpNamedCaptureGroups: { + ruleId: "no-regexp-named-capture-groups", + cases: [ + { + supported: "10.0.0", + messageId: "no-regexp-named-capture-groups", + }, + ], + }, + regexpS: { + ruleId: "no-regexp-s-flag", + cases: [ + { + supported: "8.10.0", + messageId: "no-regexp-s-flag", + }, + ], + }, + regexpUnicodeProperties: { + ruleId: "no-regexp-unicode-property-escapes", + cases: [ + { + supported: "10.0.0", + messageId: "no-regexp-unicode-property-escapes", + }, + ], + }, + restSpreadProperties: { + ruleId: "no-rest-spread-properties", + cases: [ + { + supported: "8.3.0", + messageId: "no-rest-spread-properties", + }, + ], + }, + + //-------------------------------------------------------------------------- + // ES2019 + //-------------------------------------------------------------------------- + jsonSuperset: { + ruleId: "no-json-superset", + cases: [ + { + supported: "10.0.0", + messageId: "no-json-superset", + }, + ], + }, + optionalCatchBinding: { + ruleId: "no-optional-catch-binding", + cases: [ + { + supported: "10.0.0", + messageId: "no-optional-catch-binding", + }, + ], + }, + + //-------------------------------------------------------------------------- + // ES2020 + //-------------------------------------------------------------------------- + bigint: { + ruleId: "no-bigint", + cases: [ + { + supported: "10.4.0", + test: info => info.node.type === "Literal", + messageId: "no-bigint", + }, + { + supported: null, + test: ({ node }) => + node.type === "Literal" && + (node.parent.type === "Property" || + node.parent.type === "MethodDefinition") && + !node.parent.computed && + node.parent.key === node, + messageId: "no-bigint-property-names", + }, + ], + }, + dynamicImport: { + ruleId: "no-dynamic-import", + cases: [ + { + supported: new Range(">=12.17 <13 || >=13.2"), + messageId: "no-dynamic-import", + }, + ], + }, + optionalChaining: { + ruleId: "no-optional-chaining", + cases: [ + { + supported: "14.0.0", + messageId: "no-optional-chaining", + }, + ], + }, + nullishCoalescingOperators: { + ruleId: "no-nullish-coalescing-operators", + cases: [ + { + supported: "14.0.0", + messageId: "no-nullish-coalescing-operators", + }, + ], + }, +} +const keywords = Object.keys(features) + +/** + * Parses the options. + * @param {RuleContext} context The rule context. + * @returns {{version:Range,ignores:Set}} Parsed value. + */ +function parseOptions(context) { + const raw = context.options[0] || {} + const filePath = context.getFilename() + const version = getConfiguredNodeVersion(raw.version, filePath) + const ignores = new Set(raw.ignores || []) + + return Object.freeze({ version, ignores }) +} + +/** + * Find the scope that a given node belongs to. + * @param {Scope} initialScope The initial scope to find. + * @param {Node} node The AST node. + * @returns {Scope} The scope that the node belongs to. + */ +function normalizeScope(initialScope, node) { + let scope = getInnermostScope(initialScope, node) + + while (scope && scope.block === node) { + scope = scope.upper + } + + return scope +} + +/** + * Define the visitor object as merging the rules of eslint-plugin-es. + * @param {RuleContext} context The rule context. + * @param {{version:Range,ignores:Set}} options The options. + * @returns {object} The defined visitor. + */ +function defineVisitor(context, options) { + const testInfoPrototype = { + get isStrict() { + return normalizeScope(context.getScope(), this.node).isStrict + }, + } + + /** + * Check whether a given case object is full-supported on the configured node version. + * @param {{supported:string}} aCase The case object to check. + * @returns {boolean} `true` if it's supporting. + */ + function isNotSupportingVersion(aCase) { + if (!aCase.supported) { + return true + } + + if (aCase.supported instanceof Range) { + return !options.version.intersects(aCase.supported) + } + + return options.version.intersects(getSemverRange(`<${aCase.supported}`)) + } + + /** + * Define the predicate function to check whether a given case object is supported on the configured node version. + * @param {Node} node The node which is reported. + * @returns {function(aCase:{supported:string}):boolean} The predicate function. + */ + function isNotSupportingOn(node) { + return aCase => + isNotSupportingVersion(aCase) && + (!aCase.test || aCase.test({ node, __proto__: testInfoPrototype })) + } + + return ( + keywords + // Omit full-supported features and ignored features by options + // because this rule never reports those. + .filter( + keyword => + !options.ignores.has(keyword) && + features[keyword].cases.some(isNotSupportingVersion) + ) + // Merge remaining features with overriding `context.report()`. + .reduce((visitor, keyword) => { + const { ruleId, cases } = features[keyword] + const rule = esRules[ruleId] + const thisContext = { + __proto__: context, + + // Override `context.report()` then: + // - ignore if it's supported. + // - override reporting messages. + report(descriptor) { + // Set additional information. + if (descriptor.data) { + descriptor.data.version = options.version.raw + } else { + descriptor.data = { version: options.version.raw } + } + descriptor.fix = undefined + + // Test and report. + const node = descriptor.node + const hitCase = cases.find(isNotSupportingOn(node)) + if (hitCase) { + descriptor.messageId = hitCase.messageId + descriptor.data.supported = hitCase.supported + super.report(descriptor) + } + }, + } + return mergeVisitorsInPlace(visitor, rule.create(thisContext)) + }, {}) + ) +} + +module.exports = { + meta: { + docs: { + description: + "disallow unsupported ECMAScript syntax on the specified version", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unsupported-features/es-syntax.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + version: { + type: "string", + }, + ignores: { + type: "array", + items: { + enum: Object.keys(features), + }, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + messages: { + //------------------------------------------------------------------ + // ES2015 + //------------------------------------------------------------------ + "no-arrow-functions": + "Arrow functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-binary-numeric-literals": + "Binary numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-block-scoped-functions-strict": + "Block-scoped functions in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-block-scoped-functions-sloppy": + "Block-scoped functions in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-block-scoped-variables-strict": + "Block-scoped variables in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-block-scoped-variables-sloppy": + "Block-scoped variables in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-classes-strict": + "Classes in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-classes-sloppy": + "Classes in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-computed-properties": + "Computed properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-default-parameters": + "Default parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-destructuring": + "Destructuring is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-for-of-loops": + "'for-of' loops are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-generators": + "Generator functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-modules": + "Import and export declarations are not supported yet.", + "no-new-target": + "'new.target' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-object-super-properties": + "'super' in object literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-octal-numeric-literals": + "Octal numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-property-shorthands": + "Property shorthands are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-property-shorthands-getset": + "Property shorthands of 'get' and 'set' are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-u-flag": + "RegExp 'u' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-y-flag": + "RegExp 'y' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-rest-parameters": + "Rest parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-spread-elements": + "Spread elements are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-template-literals": + "Template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-unicode-codepoint-escapes": + "Unicode code point escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + + //------------------------------------------------------------------ + // ES2016 + //------------------------------------------------------------------ + "no-exponential-operators": + "Exponential operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + + //------------------------------------------------------------------ + // ES2017 + //------------------------------------------------------------------ + "no-async-functions": + "Async functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-trailing-function-commas": + "Trailing commas in function syntax are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + + //------------------------------------------------------------------ + // ES2018 + //------------------------------------------------------------------ + "no-async-iteration": + "Async iteration is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-malformed-template-literals": + "Malformed template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-lookbehind-assertions": + "RegExp lookbehind assertions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-named-capture-groups": + "RegExp named capture groups are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-s-flag": + "RegExp 's' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-regexp-unicode-property-escapes": + "RegExp Unicode property escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-rest-spread-properties": + "Rest/spread properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + + //------------------------------------------------------------------ + // ES2019 + //------------------------------------------------------------------ + "no-json-superset": + "'\\u{{code}}' in string literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-optional-catch-binding": + "The omission of 'catch' binding is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + + //------------------------------------------------------------------ + // ES2020 + //------------------------------------------------------------------ + "no-bigint": + "Bigint literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-bigint-property-names": + "Bigint literal property names are not supported yet.", + "no-dynamic-import": + "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-optional-chaining": + "Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "no-nullish-coalescing-operators": + "Nullish coalescing operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + }, + }, + create(context) { + return defineVisitor(context, parseOptions(context)) + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js new file mode 100644 index 0000000..f63cdb8 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js @@ -0,0 +1,415 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkUnsupportedBuiltins = require("../../util/check-unsupported-builtins") +const enumeratePropertyNames = require("../../util/enumerate-property-names") + +const trackMap = { + globals: { + queueMicrotask: { + [READ]: { supported: "12.0.0", experimental: "11.0.0" }, + }, + require: { + resolve: { + paths: { [READ]: { supported: "8.9.0" } }, + }, + }, + }, + modules: { + assert: { + strict: { + [READ]: { supported: "9.9.0", backported: ["8.13.0"] }, + doesNotReject: { [READ]: { supported: "10.0.0" } }, + rejects: { [READ]: { supported: "10.0.0" } }, + }, + deepStrictEqual: { [READ]: { supported: "4.0.0" } }, + doesNotReject: { [READ]: { supported: "10.0.0" } }, + notDeepStrictEqual: { [READ]: { supported: "4.0.0" } }, + rejects: { [READ]: { supported: "10.0.0" } }, + CallTracker: { + [READ]: { supported: null, experimental: "14.2.0" }, + }, + }, + async_hooks: { + [READ]: { supported: "8.0.0" }, + createHook: { [READ]: { supported: "8.1.0" } }, + AsyncLocalStorage: { + [READ]: { supported: "13.10.0", backported: ["12.17.0"] }, + }, + }, + buffer: { + Buffer: { + alloc: { [READ]: { supported: "4.5.0" } }, + allocUnsafe: { [READ]: { supported: "4.5.0" } }, + allocUnsafeSlow: { [READ]: { supported: "4.5.0" } }, + from: { [READ]: { supported: "4.5.0" } }, + }, + kMaxLength: { [READ]: { supported: "3.0.0" } }, + transcode: { [READ]: { supported: "7.1.0" } }, + constants: { [READ]: { supported: "8.2.0" } }, + Blob: { [READ]: { supported: null, experimental: "15.7.0" } }, + }, + child_process: { + ChildProcess: { [READ]: { supported: "2.2.0" } }, + }, + console: { + clear: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } }, + count: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } }, + countReset: { + [READ]: { supported: "8.3.0", backported: ["6.13.0"] }, + }, + debug: { [READ]: { supported: "8.0.0" } }, + dirxml: { [READ]: { supported: "8.0.0" } }, + group: { [READ]: { supported: "8.5.0" } }, + groupCollapsed: { [READ]: { supported: "8.5.0" } }, + groupEnd: { [READ]: { supported: "8.5.0" } }, + table: { [READ]: { supported: "10.0.0" } }, + markTimeline: { [READ]: { supported: "8.0.0" } }, + profile: { [READ]: { supported: "8.0.0" } }, + profileEnd: { [READ]: { supported: "8.0.0" } }, + timeLog: { [READ]: { supported: "10.7.0" } }, + timeStamp: { [READ]: { supported: "8.0.0" } }, + timeline: { [READ]: { supported: "8.0.0" } }, + timelineEnd: { [READ]: { supported: "8.0.0" } }, + }, + crypto: { + Certificate: { + exportChallenge: { [READ]: { supported: "9.0.0" } }, + exportPublicKey: { [READ]: { supported: "9.0.0" } }, + verifySpkac: { [READ]: { supported: "9.0.0" } }, + }, + ECDH: { [READ]: { supported: "8.8.0", backported: ["6.13.0"] } }, + KeyObject: { [READ]: { supported: "11.6.0" } }, + createPrivateKey: { [READ]: { supported: "11.6.0" } }, + createPublicKey: { [READ]: { supported: "11.6.0" } }, + createSecretKey: { [READ]: { supported: "11.6.0" } }, + constants: { [READ]: { supported: "6.3.0" } }, + fips: { [READ]: { supported: "6.0.0" } }, + generateKeyPair: { [READ]: { supported: "10.12.0" } }, + generateKeyPairSync: { [READ]: { supported: "10.12.0" } }, + getCurves: { [READ]: { supported: "2.3.0" } }, + getFips: { [READ]: { supported: "10.0.0" } }, + privateEncrypt: { [READ]: { supported: "1.1.0" } }, + publicDecrypt: { [READ]: { supported: "1.1.0" } }, + randomFillSync: { + [READ]: { supported: "7.10.0", backported: ["6.13.0"] }, + }, + randomFill: { + [READ]: { supported: "7.10.0", backported: ["6.13.0"] }, + }, + scrypt: { [READ]: { supported: "10.5.0" } }, + scryptSync: { [READ]: { supported: "10.5.0" } }, + setFips: { [READ]: { supported: "10.0.0" } }, + sign: { [READ]: { supported: "12.0.0" } }, + timingSafeEqual: { [READ]: { supported: "6.6.0" } }, + verify: { [READ]: { supported: "12.0.0" } }, + }, + dns: { + Resolver: { [READ]: { supported: "8.3.0" } }, + resolvePtr: { [READ]: { supported: "6.0.0" } }, + promises: { + [READ]: { + supported: "11.14.0", + backported: ["10.17.0"], + experimental: "10.6.0", + }, + }, + }, + events: { + EventEmitter: { + once: { + [READ]: { supported: "11.13.0", backported: ["10.16.0"] }, + }, + }, + once: { [READ]: { supported: "11.13.0", backported: ["10.16.0"] } }, + }, + fs: { + Dirent: { [READ]: { supported: "10.10.0" } }, + copyFile: { [READ]: { supported: "8.5.0" } }, + copyFileSync: { [READ]: { supported: "8.5.0" } }, + mkdtemp: { [READ]: { supported: "5.10.0" } }, + mkdtempSync: { [READ]: { supported: "5.10.0" } }, + realpath: { + native: { [READ]: { supported: "9.2.0" } }, + }, + realpathSync: { + native: { [READ]: { supported: "9.2.0" } }, + }, + promises: { + [READ]: { + supported: "11.14.0", + backported: ["10.17.0"], + experimental: "10.1.0", + }, + }, + writev: { [READ]: { supported: "12.9.0" } }, + writevSync: { [READ]: { supported: "12.9.0" } }, + readv: { + [READ]: { supported: "13.13.0", backported: ["12.17.0"] }, + }, + readvSync: { + [READ]: { supported: "13.13.0", backported: ["12.17.0"] }, + }, + lutimes: { + [READ]: { supported: "14.5.0", backported: ["12.19.0"] }, + }, + lutimesSync: { + [READ]: { supported: "14.5.0", backported: ["12.19.0"] }, + }, + opendir: { + [READ]: { supported: "12.12.0" }, + }, + opendirSync: { + [READ]: { supported: "12.12.0" }, + }, + rm: { + [READ]: { supported: "14.14.0" }, + }, + rmSync: { + [READ]: { supported: "14.14.0" }, + }, + read: { + [READ]: { supported: "13.11.0", backported: ["12.17.0"] }, + }, + readSync: { + [READ]: { supported: "13.11.0", backported: ["12.17.0"] }, + }, + Dir: { + [READ]: { supported: "12.12.0" }, + }, + StatWatcher: { + [READ]: { supported: "14.3.0", backported: ["12.20.0"] }, + }, + }, + "fs/promises": { + [READ]: { + supported: "14.0.0", + }, + }, + http2: { + [READ]: { + supported: "10.10.0", + backported: ["8.13.0"], + experimental: "8.4.0", + }, + }, + inspector: { + [READ]: { supported: null, experimental: "8.0.0" }, + }, + module: { + Module: { + builtinModules: { + [READ]: { + supported: "9.3.0", + backported: ["6.13.0", "8.10.0"], + }, + }, + createRequireFromPath: { [READ]: { supported: "10.12.0" } }, + createRequire: { [READ]: { supported: "12.2.0" } }, + syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } }, + }, + builtinModules: { + [READ]: { + supported: "9.3.0", + backported: ["6.13.0", "8.10.0"], + }, + }, + createRequireFromPath: { [READ]: { supported: "10.12.0" } }, + createRequire: { [READ]: { supported: "12.2.0" } }, + syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } }, + }, + os: { + constants: { + [READ]: { supported: "6.3.0" }, + priority: { [READ]: { supported: "10.10.0" } }, + }, + getPriority: { [READ]: { supported: "10.10.0" } }, + homedir: { [READ]: { supported: "2.3.0" } }, + setPriority: { [READ]: { supported: "10.10.0" } }, + userInfo: { [READ]: { supported: "6.0.0" } }, + }, + path: { + toNamespacedPath: { [READ]: { supported: "9.0.0" } }, + }, + perf_hooks: { + [READ]: { supported: "8.5.0" }, + monitorEventLoopDelay: { [READ]: { supported: "11.10.0" } }, + }, + process: { + allowedNodeEnvironmentFlags: { [READ]: { supported: "10.10.0" } }, + argv0: { [READ]: { supported: "6.4.0" } }, + channel: { [READ]: { supported: "7.1.0" } }, + cpuUsage: { [READ]: { supported: "6.1.0" } }, + emitWarning: { [READ]: { supported: "6.0.0" } }, + getegid: { [READ]: { supported: "2.0.0" } }, + geteuid: { [READ]: { supported: "2.0.0" } }, + hasUncaughtExceptionCaptureCallback: { + [READ]: { supported: "9.3.0" }, + }, + hrtime: { + bigint: { [READ]: { supported: "10.7.0" } }, + }, + ppid: { + [READ]: { + supported: "9.2.0", + backported: ["6.13.0", "8.10.0"], + }, + }, + release: { [READ]: { supported: "3.0.0" } }, + report: { [READ]: { supported: null, experimental: "11.8.0" } }, + resourceUsage: { [READ]: { supported: "12.6.0" } }, + setegid: { [READ]: { supported: "2.0.0" } }, + seteuid: { [READ]: { supported: "2.0.0" } }, + setUncaughtExceptionCaptureCallback: { + [READ]: { supported: "9.3.0" }, + }, + stdout: { + getColorDepth: { [READ]: { supported: "9.9.0" } }, + hasColor: { [READ]: { supported: "11.13.0" } }, + }, + stderr: { + getColorDepth: { [READ]: { supported: "9.9.0" } }, + hasColor: { [READ]: { supported: "11.13.0" } }, + }, + }, + stream: { + Readable: { + from: { + [READ]: { supported: "12.3.0", backported: ["10.17.0"] }, + }, + }, + finished: { [READ]: { supported: "10.0.0" } }, + pipeline: { [READ]: { supported: "10.0.0" } }, + }, + trace_events: { + [READ]: { supported: "10.0.0" }, + }, + url: { + URL: { [READ]: { supported: "7.0.0", backported: ["6.13.0"] } }, + URLSearchParams: { + [READ]: { supported: "7.5.0", backported: ["6.13.0"] }, + }, + domainToASCII: { [READ]: { supported: "7.4.0" } }, + domainToUnicode: { [READ]: { supported: "7.4.0" } }, + }, + util: { + callbackify: { [READ]: { supported: "8.2.0" } }, + formatWithOptions: { [READ]: { supported: "10.0.0" } }, + getSystemErrorName: { + [READ]: { supported: "9.7.0", backported: ["8.12.0"] }, + }, + inspect: { + custom: { [READ]: { supported: "6.6.0" } }, + defaultOptions: { [READ]: { supported: "6.4.0" } }, + replDefaults: { [READ]: { supported: "11.12.0" } }, + }, + isDeepStrictEqual: { [READ]: { supported: "9.0.0" } }, + promisify: { [READ]: { supported: "8.0.0" } }, + TextDecoder: { + [READ]: { supported: "8.9.0", experimental: "8.3.0" }, + }, + TextEncoder: { + [READ]: { supported: "8.9.0", experimental: "8.3.0" }, + }, + types: { + [READ]: { supported: "10.0.0" }, + isBoxedPrimitive: { [READ]: { supported: "10.11.0" } }, + }, + }, + v8: { + [READ]: { supported: "1.0.0" }, + DefaultDeserializer: { [READ]: { supported: "8.0.0" } }, + DefaultSerializer: { [READ]: { supported: "8.0.0" } }, + Deserializer: { [READ]: { supported: "8.0.0" } }, + Serializer: { [READ]: { supported: "8.0.0" } }, + cachedDataVersionTag: { [READ]: { supported: "8.0.0" } }, + deserialize: { [READ]: { supported: "8.0.0" } }, + getHeapCodeStatistics: { [READ]: { supported: "12.8.0" } }, + getHeapSnapshot: { [READ]: { supported: "11.13.0" } }, + getHeapSpaceStatistics: { [READ]: { supported: "6.0.0" } }, + serialize: { [READ]: { supported: "8.0.0" } }, + writeHeapSnapshot: { [READ]: { supported: "11.13.0" } }, + }, + vm: { + Module: { [READ]: { supported: "9.6.0" } }, + compileFunction: { [READ]: { supported: "10.10.0" } }, + }, + worker_threads: { + [READ]: { supported: "12.11.0", experimental: "10.5.0" }, + }, + }, +} +Object.assign(trackMap.globals, { + Buffer: trackMap.modules.buffer.Buffer, + TextDecoder: { + ...trackMap.modules.util.TextDecoder, + [READ]: { supported: "11.0.0" }, + }, + TextEncoder: { + ...trackMap.modules.util.TextEncoder, + [READ]: { supported: "11.0.0" }, + }, + URL: { + ...trackMap.modules.url.URL, + [READ]: { supported: "10.0.0" }, + }, + URLSearchParams: { + ...trackMap.modules.url.URLSearchParams, + [READ]: { supported: "10.0.0" }, + }, + console: trackMap.modules.console, + process: trackMap.modules.process, +}) +/*eslint-enable camelcase */ + +module.exports = { + meta: { + docs: { + description: + "disallow unsupported Node.js built-in APIs on the specified version", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/no-unsupported-features/node-builtins.md", + }, + type: "problem", + fixable: null, + schema: [ + { + type: "object", + properties: { + version: { + type: "string", + }, + ignores: { + type: "array", + items: { + enum: Array.from( + new Set([ + ...enumeratePropertyNames(trackMap.globals), + ...enumeratePropertyNames(trackMap.modules), + ]) + ), + }, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + messages: { + unsupported: + "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + }, + }, + create(context) { + return { + "Program:exit"() { + checkUnsupportedBuiltins(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/buffer.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/buffer.js new file mode 100644 index 0000000..f45bd1c --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/buffer.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + Buffer: { [READ]: true }, + }, + modules: { + buffer: { + Buffer: { [READ]: true }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: + 'enforce either `Buffer` or `require("buffer").Buffer`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/buffer.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"buffer\").Buffer'. Use the global variable 'Buffer' instead.", + preferModule: + "Unexpected use of the global variable 'Buffer'. Use 'require(\"buffer\").Buffer' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/console.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/console.js new file mode 100644 index 0000000..a78b6bd --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/console.js @@ -0,0 +1,45 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + console: { [READ]: true }, + }, + modules: { + console: { [READ]: true }, + }, +} + +module.exports = { + meta: { + docs: { + description: 'enforce either `console` or `require("console")`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/console.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"console\")'. Use the global variable 'console' instead.", + preferModule: + "Unexpected use of the global variable 'console'. Use 'require(\"console\")' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/process.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/process.js new file mode 100644 index 0000000..be512ce --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/process.js @@ -0,0 +1,45 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + process: { [READ]: true }, + }, + modules: { + process: { [READ]: true }, + }, +} + +module.exports = { + meta: { + docs: { + description: 'enforce either `process` or `require("process")`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/process.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"process\")'. Use the global variable 'process' instead.", + preferModule: + "Unexpected use of the global variable 'process'. Use 'require(\"process\")' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-decoder.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-decoder.js new file mode 100644 index 0000000..a1f6942 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-decoder.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + TextDecoder: { [READ]: true }, + }, + modules: { + util: { + TextDecoder: { [READ]: true }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: + 'enforce either `TextDecoder` or `require("util").TextDecoder`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/text-decoder.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"util\").TextDecoder'. Use the global variable 'TextDecoder' instead.", + preferModule: + "Unexpected use of the global variable 'TextDecoder'. Use 'require(\"util\").TextDecoder' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-encoder.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-encoder.js new file mode 100644 index 0000000..48c2b6b --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/text-encoder.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + TextEncoder: { [READ]: true }, + }, + modules: { + util: { + TextEncoder: { [READ]: true }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: + 'enforce either `TextEncoder` or `require("util").TextEncoder`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/text-encoder.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"util\").TextEncoder'. Use the global variable 'TextEncoder' instead.", + preferModule: + "Unexpected use of the global variable 'TextEncoder'. Use 'require(\"util\").TextEncoder' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/url-search-params.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/url-search-params.js new file mode 100644 index 0000000..998d321 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/url-search-params.js @@ -0,0 +1,48 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + URLSearchParams: { [READ]: true }, + }, + modules: { + url: { + URLSearchParams: { [READ]: true }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: + 'enforce either `URLSearchParams` or `require("url").URLSearchParams`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/url-search-params.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"url\").URLSearchParams'. Use the global variable 'URLSearchParams' instead.", + preferModule: + "Unexpected use of the global variable 'URLSearchParams'. Use 'require(\"url\").URLSearchParams' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-global/url.js b/node_modules/eslint-plugin-n/lib/rules/prefer-global/url.js new file mode 100644 index 0000000..70c8a5f --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-global/url.js @@ -0,0 +1,47 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { READ } = require("eslint-utils") +const checkForPreferGlobal = require("../../util/check-prefer-global") + +const trackMap = { + globals: { + URL: { [READ]: true }, + }, + modules: { + url: { + URL: { [READ]: true }, + }, + }, +} + +module.exports = { + meta: { + docs: { + description: 'enforce either `URL` or `require("url").URL`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-global/url.md", + }, + type: "suggestion", + fixable: null, + schema: [{ enum: ["always", "never"] }], + messages: { + preferGlobal: + "Unexpected use of 'require(\"url\").URL'. Use the global variable 'URL' instead.", + preferModule: + "Unexpected use of the global variable 'URL'. Use 'require(\"url\").URL' instead.", + }, + }, + + create(context) { + return { + "Program:exit"() { + checkForPreferGlobal(context, trackMap) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-promises/dns.js b/node_modules/eslint-plugin-n/lib/rules/prefer-promises/dns.js new file mode 100644 index 0000000..752025a --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-promises/dns.js @@ -0,0 +1,73 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { CALL, CONSTRUCT, ReferenceTracker } = require("eslint-utils") + +const trackMap = { + dns: { + lookup: { [CALL]: true }, + lookupService: { [CALL]: true }, + Resolver: { [CONSTRUCT]: true }, + getServers: { [CALL]: true }, + resolve: { [CALL]: true }, + resolve4: { [CALL]: true }, + resolve6: { [CALL]: true }, + resolveAny: { [CALL]: true }, + resolveCname: { [CALL]: true }, + resolveMx: { [CALL]: true }, + resolveNaptr: { [CALL]: true }, + resolveNs: { [CALL]: true }, + resolvePtr: { [CALL]: true }, + resolveSoa: { [CALL]: true }, + resolveSrv: { [CALL]: true }, + resolveTxt: { [CALL]: true }, + reverse: { [CALL]: true }, + setServers: { [CALL]: true }, + }, +} + +module.exports = { + meta: { + docs: { + description: 'enforce `require("dns").promises`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-promises/dns.md", + }, + fixable: null, + messages: { + preferPromises: "Use 'dns.promises.{{name}}()' instead.", + preferPromisesNew: "Use 'new dns.promises.{{name}}()' instead.", + }, + schema: [], + type: "suggestion", + }, + + create(context) { + return { + "Program:exit"() { + const scope = context.getScope() + const tracker = new ReferenceTracker(scope, { mode: "legacy" }) + const references = [ + ...tracker.iterateCjsReferences(trackMap), + ...tracker.iterateEsmReferences(trackMap), + ] + + for (const { node, path } of references) { + const name = path[path.length - 1] + const isClass = name[0] === name[0].toUpperCase() + context.report({ + node, + messageId: isClass + ? "preferPromisesNew" + : "preferPromises", + data: { name }, + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/prefer-promises/fs.js b/node_modules/eslint-plugin-n/lib/rules/prefer-promises/fs.js new file mode 100644 index 0000000..96c8801 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/prefer-promises/fs.js @@ -0,0 +1,75 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { CALL, ReferenceTracker } = require("eslint-utils") + +const trackMap = { + fs: { + access: { [CALL]: true }, + copyFile: { [CALL]: true }, + open: { [CALL]: true }, + rename: { [CALL]: true }, + truncate: { [CALL]: true }, + rmdir: { [CALL]: true }, + mkdir: { [CALL]: true }, + readdir: { [CALL]: true }, + readlink: { [CALL]: true }, + symlink: { [CALL]: true }, + lstat: { [CALL]: true }, + stat: { [CALL]: true }, + link: { [CALL]: true }, + unlink: { [CALL]: true }, + chmod: { [CALL]: true }, + lchmod: { [CALL]: true }, + lchown: { [CALL]: true }, + chown: { [CALL]: true }, + utimes: { [CALL]: true }, + realpath: { [CALL]: true }, + mkdtemp: { [CALL]: true }, + writeFile: { [CALL]: true }, + appendFile: { [CALL]: true }, + readFile: { [CALL]: true }, + }, +} + +module.exports = { + meta: { + docs: { + description: 'enforce `require("fs").promises`', + category: "Stylistic Issues", + recommended: false, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/prefer-promises/fs.md", + }, + fixable: null, + messages: { + preferPromises: "Use 'fs.promises.{{name}}()' instead.", + }, + schema: [], + type: "suggestion", + }, + + create(context) { + return { + "Program:exit"() { + const scope = context.getScope() + const tracker = new ReferenceTracker(scope, { mode: "legacy" }) + const references = [ + ...tracker.iterateCjsReferences(trackMap), + ...tracker.iterateEsmReferences(trackMap), + ] + + for (const { node, path } of references) { + const name = path[path.length - 1] + context.report({ + node, + messageId: "preferPromises", + data: { name }, + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/process-exit-as-throw.js b/node_modules/eslint-plugin-n/lib/rules/process-exit-as-throw.js new file mode 100644 index 0000000..0d98208 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/process-exit-as-throw.js @@ -0,0 +1,163 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const CodePathAnalyzer = safeRequire( + "eslint/lib/linter/code-path-analysis/code-path-analyzer", + "eslint/lib/code-path-analysis/code-path-analyzer" +) +const CodePathSegment = safeRequire( + "eslint/lib/linter/code-path-analysis/code-path-segment", + "eslint/lib/code-path-analysis/code-path-segment" +) +const CodePath = safeRequire( + "eslint/lib/linter/code-path-analysis/code-path", + "eslint/lib/code-path-analysis/code-path" +) + +const originalLeaveNode = + CodePathAnalyzer && CodePathAnalyzer.prototype.leaveNode + +/** + * Imports a specific module. + * @param {...string} moduleNames - module names to import. + * @returns {object|null} The imported object, or null. + */ +function safeRequire(...moduleNames) { + for (const moduleName of moduleNames) { + try { + return require(moduleName) + } catch (_err) { + // Ignore. + } + } + return null +} + +/* istanbul ignore next */ +/** + * Copied from https://github.com/eslint/eslint/blob/16fad5880bb70e9dddbeab8ed0f425ae51f5841f/lib/code-path-analysis/code-path-analyzer.js#L137 + * + * @param {CodePathAnalyzer} analyzer - The instance. + * @param {ASTNode} node - The current AST node. + * @returns {void} + */ +function forwardCurrentToHead(analyzer, node) { + const codePath = analyzer.codePath + const state = CodePath.getState(codePath) + const currentSegments = state.currentSegments + const headSegments = state.headSegments + const end = Math.max(currentSegments.length, headSegments.length) + let i = 0 + let currentSegment = null + let headSegment = null + + // Fires leaving events. + for (i = 0; i < end; ++i) { + currentSegment = currentSegments[i] + headSegment = headSegments[i] + + if (currentSegment !== headSegment && currentSegment) { + if (currentSegment.reachable) { + analyzer.emitter.emit( + "onCodePathSegmentEnd", + currentSegment, + node + ) + } + } + } + + // Update state. + state.currentSegments = headSegments + + // Fires entering events. + for (i = 0; i < end; ++i) { + currentSegment = currentSegments[i] + headSegment = headSegments[i] + + if (currentSegment !== headSegment && headSegment) { + CodePathSegment.markUsed(headSegment) + if (headSegment.reachable) { + analyzer.emitter.emit( + "onCodePathSegmentStart", + headSegment, + node + ) + } + } + } +} + +/** + * Checks whether a given node is `process.exit()` or not. + * + * @param {ASTNode} node - A node to check. + * @returns {boolean} `true` if the node is `process.exit()`. + */ +function isProcessExit(node) { + return ( + node.type === "CallExpression" && + node.callee.type === "MemberExpression" && + node.callee.computed === false && + node.callee.object.type === "Identifier" && + node.callee.object.name === "process" && + node.callee.property.type === "Identifier" && + node.callee.property.name === "exit" + ) +} + +/** + * The function to override `CodePathAnalyzer.prototype.leaveNode` in order to + * address `process.exit()` as throw. + * + * @this CodePathAnalyzer + * @param {ASTNode} node - A node to be left. + * @returns {void} + */ +function overrideLeaveNode(node) { + if (isProcessExit(node)) { + this.currentNode = node + + forwardCurrentToHead(this, node) + CodePath.getState(this.codePath).makeThrow() + + this.original.leaveNode(node) + this.currentNode = null + } else { + originalLeaveNode.call(this, node) + } +} + +const visitor = + CodePathAnalyzer == null + ? {} + : { + Program: function installProcessExitAsThrow() { + CodePathAnalyzer.prototype.leaveNode = overrideLeaveNode + }, + "Program:exit": function restoreProcessExitAsThrow() { + CodePathAnalyzer.prototype.leaveNode = originalLeaveNode + }, + } + +module.exports = { + meta: { + docs: { + description: + "make `process.exit()` expressions the same code path as `throw`", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/process-exit-as-throw.md", + }, + type: "problem", + fixable: null, + schema: [], + supported: CodePathAnalyzer != null, + }, + create() { + return visitor + }, +} diff --git a/node_modules/eslint-plugin-n/lib/rules/shebang.js b/node_modules/eslint-plugin-n/lib/rules/shebang.js new file mode 100644 index 0000000..4e4439a --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/rules/shebang.js @@ -0,0 +1,169 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const getConvertPath = require("../util/get-convert-path") +const getPackageJson = require("../util/get-package-json") + +const NODE_SHEBANG = "#!/usr/bin/env node\n" +const SHEBANG_PATTERN = /^(#!.+?)?(\r)?\n/u +const NODE_SHEBANG_PATTERN = /#!\/usr\/bin\/env node(?: [^\r\n]+?)?\n/u + +function simulateNodeResolutionAlgorithm(filePath, binField) { + const possibilities = [filePath] + let newFilePath = filePath.replace(/\.js$/u, "") + possibilities.push(newFilePath) + newFilePath = newFilePath.replace(/[/\\]index$/u, "") + possibilities.push(newFilePath) + return possibilities.includes(binField) +} + +/** + * Checks whether or not a given path is a `bin` file. + * + * @param {string} filePath - A file path to check. + * @param {string|object|undefined} binField - A value of the `bin` field of `package.json`. + * @param {string} basedir - A directory path that `package.json` exists. + * @returns {boolean} `true` if the file is a `bin` file. + */ +function isBinFile(filePath, binField, basedir) { + if (!binField) { + return false + } + if (typeof binField === "string") { + return simulateNodeResolutionAlgorithm( + filePath, + path.resolve(basedir, binField) + ) + } + return Object.keys(binField).some(key => + simulateNodeResolutionAlgorithm( + filePath, + path.resolve(basedir, binField[key]) + ) + ) +} + +/** + * Gets the shebang line (includes a line ending) from a given code. + * + * @param {SourceCode} sourceCode - A source code object to check. + * @returns {{length: number, bom: boolean, shebang: string, cr: boolean}} + * shebang's information. + * `retv.shebang` is an empty string if shebang doesn't exist. + */ +function getShebangInfo(sourceCode) { + const m = SHEBANG_PATTERN.exec(sourceCode.text) + + return { + bom: sourceCode.hasBOM, + cr: Boolean(m && m[2]), + length: (m && m[0].length) || 0, + shebang: (m && m[1] && `${m[1]}\n`) || "", + } +} + +module.exports = { + meta: { + docs: { + description: "suggest correct usage of shebang", + category: "Possible Errors", + recommended: true, + url: "https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/shebang.md", + }, + type: "problem", + fixable: "code", + schema: [ + { + type: "object", + properties: { + // + convertPath: getConvertPath.schema, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const sourceCode = context.getSourceCode() + let filePath = context.getFilename() + if (filePath === "") { + return {} + } + filePath = path.resolve(filePath) + + const p = getPackageJson(filePath) + if (!p) { + return {} + } + + const basedir = path.dirname(p.filePath) + filePath = path.join( + basedir, + getConvertPath(context)( + path.relative(basedir, filePath).replace(/\\/gu, "/") + ) + ) + + const needsShebang = isBinFile(filePath, p.bin, basedir) + const info = getShebangInfo(sourceCode) + + return { + Program(node) { + if ( + needsShebang + ? NODE_SHEBANG_PATTERN.test(info.shebang) + : !info.shebang + ) { + // Good the shebang target. + // Checks BOM and \r. + if (needsShebang && info.bom) { + context.report({ + node, + message: "This file must not have Unicode BOM.", + fix(fixer) { + return fixer.removeRange([-1, 0]) + }, + }) + } + if (needsShebang && info.cr) { + context.report({ + node, + message: + "This file must have Unix linebreaks (LF).", + fix(fixer) { + const index = sourceCode.text.indexOf("\r") + return fixer.removeRange([index, index + 1]) + }, + }) + } + } else if (needsShebang) { + // Shebang is lacking. + context.report({ + node, + message: + 'This file needs shebang "#!/usr/bin/env node".', + fix(fixer) { + return fixer.replaceTextRange( + [-1, info.length], + NODE_SHEBANG + ) + }, + }) + } else { + // Shebang is extra. + context.report({ + node, + message: "This file needs no shebang.", + fix(fixer) { + return fixer.removeRange([0, info.length]) + }, + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-n/lib/util/cache.js b/node_modules/eslint-plugin-n/lib/util/cache.js new file mode 100644 index 0000000..5365163 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/cache.js @@ -0,0 +1,58 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const SKIP_TIME = 5000 + +/** + * The class of cache. + * The cache will dispose of each value if the value has not been accessed + * during 5 seconds. + */ +module.exports = class Cache { + /** + * Initialize this cache instance. + */ + constructor() { + this.map = new Map() + } + + /** + * Get the cached value of the given key. + * @param {any} key The key to get. + * @returns {any} The cached value or null. + */ + get(key) { + const entry = this.map.get(key) + const now = Date.now() + + if (entry) { + if (entry.expire > now) { + entry.expire = now + SKIP_TIME + return entry.value + } + this.map.delete(key) + } + return null + } + + /** + * Set the value of the given key. + * @param {any} key The key to set. + * @param {any} value The value to set. + * @returns {void} + */ + set(key, value) { + const entry = this.map.get(key) + const expire = Date.now() + SKIP_TIME + + if (entry) { + entry.value = value + entry.expire = expire + } else { + this.map.set(key, { value, expire }) + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-existence.js b/node_modules/eslint-plugin-n/lib/util/check-existence.js new file mode 100644 index 0000000..667e288 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-existence.js @@ -0,0 +1,55 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const exists = require("./exists") +const getAllowModules = require("./get-allow-modules") +const isTypescript = require("./is-typescript") +const mapTypescriptExtension = require("../util/map-typescript-extension") + +/** + * Checks whether or not each requirement target exists. + * + * It looks up the target according to the logic of Node.js. + * See Also: https://nodejs.org/api/modules.html + * + * @param {RuleContext} context - A context to report. + * @param {ImportTarget[]} targets - A list of target information to check. + * @returns {void} + */ +module.exports = function checkExistence(context, targets) { + const allowed = new Set(getAllowModules(context)) + + for (const target of targets) { + const missingModule = + target.moduleName != null && + !allowed.has(target.moduleName) && + target.filePath == null + + let missingFile = target.moduleName == null && !exists(target.filePath) + if (missingFile && isTypescript(context)) { + const parsed = path.parse(target.filePath) + const reversedExt = mapTypescriptExtension( + context, + target.filePath, + parsed.ext, + true + ) + const reversedPath = + path.resolve(parsed.dir, parsed.name) + reversedExt + missingFile = target.moduleName == null && !exists(reversedPath) + } + + if (missingModule || missingFile) { + context.report({ + node: target.node, + loc: target.node.loc, + message: '"{{name}}" is not found.', + data: target, + }) + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-extraneous.js b/node_modules/eslint-plugin-n/lib/util/check-extraneous.js new file mode 100644 index 0000000..d0ff8dd --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-extraneous.js @@ -0,0 +1,52 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const getAllowModules = require("./get-allow-modules") +const getPackageJson = require("./get-package-json") + +/** + * Checks whether or not each requirement target is published via package.json. + * + * It reads package.json and checks the target exists in `dependencies`. + * + * @param {RuleContext} context - A context to report. + * @param {string} filePath - The current file path. + * @param {ImportTarget[]} targets - A list of target information to check. + * @returns {void} + */ +module.exports = function checkForExtraneous(context, filePath, targets) { + const packageInfo = getPackageJson(filePath) + if (!packageInfo) { + return + } + + const allowed = new Set(getAllowModules(context)) + const dependencies = new Set( + [].concat( + Object.keys(packageInfo.dependencies || {}), + Object.keys(packageInfo.devDependencies || {}), + Object.keys(packageInfo.peerDependencies || {}), + Object.keys(packageInfo.optionalDependencies || {}) + ) + ) + + for (const target of targets) { + const extraneous = + target.moduleName != null && + target.filePath != null && + !dependencies.has(target.moduleName) && + !allowed.has(target.moduleName) + + if (extraneous) { + context.report({ + node: target.node, + loc: target.node.loc, + message: '"{{moduleName}}" is extraneous.', + data: target, + }) + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-prefer-global.js b/node_modules/eslint-plugin-n/lib/util/check-prefer-global.js new file mode 100644 index 0000000..f204966 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-prefer-global.js @@ -0,0 +1,63 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { ReferenceTracker } = require("eslint-utils") + +/** + * Verifier for `prefer-global/*` rules. + */ +class Verifier { + /** + * Initialize this instance. + * @param {RuleContext} context The rule context to report. + * @param {{modules:object,globals:object}} trackMap The track map. + */ + constructor(context, trackMap) { + this.context = context + this.trackMap = trackMap + this.verify = + context.options[0] === "never" + ? this.verifyToPreferModules + : this.verifyToPreferGlobals + } + + /** + * Verify the code to suggest the use of globals. + * @returns {void} + */ + verifyToPreferGlobals() { + const { context, trackMap } = this + const tracker = new ReferenceTracker(context.getScope(), { + mode: "legacy", + }) + + for (const { node } of [ + ...tracker.iterateCjsReferences(trackMap.modules), + ...tracker.iterateEsmReferences(trackMap.modules), + ]) { + context.report({ node, messageId: "preferGlobal" }) + } + } + + /** + * Verify the code to suggest the use of modules. + * @returns {void} + */ + verifyToPreferModules() { + const { context, trackMap } = this + const tracker = new ReferenceTracker(context.getScope()) + + for (const { node } of tracker.iterateGlobalReferences( + trackMap.globals + )) { + context.report({ node, messageId: "preferModule" }) + } + } +} + +module.exports = function checkForPreferGlobal(context, trackMap) { + new Verifier(context, trackMap).verify() +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-publish.js b/node_modules/eslint-plugin-n/lib/util/check-publish.js new file mode 100644 index 0000000..940f7c2 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-publish.js @@ -0,0 +1,71 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const getAllowModules = require("./get-allow-modules") +const getConvertPath = require("./get-convert-path") +const getNpmignore = require("./get-npmignore") +const getPackageJson = require("./get-package-json") + +/** + * Checks whether or not each requirement target is published via package.json. + * + * It reads package.json and checks the target exists in `dependencies`. + * + * @param {RuleContext} context - A context to report. + * @param {string} filePath - The current file path. + * @param {ImportTarget[]} targets - A list of target information to check. + * @returns {void} + */ +module.exports = function checkForPublish(context, filePath, targets) { + const packageInfo = getPackageJson(filePath) + if (!packageInfo) { + return + } + + const allowed = new Set(getAllowModules(context)) + const convertPath = getConvertPath(context) + const basedir = path.dirname(packageInfo.filePath) + + const toRelative = fullPath => { + const retv = path.relative(basedir, fullPath).replace(/\\/gu, "/") + return convertPath(retv) + } + const npmignore = getNpmignore(filePath) + const devDependencies = new Set( + Object.keys(packageInfo.devDependencies || {}) + ) + const dependencies = new Set( + [].concat( + Object.keys(packageInfo.dependencies || {}), + Object.keys(packageInfo.peerDependencies || {}), + Object.keys(packageInfo.optionalDependencies || {}) + ) + ) + + if (!npmignore.match(toRelative(filePath))) { + // This file is published, so this cannot import private files. + for (const target of targets) { + const isPrivateFile = + target.moduleName == null && + npmignore.match(toRelative(target.filePath)) + const isDevPackage = + target.moduleName != null && + devDependencies.has(target.moduleName) && + !dependencies.has(target.moduleName) && + !allowed.has(target.moduleName) + + if (isPrivateFile || isDevPackage) { + context.report({ + node: target.node, + loc: target.node.loc, + message: '"{{name}}" is not published.', + data: { name: target.moduleName || target.name }, + }) + } + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-restricted.js b/node_modules/eslint-plugin-n/lib/util/check-restricted.js new file mode 100644 index 0000000..0eae4f8 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-restricted.js @@ -0,0 +1,109 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const { Minimatch } = require("minimatch") + +/** @typedef {import("../util/import-target")} ImportTarget */ +/** + * @typedef {Object} DefinitionData + * @property {string | string[]} name The name to disallow. + * @property {string} [message] The custom message to show. + */ + +/** + * Check if matched or not. + * @param {InstanceType} matcher The matcher. + * @param {boolean} absolute The flag that the matcher is for absolute paths. + * @param {ImportTarget} importee The importee information. + */ +function match(matcher, absolute, { filePath, name }) { + if (absolute) { + return filePath != null && matcher.match(filePath) + } + return matcher.match(name) +} + +/** Restriction. */ +class Restriction { + /** + * Initialize this restriction. + * @param {DefinitionData} def The definition of a restriction. + */ + constructor({ name, message }) { + const names = Array.isArray(name) ? name : [name] + const matchers = names.map(raw => { + const negate = raw[0] === "!" && raw[1] !== "(" + const pattern = negate ? raw.slice(1) : raw + const absolute = path.isAbsolute(pattern) + const matcher = new Minimatch(pattern, { dot: true }) + return { absolute, matcher, negate } + }) + + this.matchers = matchers + this.message = message ? ` ${message}` : "" + } + + /** + * Check if a given importee is disallowed. + * @param {ImportTarget} importee The importee to check. + * @returns {boolean} `true` if the importee is disallowed. + */ + match(importee) { + return this.matchers.reduce( + (ret, { absolute, matcher, negate }) => + negate + ? ret && !match(matcher, absolute, importee) + : ret || match(matcher, absolute, importee), + false + ) + } +} + +/** + * Create a restriction. + * @param {string | DefinitionData} def A definition. + * @returns {Restriction} Created restriction. + */ +function createRestriction(def) { + if (typeof def === "string") { + return new Restriction({ name: def }) + } + return new Restriction(def) +} + +/** + * Create restrictions. + * @param {(string | DefinitionData | GlobDefinition)[]} defs Definitions. + * @returns {(Restriction | GlobRestriction)[]} Created restrictions. + */ +function createRestrictions(defs) { + return (defs || []).map(createRestriction) +} + +/** + * Checks if given importees are disallowed or not. + * @param {RuleContext} context - A context to report. + * @param {ImportTarget[]} targets - A list of target information to check. + * @returns {void} + */ +module.exports = function checkForRestriction(context, targets) { + const restrictions = createRestrictions(context.options[0]) + + for (const target of targets) { + const restriction = restrictions.find(r => r.match(target)) + if (restriction) { + context.report({ + node: target.node, + messageId: "restricted", + data: { + name: target.name, + customMessage: restriction.message, + }, + }) + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/check-unsupported-builtins.js b/node_modules/eslint-plugin-n/lib/util/check-unsupported-builtins.js new file mode 100644 index 0000000..15d27a8 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/check-unsupported-builtins.js @@ -0,0 +1,108 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { Range, lt, major } = require("semver") //eslint-disable-line no-unused-vars +const { ReferenceTracker } = require("eslint-utils") +const getConfiguredNodeVersion = require("./get-configured-node-version") +const getSemverRange = require("./get-semver-range") + +/** + * @typedef {Object} SupportInfo + * @property {string | null} supported The stably supported version. If `null` is present, it hasn't been supported yet. + * @property {string[]} [backported] The backported versions. + * @property {string} [experimental] The added version as experimental. + */ + +/** + * Parses the options. + * @param {RuleContext} context The rule context. + * @returns {{version:Range,ignores:Set}} Parsed value. + */ +function parseOptions(context) { + const raw = context.options[0] || {} + const filePath = context.getFilename() + const version = getConfiguredNodeVersion(raw.version, filePath) + const ignores = new Set(raw.ignores || []) + + return Object.freeze({ version, ignores }) +} + +/** + * Check if it has been supported. + * @param {SupportInfo} info The support info. + * @param {Range} configured The configured version range. + */ +function isSupported({ backported, supported }, configured) { + if ( + backported && + backported.length >= 2 && + !backported.every((v, i) => i === 0 || lt(backported[i - 1], v)) + ) { + throw new Error("Invalid BackportConfiguration") + } + + if (supported == null) { + return false + } + if (backported == null || backported.length === 0) { + return !configured.intersects(getSemverRange(`<${supported}`)) + } + + return !configured.intersects( + getSemverRange( + [...backported, supported] + .map((v, i) => (i === 0 ? `<${v}` : `>=${major(v)}.0.0 <${v}`)) + .join(" || ") + ) + ) +} + +/** + * Get the formatted text of a given supported version. + * @param {SupportInfo} info The support info. + */ +function supportedVersionToString({ backported, supported }) { + if (supported == null) { + return "(none yet)" + } + if (backported == null || backported.length === 0) { + return supported + } + return `${supported} (backported: ^${backported.join(", ^")})` +} + +/** + * Verify the code to report unsupported APIs. + * @param {RuleContext} context The rule context. + * @param {{modules:object,globals:object}} trackMap The map for APIs to report. + * @returns {void} + */ +module.exports = function checkUnsupportedBuiltins(context, trackMap) { + const options = parseOptions(context) + const tracker = new ReferenceTracker(context.getScope(), { mode: "legacy" }) + const references = [ + ...tracker.iterateCjsReferences(trackMap.modules || {}), + ...tracker.iterateEsmReferences(trackMap.modules || {}), + ...tracker.iterateGlobalReferences(trackMap.globals || {}), + ] + + for (const { node, path, info } of references) { + const name = path.join(".") + const supported = isSupported(info, options.version) + + if (!supported && !options.ignores.has(name)) { + context.report({ + node, + messageId: "unsupported", + data: { + name, + supported: supportedVersionToString(info), + version: options.version.raw, + }, + }) + } + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/enumerate-property-names.js b/node_modules/eslint-plugin-n/lib/util/enumerate-property-names.js new file mode 100644 index 0000000..1d87e1c --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/enumerate-property-names.js @@ -0,0 +1,39 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { CALL, CONSTRUCT, READ } = require("eslint-utils") + +/** + * Enumerate property names of a given object recursively. + * @param {object} trackMap The map for APIs to enumerate. + * @param {string[]|undefined} path The path to the current map. + * @returns {IterableIterator} The property names of the map. + */ +function* enumeratePropertyNames(trackMap, path = []) { + for (const key of Object.keys(trackMap)) { + const value = trackMap[key] + if (typeof value !== "object") { + continue + } + + path.push(key) + + if (value[CALL]) { + yield `${path.join(".")}()` + } + if (value[CONSTRUCT]) { + yield `new ${path.join(".")}()` + } + if (value[READ]) { + yield path.join(".") + } + yield* enumeratePropertyNames(value, path) + + path.pop() + } +} + +module.exports = enumeratePropertyNames diff --git a/node_modules/eslint-plugin-n/lib/util/exists.js b/node_modules/eslint-plugin-n/lib/util/exists.js new file mode 100644 index 0000000..d57981b --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/exists.js @@ -0,0 +1,58 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const fs = require("fs") +const path = require("path") +const Cache = require("./cache") + +const ROOT = /^(?:[/.]|\.\.|[A-Z]:\\|\\\\)(?:[/\\]\.\.)*$/u +const cache = new Cache() + +/** + * Check whether the file exists or not. + * @param {string} filePath The file path to check. + * @returns {boolean} `true` if the file exists. + */ +function existsCaseSensitive(filePath) { + let dirPath = filePath + + while (dirPath !== "" && !ROOT.test(dirPath)) { + const fileName = path.basename(dirPath) + dirPath = path.dirname(dirPath) + + if (fs.readdirSync(dirPath).indexOf(fileName) === -1) { + return false + } + } + + return true +} + +/** + * Checks whether or not the file of a given path exists. + * + * @param {string} filePath - A file path to check. + * @returns {boolean} `true` if the file of a given path exists. + */ +module.exports = function exists(filePath) { + let result = cache.get(filePath) + if (result == null) { + try { + const relativePath = path.relative(process.cwd(), filePath) + result = + fs.statSync(relativePath).isFile() && + existsCaseSensitive(relativePath) + } catch (error) { + if (error.code !== "ENOENT") { + throw error + } + result = false + } + cache.set(filePath, result) + } + + return result +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-allow-modules.js b/node_modules/eslint-plugin-n/lib/util/get-allow-modules.js new file mode 100644 index 0000000..54efcef --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-allow-modules.js @@ -0,0 +1,49 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const DEFAULT_VALUE = Object.freeze([]) + +/** + * Gets `allowModules` property from a given option object. + * + * @param {object|undefined} option - An option object to get. + * @returns {string[]|null} The `allowModules` value, or `null`. + */ +function get(option) { + if (option && option.allowModules && Array.isArray(option.allowModules)) { + return option.allowModules.map(String) + } + return null +} + +/** + * Gets "allowModules" setting. + * + * 1. This checks `options` property, then returns it if exists. + * 2. This checks `settings.n` | `settings.node` property, then returns it if exists. + * 3. This returns `[]`. + * + * @param {RuleContext} context - The rule context. + * @returns {string[]} A list of extensions. + */ +module.exports = function getAllowModules(context) { + return ( + get(context.options && context.options[0]) || + get( + context.settings && (context.settings.n || context.settings.node) + ) || + DEFAULT_VALUE + ) +} + +module.exports.schema = { + type: "array", + items: { + type: "string", + pattern: "^(?:@[a-zA-Z0-9_\\-.]+/)?[a-zA-Z0-9_\\-.]+$", + }, + uniqueItems: true, +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-configured-node-version.js b/node_modules/eslint-plugin-n/lib/util/get-configured-node-version.js new file mode 100644 index 0000000..d682e3a --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-configured-node-version.js @@ -0,0 +1,39 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { Range } = require("semver") //eslint-disable-line no-unused-vars +const getPackageJson = require("./get-package-json") +const getSemverRange = require("./get-semver-range") + +/** + * Get the `engines.node` field of package.json. + * @param {string} filename The path to the current linting file. + * @returns {Range|null} The range object of the `engines.node` field. + */ +function getEnginesNode(filename) { + const info = getPackageJson(filename) + return getSemverRange(info && info.engines && info.engines.node) +} + +/** + * Gets version configuration. + * + * 1. Parse a given version then return it if it's valid. + * 2. Look package.json up and parse `engines.node` then return it if it's valid. + * 3. Return `>=8.0.0`. + * + * @param {string|undefined} version The version range text. + * @param {string} filename The path to the current linting file. + * This will be used to look package.json up if `version` is not a valid version range. + * @returns {Range} The configured version range. + */ +module.exports = function getConfiguredNodeVersion(version, filename) { + return ( + getSemverRange(version) || + getEnginesNode(filename) || + getSemverRange(">=8.0.0") + ) +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-convert-path.js b/node_modules/eslint-plugin-n/lib/util/get-convert-path.js new file mode 100644 index 0000000..5d8f775 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-convert-path.js @@ -0,0 +1,191 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const Minimatch = require("minimatch").Minimatch + +/** + * @param {any} x - An any value. + * @returns {any} Always `x`. + */ +function identity(x) { + return x +} + +/** + * Converts old-style value to new-style value. + * + * @param {any} x - The value to convert. + * @returns {({include: string[], exclude: string[], replace: string[]})[]} Normalized value. + */ +function normalizeValue(x) { + if (Array.isArray(x)) { + return x + } + + return Object.keys(x).map(pattern => ({ + include: [pattern], + exclude: [], + replace: x[pattern], + })) +} + +/** + * Ensures the given value is a string array. + * + * @param {any} x - The value to ensure. + * @returns {string[]} The string array. + */ +function toStringArray(x) { + if (Array.isArray(x)) { + return x.map(String) + } + return [] +} + +/** + * Creates the function which checks whether a file path is matched with the given pattern or not. + * + * @param {string[]} includePatterns - The glob patterns to include files. + * @param {string[]} excludePatterns - The glob patterns to exclude files. + * @returns {function} Created predicate function. + */ +function createMatch(includePatterns, excludePatterns) { + const include = includePatterns.map(pattern => new Minimatch(pattern)) + const exclude = excludePatterns.map(pattern => new Minimatch(pattern)) + + return filePath => + include.some(m => m.match(filePath)) && + !exclude.some(m => m.match(filePath)) +} + +/** + * Creates a function which replaces a given path. + * + * @param {RegExp} fromRegexp - A `RegExp` object to replace. + * @param {string} toStr - A new string to replace. + * @returns {function} A function which replaces a given path. + */ +function defineConvert(fromRegexp, toStr) { + return filePath => filePath.replace(fromRegexp, toStr) +} + +/** + * Combines given converters. + * The result function converts a given path with the first matched converter. + * + * @param {{match: function, convert: function}} converters - A list of converters to combine. + * @returns {function} A function which replaces a given path. + */ +function combine(converters) { + return filePath => { + for (const converter of converters) { + if (converter.match(filePath)) { + return converter.convert(filePath) + } + } + return filePath + } +} + +/** + * Parses `convertPath` property from a given option object. + * + * @param {object|undefined} option - An option object to get. + * @returns {function|null} A function which converts a path., or `null`. + */ +function parse(option) { + if ( + !option || + !option.convertPath || + typeof option.convertPath !== "object" + ) { + return null + } + + const converters = [] + for (const pattern of normalizeValue(option.convertPath)) { + const include = toStringArray(pattern.include) + const exclude = toStringArray(pattern.exclude) + const fromRegexp = new RegExp(String(pattern.replace[0])) + const toStr = String(pattern.replace[1]) + + converters.push({ + match: createMatch(include, exclude), + convert: defineConvert(fromRegexp, toStr), + }) + } + + return combine(converters) +} + +/** + * Gets "convertPath" setting. + * + * 1. This checks `options` property, then returns it if exists. + * 2. This checks `settings.n` | `settings.node` property, then returns it if exists. + * 3. This returns a function of identity. + * + * @param {RuleContext} context - The rule context. + * @returns {function} A function which converts a path. + */ +module.exports = function getConvertPath(context) { + return ( + parse(context.options && context.options[0]) || + parse( + context.settings && (context.settings.n || context.settings.node) + ) || + identity + ) +} + +/** + * JSON Schema for `convertPath` option. + */ +module.exports.schema = { + anyOf: [ + { + type: "object", + properties: {}, + patternProperties: { + "^.+$": { + type: "array", + items: { type: "string" }, + minItems: 2, + maxItems: 2, + }, + }, + additionalProperties: false, + }, + { + type: "array", + items: { + type: "object", + properties: { + include: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true, + }, + exclude: { + type: "array", + items: { type: "string" }, + uniqueItems: true, + }, + replace: { + type: "array", + items: { type: "string" }, + minItems: 2, + maxItems: 2, + }, + }, + additionalProperties: false, + required: ["include", "replace"], + }, + minItems: 1, + }, + ], +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-npmignore.js b/node_modules/eslint-plugin-n/lib/util/get-npmignore.js new file mode 100644 index 0000000..a818075 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-npmignore.js @@ -0,0 +1,185 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const fs = require("fs") +const path = require("path") +const ignore = require("ignore") +const Cache = require("./cache") +const exists = require("./exists") +const getPackageJson = require("./get-package-json") + +const cache = new Cache() +const SLASH_AT_BEGIN_AND_END = /^!?\/+|^!|\/+$/gu +const PARENT_RELATIVE_PATH = /^\.\./u +const NEVER_IGNORED = + /^(?:readme\.[^.]*|(?:licen[cs]e|changes|changelog|history)(?:\.[^.]*)?)$/iu + +/** + * Checks whether or not a given file name is a relative path to a ancestor + * directory. + * + * @param {string} filePath - A file name to check. + * @returns {boolean} `true` if the file name is a relative path to a ancestor + * directory. + */ +function isAncestorFiles(filePath) { + return PARENT_RELATIVE_PATH.test(filePath) +} + +/** + * @param {function} f - A function. + * @param {function} g - A function. + * @returns {function} A logical-and function of `f` and `g`. + */ +function and(f, g) { + return filePath => f(filePath) && g(filePath) +} + +/** + * @param {function} f - A function. + * @param {function} g - A function. + * @param {function|null} h - A function. + * @returns {function} A logical-or function of `f`, `g`, and `h`. + */ +function or(f, g, h) { + return filePath => f(filePath) || g(filePath) || (h && h(filePath)) +} + +/** + * @param {function} f - A function. + * @returns {function} A logical-not function of `f`. + */ +function not(f) { + return filePath => !f(filePath) +} + +/** + * Creates a function which checks whether or not a given file is ignoreable. + * + * @param {object} p - An object of package.json. + * @returns {function} A function which checks whether or not a given file is ignoreable. + */ +function filterNeverIgnoredFiles(p) { + const basedir = path.dirname(p.filePath) + const mainFilePath = + typeof p.main === "string" ? path.join(basedir, p.main) : null + + return filePath => + path.join(basedir, filePath) !== mainFilePath && + filePath !== "package.json" && + !NEVER_IGNORED.test(path.relative(basedir, filePath)) +} + +/** + * Creates a function which checks whether or not a given file should be ignored. + * + * @param {string[]|null} files - File names of whitelist. + * @returns {function|null} A function which checks whether or not a given file should be ignored. + */ +function parseWhiteList(files) { + if (!files || !Array.isArray(files)) { + return null + } + + const ig = ignore() + const igN = ignore() + let hasN = false + + for (const file of files) { + if (typeof file === "string" && file) { + const body = file.replace(SLASH_AT_BEGIN_AND_END, "") + if (file.startsWith("!")) { + igN.add(`${body}`) + igN.add(`${body}/**`) + hasN = true + } else { + ig.add(`/${body}`) + ig.add(`/${body}/**`) + } + } + } + + return hasN + ? or(ig.createFilter(), not(igN.createFilter())) + : ig.createFilter() +} + +/** + * Creates a function which checks whether or not a given file should be ignored. + * + * @param {string} basedir - The directory path "package.json" exists. + * @param {boolean} filesFieldExists - `true` if `files` field of `package.json` exists. + * @returns {function|null} A function which checks whether or not a given file should be ignored. + */ +function parseNpmignore(basedir, filesFieldExists) { + let filePath = path.join(basedir, ".npmignore") + if (!exists(filePath)) { + if (filesFieldExists) { + return null + } + + filePath = path.join(basedir, ".gitignore") + if (!exists(filePath)) { + return null + } + } + + const ig = ignore() + ig.add(fs.readFileSync(filePath, "utf8")) + return not(ig.createFilter()) +} + +/** + * Gets an object to check whether a given path should be ignored or not. + * The object is created from: + * + * - `files` field of `package.json` + * - `.npmignore` + * + * @param {string} startPath - A file path to lookup. + * @returns {object} + * An object to check whther or not a given path should be ignored. + * The object has a method `match`. + * `match` returns `true` if a given file path should be ignored. + */ +module.exports = function getNpmignore(startPath) { + const retv = { match: isAncestorFiles } + + const p = getPackageJson(startPath) + if (p) { + const data = cache.get(p.filePath) + if (data) { + return data + } + + const filesIgnore = parseWhiteList(p.files) + const npmignoreIgnore = parseNpmignore( + path.dirname(p.filePath), + Boolean(filesIgnore) + ) + + if (filesIgnore && npmignoreIgnore) { + retv.match = and( + filterNeverIgnoredFiles(p), + or(isAncestorFiles, filesIgnore, npmignoreIgnore) + ) + } else if (filesIgnore) { + retv.match = and( + filterNeverIgnoredFiles(p), + or(isAncestorFiles, filesIgnore) + ) + } else if (npmignoreIgnore) { + retv.match = and( + filterNeverIgnoredFiles(p), + or(isAncestorFiles, npmignoreIgnore) + ) + } + + cache.set(p.filePath, retv) + } + + return retv +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-package-json.js b/node_modules/eslint-plugin-n/lib/util/get-package-json.js new file mode 100644 index 0000000..685c4a0 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-package-json.js @@ -0,0 +1,75 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const fs = require("fs") +const path = require("path") +const Cache = require("./cache") + +const cache = new Cache() + +/** + * Reads the `package.json` data in a given path. + * + * Don't cache the data. + * + * @param {string} dir - The path to a directory to read. + * @returns {object|null} The read `package.json` data, or null. + */ +function readPackageJson(dir) { + const filePath = path.join(dir, "package.json") + try { + const text = fs.readFileSync(filePath, "utf8") + const data = JSON.parse(text) + + if (typeof data === "object" && data !== null) { + data.filePath = filePath + return data + } + } catch (_err) { + // do nothing. + } + + return null +} + +/** + * Gets a `package.json` data. + * The data is cached if found, then it's used after. + * + * @param {string} [startPath] - A file path to lookup. + * @returns {object|null} A found `package.json` data or `null`. + * This object have additional property `filePath`. + */ +module.exports = function getPackageJson(startPath = "a.js") { + const startDir = path.dirname(path.resolve(startPath)) + let dir = startDir + let prevDir = "" + let data = null + + do { + data = cache.get(dir) + if (data) { + if (dir !== startDir) { + cache.set(startDir, data) + } + return data + } + + data = readPackageJson(dir) + if (data) { + cache.set(dir, data) + cache.set(startDir, data) + return data + } + + // Go to next. + prevDir = dir + dir = path.resolve(dir, "..") + } while (dir !== prevDir) + + cache.set(startDir, null) + return null +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-resolve-paths.js b/node_modules/eslint-plugin-n/lib/util/get-resolve-paths.js new file mode 100644 index 0000000..d848cc6 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-resolve-paths.js @@ -0,0 +1,46 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const DEFAULT_VALUE = Object.freeze([]) + +/** + * Gets `resolvePaths` property from a given option object. + * + * @param {object|undefined} option - An option object to get. + * @returns {string[]|null} The `allowModules` value, or `null`. + */ +function get(option) { + if (option && option.resolvePaths && Array.isArray(option.resolvePaths)) { + return option.resolvePaths.map(String) + } + return null +} + +/** + * Gets "resolvePaths" setting. + * + * 1. This checks `options` property, then returns it if exists. + * 2. This checks `settings.n` | `settings.node` property, then returns it if exists. + * 3. This returns `[]`. + * + * @param {RuleContext} context - The rule context. + * @returns {string[]} A list of extensions. + */ +module.exports = function getResolvePaths(context, optionIndex = 0) { + return ( + get(context.options && context.options[optionIndex]) || + get( + context.settings && (context.settings.n || context.settings.node) + ) || + DEFAULT_VALUE + ) +} + +module.exports.schema = { + type: "array", + items: { type: "string" }, + uniqueItems: true, +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-semver-range.js b/node_modules/eslint-plugin-n/lib/util/get-semver-range.js new file mode 100644 index 0000000..58c299b --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-semver-range.js @@ -0,0 +1,30 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const { Range } = require("semver") +const cache = new Map() + +/** + * Get the `semver.Range` object of a given range text. + * @param {string} x The text expression for a semver range. + * @returns {Range|null} The range object of a given range text. + * It's null if the `x` is not a valid range text. + */ +module.exports = function getSemverRange(x) { + const s = String(x) + let ret = cache.get(s) || null + + if (!ret) { + try { + ret = new Range(s) + } catch (_error) { + // Ignore parsing error. + } + cache.set(s, ret) + } + + return ret +} diff --git a/node_modules/eslint-plugin-n/lib/util/get-try-extensions.js b/node_modules/eslint-plugin-n/lib/util/get-try-extensions.js new file mode 100644 index 0000000..1b7aa50 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/get-try-extensions.js @@ -0,0 +1,49 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const DEFAULT_VALUE = Object.freeze([".js", ".json", ".node"]) + +/** + * Gets `tryExtensions` property from a given option object. + * + * @param {object|undefined} option - An option object to get. + * @returns {string[]|null} The `tryExtensions` value, or `null`. + */ +function get(option) { + if (option && option.tryExtensions && Array.isArray(option.tryExtensions)) { + return option.tryExtensions.map(String) + } + return null +} + +/** + * Gets "tryExtensions" setting. + * + * 1. This checks `options` property, then returns it if exists. + * 2. This checks `settings.n` | `settings.node` property, then returns it if exists. + * 3. This returns `[".js", ".json", ".node"]`. + * + * @param {RuleContext} context - The rule context. + * @returns {string[]} A list of extensions. + */ +module.exports = function getTryExtensions(context, optionIndex = 0) { + return ( + get(context.options && context.options[optionIndex]) || + get( + context.settings && (context.settings.n || context.settings.node) + ) || + DEFAULT_VALUE + ) +} + +module.exports.schema = { + type: "array", + items: { + type: "string", + pattern: "^\\.", + }, + uniqueItems: true, +} diff --git a/node_modules/eslint-plugin-n/lib/util/import-target.js b/node_modules/eslint-plugin-n/lib/util/import-target.js new file mode 100644 index 0000000..9f62a11 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/import-target.js @@ -0,0 +1,132 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const { pathToFileURL, fileURLToPath } = require("url") +const resolve = require("resolve") +const { + defaultResolve: importResolve, +} = require("../converted-esm/import-meta-resolve") + +/** + * Resolve the given id to file paths. + * @param {boolean} isModule The flag which indicates this id is a module. + * @param {string} id The id to resolve. + * @param {object} options The options of node-resolve module. + * It requires `options.basedir`. + * @param {'import' | 'require'} moduleType - whether the target was require-ed or imported + * @returns {string|null} The resolved path. + */ +function getFilePath(isModule, id, options, moduleType) { + if (moduleType === "import") { + const paths = + options.paths && options.paths.length > 0 + ? options.paths.map(p => path.resolve(process.cwd(), p)) + : [options.basedir] + for (const aPath of paths) { + try { + const { url } = importResolve(id, { + parentURL: pathToFileURL(path.join(aPath, "dummy-file.mjs")) + .href, + conditions: ["node", "import", "require"], + }) + + if (url) { + return fileURLToPath(url) + } + } catch (e) { + continue + } + } + + if (isModule) { + return null + } + return path.resolve( + (options.paths && options.paths[0]) || options.basedir, + id + ) + } else { + try { + return resolve.sync(id, options) + } catch (_err) { + try { + const { url } = importResolve(id, { + parentURL: pathToFileURL( + path.join(options.basedir, "dummy-file.js") + ).href, + conditions: ["node", "require"], + }) + + return fileURLToPath(url) + } catch (err) { + if (isModule) { + return null + } + return path.resolve(options.basedir, id) + } + } + } +} + +/** + * Gets the module name of a given path. + * + * e.g. `eslint/lib/ast-utils` -> `eslint` + * + * @param {string} nameOrPath - A path to get. + * @returns {string} The module name of the path. + */ +function getModuleName(nameOrPath) { + let end = nameOrPath.indexOf("/") + if (end !== -1 && nameOrPath[0] === "@") { + end = nameOrPath.indexOf("/", 1 + end) + } + + return end === -1 ? nameOrPath : nameOrPath.slice(0, end) +} + +/** + * Information of an import target. + */ +module.exports = class ImportTarget { + /** + * Initialize this instance. + * @param {ASTNode} node - The node of a `require()` or a module declaraiton. + * @param {string} name - The name of an import target. + * @param {object} options - The options of `node-resolve` module. + * @param {'import' | 'require'} moduleType - whether the target was require-ed or imported + */ + constructor(node, name, options, moduleType) { + const isModule = !/^(?:[./\\]|\w+:)/u.test(name) + + /** + * The node of a `require()` or a module declaraiton. + * @type {ASTNode} + */ + this.node = node + + /** + * The name of this import target. + * @type {string} + */ + this.name = name + + /** + * The full path of this import target. + * If the target is a module and it does not exist then this is `null`. + * @type {string|null} + */ + this.filePath = getFilePath(isModule, name, options, moduleType) + + /** + * The module name of this import target. + * If the target is a relative path then this is `null`. + * @type {string|null} + */ + this.moduleName = isModule ? getModuleName(name) : null + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/is-typescript.js b/node_modules/eslint-plugin-n/lib/util/is-typescript.js new file mode 100644 index 0000000..a61a137 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/is-typescript.js @@ -0,0 +1,16 @@ +"use strict" + +const path = require("path") + +const typescriptExtensions = [".ts", ".cts", ".mts"] + +/** + * Determine if the context source file is typescript. + * + * @param {RuleContext} context - A context + * @returns {boolean} + */ +module.exports = function isTypescript(context) { + const sourceFileExt = path.extname(context.getPhysicalFilename()) + return typescriptExtensions.includes(sourceFileExt) +} diff --git a/node_modules/eslint-plugin-n/lib/util/map-typescript-extension.js b/node_modules/eslint-plugin-n/lib/util/map-typescript-extension.js new file mode 100644 index 0000000..ecd3d9f --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/map-typescript-extension.js @@ -0,0 +1,50 @@ +"use strict" + +const path = require("path") +const isTypescript = require("../util/is-typescript") + +const mapping = { + "": ".js", // default empty extension will map to js + ".ts": ".js", + ".cts": ".cjs", + ".mts": ".mjs", +} + +const reverseMapping = { + ".js": ".ts", + ".cjs": ".cts", + ".mjs": ".mts", +} + +/** + * Maps the typescript file extension that should be added in an import statement, + * based on the given file extension of the referenced file OR fallsback to the original given extension. + * + * For example, in typescript, when referencing another typescript from a typescript file, + * a .js extension should be used instead of the original .ts extension of the referenced file. + * + * @param {RuleContext} context + * @param {string} filePath The filePath of the import + * @param {string} fallbackExtension The non-typescript fallback + * @param {boolean} reverse Execute a reverse path mapping + * @returns {string} The file extension to append to the import statement. + */ +module.exports = function mapTypescriptExtension( + context, + filePath, + fallbackExtension, + reverse = false +) { + const ext = path.extname(filePath) + if (reverse) { + if (isTypescript(context) && ext in reverseMapping) { + return reverseMapping[ext] + } + } else { + if (isTypescript(context) && ext in mapping) { + return mapping[ext] + } + } + + return fallbackExtension +} diff --git a/node_modules/eslint-plugin-n/lib/util/merge-visitors-in-place.js b/node_modules/eslint-plugin-n/lib/util/merge-visitors-in-place.js new file mode 100644 index 0000000..eea30da --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/merge-visitors-in-place.js @@ -0,0 +1,46 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +/** + * Merge two visitors. + * This function modifies `visitor1` directly to merge. + * @param {Visitor} visitor1 The visitor which is assigned. + * @param {Visitor} visitor2 The visitor which is assigning. + * @returns {Visitor} `visitor1`. + */ +module.exports = function mergeVisitorsInPlace(visitor1, visitor2) { + for (const key of Object.keys(visitor2)) { + const handler1 = visitor1[key] + const handler2 = visitor2[key] + + if (typeof handler1 === "function") { + if (handler1._handlers) { + handler1._handlers.push(handler2) + } else { + const handlers = [handler1, handler2] + visitor1[key] = Object.assign(dispatch.bind(null, handlers), { + _handlers: handlers, + }) + } + } else { + visitor1[key] = handler2 + } + } + + return visitor1 +} + +/** + * Dispatch all given functions with a node. + * @param {function[]} handlers The function list to call. + * @param {Node} node The AST node to be handled. + * @returns {void} + */ +function dispatch(handlers, node) { + for (const h of handlers) { + h(node) + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/strip-import-path-params.js b/node_modules/eslint-plugin-n/lib/util/strip-import-path-params.js new file mode 100644 index 0000000..6b92cde --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/strip-import-path-params.js @@ -0,0 +1,10 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +module.exports = function stripImportPathParams(path) { + const i = path.indexOf("!") + return i === -1 ? path : path.slice(0, i) +} diff --git a/node_modules/eslint-plugin-n/lib/util/visit-import.js b/node_modules/eslint-plugin-n/lib/util/visit-import.js new file mode 100644 index 0000000..66898e6 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/visit-import.js @@ -0,0 +1,68 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const isCoreModule = require("is-core-module") +const getResolvePaths = require("./get-resolve-paths") +const getTryExtensions = require("./get-try-extensions") +const ImportTarget = require("./import-target") +const stripImportPathParams = require("./strip-import-path-params") + +/** + * Gets a list of `import`/`export` declaration targets. + * + * Core modules of Node.js (e.g. `fs`, `http`) are excluded. + * + * @param {RuleContext} context - The rule context. + * @param {Object} [options] - The flag to include core modules. + * @param {boolean} [options.includeCore] - The flag to include core modules. + * @param {number} [options.optionIndex] - The index of rule options. + * @param {function(ImportTarget[]):void} callback The callback function to get result. + * @returns {ImportTarget[]} A list of found target's information. + */ +module.exports = function visitImport( + context, + { includeCore = false, optionIndex = 0 } = {}, + callback +) { + const targets = [] + const basedir = path.dirname(path.resolve(context.getFilename())) + const paths = getResolvePaths(context, optionIndex) + const extensions = getTryExtensions(context, optionIndex) + const options = { basedir, paths, extensions } + + return { + [[ + "ExportAllDeclaration", + "ExportNamedDeclaration", + "ImportDeclaration", + "ImportExpression", + ]](node) { + const sourceNode = node.source + + // skip `import(foo)` + if ( + node.type === "ImportExpression" && + sourceNode && + sourceNode.type !== "Literal" + ) { + return + } + + const name = sourceNode && stripImportPathParams(sourceNode.value) + // Note: "999" arbitrary to check current/future Node.js version + if (name && (includeCore || !isCoreModule(name, "999"))) { + targets.push( + new ImportTarget(sourceNode, name, options, "import") + ) + } + }, + + "Program:exit"() { + callback(targets) + }, + } +} diff --git a/node_modules/eslint-plugin-n/lib/util/visit-require.js b/node_modules/eslint-plugin-n/lib/util/visit-require.js new file mode 100644 index 0000000..8b31077 --- /dev/null +++ b/node_modules/eslint-plugin-n/lib/util/visit-require.js @@ -0,0 +1,62 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict" + +const path = require("path") +const { CALL, ReferenceTracker, getStringIfConstant } = require("eslint-utils") +const isCoreModule = require("is-core-module") +const getResolvePaths = require("./get-resolve-paths") +const getTryExtensions = require("./get-try-extensions") +const ImportTarget = require("./import-target") +const stripImportPathParams = require("./strip-import-path-params") + +/** + * Gets a list of `require()` targets. + * + * Core modules of Node.js (e.g. `fs`, `http`) are excluded. + * + * @param {RuleContext} context - The rule context. + * @param {Object} [options] - The flag to include core modules. + * @param {boolean} [options.includeCore] - The flag to include core modules. + * @param {function(ImportTarget[]):void} callback The callback function to get result. + * @returns {Object} The visitor. + */ +module.exports = function visitRequire( + context, + { includeCore = false } = {}, + callback +) { + const targets = [] + const basedir = path.dirname(path.resolve(context.getFilename())) + const paths = getResolvePaths(context) + const extensions = getTryExtensions(context) + const options = { basedir, paths, extensions } + + return { + "Program:exit"() { + const tracker = new ReferenceTracker(context.getScope()) + const references = tracker.iterateGlobalReferences({ + require: { + [CALL]: true, + resolve: { [CALL]: true }, + }, + }) + + for (const { node } of references) { + const targetNode = node.arguments[0] + const rawName = getStringIfConstant(targetNode) + const name = rawName && stripImportPathParams(rawName) + // Note: "999" arbitrary to check current/future Node.js version + if (name && (includeCore || !isCoreModule(name, "999"))) { + targets.push( + new ImportTarget(targetNode, name, options, "require") + ) + } + } + + callback(targets) + }, + } +} diff --git a/node_modules/eslint-plugin-n/package.json b/node_modules/eslint-plugin-n/package.json new file mode 100644 index 0000000..a9e40e0 --- /dev/null +++ b/node_modules/eslint-plugin-n/package.json @@ -0,0 +1,103 @@ +{ + "name": "eslint-plugin-n", + "version": "15.2.3", + "description": "Additional ESLint's rules for Node.js", + "engines": { + "node": ">=12.22.0" + }, + "main": "lib/index.js", + "files": [ + "lib" + ], + "peerDependencies": { + "eslint": ">=7.0.0" + }, + "dependencies": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + }, + "devDependencies": { + "codecov": "^3.3.0", + "esbuild": "^0.14.39", + "eslint": "^8.15.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-eslint-plugin": "^4.0.1", + "eslint-plugin-n": "file:.", + "fast-glob": "^3.2.11", + "globals": "^13.14.0", + "husky": "^8.0.1", + "import-meta-resolve": "^1.1.1", + "lint-staged": "^12.4.1", + "mocha": "^10.0.0", + "nyc": "^15.1.0", + "opener": "^1.5.1", + "prettier": "^2.6.2", + "punycode": "^2.1.1", + "release-it": "^15.0.0", + "rimraf": "^3.0.2" + }, + "scripts": { + "build": "node scripts/update", + "clean": "rimraf .nyc_output coverage", + "codecov": "nyc report --reporter text-lcov | codecov --pipe --disable=gcov -t $CODECOV_TOKEN", + "coverage": "opener ./coverage/lcov-report/index.html", + "lint": "eslint lib scripts tests/lib .eslintrc.js", + "new": "node scripts/new-rule", + "pretest": "npm run -s lint", + "test": "nyc npm run -s test:_mocha", + "test:ci": "nyc npm run -s test:_mocha", + "test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress --timeout 4000", + "preversion": "npm test", + "version": "npm run -s build && eslint lib/rules --fix && git add .", + "postversion": "git push && git push --tags", + "watch": "npm run test:_mocha -- --watch --growl", + "format": "prettier --loglevel warn --write \"**/*.{js,css,md}\"", + "prepare": "husky install" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/weiran-zsd/eslint-plugin-node.git" + }, + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "node", + "nodejs", + "ecmascript", + "shebang", + "file", + "path", + "import", + "require" + ], + "author": "Toru Nagashima", + "license": "MIT", + "bugs": { + "url": "https://github.com/weiran-zsd/eslint-plugin-node/issues" + }, + "homepage": "https://github.com/weiran-zsd/eslint-plugin-node#readme", + "funding": "https://github.com/sponsors/mysticatea", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "release-it": { + "github": { + "release": true + }, + "npm": { + "skipChecks": true + } + }, + "lint-staged": { + "*.js": "eslint --cache --fix", + "*.{json,js}": "prettier --write --ignore-path .eslintignore" + } +} diff --git a/node_modules/eslint-plugin-promise/.editorconfig b/node_modules/eslint-plugin-promise/.editorconfig new file mode 100644 index 0000000..c6812c1 --- /dev/null +++ b/node_modules/eslint-plugin-promise/.editorconfig @@ -0,0 +1,12 @@ +; EditorConfig file: https://EditorConfig.org +; Install the "EditorConfig" plugin into your editor to use + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/node_modules/eslint-plugin-promise/.husky/pre-commit b/node_modules/eslint-plugin-promise/.husky/pre-commit new file mode 100755 index 0000000..36af219 --- /dev/null +++ b/node_modules/eslint-plugin-promise/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/node_modules/eslint-plugin-promise/.prettierignore b/node_modules/eslint-plugin-promise/.prettierignore new file mode 100644 index 0000000..4ebc8ae --- /dev/null +++ b/node_modules/eslint-plugin-promise/.prettierignore @@ -0,0 +1 @@ +coverage diff --git a/node_modules/eslint-plugin-promise/CHANGELOG.md b/node_modules/eslint-plugin-promise/CHANGELOG.md new file mode 100644 index 0000000..f1f4a2e --- /dev/null +++ b/node_modules/eslint-plugin-promise/CHANGELOG.md @@ -0,0 +1,182 @@ +## 6.0.0 + +- Dropped node 10 from engines #231 +- Updated a ton of deps #236, #237, #235, #234 +- ESLint 8 support #219 + +## 5.2.0 + +- Updated `param-names` rule to allow for unused params + +## 5.1.1 + +- Updated docs to include `no-callback-in-promise` reasons #215 + +## 5.1.0 + +- Included `catch()` and `finally()` in `prefer-await-to-then` #196 +- Added some additional tests and upgraded some dev deps #196 +- Exempted array methods in prefer-await-to-callbacks + ([#212](https://github.com/xjamundx/eslint-plugin-promise/issues/212)) + +## 5.0.0 + +- ESLint 7.0 Support + +## 4.3.1. + +- Updated and applied prettier + +## 4.3.0 + +- https://github.com/xjamundx/eslint-plugin-promise/pull/202 +- Udpated jest + +## 4.2.2 + +- Added license +- Dependabot security updates + +## 4.2.1 + +- Added more use cases to `no-return-wrap` + +## 4.0.1 + +- Remove `promise/param-names` fixer + ([#146](https://github.com/xjamundx/eslint-plugin-promise/pull/146)) + +## 4.0.0 + +- Added fixer for `promise/no-new-statics` rule + ([#133](https://github.com/xjamundx/eslint-plugin-promise/pull/133)) +- Support ESLint v5 + ([#144](https://github.com/xjamundx/eslint-plugin-promise/pull/144)) + +This is a breaking change that drops support for Node v4. In order to use ESLint +v5 and eslint-plugin-promise v4, you must use Node >=6. + +## 3.8.0 + +- Removed `promise/avoid-new` from recommended configuration + ([#119](https://github.com/xjamundx/eslint-plugin-promise/pull/119)) +- Ignored event listener callbacks in `promise/prefer-await-to-callbacks` + ([#117](https://github.com/xjamundx/eslint-plugin-promise/pull/117)) +- Ignored top-level awaits in `promise/prefer-await-to-then` + ([#126](https://github.com/xjamundx/eslint-plugin-promise/pull/126)) +- Added docs for `promise/no-nesting` and `promise/prefer-await-to-then` + ([#120](https://github.com/xjamundx/eslint-plugin-promise/pull/120)) + ([#121](https://github.com/xjamundx/eslint-plugin-promise/pull/121)) + +## 3.7.0 + +- Added `promise/valid-params` rule + ([#85](https://github.com/xjamundx/eslint-plugin-promise/pull/85)) +- Added `promise/no-new-statics` rule + ([#82](https://github.com/xjamundx/eslint-plugin-promise/pull/82)) +- Added fixer for `promise/param-names` rule + ([#99](https://github.com/xjamundx/eslint-plugin-promise/pull/99)) +- Added rule documentation to each rule + ([#91](https://github.com/xjamundx/eslint-plugin-promise/pull/91)) + +## 3.6.0 + +- Added `['catch']` support in `catch-or-return` +- Added `no-return-in-finally` rule +- Fixed some formatting in the docs +- Added `allowReject` option to `no-return-wrap` +- Added exceptions for `no-callback-in-promise` + +## 3.5.0 + +- Added support for recommended settings using + `extends: plugin:promise/recommended` + +## 3.4.2 + +- Fixed always return false positive with ternary (#31) + +## 3.4.1 + +- fixed #49 + +## 3.4.0 + +- new rule: avoid-new +- new rule: no-promise-in-callback +- new rule: no-callback-in-promise +- new rule: no-nesting + +## 3.3.2 + +- Removed eslint from peerDeps + +## 3.3.1 + +- Updated engines with proper stuff +- Fixed bug for unreachable code + +## 3.3.0 + +- Rule: `prefer-async-to-callbacks` added +- Rule: `prefer-async-to-then` added + +## 3.2.1 + +- Fix: `no-return-wrap` rule missing from index.js + +## 3.2.0 + +- Added `no-return-wrap` rule + +## 3.1.0 + +- Added multiple terminationMethods + +## 3.0.1 + +- Removed deprecated `always-catch` rule +- FIX: always-return error with "fn && fn()" + +## 3.0.0 + +- Updated column and line numbers +- Added flow analysis for better handling of if statements + +## 2.0.1 + +- Fixed type in docs + +## 2.0.0 + +- ESLint 3.0 Support + +## 1.3.2 + +- Updated tests to run on eslint 2.0 +- Fixed some issues with `no-native` rule + +## 1.3.1 + +- Actually added `no-native` rule + +## 1.3.0 + +- Added `no-native` rule + +## 1.2.0 + +- Allow `throw` in `always-return` rule +- Added `terminationMethod` option to `catch-or-return` rule + +## 1.1.0 + +- Added `catch-or-return` rule + +## 1.0.8 + +- Fixed crash issues + +## 1.0.0 - 1.0.7 + +- Lots of basic feature updates and doc changes diff --git a/node_modules/eslint-plugin-promise/LICENSE.md b/node_modules/eslint-plugin-promise/LICENSE.md new file mode 100644 index 0000000..c3a843b --- /dev/null +++ b/node_modules/eslint-plugin-promise/LICENSE.md @@ -0,0 +1,13 @@ +Copyright (c) 2020, Jamund Ferguson + +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/eslint-plugin-promise/README.md b/node_modules/eslint-plugin-promise/README.md new file mode 100644 index 0000000..ec75250 --- /dev/null +++ b/node_modules/eslint-plugin-promise/README.md @@ -0,0 +1,132 @@ +# eslint-plugin-promise + +Enforce best practices for JavaScript promises. + +[![travis-ci](https://travis-ci.org/xjamundx/eslint-plugin-promise.svg)](https://travis-ci.org/xjamundx/eslint-plugin-promise) +[![npm version](https://badge.fury.io/js/eslint-plugin-promise.svg)](https://www.npmjs.com/package/eslint-plugin-promise) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) + + + + +- [Installation](#installation) +- [Usage](#usage) +- [Rules](#rules) +- [Maintainers](#maintainers) +- [License](#license) + + + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm install eslint --save-dev +``` + +Next, install `eslint-plugin-promise`: + +``` +$ npm install eslint-plugin-promise --save-dev +``` + +**Note:** If you installed ESLint globally (using the `-g` flag) then you must +also install `eslint-plugin-promise` globally. + +## Usage + +Add `promise` to the plugins section of your `.eslintrc.json` configuration +file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": ["promise"] +} +``` + +Then configure the rules you want to use under the rules section. + +```json +{ + "rules": { + "promise/always-return": "error", + "promise/no-return-wrap": "error", + "promise/param-names": "error", + "promise/catch-or-return": "error", + "promise/no-native": "off", + "promise/no-nesting": "warn", + "promise/no-promise-in-callback": "warn", + "promise/no-callback-in-promise": "warn", + "promise/avoid-new": "warn", + "promise/no-new-statics": "error", + "promise/no-return-in-finally": "warn", + "promise/valid-params": "warn" + } +} +``` + +or start with the recommended rule set: + +```json +{ + "extends": ["plugin:promise/recommended"] +} +``` + +## Rules + +| rule | description | recommended | fixable | +| -------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------- | -------- | +| [`catch-or-return`][catch-or-return] | Enforces the use of `catch()` on un-returned promises. | :bangbang: | | +| [`no-return-wrap`][no-return-wrap] | Avoid wrapping values in `Promise.resolve` or `Promise.reject` when not needed. | :bangbang: | | +| [`param-names`][param-names] | Enforce consistent param names and ordering when creating new promises. | :bangbang: | | +| [`always-return`][always-return] | Return inside each `then()` to create readable and reusable Promise chains. | :bangbang: | | +| [`no-native`][no-native] | In an ES5 environment, make sure to create a `Promise` constructor before using. | | | +| [`no-nesting`][no-nesting] | Avoid nested `then()` or `catch()` statements | :warning: | | +| [`no-promise-in-callback`][no-promise-in-callback] | Avoid using promises inside of callbacks | :warning: | | +| [`no-callback-in-promise`][no-callback-in-promise] | Avoid calling `cb()` inside of a `then()` (use [nodeify][] instead) | :warning: | | +| [`avoid-new`][avoid-new] | Avoid creating `new` promises outside of utility libs (use [pify][] instead) | | | +| [`no-new-statics`][no-new-statics] | Avoid calling `new` on a Promise static method | :bangbang: | :wrench: | +| [`no-return-in-finally`][no-return-in-finally] | Disallow return statements in `finally()` | :warning: | | +| [`valid-params`][valid-params] | Ensures the proper number of arguments are passed to Promise functions | :warning: | | +| [`prefer-await-to-then`][prefer-await-to-then] | Prefer `await` to `then()`/`catch()`/`finally()` for reading Promise values | :seven: | | +| [`prefer-await-to-callbacks`][prefer-await-to-callbacks] | Prefer async/await to the callback pattern | :seven: | | + +**Key** + +| icon | description | +| ---------- | ----------------------------------------------- | +| :bangbang: | Reports as error in recommended configuration | +| :warning: | Reports as warning in recommended configuration | +| :seven: | ES2017 Async Await rules | +| :wrench: | Rule is fixable with `eslint --fix` | + +## Maintainers + +- Jamund Ferguson - [@xjamundx][] +- Macklin Underdown - [@macklinu][] + +## License + +- (c) MMXV jden - ISC license. +- (c) 2016 Jamund Ferguson - ISC license. + +[catch-or-return]: docs/rules/catch-or-return.md +[no-return-wrap]: docs/rules/no-return-wrap.md +[param-names]: docs/rules/param-names.md +[always-return]: docs/rules/always-return.md +[no-native]: docs/rules/no-native.md +[no-nesting]: docs/rules/no-nesting.md +[no-promise-in-callback]: docs/rules/no-promise-in-callback.md +[no-callback-in-promise]: docs/rules/no-callback-in-promise.md +[avoid-new]: docs/rules/avoid-new.md +[no-new-statics]: docs/rules/no-new-statics.md +[no-return-in-finally]: docs/rules/no-return-in-finally.md +[valid-params]: docs/rules/valid-params.md +[prefer-await-to-then]: docs/rules/prefer-await-to-then.md +[prefer-await-to-callbacks]: docs/rules/prefer-await-to-callbacks.md +[nodeify]: https://www.npmjs.com/package/nodeify +[pify]: https://www.npmjs.com/package/pify +[@macklinu]: https://github.com/macklinu +[@xjamundx]: https://github.com/xjamundx diff --git a/node_modules/eslint-plugin-promise/index.js b/node_modules/eslint-plugin-promise/index.js new file mode 100644 index 0000000..08008d2 --- /dev/null +++ b/node_modules/eslint-plugin-promise/index.js @@ -0,0 +1,46 @@ +'use strict' + +module.exports = { + rules: { + 'param-names': require('./rules/param-names'), + 'no-return-wrap': require('./rules/no-return-wrap'), + 'always-return': require('./rules/always-return'), + 'catch-or-return': require('./rules/catch-or-return'), + 'prefer-await-to-callbacks': require('./rules/prefer-await-to-callbacks'), + 'prefer-await-to-then': require('./rules/prefer-await-to-then'), + 'no-native': require('./rules/no-native'), + 'no-callback-in-promise': require('./rules/no-callback-in-promise'), + 'no-promise-in-callback': require('./rules/no-promise-in-callback'), + 'no-nesting': require('./rules/no-nesting'), + 'avoid-new': require('./rules/avoid-new'), + 'no-new-statics': require('./rules/no-new-statics'), + 'no-return-in-finally': require('./rules/no-return-in-finally'), + 'valid-params': require('./rules/valid-params'), + }, + rulesConfig: { + 'param-names': 1, + 'always-return': 1, + 'no-return-wrap': 1, + 'no-native': 0, + 'catch-or-return': 1, + }, + configs: { + recommended: { + plugins: ['promise'], + rules: { + 'promise/always-return': 'error', + 'promise/no-return-wrap': 'error', + 'promise/param-names': 'error', + 'promise/catch-or-return': 'error', + 'promise/no-native': 'off', + 'promise/no-nesting': 'warn', + 'promise/no-promise-in-callback': 'warn', + 'promise/no-callback-in-promise': 'warn', + 'promise/avoid-new': 'off', + 'promise/no-new-statics': 'error', + 'promise/no-return-in-finally': 'warn', + 'promise/valid-params': 'warn', + }, + }, + }, +} diff --git a/node_modules/eslint-plugin-promise/package.json b/node_modules/eslint-plugin-promise/package.json new file mode 100644 index 0000000..9f6a0c0 --- /dev/null +++ b/node_modules/eslint-plugin-promise/package.json @@ -0,0 +1,89 @@ +{ + "name": "eslint-plugin-promise", + "version": "6.0.0", + "description": "Enforce best practices for JavaScript promises", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "promise", + "promises" + ], + "author": "jden ", + "contributors": [ + "Brett Zamir" + ], + "repository": "https://github.com/xjamundx/eslint-plugin-promise", + "homepage": "https://github.com/xjamundx/eslint-plugin-promise", + "bugs": "https://github.com/xjamundx/eslint-plugin-promise/issues", + "scripts": { + "format": "prettier --write .", + "lint": "eslint .", + "prepare": "husky install", + "test": "jest --coverage" + }, + "dependencies": {}, + "devDependencies": { + "doctoc": "^2.1.0", + "eslint": "^8.5.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-eslint-plugin": "^4.1.0", + "eslint-plugin-jest": "^25.3.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^4.0.0", + "husky": "^7.0.4", + "jest": "^27.4.5", + "jest-runner-eslint": "^1.0.0", + "lint-staged": "^12.1.2", + "prettier": "^2.5.1" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "license": "ISC", + "lint-staged": { + "{README.md,CONTRIBUTING.md}": [ + "doctoc --maxlevel 3 --notitle" + ], + "*.js": [ + "prettier --write", + "eslint --fix" + ], + "*.+(json|md)": [ + "prettier --write" + ] + }, + "prettier": { + "semi": false, + "singleQuote": true, + "proseWrap": "always" + }, + "jest": { + "coverageThreshold": { + "global": { + "branches": 100, + "functions": 100, + "lines": 100, + "statements": 100 + } + }, + "projects": [ + { + "displayName": "test", + "testEnvironment": "node" + }, + { + "runner": "jest-runner-eslint", + "displayName": "lint", + "testMatch": [ + "/rules/**/*.js", + "/__tests__/**/*.js", + "/index.js" + ] + } + ] + } +} diff --git a/node_modules/eslint-plugin-promise/rules/always-return.js b/node_modules/eslint-plugin-promise/rules/always-return.js new file mode 100644 index 0000000..2e70356 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/always-return.js @@ -0,0 +1,154 @@ +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +function isFunctionWithBlockStatement(node) { + if (node.type === 'FunctionExpression') { + return true + } + if (node.type === 'ArrowFunctionExpression') { + return node.body.type === 'BlockStatement' + } + return false +} + +function isThenCallExpression(node) { + return ( + node.type === 'CallExpression' && + node.callee.type === 'MemberExpression' && + node.callee.property.name === 'then' + ) +} + +function isFirstArgument(node) { + return ( + node.parent && node.parent.arguments && node.parent.arguments[0] === node + ) +} + +function isInlineThenFunctionExpression(node) { + return ( + isFunctionWithBlockStatement(node) && + isThenCallExpression(node.parent) && + isFirstArgument(node) + ) +} + +function hasParentReturnStatement(node) { + // istanbul ignore else -- not reachable given not checking `Program` + if (node && node.parent && node.parent.type) { + // if the parent is a then, and we haven't returned anything, fail + if (isThenCallExpression(node.parent)) { + return false + } + + if (node.parent.type === 'ReturnStatement') { + return true + } + return hasParentReturnStatement(node.parent) + } + + // istanbul ignore next -- not reachable given not checking `Program` + return false +} + +function peek(arr) { + return arr[arr.length - 1] +} + +module.exports = { + meta: { + type: 'problem', + docs: { + url: getDocsUrl('always-return'), + }, + schema: [], + }, + create(context) { + // funcInfoStack is a stack representing the stack of currently executing + // functions + // funcInfoStack[i].branchIDStack is a stack representing the currently + // executing branches ("codePathSegment"s) within the given function + // funcInfoStack[i].branchInfoMap is an object representing information + // about all branches within the given function + // funcInfoStack[i].branchInfoMap[j].good is a boolean representing whether + // the given branch explicitly `return`s or `throw`s. It starts as `false` + // for every branch and is updated to `true` if a `return` or `throw` + // statement is found + // funcInfoStack[i].branchInfoMap[j].loc is a eslint SourceLocation object + // for the given branch + // example: + // funcInfoStack = [ { branchIDStack: [ 's1_1' ], + // branchInfoMap: + // { s1_1: + // { good: false, + // loc: } } }, + // { branchIDStack: ['s2_1', 's2_4'], + // branchInfoMap: + // { s2_1: + // { good: false, + // loc: }, + // s2_2: + // { good: true, + // loc: }, + // s2_4: + // { good: false, + // loc: } } } ] + const funcInfoStack = [] + + function markCurrentBranchAsGood() { + const funcInfo = peek(funcInfoStack) + const currentBranchID = peek(funcInfo.branchIDStack) + if (funcInfo.branchInfoMap[currentBranchID]) { + funcInfo.branchInfoMap[currentBranchID].good = true + } + // else unreachable code + } + + return { + ReturnStatement: markCurrentBranchAsGood, + ThrowStatement: markCurrentBranchAsGood, + + onCodePathSegmentStart(segment, node) { + const funcInfo = peek(funcInfoStack) + funcInfo.branchIDStack.push(segment.id) + funcInfo.branchInfoMap[segment.id] = { good: false, node } + }, + + onCodePathSegmentEnd() { + const funcInfo = peek(funcInfoStack) + funcInfo.branchIDStack.pop() + }, + + onCodePathStart() { + funcInfoStack.push({ + branchIDStack: [], + branchInfoMap: {}, + }) + }, + + onCodePathEnd(path, node) { + const funcInfo = funcInfoStack.pop() + + if (!isInlineThenFunctionExpression(node)) { + return + } + + path.finalSegments.forEach((segment) => { + const id = segment.id + const branch = funcInfo.branchInfoMap[id] + if (!branch.good) { + if (hasParentReturnStatement(branch.node)) { + return + } + + context.report({ + message: 'Each then() should return a value or throw', + node: branch.node, + }) + } + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/avoid-new.js b/node_modules/eslint-plugin-promise/rules/avoid-new.js new file mode 100644 index 0000000..2763cf8 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/avoid-new.js @@ -0,0 +1,27 @@ +/** + * Rule: avoid-new + * Avoid creating new promises outside of utility libraries. + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('avoid-new'), + }, + schema: [], + }, + create(context) { + return { + NewExpression(node) { + if (node.callee.name === 'Promise') { + context.report({ node, message: 'Avoid creating new promises.' }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/catch-or-return.js b/node_modules/eslint-plugin-promise/rules/catch-or-return.js new file mode 100644 index 0000000..c5f31e1 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/catch-or-return.js @@ -0,0 +1,121 @@ +/** + * Rule: catch-or-return + * Ensures that promises either include a catch() handler + * or are returned (to be handled upstream) + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const isPromise = require('./lib/is-promise') + +module.exports = { + meta: { + type: 'problem', + docs: { + url: getDocsUrl('catch-or-return'), + }, + messages: { + terminationMethod: 'Expected {{ terminationMethod }}() or return', + }, + schema: [ + { + type: 'object', + properties: { + allowFinally: { + type: 'boolean', + }, + allowThen: { + type: 'boolean', + }, + terminationMethod: { + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { + type: 'string', + }, + }, + ], + }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const options = context.options[0] || {} + const allowThen = options.allowThen + const allowFinally = options.allowFinally + let terminationMethod = options.terminationMethod || 'catch' + + if (typeof terminationMethod === 'string') { + terminationMethod = [terminationMethod] + } + + function isAllowedPromiseTermination(expression) { + // somePromise.then(a, b) + if ( + allowThen && + expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.name === 'then' && + expression.arguments.length === 2 + ) { + return true + } + + // somePromise.catch().finally(fn) + if ( + allowFinally && + expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.name === 'finally' && + isPromise(expression.callee.object) && + isAllowedPromiseTermination(expression.callee.object) + ) { + return true + } + + // somePromise.catch() + if ( + expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + terminationMethod.indexOf(expression.callee.property.name) !== -1 + ) { + return true + } + + // somePromise['catch']() + if ( + expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.type === 'Literal' && + expression.callee.property.value === 'catch' + ) { + return true + } + + return false + } + + return { + ExpressionStatement(node) { + if (!isPromise(node.expression)) { + return + } + + if (isAllowedPromiseTermination(node.expression)) { + return + } + + context.report({ + node, + messageId: 'terminationMethod', + data: { terminationMethod }, + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/lib/get-docs-url.js b/node_modules/eslint-plugin-promise/rules/lib/get-docs-url.js new file mode 100644 index 0000000..9410f3e --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/get-docs-url.js @@ -0,0 +1,17 @@ +'use strict' + +const REPO_URL = 'https://github.com/xjamundx/eslint-plugin-promise' + +/** + * Generates the URL to documentation for the given rule name. It uses the + * package version to build the link to a tagged version of the + * documentation file. + * + * @param {string} ruleName - Name of the eslint rule + * @returns {string} URL to the documentation for the given rule + */ +function getDocsUrl(ruleName) { + return `${REPO_URL}/blob/master/docs/rules/${ruleName}.md` +} + +module.exports = getDocsUrl diff --git a/node_modules/eslint-plugin-promise/rules/lib/has-promise-callback.js b/node_modules/eslint-plugin-promise/rules/lib/has-promise-callback.js new file mode 100644 index 0000000..8cf07c0 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/has-promise-callback.js @@ -0,0 +1,17 @@ +/** + * Library: Has Promise Callback + * Makes sure that an Expression node is part of a promise + * with callback functions (like then() or catch()) + */ + +'use strict' + +function hasPromiseCallback(node) { + // istanbul ignore if -- only being called within `CallExpression` + if (node.type !== 'CallExpression') return + if (node.callee.type !== 'MemberExpression') return + const propertyName = node.callee.property.name + return propertyName === 'then' || propertyName === 'catch' +} + +module.exports = hasPromiseCallback diff --git a/node_modules/eslint-plugin-promise/rules/lib/is-callback.js b/node_modules/eslint-plugin-promise/rules/lib/is-callback.js new file mode 100644 index 0000000..2f60b5d --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/is-callback.js @@ -0,0 +1,14 @@ +'use strict' + +const isNamedCallback = require('./is-named-callback') + +function isCallback(node, exceptions) { + const isCallExpression = node.type === 'CallExpression' + // istanbul ignore next -- always invoked on `CallExpression` + const callee = node.callee || {} + const nameIsCallback = isNamedCallback(callee.name, exceptions) + const isCB = isCallExpression && nameIsCallback + return isCB +} + +module.exports = isCallback diff --git a/node_modules/eslint-plugin-promise/rules/lib/is-inside-callback.js b/node_modules/eslint-plugin-promise/rules/lib/is-inside-callback.js new file mode 100644 index 0000000..fd91595 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/is-inside-callback.js @@ -0,0 +1,20 @@ +'use strict' + +const isInsidePromise = require('./is-inside-promise') + +function isInsideCallback(node) { + const isCallExpression = + node.type === 'FunctionExpression' || + node.type === 'ArrowFunctionExpression' || + node.type === 'FunctionDeclaration' // this may be controversial + + // it's totally fine to use promises inside promises + if (isInsidePromise(node)) return + + const name = node.params && node.params[0] && node.params[0].name + const firstArgIsError = name === 'err' || name === 'error' + const isInACallback = isCallExpression && firstArgIsError + return isInACallback +} + +module.exports = isInsideCallback diff --git a/node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js b/node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js new file mode 100644 index 0000000..9d3062f --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js @@ -0,0 +1,15 @@ +'use strict' + +function isInsidePromise(node) { + const isFunctionExpression = + node.type === 'FunctionExpression' || + node.type === 'ArrowFunctionExpression' + const parent = node.parent || {} + const callee = parent.callee || {} + const name = (callee.property && callee.property.name) || '' + const parentIsPromise = name === 'then' || name === 'catch' + const isInCB = isFunctionExpression && parentIsPromise + return isInCB +} + +module.exports = isInsidePromise diff --git a/node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js b/node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js new file mode 100644 index 0000000..59df4fe --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js @@ -0,0 +1,14 @@ +'use strict' + +let callbacks = ['done', 'cb', 'callback', 'next'] + +module.exports = function isNamedCallback(potentialCallbackName, exceptions) { + for (let i = 0; i < exceptions.length; i++) { + callbacks = callbacks.filter((item) => { + return item !== exceptions[i] + }) + } + return callbacks.some((trueCallbackName) => { + return potentialCallbackName === trueCallbackName + }) +} diff --git a/node_modules/eslint-plugin-promise/rules/lib/is-promise.js b/node_modules/eslint-plugin-promise/rules/lib/is-promise.js new file mode 100644 index 0000000..857e346 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/is-promise.js @@ -0,0 +1,36 @@ +/** + * Library: isPromise + * Makes sure that an Expression node is part of a promise. + */ +'use strict' + +const PROMISE_STATICS = require('./promise-statics') + +function isPromise(expression) { + return ( + // hello.then() + (expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.name === 'then') || + // hello.catch() + (expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.name === 'catch') || + // hello.finally() + (expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.property.name === 'finally') || + // somePromise.ANYTHING() + (expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + isPromise(expression.callee.object)) || + // Promise.STATIC_METHOD() + (expression.type === 'CallExpression' && + expression.callee.type === 'MemberExpression' && + expression.callee.object.type === 'Identifier' && + expression.callee.object.name === 'Promise' && + PROMISE_STATICS[expression.callee.property.name]) + ) +} + +module.exports = isPromise diff --git a/node_modules/eslint-plugin-promise/rules/lib/promise-statics.js b/node_modules/eslint-plugin-promise/rules/lib/promise-statics.js new file mode 100644 index 0000000..8186ddd --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/lib/promise-statics.js @@ -0,0 +1,8 @@ +'use strict' + +module.exports = { + all: true, + race: true, + reject: true, + resolve: true, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-callback-in-promise.js b/node_modules/eslint-plugin-promise/rules/no-callback-in-promise.js new file mode 100644 index 0000000..1d03ddb --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-callback-in-promise.js @@ -0,0 +1,71 @@ +/** + * Rule: no-callback-in-promise + * Avoid calling back inside of a promise + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const hasPromiseCallback = require('./lib/has-promise-callback') +const isInsidePromise = require('./lib/is-inside-promise') +const isCallback = require('./lib/is-callback') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('no-callback-in-promise'), + }, + messages: { + callback: 'Avoid calling back inside of a promise.', + }, + schema: [ + { + type: 'object', + properties: { + exceptions: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + return { + CallExpression(node) { + const options = context.options[0] || {} + const exceptions = options.exceptions || [] + if (!isCallback(node, exceptions)) { + // in general we send you packing if you're not a callback + // but we also need to watch out for whatever.then(cb) + if (hasPromiseCallback(node)) { + const name = + node.arguments && node.arguments[0] && node.arguments[0].name + if ( + name === 'callback' || + name === 'cb' || + name === 'next' || + name === 'done' + ) { + context.report({ + node: node.arguments[0], + messageId: 'callback', + }) + } + } + return + } + if (context.getAncestors().some(isInsidePromise)) { + context.report({ + node, + messageId: 'callback', + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-native.js b/node_modules/eslint-plugin-promise/rules/no-native.js new file mode 100644 index 0000000..23878dd --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-native.js @@ -0,0 +1,66 @@ +// Borrowed from here: +// https://github.com/colonyamerican/eslint-plugin-cah/issues/3 + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +function isDeclared(scope, ref) { + return scope.variables.some((variable) => { + if (variable.name !== ref.identifier.name) { + return false + } + + // Presumably can't pass this since the implicit `Promise` global + // being checked here would always lack `defs` + // istanbul ignore else + if (!variable.defs || !variable.defs.length) { + return false + } + + // istanbul ignore next + return true + }) +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('no-native'), + }, + messages: { + name: '"{{name}}" is not defined.', + }, + schema: [], + }, + create(context) { + /** + * Checks for and reports reassigned constants + * + * @param {Scope} scope - an escope Scope object + * @returns {void} + * @private + */ + return { + 'Program:exit'() { + const scope = context.getScope() + + scope.implicit.left.forEach((ref) => { + if (ref.identifier.name !== 'Promise') { + return + } + + // istanbul ignore else + if (!isDeclared(scope, ref)) { + context.report({ + node: ref.identifier, + messageId: 'name', + data: { name: ref.identifier.name }, + }) + } + }) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-nesting.js b/node_modules/eslint-plugin-promise/rules/no-nesting.js new file mode 100644 index 0000000..7e78025 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-nesting.js @@ -0,0 +1,30 @@ +/** + * Rule: no-nesting + * Avoid nesting your promises. + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const hasPromiseCallback = require('./lib/has-promise-callback') +const isInsidePromise = require('./lib/is-inside-promise') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('no-nesting'), + }, + schema: [], + }, + create(context) { + return { + CallExpression(node) { + if (!hasPromiseCallback(node)) return + if (context.getAncestors().some(isInsidePromise)) { + context.report({ node, message: 'Avoid nesting promises.' }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-new-statics.js b/node_modules/eslint-plugin-promise/rules/no-new-statics.js new file mode 100644 index 0000000..6ad0161 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-new-statics.js @@ -0,0 +1,38 @@ +'use strict' + +const PROMISE_STATICS = require('./lib/promise-statics') +const getDocsUrl = require('./lib/get-docs-url') + +module.exports = { + meta: { + type: 'problem', + docs: { + url: getDocsUrl('no-new-statics'), + }, + fixable: 'code', + schema: [], + }, + create(context) { + return { + NewExpression(node) { + if ( + node.callee.type === 'MemberExpression' && + node.callee.object.name === 'Promise' && + PROMISE_STATICS[node.callee.property.name] + ) { + context.report({ + node, + message: "Avoid calling 'new' on 'Promise.{{ name }}()'", + data: { name: node.callee.property.name }, + fix(fixer) { + return fixer.replaceTextRange( + [node.range[0], node.range[0] + 'new '.length], + '' + ) + }, + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-promise-in-callback.js b/node_modules/eslint-plugin-promise/rules/no-promise-in-callback.js new file mode 100644 index 0000000..4411cf7 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-promise-in-callback.js @@ -0,0 +1,41 @@ +/** + * Rule: no-promise-in-callback + * Discourage using promises inside of callbacks. + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const isPromise = require('./lib/is-promise') +const isInsideCallback = require('./lib/is-inside-callback') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('no-promise-in-callback'), + }, + schema: [], + }, + create(context) { + return { + CallExpression(node) { + if (!isPromise(node)) return + + // if i'm returning the promise, it's probably not really a callback + // function, and I should be okay.... + if (node.parent.type === 'ReturnStatement') return + + // what about if the parent is an ArrowFunctionExpression + // would that imply an implicit return? + + if (context.getAncestors().some(isInsideCallback)) { + context.report({ + node: node.callee, + message: 'Avoid using promises inside of callbacks.', + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-return-in-finally.js b/node_modules/eslint-plugin-promise/rules/no-return-in-finally.js new file mode 100644 index 0000000..fb4702c --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-return-in-finally.js @@ -0,0 +1,46 @@ +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const isPromise = require('./lib/is-promise') + +module.exports = { + meta: { + type: 'problem', + docs: { + url: getDocsUrl('no-return-in-finally'), + }, + schema: [], + }, + create(context) { + return { + CallExpression(node) { + if (isPromise(node)) { + if ( + node.callee && + node.callee.property && + node.callee.property.name === 'finally' + ) { + // istanbul ignore else -- passing `isPromise` means should have a body + if ( + node.arguments && + node.arguments[0] && + node.arguments[0].body && + node.arguments[0].body.body + ) { + if ( + node.arguments[0].body.body.some((statement) => { + return statement.type === 'ReturnStatement' + }) + ) { + context.report({ + node: node.callee.property, + message: 'No return in finally', + }) + } + } + } + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/no-return-wrap.js b/node_modules/eslint-plugin-promise/rules/no-return-wrap.js new file mode 100644 index 0000000..b603ebd --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/no-return-wrap.js @@ -0,0 +1,94 @@ +/** + * Rule: no-return-wrap function + * Prevents unnecessary wrapping of results in Promise.resolve + * or Promise.reject as the Promise will do that for us + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const isPromise = require('./lib/is-promise') + +function isInPromise(context) { + let functionNode = context + .getAncestors() + .filter((node) => { + return ( + node.type === 'ArrowFunctionExpression' || + node.type === 'FunctionExpression' + ) + }) + .reverse()[0] + while ( + functionNode && + functionNode.parent && + functionNode.parent.type === 'MemberExpression' && + functionNode.parent.object === functionNode && + functionNode.parent.property.type === 'Identifier' && + functionNode.parent.property.name === 'bind' && + functionNode.parent.parent && + functionNode.parent.parent.type === 'CallExpression' && + functionNode.parent.parent.callee === functionNode.parent + ) { + functionNode = functionNode.parent.parent + } + return functionNode && functionNode.parent && isPromise(functionNode.parent) +} + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('no-return-wrap'), + }, + messages: { + resolve: 'Avoid wrapping return values in Promise.resolve', + reject: 'Expected throw instead of Promise.reject', + }, + schema: [ + { + type: 'object', + properties: { + allowReject: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + const options = context.options[0] || {} + const allowReject = options.allowReject + + /** + * Checks a call expression, reporting if necessary. + * @param callExpression The call expression. + * @param node The node to report. + */ + function checkCallExpression({ callee }, node) { + if ( + isInPromise(context) && + callee.type === 'MemberExpression' && + callee.object.name === 'Promise' + ) { + if (callee.property.name === 'resolve') { + context.report({ node, messageId: 'resolve' }) + } else if (!allowReject && callee.property.name === 'reject') { + context.report({ node, messageId: 'reject' }) + } + } + } + + return { + ReturnStatement(node) { + if (node.argument && node.argument.type === 'CallExpression') { + checkCallExpression(node.argument, node) + } + }, + 'ArrowFunctionExpression > CallExpression'(node) { + checkCallExpression(node, node) + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/param-names.js b/node_modules/eslint-plugin-promise/rules/param-names.js new file mode 100644 index 0000000..ab53a52 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/param-names.js @@ -0,0 +1,39 @@ +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('param-names'), + }, + schema: [], + }, + create(context) { + return { + NewExpression(node) { + if (node.callee.name === 'Promise' && node.arguments.length === 1) { + const params = node.arguments[0].params + + if (!params || !params.length) { + return + } + + if ( + (params[0].name !== 'resolve' && params[0].name !== '_resolve') || + (params[1] && + params[1].name !== 'reject' && + params[1].name !== '_reject') + ) { + context.report({ + node, + message: + 'Promise constructor parameters must be named resolve, reject', + }) + } + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/prefer-await-to-callbacks.js b/node_modules/eslint-plugin-promise/rules/prefer-await-to-callbacks.js new file mode 100644 index 0000000..87aee7a --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/prefer-await-to-callbacks.js @@ -0,0 +1,95 @@ +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('prefer-await-to-callbacks'), + }, + messages: { + error: 'Avoid callbacks. Prefer Async/Await.', + }, + schema: [], + }, + create(context) { + function checkLastParamsForCallback(node) { + const lastParam = node.params[node.params.length - 1] || {} + if (lastParam.name === 'callback' || lastParam.name === 'cb') { + context.report({ node: lastParam, messageId: 'error' }) + } + } + function isInsideYieldOrAwait() { + return context.getAncestors().some((parent) => { + return ( + parent.type === 'AwaitExpression' || parent.type === 'YieldExpression' + ) + }) + } + return { + CallExpression(node) { + // Callbacks aren't allowed. + if (node.callee.name === 'cb' || node.callee.name === 'callback') { + context.report({ node, messageId: 'error' }) + return + } + + // Then-ables aren't allowed either. + const args = node.arguments + const lastArgIndex = args.length - 1 + const arg = lastArgIndex > -1 && node.arguments[lastArgIndex] + if ( + (arg && arg.type === 'FunctionExpression') || + arg.type === 'ArrowFunctionExpression' + ) { + // Ignore event listener callbacks. + if ( + node.callee.property && + (node.callee.property.name === 'on' || + node.callee.property.name === 'once') + ) { + return + } + + // carve out exemption for map/filter/etc + const arrayMethods = [ + 'map', + 'every', + 'forEach', + 'some', + 'find', + 'filter', + ] + const isLodash = + node.callee.object && + ['lodash', 'underscore', '_'].includes(node.callee.object.name) + const callsArrayMethod = + node.callee.property && + arrayMethods.includes(node.callee.property.name) && + (node.arguments.length === 1 || + (node.arguments.length === 2 && isLodash)) + const isArrayMethod = + node.callee.name && + arrayMethods.includes(node.callee.name) && + node.arguments.length === 2 + if (callsArrayMethod || isArrayMethod) return + + // actually check for callbacks (I know this is the worst) + if ( + arg.params && + arg.params[0] && + (arg.params[0].name === 'err' || arg.params[0].name === 'error') + ) { + if (!isInsideYieldOrAwait()) { + context.report({ node: arg, messageId: 'error' }) + } + } + } + }, + FunctionDeclaration: checkLastParamsForCallback, + FunctionExpression: checkLastParamsForCallback, + ArrowFunctionExpression: checkLastParamsForCallback, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/prefer-await-to-then.js b/node_modules/eslint-plugin-promise/rules/prefer-await-to-then.js new file mode 100644 index 0000000..2828cdd --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/prefer-await-to-then.js @@ -0,0 +1,58 @@ +/** + * Rule: prefer-await-to-then + * Discourage using then()/catch()/finally() and instead use async/await. + */ + +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') + +module.exports = { + meta: { + type: 'suggestion', + docs: { + url: getDocsUrl('prefer-await-to-then'), + }, + schema: [], + }, + create(context) { + /** Returns true if node is inside yield or await expression. */ + function isInsideYieldOrAwait() { + return context.getAncestors().some((parent) => { + return ( + parent.type === 'AwaitExpression' || parent.type === 'YieldExpression' + ) + }) + } + + /** + * Returns true if node is created at the top-level scope. + * Await statements are not allowed at the top level, + * only within function declarations. + */ + function isTopLevelScoped() { + return context.getScope().block.type === 'Program' + } + + return { + MemberExpression(node) { + if (isTopLevelScoped() || isInsideYieldOrAwait()) { + return + } + + // if you're a then/catch/finally expression then you're probably a promise + if ( + node.property && + (node.property.name === 'then' || + node.property.name === 'catch' || + node.property.name === 'finally') + ) { + context.report({ + node: node.property, + message: 'Prefer await to then()/catch()/finally().', + }) + } + }, + } + }, +} diff --git a/node_modules/eslint-plugin-promise/rules/valid-params.js b/node_modules/eslint-plugin-promise/rules/valid-params.js new file mode 100644 index 0000000..c01c333 --- /dev/null +++ b/node_modules/eslint-plugin-promise/rules/valid-params.js @@ -0,0 +1,69 @@ +'use strict' + +const getDocsUrl = require('./lib/get-docs-url') +const isPromise = require('./lib/is-promise') + +module.exports = { + meta: { + type: 'problem', + docs: { + description: + 'Ensures the proper number of arguments are passed to Promise functions', + url: getDocsUrl('valid-params'), + }, + schema: [], + }, + create(context) { + return { + CallExpression(node) { + if (!isPromise(node)) { + return + } + + const name = node.callee.property.name + const numArgs = node.arguments.length + + // istanbul ignore next -- `isPromise` filters out others + switch (name) { + case 'resolve': + case 'reject': + if (numArgs > 1) { + context.report({ + node, + message: + 'Promise.{{ name }}() requires 0 or 1 arguments, but received {{ numArgs }}', + data: { name, numArgs }, + }) + } + break + case 'then': + if (numArgs < 1 || numArgs > 2) { + context.report({ + node, + message: + 'Promise.{{ name }}() requires 1 or 2 arguments, but received {{ numArgs }}', + data: { name, numArgs }, + }) + } + break + case 'race': + case 'all': + case 'catch': + case 'finally': + if (numArgs !== 1) { + context.report({ + node, + message: + 'Promise.{{ name }}() requires 1 argument, but received {{ numArgs }}', + data: { name, numArgs }, + }) + } + break + default: + // istanbul ignore next -- `isPromise` filters out others + break + } + }, + } + }, +} diff --git a/node_modules/eslint-scope/LICENSE b/node_modules/eslint-scope/LICENSE new file mode 100644 index 0000000..d36a526 --- /dev/null +++ b/node_modules/eslint-scope/LICENSE @@ -0,0 +1,22 @@ +Copyright JS Foundation and other contributors, https://js.foundation +Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/eslint-scope/README.md b/node_modules/eslint-scope/README.md new file mode 100644 index 0000000..4ad41d5 --- /dev/null +++ b/node_modules/eslint-scope/README.md @@ -0,0 +1,66 @@ +# ESLint Scope + +ESLint Scope is the [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) scope analyzer used in ESLint. It is a fork of [escope](http://github.com/estools/escope). + +## Install + +``` +npm i eslint-scope --save +``` + +## 📖 Usage + +To use in an ESM file: + +```js +import * as eslintScope from 'eslint-scope'; +``` + +To use in a CommonJS file: + +```js +const eslintScope = require('eslint-scope'); +``` + +Example: + +```js +import * as eslintScope from 'eslint-scope'; +import * as espree from 'espree'; +import estraverse from 'estraverse'; + +const ast = espree.parse(code, { range: true }); +const scopeManager = eslintScope.analyze(ast); + +const currentScope = scopeManager.acquire(ast); // global scope + +estraverse.traverse(ast, { + enter (node, parent) { + // do stuff + + if (/Function/.test(node.type)) { + currentScope = scopeManager.acquire(node); // get current function scope + } + }, + leave(node, parent) { + if (/Function/.test(node.type)) { + currentScope = currentScope.upper; // set to parent scope + } + + // do stuff + } +}); +``` + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/eslint-scope/issues). + +## Build Commands + +* `npm test` - run all linting and tests +* `npm run lint` - run all linting + +## License + +ESLint Scope is licensed under a permissive BSD 2-clause license. diff --git a/node_modules/eslint-scope/dist/eslint-scope.cjs b/node_modules/eslint-scope/dist/eslint-scope.cjs new file mode 100644 index 0000000..9e3cadf --- /dev/null +++ b/node_modules/eslint-scope/dist/eslint-scope.cjs @@ -0,0 +1,2240 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var assert = require('assert'); +var estraverse = require('estraverse'); +var esrecurse = require('esrecurse'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert); +var estraverse__default = /*#__PURE__*/_interopDefaultLegacy(estraverse); +var esrecurse__default = /*#__PURE__*/_interopDefaultLegacy(esrecurse); + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const READ = 0x1; +const WRITE = 0x2; +const RW = READ | WRITE; + +/** + * A Reference represents a single occurrence of an identifier in code. + * @constructor Reference + */ +class Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; + + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; + + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; + + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { + + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; + + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; + + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + + /** + * Whether the reference is static. + * @function Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } + + /** + * Whether the reference is writeable. + * @function Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } + + /** + * Whether the reference is readable. + * @function Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); + } + + /** + * Whether the reference is read-only. + * @function Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } + + /** + * Whether the reference is write-only. + * @function Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } + + /** + * Whether the reference is read-write. + * @function Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } +} + +/** + * @constant Reference.READ + * @private + */ +Reference.READ = READ; + +/** + * @constant Reference.WRITE + * @private + */ +Reference.WRITE = WRITE; + +/** + * @constant Reference.RW + * @private + */ +Reference.RW = RW; + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @constructor Variable + */ +class Variable { + constructor(name, scope) { + + /** + * The variable name, as given in the source code. + * @member {string} Variable#name + */ + this.name = name; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; + + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; + + this.tainted = false; + + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } +} + +Variable.CatchClause = "CatchClause"; +Variable.Parameter = "Parameter"; +Variable.FunctionName = "FunctionName"; +Variable.ClassName = "ClassName"; +Variable.Variable = "Variable"; +Variable.ImportBinding = "ImportBinding"; +Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @constructor Definition + */ +class Definition { + constructor(type, name, node, parent, index, kind) { + + /** + * @member {string} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; + + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; + + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; + + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; + + /** + * @member {number?} Definition#index - the index in the declaration statement. + */ + this.index = index; + + /** + * @member {string?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } +} + +/** + * @constructor ParameterDefinition + */ +class ParameterDefinition extends Definition { + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); + + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const { Syntax: Syntax$2 } = estraverse__default["default"]; + +/** + * Test if scope is struct + * @param {Scope} scope scope + * @param {Block} block block + * @param {boolean} isMethodDefinition is method definition + * @param {boolean} useDirective use directive + * @returns {boolean} is strict scope + */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; + + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } + + if (isMethodDefinition) { + return true; + } + + if (scope.type === "class" || scope.type === "module") { + return true; + } + + if (scope.type === "block" || scope.type === "switch") { + return false; + } + + if (scope.type === "function") { + if (block.type === Syntax$2.ArrowFunctionExpression && block.body.type !== Syntax$2.BlockStatement) { + return false; + } + + if (block.type === Syntax$2.Program) { + body = block; + } else { + body = block.body; + } + + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax$2.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax$2.ExpressionStatement) { + break; + } + const expr = stmt.expression; + + if (expr.type !== Syntax$2.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} + +/** + * Register scope + * @param {ScopeManager} scopeManager scope manager + * @param {Scope} scope scope + * @returns {void} + */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); + + const scopes = scopeManager.__nodeToScope.get(scope.block); + + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } +} + +/** + * Should be statically + * @param {Object} def def + * @returns {boolean} should be statically + */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} + +/** + * @constructor Scope + */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { + + /** + * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for", + * "class", "class-field-initializer", "class-static-block". + * @member {string} Scope#type + */ + this.type = type; + + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); + + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; + + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; + + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; + + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; + + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + this.type === "global" || + this.type === "module" || + this.type === "function" || + this.type === "class-field-initializer" || + this.type === "class-static-block" + ? this + : upperScope.variableScope; + + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; + + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = scopeManager.isStrictModeSupported() + ? isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()) + : false; + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + + this.__declaredVariables = scopeManager.__declaredVariables; + + registerScope(scopeManager, this); + } + + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } + + __shouldStaticallyCloseForGlobal(ref) { + + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + + const variable = this.set.get(name); + const defs = variable.defs; + + return defs.length > 0 && defs.every(shouldBeStatically); + } + + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } + + __dynamicCloseRef(ref) { + + // notify all names are through to global + let current = this; + + do { + current.through.push(ref); + current = current.upper; + } while (current); + } + + __globalCloseRef(ref) { + + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } + + __close(scopeManager) { + let closeRef; + + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } + + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + closeRef.call(this, ref); + } + this.__left = null; + + return this.upper; + } + + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } + + __resolve(ref) { + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + + return true; + } + + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + } + + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } + + let variables = this.__declaredVariables.get(node); + + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } + + __defineGeneric(name, set, variables, node, def) { + let variable; + + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } + + __define(node, def) { + if (node && node.type === Syntax$2.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + + // because Array element may be null + if (!node || node.type !== Syntax$2.Identifier) { + return; + } + + // Specially handle like `this`. + if (node.name === "super") { + return; + } + + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + + this.references.push(ref); + this.__left.push(ref); + } + + __detectEval() { + let current = this; + + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } + + __detectThis() { + this.thisFound = true; + } + + __isClosed() { + return this.__left === null; + } + + /** + * returns resolved {Reference} + * @function Scope#resolve + * @param {Espree.Identifier} ident identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; + + assert__default["default"](this.__isClosed(), "Scope should be closed."); + assert__default["default"](ident.type === Syntax$2.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } + + /** + * returns this scope is static + * @function Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + + /** + * returns this scope has materialized arguments + * @function Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + /** + * returns this scope has materialized `this` reference + * @function Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } +} + +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], + + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } + + __close(scopeManager) { + const implicit = []; + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } + + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; + + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); + + } + + this.implicit.left = this.__left; + + return super.__close(scopeManager); + } + + __defineImplicit(node, def) { + if (node && node.type === Syntax$2.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} + +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} + +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} + +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} + +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; + + return this.upper; + } +} + +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } +} + +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } +} + +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax$2.ArrowFunctionExpression) { + this.__defineArguments(); + } + } + + isArgumentsMaterialized() { + + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax$2.ArrowFunctionExpression) { + return false; + } + + if (!this.isStatic()) { + return true; + } + + const variable = this.set.get("arguments"); + + assert__default["default"](variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } + + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } + + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } + + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { + + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } + + const bodyStart = this.block.body.range[0]; + + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} + +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} + +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } +} + +class ClassFieldInitializerScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-field-initializer", upperScope, block, true); + } +} + +class ClassStaticBlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-static-block", upperScope, block, true); + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @constructor ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } + + __useDirective() { + return this.__options.directive; + } + + __isOptimistic() { + return this.__options.optimistic; + } + + __ignoreEval() { + return this.__options.ignoreEval; + } + + __isNodejsScope() { + return this.__options.nodejsScope || this.__options.sourceType === "commonjs"; + } + + isModule() { + return this.__options.sourceType === "module"; + } + + isImpliedStrict() { + return this.__options.impliedStrict; + } + + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } + + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } + + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * @param {Espree.Node} node a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } + + /** + * acquire scope from node. + * @function ScopeManager#acquire + * @param {Espree.Node} node node for the acquired scope. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + + /** + * predicate + * @param {Scope} testScope scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } + + const scopes = this.__get(node); + + if (!scopes || scopes.length === 0) { + return null; + } + + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } + + return null; + } + + /** + * acquire all scopes from node. + * @function ScopeManager#acquireAll + * @param {Espree.Node} node node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + + /** + * release the node. + * @function ScopeManager#release + * @param {Espree.Node} node releasing node. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); + + if (scopes && scopes.length) { + const scope = scopes[0].upper; + + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } + + attach() { } // eslint-disable-line class-methods-use-this + + detach() { } // eslint-disable-line class-methods-use-this + + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert__default["default"](this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } + + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } + + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } + + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } + + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } + + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } + + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } + + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } + + __nestClassFieldInitializerScope(node) { + return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node)); + } + + __nestClassStaticBlockScope(node) { + return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node)); + } + + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } + + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } + + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } + + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const { Syntax: Syntax$1 } = estraverse__default["default"]; + +/** + * Get last array element + * @param {Array} xs array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} + +class PatternVisitor extends esrecurse__default["default"].Visitor { + static isPattern(node) { + const nodeType = node.type; + + return ( + nodeType === Syntax$1.Identifier || + nodeType === Syntax$1.ObjectPattern || + nodeType === Syntax$1.ArrayPattern || + nodeType === Syntax$1.SpreadElement || + nodeType === Syntax$1.RestElement || + nodeType === Syntax$1.AssignmentPattern + ); + } + + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } + + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); + + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } + + Property(property) { + + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); + } + + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); + } + + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; + + this.visit(element); + } + } + + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } + + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } + + MemberExpression(node) { + + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); + } + + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); + } + + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // + + SpreadElement(node) { + this.visit(node.argument); + } + + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } + + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + + CallExpression(node) { + + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const { Syntax } = estraverse__default["default"]; + +/** + * Traverse identifier in pattern + * @param {Object} options options + * @param {pattern} rootPattern root pattern + * @param {Refencer} referencer referencer + * @param {callback} callback callback + * @returns {void} + */ +function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); + + visitor.visit(rootPattern); + + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } +} + +// Importing ImportDeclaration. +// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation +// https://github.com/estree/estree/blob/master/es6.md#importdeclaration +// FIXME: Now, we don't create module environment, because the context is +// implementation dependent. + +class Importer extends esrecurse__default["default"].Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } + + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); + }); + } + + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); + + if (local) { + this.visitImport(local, node); + } + } + + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + + this.visitImport(local, node); + } + + ImportSpecifier(node) { + const local = (node.local || node.id); + + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } +} + +// Referencing variables and creating bindings. +class Referencer extends esrecurse__default["default"].Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + + currentScope() { + return this.scopeManager.__currentScope; + } + + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } + } + + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } + + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); + + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } + + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; + + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } + + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } + + visitFunction(node) { + let i, iz; + + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === Syntax.FunctionDeclaration) { + + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); + } + + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + + const that = this; + + /** + * Visit pattern callback + * @param {pattern} pattern pattern + * @param {Object} info info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); + + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } + + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } + + this.visit(node.superClass); + + this.scopeManager.__nestClassScope(node); + + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); + + this.close(node); + } + + visitProperty(node) { + let previous; + + if (node.computed) { + this.visit(node.key); + } + + const isMethodDefinition = node.type === Syntax.MethodDefinition; + + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } + + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + visitVariableDeclaration(variableTargetScope, type, node, index) { + + const decl = node.declarations[index]; + const init = decl.init; + + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); + } + + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } + + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); + + this.close(node); + } + + Program(node) { + this.scopeManager.__nestGlobalScope(node); + + if (this.scopeManager.__isNodejsScope()) { + + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + + this.visitChildren(node); + this.close(node); + } + + Identifier(node) { + this.currentScope().__referencing(node); + } + + // eslint-disable-next-line class-methods-use-this + PrivateIdentifier() { + + // Do nothing. + } + + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + } + + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + + Property(node) { + this.visitProperty(node); + } + + PropertyDefinition(node) { + const { computed, key, value } = node; + + if (computed) { + this.visit(key); + } + if (value) { + this.scopeManager.__nestClassFieldInitializerScope(value); + this.visit(value); + this.close(value); + } + } + + StaticBlock(node) { + this.scopeManager.__nestClassStaticBlockScope(node); + + this.visitChildren(node); + + this.close(node); + } + + MethodDefinition(node) { + this.visitProperty(node); + } + + BreakStatement() {} // eslint-disable-line class-methods-use-this + + ContinueStatement() {} // eslint-disable-line class-methods-use-this + + LabeledStatement(node) { + this.visit(node.body); + } + + ForStatement(node) { + + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ClassExpression(node) { + this.visitClass(node); + } + + ClassDeclaration(node) { + this.visitClass(node); + } + + CallExpression(node) { + + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { + + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } + + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } + + WithStatement(node) { + this.visit(node.object); + + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + + this.visit(node.body); + + this.close(node); + } + + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); + + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + } + + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); + + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + + this.close(node); + } + + FunctionDeclaration(node) { + this.visitFunction(node); + } + + FunctionExpression(node) { + this.visitFunction(node); + } + + ForOfStatement(node) { + this.visitForIn(node); + } + + ForInStatement(node) { + this.visitForIn(node); + } + + ArrowFunctionExpression(node) { + this.visitFunction(node); + } + + ImportDeclaration(node) { + assert__default["default"](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); + + const importer = new Importer(node, this); + + importer.visit(node); + } + + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); + } + + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportSpecifier(node) { + + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + + this.visit(local); + } + + MetaProperty() { // eslint-disable-line class-methods-use-this + + // do nothing. + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +const version = "7.1.1"; + +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module', 'commonjs'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} + +/** + * Preform deep update on option object + * @param {Object} target Options + * @param {Object} override Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { + + /** + * Is hash object + * @param {Object} value Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); + } + + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; + + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; +} + +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree Abstract Syntax Tree + * @param {Object} providedOptions Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] the optimistic flag + * @param {boolean} [providedOptions.directive=false] the directive flag + * @param {boolean} [providedOptions.ignoreEval=false] whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false] whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false] implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs' + * @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(tree); + + assert__default["default"](scopeManager.__currentScope === null, "currentScope should be null."); + + return scopeManager; +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +exports.Definition = Definition; +exports.PatternVisitor = PatternVisitor; +exports.Reference = Reference; +exports.Referencer = Referencer; +exports.Scope = Scope; +exports.ScopeManager = ScopeManager; +exports.Variable = Variable; +exports.analyze = analyze; +exports.version = version; +//# sourceMappingURL=eslint-scope.cjs.map diff --git a/node_modules/eslint-scope/lib/definition.js b/node_modules/eslint-scope/lib/definition.js new file mode 100644 index 0000000..9744ef4 --- /dev/null +++ b/node_modules/eslint-scope/lib/definition.js @@ -0,0 +1,85 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import Variable from "./variable.js"; + +/** + * @constructor Definition + */ +class Definition { + constructor(type, name, node, parent, index, kind) { + + /** + * @member {string} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; + + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; + + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; + + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; + + /** + * @member {number?} Definition#index - the index in the declaration statement. + */ + this.index = index; + + /** + * @member {string?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } +} + +/** + * @constructor ParameterDefinition + */ +class ParameterDefinition extends Definition { + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); + + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } +} + +export { + ParameterDefinition, + Definition +}; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/index.js b/node_modules/eslint-scope/lib/index.js new file mode 100644 index 0000000..cd0678d --- /dev/null +++ b/node_modules/eslint-scope/lib/index.js @@ -0,0 +1,172 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Escope (escope) is an ECMAScript + * scope analyzer extracted from the esmangle project. + *

+ * escope finds lexical scopes in a source program, i.e. areas of that + * program where different occurrences of the same identifier refer to the same + * variable. With each scope the contained variables are collected, and each + * identifier reference in code is linked to its corresponding variable (if + * possible). + *

+ * escope works on a syntax tree of the parsed source code which has + * to adhere to the + * Mozilla Parser API. E.g. espree is a parser + * that produces such syntax trees. + *

+ * The main interface is the {@link analyze} function. + * @module escope + */ +/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ + +import assert from "assert"; + +import ScopeManager from "./scope-manager.js"; +import Referencer from "./referencer.js"; +import Reference from "./reference.js"; +import Variable from "./variable.js"; + +import eslintScopeVersion from "./version.js"; + +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module', 'commonjs'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} + +/** + * Preform deep update on option object + * @param {Object} target Options + * @param {Object} override Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { + + /** + * Is hash object + * @param {Object} value Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); + } + + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; + + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; +} + +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree Abstract Syntax Tree + * @param {Object} providedOptions Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] the optimistic flag + * @param {boolean} [providedOptions.directive=false] the directive flag + * @param {boolean} [providedOptions.ignoreEval=false] whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false] whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false] implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs' + * @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(tree); + + assert(scopeManager.__currentScope === null, "currentScope should be null."); + + return scopeManager; +} + +export { + + /** @name module:escope.version */ + eslintScopeVersion as version, + + /** @name module:escope.Reference */ + Reference, + + /** @name module:escope.Variable */ + Variable, + + /** @name module:escope.ScopeManager */ + ScopeManager, + + /** @name module:escope.Referencer */ + Referencer, + + analyze +}; + +/** @name module:escope.Definition */ +export { Definition } from "./definition.js"; + +/** @name module:escope.PatternVisitor */ +export { default as PatternVisitor } from "./pattern-visitor.js"; + +/** @name module:escope.Scope */ +export { Scope } from "./scope.js"; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/pattern-visitor.js b/node_modules/eslint-scope/lib/pattern-visitor.js new file mode 100644 index 0000000..a9ff48e --- /dev/null +++ b/node_modules/eslint-scope/lib/pattern-visitor.js @@ -0,0 +1,153 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* eslint-disable no-undefined */ + +import estraverse from "estraverse"; +import esrecurse from "esrecurse"; + +const { Syntax } = estraverse; + +/** + * Get last array element + * @param {Array} xs array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} + +class PatternVisitor extends esrecurse.Visitor { + static isPattern(node) { + const nodeType = node.type; + + return ( + nodeType === Syntax.Identifier || + nodeType === Syntax.ObjectPattern || + nodeType === Syntax.ArrayPattern || + nodeType === Syntax.SpreadElement || + nodeType === Syntax.RestElement || + nodeType === Syntax.AssignmentPattern + ); + } + + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } + + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); + + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } + + Property(property) { + + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); + } + + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); + } + + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; + + this.visit(element); + } + } + + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } + + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } + + MemberExpression(node) { + + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); + } + + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); + } + + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // + + SpreadElement(node) { + this.visit(node.argument); + } + + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } + + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + + CallExpression(node) { + + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } +} + +export default PatternVisitor; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/reference.js b/node_modules/eslint-scope/lib/reference.js new file mode 100644 index 0000000..e657d62 --- /dev/null +++ b/node_modules/eslint-scope/lib/reference.js @@ -0,0 +1,166 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const READ = 0x1; +const WRITE = 0x2; +const RW = READ | WRITE; + +/** + * A Reference represents a single occurrence of an identifier in code. + * @constructor Reference + */ +class Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; + + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; + + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; + + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { + + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; + + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; + + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + + /** + * Whether the reference is static. + * @function Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } + + /** + * Whether the reference is writeable. + * @function Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } + + /** + * Whether the reference is readable. + * @function Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); + } + + /** + * Whether the reference is read-only. + * @function Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } + + /** + * Whether the reference is write-only. + * @function Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } + + /** + * Whether the reference is read-write. + * @function Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } +} + +/** + * @constant Reference.READ + * @private + */ +Reference.READ = READ; + +/** + * @constant Reference.WRITE + * @private + */ +Reference.WRITE = WRITE; + +/** + * @constant Reference.RW + * @private + */ +Reference.RW = RW; + +export default Reference; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/referencer.js b/node_modules/eslint-scope/lib/referencer.js new file mode 100644 index 0000000..0147f68 --- /dev/null +++ b/node_modules/eslint-scope/lib/referencer.js @@ -0,0 +1,654 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ + +import estraverse from "estraverse"; +import esrecurse from "esrecurse"; +import Reference from "./reference.js"; +import Variable from "./variable.js"; +import PatternVisitor from "./pattern-visitor.js"; +import { Definition, ParameterDefinition } from "./definition.js"; +import assert from "assert"; + +const { Syntax } = estraverse; + +/** + * Traverse identifier in pattern + * @param {Object} options options + * @param {pattern} rootPattern root pattern + * @param {Refencer} referencer referencer + * @param {callback} callback callback + * @returns {void} + */ +function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); + + visitor.visit(rootPattern); + + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } +} + +// Importing ImportDeclaration. +// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation +// https://github.com/estree/estree/blob/master/es6.md#importdeclaration +// FIXME: Now, we don't create module environment, because the context is +// implementation dependent. + +class Importer extends esrecurse.Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } + + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); + }); + } + + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); + + if (local) { + this.visitImport(local, node); + } + } + + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + + this.visitImport(local, node); + } + + ImportSpecifier(node) { + const local = (node.local || node.id); + + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } +} + +// Referencing variables and creating bindings. +class Referencer extends esrecurse.Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + + currentScope() { + return this.scopeManager.__currentScope; + } + + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } + } + + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } + + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); + + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } + + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; + + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } + + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } + + visitFunction(node) { + let i, iz; + + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === Syntax.FunctionDeclaration) { + + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); + } + + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + + const that = this; + + /** + * Visit pattern callback + * @param {pattern} pattern pattern + * @param {Object} info info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); + + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } + + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } + + this.visit(node.superClass); + + this.scopeManager.__nestClassScope(node); + + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); + + this.close(node); + } + + visitProperty(node) { + let previous; + + if (node.computed) { + this.visit(node.key); + } + + const isMethodDefinition = node.type === Syntax.MethodDefinition; + + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } + + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + visitVariableDeclaration(variableTargetScope, type, node, index) { + + const decl = node.declarations[index]; + const init = decl.init; + + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); + } + + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } + + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); + + this.close(node); + } + + Program(node) { + this.scopeManager.__nestGlobalScope(node); + + if (this.scopeManager.__isNodejsScope()) { + + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + + this.visitChildren(node); + this.close(node); + } + + Identifier(node) { + this.currentScope().__referencing(node); + } + + // eslint-disable-next-line class-methods-use-this + PrivateIdentifier() { + + // Do nothing. + } + + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + } + + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + + Property(node) { + this.visitProperty(node); + } + + PropertyDefinition(node) { + const { computed, key, value } = node; + + if (computed) { + this.visit(key); + } + if (value) { + this.scopeManager.__nestClassFieldInitializerScope(value); + this.visit(value); + this.close(value); + } + } + + StaticBlock(node) { + this.scopeManager.__nestClassStaticBlockScope(node); + + this.visitChildren(node); + + this.close(node); + } + + MethodDefinition(node) { + this.visitProperty(node); + } + + BreakStatement() {} // eslint-disable-line class-methods-use-this + + ContinueStatement() {} // eslint-disable-line class-methods-use-this + + LabeledStatement(node) { + this.visit(node.body); + } + + ForStatement(node) { + + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ClassExpression(node) { + this.visitClass(node); + } + + ClassDeclaration(node) { + this.visitClass(node); + } + + CallExpression(node) { + + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { + + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } + + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } + + WithStatement(node) { + this.visit(node.object); + + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + + this.visit(node.body); + + this.close(node); + } + + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); + + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + } + + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); + + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + + this.close(node); + } + + FunctionDeclaration(node) { + this.visitFunction(node); + } + + FunctionExpression(node) { + this.visitFunction(node); + } + + ForOfStatement(node) { + this.visitForIn(node); + } + + ForInStatement(node) { + this.visitForIn(node); + } + + ArrowFunctionExpression(node) { + this.visitFunction(node); + } + + ImportDeclaration(node) { + assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); + + const importer = new Importer(node, this); + + importer.visit(node); + } + + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); + } + + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportSpecifier(node) { + + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + + this.visit(local); + } + + MetaProperty() { // eslint-disable-line class-methods-use-this + + // do nothing. + } +} + +export default Referencer; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/scope-manager.js b/node_modules/eslint-scope/lib/scope-manager.js new file mode 100644 index 0000000..e41d471 --- /dev/null +++ b/node_modules/eslint-scope/lib/scope-manager.js @@ -0,0 +1,255 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* eslint-disable no-underscore-dangle */ + +import { + BlockScope, + CatchScope, + ClassFieldInitializerScope, + ClassStaticBlockScope, + ClassScope, + ForScope, + FunctionExpressionNameScope, + FunctionScope, + GlobalScope, + ModuleScope, + SwitchScope, + WithScope +} from "./scope.js"; +import assert from "assert"; + +/** + * @constructor ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } + + __useDirective() { + return this.__options.directive; + } + + __isOptimistic() { + return this.__options.optimistic; + } + + __ignoreEval() { + return this.__options.ignoreEval; + } + + __isNodejsScope() { + return this.__options.nodejsScope || this.__options.sourceType === "commonjs"; + } + + isModule() { + return this.__options.sourceType === "module"; + } + + isImpliedStrict() { + return this.__options.impliedStrict; + } + + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } + + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } + + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * @param {Espree.Node} node a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } + + /** + * acquire scope from node. + * @function ScopeManager#acquire + * @param {Espree.Node} node node for the acquired scope. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + + /** + * predicate + * @param {Scope} testScope scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } + + const scopes = this.__get(node); + + if (!scopes || scopes.length === 0) { + return null; + } + + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } + + return null; + } + + /** + * acquire all scopes from node. + * @function ScopeManager#acquireAll + * @param {Espree.Node} node node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + + /** + * release the node. + * @function ScopeManager#release + * @param {Espree.Node} node releasing node. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); + + if (scopes && scopes.length) { + const scope = scopes[0].upper; + + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } + + attach() { } // eslint-disable-line class-methods-use-this + + detach() { } // eslint-disable-line class-methods-use-this + + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert(this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } + + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } + + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } + + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } + + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } + + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } + + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } + + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } + + __nestClassFieldInitializerScope(node) { + return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node)); + } + + __nestClassStaticBlockScope(node) { + return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node)); + } + + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } + + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } + + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } + + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} + +export default ScopeManager; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/scope.js b/node_modules/eslint-scope/lib/scope.js new file mode 100644 index 0000000..0619b90 --- /dev/null +++ b/node_modules/eslint-scope/lib/scope.js @@ -0,0 +1,772 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ + +import estraverse from "estraverse"; + +import Reference from "./reference.js"; +import Variable from "./variable.js"; +import { Definition } from "./definition.js"; +import assert from "assert"; + +const { Syntax } = estraverse; + +/** + * Test if scope is struct + * @param {Scope} scope scope + * @param {Block} block block + * @param {boolean} isMethodDefinition is method definition + * @param {boolean} useDirective use directive + * @returns {boolean} is strict scope + */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; + + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } + + if (isMethodDefinition) { + return true; + } + + if (scope.type === "class" || scope.type === "module") { + return true; + } + + if (scope.type === "block" || scope.type === "switch") { + return false; + } + + if (scope.type === "function") { + if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { + return false; + } + + if (block.type === Syntax.Program) { + body = block; + } else { + body = block.body; + } + + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax.ExpressionStatement) { + break; + } + const expr = stmt.expression; + + if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} + +/** + * Register scope + * @param {ScopeManager} scopeManager scope manager + * @param {Scope} scope scope + * @returns {void} + */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); + + const scopes = scopeManager.__nodeToScope.get(scope.block); + + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } +} + +/** + * Should be statically + * @param {Object} def def + * @returns {boolean} should be statically + */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} + +/** + * @constructor Scope + */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { + + /** + * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for", + * "class", "class-field-initializer", "class-static-block". + * @member {string} Scope#type + */ + this.type = type; + + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); + + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; + + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; + + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; + + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; + + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + this.type === "global" || + this.type === "module" || + this.type === "function" || + this.type === "class-field-initializer" || + this.type === "class-static-block" + ? this + : upperScope.variableScope; + + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; + + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = scopeManager.isStrictModeSupported() + ? isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()) + : false; + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + + this.__declaredVariables = scopeManager.__declaredVariables; + + registerScope(scopeManager, this); + } + + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } + + __shouldStaticallyCloseForGlobal(ref) { + + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + + const variable = this.set.get(name); + const defs = variable.defs; + + return defs.length > 0 && defs.every(shouldBeStatically); + } + + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } + + __dynamicCloseRef(ref) { + + // notify all names are through to global + let current = this; + + do { + current.through.push(ref); + current = current.upper; + } while (current); + } + + __globalCloseRef(ref) { + + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } + + __close(scopeManager) { + let closeRef; + + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } + + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + closeRef.call(this, ref); + } + this.__left = null; + + return this.upper; + } + + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } + + __resolve(ref) { + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + + return true; + } + + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + } + + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } + + let variables = this.__declaredVariables.get(node); + + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } + + __defineGeneric(name, set, variables, node, def) { + let variable; + + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } + + __define(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + + // because Array element may be null + if (!node || node.type !== Syntax.Identifier) { + return; + } + + // Specially handle like `this`. + if (node.name === "super") { + return; + } + + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + + this.references.push(ref); + this.__left.push(ref); + } + + __detectEval() { + let current = this; + + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } + + __detectThis() { + this.thisFound = true; + } + + __isClosed() { + return this.__left === null; + } + + /** + * returns resolved {Reference} + * @function Scope#resolve + * @param {Espree.Identifier} ident identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; + + assert(this.__isClosed(), "Scope should be closed."); + assert(ident.type === Syntax.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } + + /** + * returns this scope is static + * @function Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + + /** + * returns this scope has materialized arguments + * @function Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + /** + * returns this scope has materialized `this` reference + * @function Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } +} + +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], + + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } + + __close(scopeManager) { + const implicit = []; + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } + + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; + + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); + + } + + this.implicit.left = this.__left; + + return super.__close(scopeManager); + } + + __defineImplicit(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} + +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} + +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} + +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} + +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; + + return this.upper; + } +} + +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } +} + +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } +} + +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + } + + isArgumentsMaterialized() { + + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax.ArrowFunctionExpression) { + return false; + } + + if (!this.isStatic()) { + return true; + } + + const variable = this.set.get("arguments"); + + assert(variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } + + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } + + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } + + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { + + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } + + const bodyStart = this.block.body.range[0]; + + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} + +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} + +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } +} + +class ClassFieldInitializerScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-field-initializer", upperScope, block, true); + } +} + +class ClassStaticBlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-static-block", upperScope, block, true); + } +} + +export { + Scope, + GlobalScope, + ModuleScope, + FunctionExpressionNameScope, + CatchScope, + WithScope, + BlockScope, + SwitchScope, + FunctionScope, + ForScope, + ClassScope, + ClassFieldInitializerScope, + ClassStaticBlockScope +}; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/variable.js b/node_modules/eslint-scope/lib/variable.js new file mode 100644 index 0000000..286202f --- /dev/null +++ b/node_modules/eslint-scope/lib/variable.js @@ -0,0 +1,87 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @constructor Variable + */ +class Variable { + constructor(name, scope) { + + /** + * The variable name, as given in the source code. + * @member {string} Variable#name + */ + this.name = name; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; + + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; + + this.tainted = false; + + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } +} + +Variable.CatchClause = "CatchClause"; +Variable.Parameter = "Parameter"; +Variable.FunctionName = "FunctionName"; +Variable.ClassName = "ClassName"; +Variable.Variable = "Variable"; +Variable.ImportBinding = "ImportBinding"; +Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; + +export default Variable; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/eslint-scope/lib/version.js b/node_modules/eslint-scope/lib/version.js new file mode 100644 index 0000000..35c77dd --- /dev/null +++ b/node_modules/eslint-scope/lib/version.js @@ -0,0 +1,3 @@ +const version = "7.1.1"; + +export default version; diff --git a/node_modules/eslint-scope/package.json b/node_modules/eslint-scope/package.json new file mode 100644 index 0000000..737ba38 --- /dev/null +++ b/node_modules/eslint-scope/package.json @@ -0,0 +1,62 @@ +{ + "name": "eslint-scope", + "description": "ECMAScript scope analyzer for ESLint", + "homepage": "http://github.com/eslint/eslint-scope", + "main": "./dist/eslint-scope.cjs", + "type": "module", + "exports": { + ".": { + "import": "./lib/index.js", + "require": "./dist/eslint-scope.cjs" + }, + "./package.json": "./package.json" + }, + "version": "7.1.1", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "repository": "eslint/eslint-scope", + "bugs": { + "url": "https://github.com/eslint/eslint-scope/issues" + }, + "license": "BSD-2-Clause", + "scripts": { + "build": "rollup -c", + "lint": "npm run build && node Makefile.js lint", + "update-version": "node tools/update-version.js", + "test": "npm run build && node Makefile.js test", + "prepublishOnly": "npm run update-version && npm run build", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + }, + "files": [ + "LICENSE", + "README.md", + "lib", + "dist/eslint-scope.cjs" + ], + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "devDependencies": { + "@typescript-eslint/parser": "^4.28.1", + "c8": "^7.7.3", + "chai": "^4.3.4", + "eslint": "^7.29.0", + "eslint-config-eslint": "^7.0.0", + "eslint-plugin-jsdoc": "^35.4.1", + "eslint-plugin-node": "^11.1.0", + "eslint-release": "^3.2.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "mocha": "^9.0.1", + "npm-license": "^0.3.3", + "rollup": "^2.52.7", + "shelljs": "^0.8.4", + "typescript": "^4.3.5" + } +} diff --git a/node_modules/eslint-utils/LICENSE b/node_modules/eslint-utils/LICENSE new file mode 100644 index 0000000..883ee1f --- /dev/null +++ b/node_modules/eslint-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Toru Nagashima + +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/eslint-utils/README.md b/node_modules/eslint-utils/README.md new file mode 100644 index 0000000..0b91759 --- /dev/null +++ b/node_modules/eslint-utils/README.md @@ -0,0 +1,38 @@ +# eslint-utils + +[![npm version](https://img.shields.io/npm/v/eslint-utils.svg)](https://www.npmjs.com/package/eslint-utils) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-utils.svg)](http://www.npmtrends.com/eslint-utils) +[![Build Status](https://github.com/mysticatea/eslint-utils/workflows/CI/badge.svg)](https://github.com/mysticatea/eslint-utils/actions) +[![Coverage Status](https://codecov.io/gh/mysticatea/eslint-utils/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/eslint-utils) +[![Dependency Status](https://david-dm.org/mysticatea/eslint-utils.svg)](https://david-dm.org/mysticatea/eslint-utils) + +## 🏁 Goal + +This package provides utility functions and classes for make ESLint custom rules. + +For examples: + +- [getStaticValue](https://eslint-utils.mysticatea.dev/api/ast-utils.html#getstaticvalue) evaluates static value on AST. +- [ReferenceTracker](https://eslint-utils.mysticatea.dev/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring. + +## 📖 Usage + +See [documentation](https://eslint-utils.mysticatea.dev/). + +## 📰 Changelog + +See [releases](https://github.com/mysticatea/eslint-utils/releases). + +## ❤️ Contributing + +Welcome contributing! + +Please use GitHub's Issues/PRs. + +### Development Tools + +- `npm test` runs tests and measures coverage. +- `npm run clean` removes the coverage result of `npm test` command. +- `npm run coverage` shows the coverage result of the last `npm test` command. +- `npm run lint` runs ESLint. +- `npm run watch` runs tests on each file change. diff --git a/node_modules/eslint-utils/index.js b/node_modules/eslint-utils/index.js new file mode 100644 index 0000000..034a19b --- /dev/null +++ b/node_modules/eslint-utils/index.js @@ -0,0 +1,1956 @@ +/*! @author Toru Nagashima */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var evk = _interopDefault(require('eslint-visitor-keys')); + +/** + * Get the innermost scope which contains a given location. + * @param {Scope} initialScope The initial scope to search. + * @param {Node} node The location to search. + * @returns {Scope} The innermost scope. + */ +function getInnermostScope(initialScope, node) { + const location = node.range[0]; + + let scope = initialScope; + let found = false; + do { + found = false; + for (const childScope of scope.childScopes) { + const range = childScope.block.range; + + if (range[0] <= location && location < range[1]) { + scope = childScope; + found = true; + break + } + } + } while (found) + + return scope +} + +/** + * Find the variable of a given name. + * @param {Scope} initialScope The scope to start finding. + * @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node. + * @returns {Variable|null} The found variable or null. + */ +function findVariable(initialScope, nameOrNode) { + let name = ""; + let scope = initialScope; + + if (typeof nameOrNode === "string") { + name = nameOrNode; + } else { + name = nameOrNode.name; + scope = getInnermostScope(scope, nameOrNode); + } + + while (scope != null) { + const variable = scope.set.get(name); + if (variable != null) { + return variable + } + scope = scope.upper; + } + + return null +} + +/** + * Negate the result of `this` calling. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the result of `this(token)` is `false`. + */ +function negate0(token) { + return !this(token) //eslint-disable-line no-invalid-this +} + +/** + * Creates the negate function of the given function. + * @param {function(Token):boolean} f - The function to negate. + * @returns {function(Token):boolean} Negated function. + */ +function negate(f) { + return negate0.bind(f) +} + +/** + * Checks if the given token is a PunctuatorToken with the given value + * @param {Token} token - The token to check. + * @param {string} value - The value to check. + * @returns {boolean} `true` if the token is a PunctuatorToken with the given value. + */ +function isPunctuatorTokenWithValue(token, value) { + return token.type === "Punctuator" && token.value === value +} + +/** + * Checks if the given token is an arrow token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an arrow token. + */ +function isArrowToken(token) { + return isPunctuatorTokenWithValue(token, "=>") +} + +/** + * Checks if the given token is a comma token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a comma token. + */ +function isCommaToken(token) { + return isPunctuatorTokenWithValue(token, ",") +} + +/** + * Checks if the given token is a semicolon token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a semicolon token. + */ +function isSemicolonToken(token) { + return isPunctuatorTokenWithValue(token, ";") +} + +/** + * Checks if the given token is a colon token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a colon token. + */ +function isColonToken(token) { + return isPunctuatorTokenWithValue(token, ":") +} + +/** + * Checks if the given token is an opening parenthesis token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening parenthesis token. + */ +function isOpeningParenToken(token) { + return isPunctuatorTokenWithValue(token, "(") +} + +/** + * Checks if the given token is a closing parenthesis token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing parenthesis token. + */ +function isClosingParenToken(token) { + return isPunctuatorTokenWithValue(token, ")") +} + +/** + * Checks if the given token is an opening square bracket token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening square bracket token. + */ +function isOpeningBracketToken(token) { + return isPunctuatorTokenWithValue(token, "[") +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing square bracket token. + */ +function isClosingBracketToken(token) { + return isPunctuatorTokenWithValue(token, "]") +} + +/** + * Checks if the given token is an opening brace token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening brace token. + */ +function isOpeningBraceToken(token) { + return isPunctuatorTokenWithValue(token, "{") +} + +/** + * Checks if the given token is a closing brace token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing brace token. + */ +function isClosingBraceToken(token) { + return isPunctuatorTokenWithValue(token, "}") +} + +/** + * Checks if the given token is a comment token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a comment token. + */ +function isCommentToken(token) { + return ["Block", "Line", "Shebang"].includes(token.type) +} + +const isNotArrowToken = negate(isArrowToken); +const isNotCommaToken = negate(isCommaToken); +const isNotSemicolonToken = negate(isSemicolonToken); +const isNotColonToken = negate(isColonToken); +const isNotOpeningParenToken = negate(isOpeningParenToken); +const isNotClosingParenToken = negate(isClosingParenToken); +const isNotOpeningBracketToken = negate(isOpeningBracketToken); +const isNotClosingBracketToken = negate(isClosingBracketToken); +const isNotOpeningBraceToken = negate(isOpeningBraceToken); +const isNotClosingBraceToken = negate(isClosingBraceToken); +const isNotCommentToken = negate(isCommentToken); + +/** + * Get the `(` token of the given function node. + * @param {Node} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {Token} `(` token. + */ +function getOpeningParenOfParams(node, sourceCode) { + return node.id + ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) + : sourceCode.getFirstToken(node, isOpeningParenToken) +} + +/** + * Get the location of the given function node for reporting. + * @param {Node} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {string} The location of the function node for reporting. + */ +function getFunctionHeadLocation(node, sourceCode) { + const parent = node.parent; + let start = null; + let end = null; + + if (node.type === "ArrowFunctionExpression") { + const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); + + start = arrowToken.loc.start; + end = arrowToken.loc.end; + } else if ( + parent.type === "Property" || + parent.type === "MethodDefinition" || + parent.type === "PropertyDefinition" + ) { + start = parent.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else { + start = node.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } + + return { + start: { ...start }, + end: { ...end }, + } +} + +/* globals globalThis, global, self, window */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : typeof global !== "undefined" + ? global + : {}; + +const builtinNames = Object.freeze( + new Set([ + "Array", + "ArrayBuffer", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "Boolean", + "DataView", + "Date", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "Float32Array", + "Float64Array", + "Function", + "Infinity", + "Int16Array", + "Int32Array", + "Int8Array", + "isFinite", + "isNaN", + "isPrototypeOf", + "JSON", + "Map", + "Math", + "NaN", + "Number", + "Object", + "parseFloat", + "parseInt", + "Promise", + "Proxy", + "Reflect", + "RegExp", + "Set", + "String", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "undefined", + "unescape", + "WeakMap", + "WeakSet", + ]), +); +const callAllowed = new Set( + [ + Array.isArray, + typeof BigInt === "function" ? BigInt : undefined, + Boolean, + Date, + Date.parse, + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, + escape, + isFinite, + isNaN, + isPrototypeOf, + ...Object.getOwnPropertyNames(Math) + .map((k) => Math[k]) + .filter((f) => typeof f === "function"), + Number, + Number.isFinite, + Number.isNaN, + Number.parseFloat, + Number.parseInt, + Object, + Object.entries, + Object.is, + Object.isExtensible, + Object.isFrozen, + Object.isSealed, + Object.keys, + Object.values, + parseFloat, + parseInt, + RegExp, + String, + String.fromCharCode, + String.fromCodePoint, + String.raw, + Symbol.for, + Symbol.keyFor, + unescape, + ].filter((f) => typeof f === "function"), +); +const callPassThrough = new Set([ + Object.freeze, + Object.preventExtensions, + Object.seal, +]); + +/** + * Get the property descriptor. + * @param {object} object The object to get. + * @param {string|number|symbol} name The property name to get. + */ +function getPropertyDescriptor(object, name) { + let x = object; + while ((typeof x === "object" || typeof x === "function") && x !== null) { + const d = Object.getOwnPropertyDescriptor(x, name); + if (d) { + return d + } + x = Object.getPrototypeOf(x); + } + return null +} + +/** + * Check if a property is getter or not. + * @param {object} object The object to check. + * @param {string|number|symbol} name The property name to check. + */ +function isGetter(object, name) { + const d = getPropertyDescriptor(object, name); + return d != null && d.get != null +} + +/** + * Get the element values of a given node list. + * @param {Node[]} nodeList The node list to get values. + * @param {Scope|undefined} initialScope The initial scope to find variables. + * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null. + */ +function getElementValues(nodeList, initialScope) { + const valueList = []; + + for (let i = 0; i < nodeList.length; ++i) { + const elementNode = nodeList[i]; + + if (elementNode == null) { + valueList.length = i + 1; + } else if (elementNode.type === "SpreadElement") { + const argument = getStaticValueR(elementNode.argument, initialScope); + if (argument == null) { + return null + } + valueList.push(...argument.value); + } else { + const element = getStaticValueR(elementNode, initialScope); + if (element == null) { + return null + } + valueList.push(element.value); + } + } + + return valueList +} + +const operations = Object.freeze({ + ArrayExpression(node, initialScope) { + const elements = getElementValues(node.elements, initialScope); + return elements != null ? { value: elements } : null + }, + + AssignmentExpression(node, initialScope) { + if (node.operator === "=") { + return getStaticValueR(node.right, initialScope) + } + return null + }, + + //eslint-disable-next-line complexity + BinaryExpression(node, initialScope) { + if (node.operator === "in" || node.operator === "instanceof") { + // Not supported. + return null + } + + const left = getStaticValueR(node.left, initialScope); + const right = getStaticValueR(node.right, initialScope); + if (left != null && right != null) { + switch (node.operator) { + case "==": + return { value: left.value == right.value } //eslint-disable-line eqeqeq + case "!=": + return { value: left.value != right.value } //eslint-disable-line eqeqeq + case "===": + return { value: left.value === right.value } + case "!==": + return { value: left.value !== right.value } + case "<": + return { value: left.value < right.value } + case "<=": + return { value: left.value <= right.value } + case ">": + return { value: left.value > right.value } + case ">=": + return { value: left.value >= right.value } + case "<<": + return { value: left.value << right.value } + case ">>": + return { value: left.value >> right.value } + case ">>>": + return { value: left.value >>> right.value } + case "+": + return { value: left.value + right.value } + case "-": + return { value: left.value - right.value } + case "*": + return { value: left.value * right.value } + case "/": + return { value: left.value / right.value } + case "%": + return { value: left.value % right.value } + case "**": + return { value: Math.pow(left.value, right.value) } + case "|": + return { value: left.value | right.value } + case "^": + return { value: left.value ^ right.value } + case "&": + return { value: left.value & right.value } + + // no default + } + } + + return null + }, + + CallExpression(node, initialScope) { + const calleeNode = node.callee; + const args = getElementValues(node.arguments, initialScope); + + if (args != null) { + if (calleeNode.type === "MemberExpression") { + if (calleeNode.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(calleeNode.object, initialScope); + if (object != null) { + if ( + object.value == null && + (object.optional || node.optional) + ) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue( + calleeNode, + initialScope, + ); + + if (property != null) { + const receiver = object.value; + const methodName = property.value; + if (callAllowed.has(receiver[methodName])) { + return { value: receiver[methodName](...args) } + } + if (callPassThrough.has(receiver[methodName])) { + return { value: args[0] } + } + } + } + } else { + const callee = getStaticValueR(calleeNode, initialScope); + if (callee != null) { + if (callee.value == null && node.optional) { + return { value: undefined, optional: true } + } + const func = callee.value; + if (callAllowed.has(func)) { + return { value: func(...args) } + } + if (callPassThrough.has(func)) { + return { value: args[0] } + } + } + } + } + + return null + }, + + ConditionalExpression(node, initialScope) { + const test = getStaticValueR(node.test, initialScope); + if (test != null) { + return test.value + ? getStaticValueR(node.consequent, initialScope) + : getStaticValueR(node.alternate, initialScope) + } + return null + }, + + ExpressionStatement(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + + Identifier(node, initialScope) { + if (initialScope != null) { + const variable = findVariable(initialScope, node); + + // Built-in globals. + if ( + variable != null && + variable.defs.length === 0 && + builtinNames.has(variable.name) && + variable.name in globalObject + ) { + return { value: globalObject[variable.name] } + } + + // Constants. + if (variable != null && variable.defs.length === 1) { + const def = variable.defs[0]; + if ( + def.parent && + def.parent.kind === "const" && + // TODO(mysticatea): don't support destructuring here. + def.node.id.type === "Identifier" + ) { + return getStaticValueR(def.node.init, initialScope) + } + } + } + return null + }, + + Literal(node) { + //istanbul ignore if : this is implementation-specific behavior. + if ((node.regex != null || node.bigint != null) && node.value == null) { + // It was a RegExp/BigInt literal, but Node.js didn't support it. + return null + } + return { value: node.value } + }, + + LogicalExpression(node, initialScope) { + const left = getStaticValueR(node.left, initialScope); + if (left != null) { + if ( + (node.operator === "||" && Boolean(left.value) === true) || + (node.operator === "&&" && Boolean(left.value) === false) || + (node.operator === "??" && left.value != null) + ) { + return left + } + + const right = getStaticValueR(node.right, initialScope); + if (right != null) { + return right + } + } + + return null + }, + + MemberExpression(node, initialScope) { + if (node.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(node.object, initialScope); + if (object != null) { + if (object.value == null && (object.optional || node.optional)) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue(node, initialScope); + + if (property != null && !isGetter(object.value, property.value)) { + return { value: object.value[property.value] } + } + } + return null + }, + + ChainExpression(node, initialScope) { + const expression = getStaticValueR(node.expression, initialScope); + if (expression != null) { + return { value: expression.value } + } + return null + }, + + NewExpression(node, initialScope) { + const callee = getStaticValueR(node.callee, initialScope); + const args = getElementValues(node.arguments, initialScope); + + if (callee != null && args != null) { + const Func = callee.value; + if (callAllowed.has(Func)) { + return { value: new Func(...args) } + } + } + + return null + }, + + ObjectExpression(node, initialScope) { + const object = {}; + + for (const propertyNode of node.properties) { + if (propertyNode.type === "Property") { + if (propertyNode.kind !== "init") { + return null + } + const key = getStaticPropertyNameValue( + propertyNode, + initialScope, + ); + const value = getStaticValueR(propertyNode.value, initialScope); + if (key == null || value == null) { + return null + } + object[key.value] = value.value; + } else if ( + propertyNode.type === "SpreadElement" || + propertyNode.type === "ExperimentalSpreadProperty" + ) { + const argument = getStaticValueR( + propertyNode.argument, + initialScope, + ); + if (argument == null) { + return null + } + Object.assign(object, argument.value); + } else { + return null + } + } + + return { value: object } + }, + + SequenceExpression(node, initialScope) { + const last = node.expressions[node.expressions.length - 1]; + return getStaticValueR(last, initialScope) + }, + + TaggedTemplateExpression(node, initialScope) { + const tag = getStaticValueR(node.tag, initialScope); + const expressions = getElementValues( + node.quasi.expressions, + initialScope, + ); + + if (tag != null && expressions != null) { + const func = tag.value; + const strings = node.quasi.quasis.map((q) => q.value.cooked); + strings.raw = node.quasi.quasis.map((q) => q.value.raw); + + if (func === String.raw) { + return { value: func(strings, ...expressions) } + } + } + + return null + }, + + TemplateLiteral(node, initialScope) { + const expressions = getElementValues(node.expressions, initialScope); + if (expressions != null) { + let value = node.quasis[0].value.cooked; + for (let i = 0; i < expressions.length; ++i) { + value += expressions[i]; + value += node.quasis[i + 1].value.cooked; + } + return { value } + } + return null + }, + + UnaryExpression(node, initialScope) { + if (node.operator === "delete") { + // Not supported. + return null + } + if (node.operator === "void") { + return { value: undefined } + } + + const arg = getStaticValueR(node.argument, initialScope); + if (arg != null) { + switch (node.operator) { + case "-": + return { value: -arg.value } + case "+": + return { value: +arg.value } //eslint-disable-line no-implicit-coercion + case "!": + return { value: !arg.value } + case "~": + return { value: ~arg.value } + case "typeof": + return { value: typeof arg.value } + + // no default + } + } + + return null + }, +}); + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope|undefined} initialScope The scope to start finding variable. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`. + */ +function getStaticValueR(node, initialScope) { + if (node != null && Object.hasOwnProperty.call(operations, node.type)) { + return operations[node.type](node, initialScope) + } + return null +} + +/** + * Get the static value of property name from a MemberExpression node or a Property node. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the property name of the node, or `null`. + */ +function getStaticPropertyNameValue(node, initialScope) { + const nameNode = node.type === "Property" ? node.key : node.property; + + if (node.computed) { + return getStaticValueR(nameNode, initialScope) + } + + if (nameNode.type === "Identifier") { + return { value: nameNode.name } + } + + if (nameNode.type === "Literal") { + if (nameNode.bigint) { + return { value: nameNode.bigint } + } + return { value: String(nameNode.value) } + } + + return null +} + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`. + */ +function getStaticValue(node, initialScope = null) { + try { + return getStaticValueR(node, initialScope) + } catch (_error) { + return null + } +} + +/** + * Get the value of a given node if it's a literal or a template literal. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant. + * @returns {string|null} The value of the node, or `null`. + */ +function getStringIfConstant(node, initialScope = null) { + // Handle the literals that the platform doesn't support natively. + if (node && node.type === "Literal" && node.value === null) { + if (node.regex) { + return `/${node.regex.pattern}/${node.regex.flags}` + } + if (node.bigint) { + return node.bigint + } + } + + const evaluated = getStaticValue(node, initialScope); + return evaluated && String(evaluated.value) +} + +/** + * Get the property name from a MemberExpression node or a Property node. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {string|null} The property name of the node. + */ +function getPropertyName(node, initialScope) { + switch (node.type) { + case "MemberExpression": + if (node.computed) { + return getStringIfConstant(node.property, initialScope) + } + if (node.property.type === "PrivateIdentifier") { + return null + } + return node.property.name + + case "Property": + case "MethodDefinition": + case "PropertyDefinition": + if (node.computed) { + return getStringIfConstant(node.key, initialScope) + } + if (node.key.type === "Literal") { + return String(node.key.value) + } + if (node.key.type === "PrivateIdentifier") { + return null + } + return node.key.name + + // no default + } + + return null +} + +/** + * Get the name and kind of the given function node. + * @param {ASTNode} node - The function node to get. + * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys. + * @returns {string} The name and kind of the function node. + */ +// eslint-disable-next-line complexity +function getFunctionNameWithKind(node, sourceCode) { + const parent = node.parent; + const tokens = []; + const isObjectMethod = parent.type === "Property" && parent.value === node; + const isClassMethod = + parent.type === "MethodDefinition" && parent.value === node; + const isClassFieldMethod = + parent.type === "PropertyDefinition" && parent.value === node; + + // Modifiers. + if (isClassMethod || isClassFieldMethod) { + if (parent.static) { + tokens.push("static"); + } + if (parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } + } + if (node.async) { + tokens.push("async"); + } + if (node.generator) { + tokens.push("generator"); + } + + // Kinds. + if (isObjectMethod || isClassMethod) { + if (parent.kind === "constructor") { + return "constructor" + } + if (parent.kind === "get") { + tokens.push("getter"); + } else if (parent.kind === "set") { + tokens.push("setter"); + } else { + tokens.push("method"); + } + } else if (isClassFieldMethod) { + tokens.push("method"); + } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); + } + + // Names. + if (isObjectMethod || isClassMethod || isClassFieldMethod) { + if (parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getPropertyName(parent); + if (name) { + tokens.push(`'${name}'`); + } else if (sourceCode) { + const keyText = sourceCode.getText(parent.key); + if (!keyText.includes("\n")) { + tokens.push(`[${keyText}]`); + } + } + } + } else if (node.id) { + tokens.push(`'${node.id.name}'`); + } else if ( + parent.type === "VariableDeclarator" && + parent.id && + parent.id.type === "Identifier" + ) { + tokens.push(`'${parent.id.name}'`); + } else if ( + (parent.type === "AssignmentExpression" || + parent.type === "AssignmentPattern") && + parent.left && + parent.left.type === "Identifier" + ) { + tokens.push(`'${parent.left.name}'`); + } + + return tokens.join(" ") +} + +const typeConversionBinaryOps = Object.freeze( + new Set([ + "==", + "!=", + "<", + "<=", + ">", + ">=", + "<<", + ">>", + ">>>", + "+", + "-", + "*", + "/", + "%", + "|", + "^", + "&", + "in", + ]), +); +const typeConversionUnaryOps = Object.freeze(new Set(["-", "+", "!", "~"])); + +/** + * Check whether the given value is an ASTNode or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ +function isNode(x) { + return x !== null && typeof x === "object" && typeof x.type === "string" +} + +const visitor = Object.freeze( + Object.assign(Object.create(null), { + $visit(node, options, visitorKeys) { + const { type } = node; + + if (typeof this[type] === "function") { + return this[type](node, options, visitorKeys) + } + + return this.$visitChildren(node, options, visitorKeys) + }, + + $visitChildren(node, options, visitorKeys) { + const { type } = node; + + for (const key of visitorKeys[type] || evk.getKeys(node)) { + const value = node[key]; + + if (Array.isArray(value)) { + for (const element of value) { + if ( + isNode(element) && + this.$visit(element, options, visitorKeys) + ) { + return true + } + } + } else if ( + isNode(value) && + this.$visit(value, options, visitorKeys) + ) { + return true + } + } + + return false + }, + + ArrowFunctionExpression() { + return false + }, + AssignmentExpression() { + return true + }, + AwaitExpression() { + return true + }, + BinaryExpression(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + typeConversionBinaryOps.has(node.operator) && + (node.left.type !== "Literal" || node.right.type !== "Literal") + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + CallExpression() { + return true + }, + FunctionExpression() { + return false + }, + ImportExpression() { + return true + }, + MemberExpression(node, options, visitorKeys) { + if (options.considerGetters) { + return true + } + if ( + options.considerImplicitTypeConversion && + node.computed && + node.property.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + MethodDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + NewExpression() { + return true + }, + Property(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + PropertyDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UnaryExpression(node, options, visitorKeys) { + if (node.operator === "delete") { + return true + } + if ( + options.considerImplicitTypeConversion && + typeConversionUnaryOps.has(node.operator) && + node.argument.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UpdateExpression() { + return true + }, + YieldExpression() { + return true + }, + }), +); + +/** + * Check whether a given node has any side effect or not. + * @param {Node} node The node to get. + * @param {SourceCode} sourceCode The source code object. + * @param {object} [options] The option object. + * @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects. + * @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects. + * @param {object} [options.visitorKeys=evk.KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`. + * @returns {boolean} `true` if the node has a certain side effect. + */ +function hasSideEffect( + node, + sourceCode, + { considerGetters = false, considerImplicitTypeConversion = false } = {}, +) { + return visitor.$visit( + node, + { considerGetters, considerImplicitTypeConversion }, + sourceCode.visitorKeys || evk.KEYS, + ) +} + +/** + * Get the left parenthesis of the parent node syntax if it exists. + * E.g., `if (a) {}` then the `(`. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token|null} The left parenthesis of the parent node syntax + */ +function getParentSyntaxParen(node, sourceCode) { + const parent = node.parent; + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + if (parent.arguments.length === 1 && parent.arguments[0] === node) { + return sourceCode.getTokenAfter( + parent.callee, + isOpeningParenToken, + ) + } + return null + + case "DoWhileStatement": + if (parent.test === node) { + return sourceCode.getTokenAfter( + parent.body, + isOpeningParenToken, + ) + } + return null + + case "IfStatement": + case "WhileStatement": + if (parent.test === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "ImportExpression": + if (parent.source === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "SwitchStatement": + if (parent.discriminant === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "WithStatement": + if (parent.object === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + default: + return null + } +} + +/** + * Check whether a given node is parenthesized or not. + * @param {number} times The number of parantheses. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized the given times. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized. + */ +function isParenthesized( + timesOrNode, + nodeOrSourceCode, + optionalSourceCode, +) { + let times, node, sourceCode, maybeLeftParen, maybeRightParen; + if (typeof timesOrNode === "number") { + times = timesOrNode | 0; + node = nodeOrSourceCode; + sourceCode = optionalSourceCode; + if (!(times >= 1)) { + throw new TypeError("'times' should be a positive integer.") + } + } else { + times = 1; + node = timesOrNode; + sourceCode = nodeOrSourceCode; + } + + if ( + node == null || + // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}` + (node.parent.type === "CatchClause" && node.parent.param === node) + ) { + return false + } + + maybeLeftParen = maybeRightParen = node; + do { + maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen); + maybeRightParen = sourceCode.getTokenAfter(maybeRightParen); + } while ( + maybeLeftParen != null && + maybeRightParen != null && + isOpeningParenToken(maybeLeftParen) && + isClosingParenToken(maybeRightParen) && + // Avoid false positive such as `if (a) {}` + maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && + --times > 0 + ) + + return times === 0 +} + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu; + +/** @type {WeakMap} */ +const internal = new WeakMap(); + +/** + * Check whether a given character is escaped or not. + * @param {string} str The string to check. + * @param {number} index The location of the character to check. + * @returns {boolean} `true` if the character is escaped. + */ +function isEscaped(str, index) { + let escaped = false; + for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) { + escaped = !escaped; + } + return escaped +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {string} replacement The new substring to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceS(matcher, str, replacement) { + const chunks = []; + let index = 0; + + /** @type {RegExpExecArray} */ + let match = null; + + /** + * @param {string} key The placeholder. + * @returns {string} The replaced string. + */ + function replacer(key) { + switch (key) { + case "$$": + return "$" + case "$&": + return match[0] + case "$`": + return str.slice(0, match.index) + case "$'": + return str.slice(match.index + match[0].length) + default: { + const i = key.slice(1); + if (i in match) { + return match[i] + } + return key + } + } + } + + for (match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push(replacement.replace(placeholder, replacer)); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {(...strs[])=>string} replace The function to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceF(matcher, str, replace) { + const chunks = []; + let index = 0; + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push(String(replace(...match, match.index, match.input))); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * The class to find patterns as considering escape sequences. + */ +class PatternMatcher { + /** + * Initialize this matcher. + * @param {RegExp} pattern The pattern to match. + * @param {{escaped:boolean}} options The options. + */ + constructor(pattern, { escaped = false } = {}) { + if (!(pattern instanceof RegExp)) { + throw new TypeError("'pattern' should be a RegExp instance.") + } + if (!pattern.flags.includes("g")) { + throw new Error("'pattern' should contains 'g' flag.") + } + + internal.set(this, { + pattern: new RegExp(pattern.source, pattern.flags), + escaped: Boolean(escaped), + }); + } + + /** + * Find the pattern in a given string. + * @param {string} str The string to find. + * @returns {IterableIterator} The iterator which iterate the matched information. + */ + *execAll(str) { + const { pattern, escaped } = internal.get(this); + let match = null; + let lastIndex = 0; + + pattern.lastIndex = 0; + while ((match = pattern.exec(str)) != null) { + if (escaped || !isEscaped(str, match.index)) { + lastIndex = pattern.lastIndex; + yield match; + pattern.lastIndex = lastIndex; + } + } + } + + /** + * Check whether the pattern is found in a given string. + * @param {string} str The string to check. + * @returns {boolean} `true` if the pattern was found in the string. + */ + test(str) { + const it = this.execAll(str); + const ret = it.next(); + return !ret.done + } + + /** + * Replace a given string. + * @param {string} str The string to be replaced. + * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`. + * @returns {string} The replaced string. + */ + [Symbol.replace](str, replacer) { + return typeof replacer === "function" + ? replaceF(this, String(str), replacer) + : replaceS(this, String(str), String(replacer)) + } +} + +const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; +const has = Function.call.bind(Object.hasOwnProperty); + +const READ = Symbol("read"); +const CALL = Symbol("call"); +const CONSTRUCT = Symbol("construct"); +const ESM = Symbol("esm"); + +const requireCall = { require: { [CALL]: true } }; + +/** + * Check whether a given variable is modified or not. + * @param {Variable} variable The variable to check. + * @returns {boolean} `true` if the variable is modified. + */ +function isModifiedGlobal(variable) { + return ( + variable == null || + variable.defs.length !== 0 || + variable.references.some((r) => r.isWrite()) + ) +} + +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = node.parent; + + switch (parent && parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return parent.expressions[parent.expressions.length - 1] === node + case "ChainExpression": + return true + + default: + return false + } +} + +/** + * The reference tracker. + */ +class ReferenceTracker { + /** + * Initialize this tracker. + * @param {Scope} globalScope The global scope. + * @param {object} [options] The options. + * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. + */ + constructor( + globalScope, + { + mode = "strict", + globalObjectNames = ["global", "globalThis", "self", "window"], + } = {}, + ) { + this.variableStack = []; + this.globalScope = globalScope; + this.mode = mode; + this.globalObjectNames = globalObjectNames.slice(0); + } + + /** + * Iterate the references of global variables. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateGlobalReferences(traceMap) { + for (const key of Object.keys(traceMap)) { + const nextTraceMap = traceMap[key]; + const path = [key]; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + variable, + path, + nextTraceMap, + true, + ); + } + + for (const key of this.globalObjectNames) { + const path = []; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + } + + /** + * Iterate the references of CommonJS modules. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateCjsReferences(traceMap) { + for (const { node } of this.iterateGlobalReferences(requireCall)) { + const key = getStringIfConstant(node.arguments[0]); + if (key == null || !has(traceMap, key)) { + continue + } + + const nextTraceMap = traceMap[key]; + const path = [key]; + + if (nextTraceMap[READ]) { + yield { + node, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences(node, path, nextTraceMap); + } + } + + /** + * Iterate the references of ES modules. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateEsmReferences(traceMap) { + const programNode = this.globalScope.block; + + for (const node of programNode.body) { + if (!IMPORT_TYPE.test(node.type) || node.source == null) { + continue + } + const moduleId = node.source.value; + + if (!has(traceMap, moduleId)) { + continue + } + const nextTraceMap = traceMap[moduleId]; + const path = [moduleId]; + + if (nextTraceMap[READ]) { + yield { node, path, type: READ, info: nextTraceMap[READ] }; + } + + if (node.type === "ExportAllDeclaration") { + for (const key of Object.keys(nextTraceMap)) { + const exportTraceMap = nextTraceMap[key]; + if (exportTraceMap[READ]) { + yield { + node, + path: path.concat(key), + type: READ, + info: exportTraceMap[READ], + }; + } + } + } else { + for (const specifier of node.specifiers) { + const esm = has(nextTraceMap, ESM); + const it = this._iterateImportReferences( + specifier, + path, + esm + ? nextTraceMap + : this.mode === "legacy" + ? { default: nextTraceMap, ...nextTraceMap } + : { default: nextTraceMap }, + ); + + if (esm) { + yield* it; + } else { + for (const report of it) { + report.path = report.path.filter(exceptDefault); + if ( + report.path.length >= 2 || + report.type !== READ + ) { + yield report; + } + } + } + } + } + } + } + + /** + * Iterate the references for a given variable. + * @param {Variable} variable The variable to iterate that references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @param {boolean} shouldReport = The flag to report those references. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateVariableReferences(variable, path, traceMap, shouldReport) { + if (this.variableStack.includes(variable)) { + return + } + this.variableStack.push(variable); + try { + for (const reference of variable.references) { + if (!reference.isRead()) { + continue + } + const node = reference.identifier; + + if (shouldReport && traceMap[READ]) { + yield { node, path, type: READ, info: traceMap[READ] }; + } + yield* this._iteratePropertyReferences(node, path, traceMap); + } + } finally { + this.variableStack.pop(); + } + } + + /** + * Iterate the references for a given AST node. + * @param rootNode The AST node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + //eslint-disable-next-line complexity + *_iteratePropertyReferences(rootNode, path, traceMap) { + let node = rootNode; + while (isPassThrough(node)) { + node = node.parent; + } + + const parent = node.parent; + if (parent.type === "MemberExpression") { + if (parent.object === node) { + const key = getPropertyName(parent); + if (key == null || !has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: parent, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + parent, + path, + nextTraceMap, + ); + } + return + } + if (parent.type === "CallExpression") { + if (parent.callee === node && traceMap[CALL]) { + yield { node: parent, path, type: CALL, info: traceMap[CALL] }; + } + return + } + if (parent.type === "NewExpression") { + if (parent.callee === node && traceMap[CONSTRUCT]) { + yield { + node: parent, + path, + type: CONSTRUCT, + info: traceMap[CONSTRUCT], + }; + } + return + } + if (parent.type === "AssignmentExpression") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + yield* this._iteratePropertyReferences(parent, path, traceMap); + } + return + } + if (parent.type === "AssignmentPattern") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + } + return + } + if (parent.type === "VariableDeclarator") { + if (parent.init === node) { + yield* this._iterateLhsReferences(parent.id, path, traceMap); + } + } + } + + /** + * Iterate the references for a given Pattern node. + * @param {Node} patternNode The Pattern node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateLhsReferences(patternNode, path, traceMap) { + if (patternNode.type === "Identifier") { + const variable = findVariable(this.globalScope, patternNode); + if (variable != null) { + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + return + } + if (patternNode.type === "ObjectPattern") { + for (const property of patternNode.properties) { + const key = getPropertyName(property); + + if (key == null || !has(traceMap, key)) { + continue + } + + const nextPath = path.concat(key); + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: property, + path: nextPath, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateLhsReferences( + property.value, + nextPath, + nextTraceMap, + ); + } + return + } + if (patternNode.type === "AssignmentPattern") { + yield* this._iterateLhsReferences(patternNode.left, path, traceMap); + } + } + + /** + * Iterate the references for a given ModuleSpecifier node. + * @param {Node} specifierNode The ModuleSpecifier node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateImportReferences(specifierNode, path, traceMap) { + const type = specifierNode.type; + + if (type === "ImportSpecifier" || type === "ImportDefaultSpecifier") { + const key = + type === "ImportDefaultSpecifier" + ? "default" + : specifierNode.imported.name; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: specifierNode, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateVariableReferences( + findVariable(this.globalScope, specifierNode.local), + path, + nextTraceMap, + false, + ); + + return + } + + if (type === "ImportNamespaceSpecifier") { + yield* this._iterateVariableReferences( + findVariable(this.globalScope, specifierNode.local), + path, + traceMap, + false, + ); + return + } + + if (type === "ExportSpecifier") { + const key = specifierNode.local.name; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: specifierNode, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + } + } +} + +ReferenceTracker.READ = READ; +ReferenceTracker.CALL = CALL; +ReferenceTracker.CONSTRUCT = CONSTRUCT; +ReferenceTracker.ESM = ESM; + +/** + * This is a predicate function for Array#filter. + * @param {string} name A name part. + * @param {number} index The index of the name. + * @returns {boolean} `false` if it's default. + */ +function exceptDefault(name, index) { + return !(index === 1 && name === "default") +} + +var index = { + CALL, + CONSTRUCT, + ESM, + findVariable, + getFunctionHeadLocation, + getFunctionNameWithKind, + getInnermostScope, + getPropertyName, + getStaticValue, + getStringIfConstant, + hasSideEffect, + isArrowToken, + isClosingBraceToken, + isClosingBracketToken, + isClosingParenToken, + isColonToken, + isCommaToken, + isCommentToken, + isNotArrowToken, + isNotClosingBraceToken, + isNotClosingBracketToken, + isNotClosingParenToken, + isNotColonToken, + isNotCommaToken, + isNotCommentToken, + isNotOpeningBraceToken, + isNotOpeningBracketToken, + isNotOpeningParenToken, + isNotSemicolonToken, + isOpeningBraceToken, + isOpeningBracketToken, + isOpeningParenToken, + isParenthesized, + isSemicolonToken, + PatternMatcher, + READ, + ReferenceTracker, +}; + +exports.CALL = CALL; +exports.CONSTRUCT = CONSTRUCT; +exports.ESM = ESM; +exports.PatternMatcher = PatternMatcher; +exports.READ = READ; +exports.ReferenceTracker = ReferenceTracker; +exports.default = index; +exports.findVariable = findVariable; +exports.getFunctionHeadLocation = getFunctionHeadLocation; +exports.getFunctionNameWithKind = getFunctionNameWithKind; +exports.getInnermostScope = getInnermostScope; +exports.getPropertyName = getPropertyName; +exports.getStaticValue = getStaticValue; +exports.getStringIfConstant = getStringIfConstant; +exports.hasSideEffect = hasSideEffect; +exports.isArrowToken = isArrowToken; +exports.isClosingBraceToken = isClosingBraceToken; +exports.isClosingBracketToken = isClosingBracketToken; +exports.isClosingParenToken = isClosingParenToken; +exports.isColonToken = isColonToken; +exports.isCommaToken = isCommaToken; +exports.isCommentToken = isCommentToken; +exports.isNotArrowToken = isNotArrowToken; +exports.isNotClosingBraceToken = isNotClosingBraceToken; +exports.isNotClosingBracketToken = isNotClosingBracketToken; +exports.isNotClosingParenToken = isNotClosingParenToken; +exports.isNotColonToken = isNotColonToken; +exports.isNotCommaToken = isNotCommaToken; +exports.isNotCommentToken = isNotCommentToken; +exports.isNotOpeningBraceToken = isNotOpeningBraceToken; +exports.isNotOpeningBracketToken = isNotOpeningBracketToken; +exports.isNotOpeningParenToken = isNotOpeningParenToken; +exports.isNotSemicolonToken = isNotSemicolonToken; +exports.isOpeningBraceToken = isOpeningBraceToken; +exports.isOpeningBracketToken = isOpeningBracketToken; +exports.isOpeningParenToken = isOpeningParenToken; +exports.isParenthesized = isParenthesized; +exports.isSemicolonToken = isSemicolonToken; +//# sourceMappingURL=index.js.map diff --git a/node_modules/eslint-utils/index.js.map b/node_modules/eslint-utils/index.js.map new file mode 100644 index 0000000..2a76624 --- /dev/null +++ b/node_modules/eslint-utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["src/get-innermost-scope.js","src/find-variable.js","src/token-predicate.js","src/get-function-head-location.js","src/get-static-value.js","src/get-string-if-constant.js","src/get-property-name.js","src/get-function-name-with-kind.js","src/has-side-effect.js","src/is-parenthesized.js","src/pattern-matcher.js","src/reference-tracker.js","src/index.js"],"sourcesContent":["/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = node.range[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = childScope.block.range\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope\"\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/**\n * Negate the result of `this` calling.\n * @param {Token} token The token to check.\n * @returns {boolean} `true` if the result of `this(token)` is `false`.\n */\nfunction negate0(token) {\n return !this(token) //eslint-disable-line no-invalid-this\n}\n\n/**\n * Creates the negate function of the given function.\n * @param {function(Token):boolean} f - The function to negate.\n * @returns {function(Token):boolean} Negated function.\n */\nfunction negate(f) {\n return negate0.bind(f)\n}\n\n/**\n * Checks if the given token is a PunctuatorToken with the given value\n * @param {Token} token - The token to check.\n * @param {string} value - The value to check.\n * @returns {boolean} `true` if the token is a PunctuatorToken with the given value.\n */\nfunction isPunctuatorTokenWithValue(token, value) {\n return token.type === \"Punctuator\" && token.value === value\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return isPunctuatorTokenWithValue(token, \"=>\")\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return isPunctuatorTokenWithValue(token, \",\")\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a semicolon token.\n */\nexport function isSemicolonToken(token) {\n return isPunctuatorTokenWithValue(token, \";\")\n}\n\n/**\n * Checks if the given token is a colon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a colon token.\n */\nexport function isColonToken(token) {\n return isPunctuatorTokenWithValue(token, \":\")\n}\n\n/**\n * Checks if the given token is an opening parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening parenthesis token.\n */\nexport function isOpeningParenToken(token) {\n return isPunctuatorTokenWithValue(token, \"(\")\n}\n\n/**\n * Checks if the given token is a closing parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing parenthesis token.\n */\nexport function isClosingParenToken(token) {\n return isPunctuatorTokenWithValue(token, \")\")\n}\n\n/**\n * Checks if the given token is an opening square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening square bracket token.\n */\nexport function isOpeningBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"[\")\n}\n\n/**\n * Checks if the given token is a closing square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing square bracket token.\n */\nexport function isClosingBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"]\")\n}\n\n/**\n * Checks if the given token is an opening brace token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening brace token.\n */\nexport function isOpeningBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"{\")\n}\n\n/**\n * Checks if the given token is a closing brace token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing brace token.\n */\nexport function isClosingBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"}\")\n}\n\n/**\n * Checks if the given token is a comment token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a comment token.\n */\nexport function isCommentToken(token) {\n return [\"Block\", \"Line\", \"Shebang\"].includes(token.type)\n}\n\nexport const isNotArrowToken = negate(isArrowToken)\nexport const isNotCommaToken = negate(isCommaToken)\nexport const isNotSemicolonToken = negate(isSemicolonToken)\nexport const isNotColonToken = negate(isColonToken)\nexport const isNotOpeningParenToken = negate(isOpeningParenToken)\nexport const isNotClosingParenToken = negate(isClosingParenToken)\nexport const isNotOpeningBracketToken = negate(isOpeningBracketToken)\nexport const isNotClosingBracketToken = negate(isClosingBracketToken)\nexport const isNotOpeningBraceToken = negate(isOpeningBraceToken)\nexport const isNotClosingBraceToken = negate(isClosingBraceToken)\nexport const isNotCommentToken = negate(isCommentToken)\n","import { isArrowToken, isOpeningParenToken } from \"./token-predicate\"\n\n/**\n * Get the `(` token of the given function node.\n * @param {Node} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {Token} `(` token.\n */\nfunction getOpeningParenOfParams(node, sourceCode) {\n return node.id\n ? sourceCode.getTokenAfter(node.id, isOpeningParenToken)\n : sourceCode.getFirstToken(node, isOpeningParenToken)\n}\n\n/**\n * Get the location of the given function node for reporting.\n * @param {Node} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {string} The location of the function node for reporting.\n */\nexport function getFunctionHeadLocation(node, sourceCode) {\n const parent = node.parent\n let start = null\n let end = null\n\n if (node.type === \"ArrowFunctionExpression\") {\n const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken)\n\n start = arrowToken.loc.start\n end = arrowToken.loc.end\n } else if (\n parent.type === \"Property\" ||\n parent.type === \"MethodDefinition\" ||\n parent.type === \"PropertyDefinition\"\n ) {\n start = parent.loc.start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n } else {\n start = node.loc.start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n }\n\n return {\n start: { ...start },\n end: { ...end },\n }\n}\n","/* globals globalThis, global, self, window */\n\nimport { findVariable } from \"./find-variable\"\n\nconst globalObject =\n typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : {}\n\nconst builtinNames = Object.freeze(\n new Set([\n \"Array\",\n \"ArrayBuffer\",\n \"BigInt\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Boolean\",\n \"DataView\",\n \"Date\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"Float32Array\",\n \"Float64Array\",\n \"Function\",\n \"Infinity\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"isFinite\",\n \"isNaN\",\n \"isPrototypeOf\",\n \"JSON\",\n \"Map\",\n \"Math\",\n \"NaN\",\n \"Number\",\n \"Object\",\n \"parseFloat\",\n \"parseInt\",\n \"Promise\",\n \"Proxy\",\n \"Reflect\",\n \"RegExp\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"undefined\",\n \"unescape\",\n \"WeakMap\",\n \"WeakSet\",\n ]),\n)\nconst callAllowed = new Set(\n [\n Array.isArray,\n typeof BigInt === \"function\" ? BigInt : undefined,\n Boolean,\n Date,\n Date.parse,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n escape,\n isFinite,\n isNaN,\n isPrototypeOf,\n ...Object.getOwnPropertyNames(Math)\n .map((k) => Math[k])\n .filter((f) => typeof f === \"function\"),\n Number,\n Number.isFinite,\n Number.isNaN,\n Number.parseFloat,\n Number.parseInt,\n Object,\n Object.entries,\n Object.is,\n Object.isExtensible,\n Object.isFrozen,\n Object.isSealed,\n Object.keys,\n Object.values,\n parseFloat,\n parseInt,\n RegExp,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n Symbol.for,\n Symbol.keyFor,\n unescape,\n ].filter((f) => typeof f === \"function\"),\n)\nconst callPassThrough = new Set([\n Object.freeze,\n Object.preventExtensions,\n Object.seal,\n])\n\n/**\n * Get the property descriptor.\n * @param {object} object The object to get.\n * @param {string|number|symbol} name The property name to get.\n */\nfunction getPropertyDescriptor(object, name) {\n let x = object\n while ((typeof x === \"object\" || typeof x === \"function\") && x !== null) {\n const d = Object.getOwnPropertyDescriptor(x, name)\n if (d) {\n return d\n }\n x = Object.getPrototypeOf(x)\n }\n return null\n}\n\n/**\n * Check if a property is getter or not.\n * @param {object} object The object to check.\n * @param {string|number|symbol} name The property name to check.\n */\nfunction isGetter(object, name) {\n const d = getPropertyDescriptor(object, name)\n return d != null && d.get != null\n}\n\n/**\n * Get the element values of a given node list.\n * @param {Node[]} nodeList The node list to get values.\n * @param {Scope|undefined} initialScope The initial scope to find variables.\n * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null.\n */\nfunction getElementValues(nodeList, initialScope) {\n const valueList = []\n\n for (let i = 0; i < nodeList.length; ++i) {\n const elementNode = nodeList[i]\n\n if (elementNode == null) {\n valueList.length = i + 1\n } else if (elementNode.type === \"SpreadElement\") {\n const argument = getStaticValueR(elementNode.argument, initialScope)\n if (argument == null) {\n return null\n }\n valueList.push(...argument.value)\n } else {\n const element = getStaticValueR(elementNode, initialScope)\n if (element == null) {\n return null\n }\n valueList.push(element.value)\n }\n }\n\n return valueList\n}\n\nconst operations = Object.freeze({\n ArrayExpression(node, initialScope) {\n const elements = getElementValues(node.elements, initialScope)\n return elements != null ? { value: elements } : null\n },\n\n AssignmentExpression(node, initialScope) {\n if (node.operator === \"=\") {\n return getStaticValueR(node.right, initialScope)\n }\n return null\n },\n\n //eslint-disable-next-line complexity\n BinaryExpression(node, initialScope) {\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n // Not supported.\n return null\n }\n\n const left = getStaticValueR(node.left, initialScope)\n const right = getStaticValueR(node.right, initialScope)\n if (left != null && right != null) {\n switch (node.operator) {\n case \"==\":\n return { value: left.value == right.value } //eslint-disable-line eqeqeq\n case \"!=\":\n return { value: left.value != right.value } //eslint-disable-line eqeqeq\n case \"===\":\n return { value: left.value === right.value }\n case \"!==\":\n return { value: left.value !== right.value }\n case \"<\":\n return { value: left.value < right.value }\n case \"<=\":\n return { value: left.value <= right.value }\n case \">\":\n return { value: left.value > right.value }\n case \">=\":\n return { value: left.value >= right.value }\n case \"<<\":\n return { value: left.value << right.value }\n case \">>\":\n return { value: left.value >> right.value }\n case \">>>\":\n return { value: left.value >>> right.value }\n case \"+\":\n return { value: left.value + right.value }\n case \"-\":\n return { value: left.value - right.value }\n case \"*\":\n return { value: left.value * right.value }\n case \"/\":\n return { value: left.value / right.value }\n case \"%\":\n return { value: left.value % right.value }\n case \"**\":\n return { value: Math.pow(left.value, right.value) }\n case \"|\":\n return { value: left.value | right.value }\n case \"^\":\n return { value: left.value ^ right.value }\n case \"&\":\n return { value: left.value & right.value }\n\n // no default\n }\n }\n\n return null\n },\n\n CallExpression(node, initialScope) {\n const calleeNode = node.callee\n const args = getElementValues(node.arguments, initialScope)\n\n if (args != null) {\n if (calleeNode.type === \"MemberExpression\") {\n if (calleeNode.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(calleeNode.object, initialScope)\n if (object != null) {\n if (\n object.value == null &&\n (object.optional || node.optional)\n ) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(\n calleeNode,\n initialScope,\n )\n\n if (property != null) {\n const receiver = object.value\n const methodName = property.value\n if (callAllowed.has(receiver[methodName])) {\n return { value: receiver[methodName](...args) }\n }\n if (callPassThrough.has(receiver[methodName])) {\n return { value: args[0] }\n }\n }\n }\n } else {\n const callee = getStaticValueR(calleeNode, initialScope)\n if (callee != null) {\n if (callee.value == null && node.optional) {\n return { value: undefined, optional: true }\n }\n const func = callee.value\n if (callAllowed.has(func)) {\n return { value: func(...args) }\n }\n if (callPassThrough.has(func)) {\n return { value: args[0] }\n }\n }\n }\n }\n\n return null\n },\n\n ConditionalExpression(node, initialScope) {\n const test = getStaticValueR(node.test, initialScope)\n if (test != null) {\n return test.value\n ? getStaticValueR(node.consequent, initialScope)\n : getStaticValueR(node.alternate, initialScope)\n }\n return null\n },\n\n ExpressionStatement(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n\n Identifier(node, initialScope) {\n if (initialScope != null) {\n const variable = findVariable(initialScope, node)\n\n // Built-in globals.\n if (\n variable != null &&\n variable.defs.length === 0 &&\n builtinNames.has(variable.name) &&\n variable.name in globalObject\n ) {\n return { value: globalObject[variable.name] }\n }\n\n // Constants.\n if (variable != null && variable.defs.length === 1) {\n const def = variable.defs[0]\n if (\n def.parent &&\n def.parent.kind === \"const\" &&\n // TODO(mysticatea): don't support destructuring here.\n def.node.id.type === \"Identifier\"\n ) {\n return getStaticValueR(def.node.init, initialScope)\n }\n }\n }\n return null\n },\n\n Literal(node) {\n //istanbul ignore if : this is implementation-specific behavior.\n if ((node.regex != null || node.bigint != null) && node.value == null) {\n // It was a RegExp/BigInt literal, but Node.js didn't support it.\n return null\n }\n return { value: node.value }\n },\n\n LogicalExpression(node, initialScope) {\n const left = getStaticValueR(node.left, initialScope)\n if (left != null) {\n if (\n (node.operator === \"||\" && Boolean(left.value) === true) ||\n (node.operator === \"&&\" && Boolean(left.value) === false) ||\n (node.operator === \"??\" && left.value != null)\n ) {\n return left\n }\n\n const right = getStaticValueR(node.right, initialScope)\n if (right != null) {\n return right\n }\n }\n\n return null\n },\n\n MemberExpression(node, initialScope) {\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(node.object, initialScope)\n if (object != null) {\n if (object.value == null && (object.optional || node.optional)) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(node, initialScope)\n\n if (property != null && !isGetter(object.value, property.value)) {\n return { value: object.value[property.value] }\n }\n }\n return null\n },\n\n ChainExpression(node, initialScope) {\n const expression = getStaticValueR(node.expression, initialScope)\n if (expression != null) {\n return { value: expression.value }\n }\n return null\n },\n\n NewExpression(node, initialScope) {\n const callee = getStaticValueR(node.callee, initialScope)\n const args = getElementValues(node.arguments, initialScope)\n\n if (callee != null && args != null) {\n const Func = callee.value\n if (callAllowed.has(Func)) {\n return { value: new Func(...args) }\n }\n }\n\n return null\n },\n\n ObjectExpression(node, initialScope) {\n const object = {}\n\n for (const propertyNode of node.properties) {\n if (propertyNode.type === \"Property\") {\n if (propertyNode.kind !== \"init\") {\n return null\n }\n const key = getStaticPropertyNameValue(\n propertyNode,\n initialScope,\n )\n const value = getStaticValueR(propertyNode.value, initialScope)\n if (key == null || value == null) {\n return null\n }\n object[key.value] = value.value\n } else if (\n propertyNode.type === \"SpreadElement\" ||\n propertyNode.type === \"ExperimentalSpreadProperty\"\n ) {\n const argument = getStaticValueR(\n propertyNode.argument,\n initialScope,\n )\n if (argument == null) {\n return null\n }\n Object.assign(object, argument.value)\n } else {\n return null\n }\n }\n\n return { value: object }\n },\n\n SequenceExpression(node, initialScope) {\n const last = node.expressions[node.expressions.length - 1]\n return getStaticValueR(last, initialScope)\n },\n\n TaggedTemplateExpression(node, initialScope) {\n const tag = getStaticValueR(node.tag, initialScope)\n const expressions = getElementValues(\n node.quasi.expressions,\n initialScope,\n )\n\n if (tag != null && expressions != null) {\n const func = tag.value\n const strings = node.quasi.quasis.map((q) => q.value.cooked)\n strings.raw = node.quasi.quasis.map((q) => q.value.raw)\n\n if (func === String.raw) {\n return { value: func(strings, ...expressions) }\n }\n }\n\n return null\n },\n\n TemplateLiteral(node, initialScope) {\n const expressions = getElementValues(node.expressions, initialScope)\n if (expressions != null) {\n let value = node.quasis[0].value.cooked\n for (let i = 0; i < expressions.length; ++i) {\n value += expressions[i]\n value += node.quasis[i + 1].value.cooked\n }\n return { value }\n }\n return null\n },\n\n UnaryExpression(node, initialScope) {\n if (node.operator === \"delete\") {\n // Not supported.\n return null\n }\n if (node.operator === \"void\") {\n return { value: undefined }\n }\n\n const arg = getStaticValueR(node.argument, initialScope)\n if (arg != null) {\n switch (node.operator) {\n case \"-\":\n return { value: -arg.value }\n case \"+\":\n return { value: +arg.value } //eslint-disable-line no-implicit-coercion\n case \"!\":\n return { value: !arg.value }\n case \"~\":\n return { value: ~arg.value }\n case \"typeof\":\n return { value: typeof arg.value }\n\n // no default\n }\n }\n\n return null\n },\n})\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope|undefined} initialScope The scope to start finding variable.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.\n */\nfunction getStaticValueR(node, initialScope) {\n if (node != null && Object.hasOwnProperty.call(operations, node.type)) {\n return operations[node.type](node, initialScope)\n }\n return null\n}\n\n/**\n * Get the static value of property name from a MemberExpression node or a Property node.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the property name of the node, or `null`.\n */\nfunction getStaticPropertyNameValue(node, initialScope) {\n const nameNode = node.type === \"Property\" ? node.key : node.property\n\n if (node.computed) {\n return getStaticValueR(nameNode, initialScope)\n }\n\n if (nameNode.type === \"Identifier\") {\n return { value: nameNode.name }\n }\n\n if (nameNode.type === \"Literal\") {\n if (nameNode.bigint) {\n return { value: nameNode.bigint }\n }\n return { value: String(nameNode.value) }\n }\n\n return null\n}\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.\n */\nexport function getStaticValue(node, initialScope = null) {\n try {\n return getStaticValueR(node, initialScope)\n } catch (_error) {\n return null\n }\n}\n","import { getStaticValue } from \"./get-static-value\"\n\n/**\n * Get the value of a given node if it's a literal or a template literal.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant.\n * @returns {string|null} The value of the node, or `null`.\n */\nexport function getStringIfConstant(node, initialScope = null) {\n // Handle the literals that the platform doesn't support natively.\n if (node && node.type === \"Literal\" && node.value === null) {\n if (node.regex) {\n return `/${node.regex.pattern}/${node.regex.flags}`\n }\n if (node.bigint) {\n return node.bigint\n }\n }\n\n const evaluated = getStaticValue(node, initialScope)\n return evaluated && String(evaluated.value)\n}\n","import { getStringIfConstant } from \"./get-string-if-constant\"\n\n/**\n * Get the property name from a MemberExpression node or a Property node.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {string|null} The property name of the node.\n */\nexport function getPropertyName(node, initialScope) {\n switch (node.type) {\n case \"MemberExpression\":\n if (node.computed) {\n return getStringIfConstant(node.property, initialScope)\n }\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n return node.property.name\n\n case \"Property\":\n case \"MethodDefinition\":\n case \"PropertyDefinition\":\n if (node.computed) {\n return getStringIfConstant(node.key, initialScope)\n }\n if (node.key.type === \"Literal\") {\n return String(node.key.value)\n }\n if (node.key.type === \"PrivateIdentifier\") {\n return null\n }\n return node.key.name\n\n // no default\n }\n\n return null\n}\n","import { getPropertyName } from \"./get-property-name\"\n\n/**\n * Get the name and kind of the given function node.\n * @param {ASTNode} node - The function node to get.\n * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys.\n * @returns {string} The name and kind of the function node.\n */\n// eslint-disable-next-line complexity\nexport function getFunctionNameWithKind(node, sourceCode) {\n const parent = node.parent\n const tokens = []\n const isObjectMethod = parent.type === \"Property\" && parent.value === node\n const isClassMethod =\n parent.type === \"MethodDefinition\" && parent.value === node\n const isClassFieldMethod =\n parent.type === \"PropertyDefinition\" && parent.value === node\n\n // Modifiers.\n if (isClassMethod || isClassFieldMethod) {\n if (parent.static) {\n tokens.push(\"static\")\n }\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(\"private\")\n }\n }\n if (node.async) {\n tokens.push(\"async\")\n }\n if (node.generator) {\n tokens.push(\"generator\")\n }\n\n // Kinds.\n if (isObjectMethod || isClassMethod) {\n if (parent.kind === \"constructor\") {\n return \"constructor\"\n }\n if (parent.kind === \"get\") {\n tokens.push(\"getter\")\n } else if (parent.kind === \"set\") {\n tokens.push(\"setter\")\n } else {\n tokens.push(\"method\")\n }\n } else if (isClassFieldMethod) {\n tokens.push(\"method\")\n } else {\n if (node.type === \"ArrowFunctionExpression\") {\n tokens.push(\"arrow\")\n }\n tokens.push(\"function\")\n }\n\n // Names.\n if (isObjectMethod || isClassMethod || isClassFieldMethod) {\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(`#${parent.key.name}`)\n } else {\n const name = getPropertyName(parent)\n if (name) {\n tokens.push(`'${name}'`)\n } else if (sourceCode) {\n const keyText = sourceCode.getText(parent.key)\n if (!keyText.includes(\"\\n\")) {\n tokens.push(`[${keyText}]`)\n }\n }\n }\n } else if (node.id) {\n tokens.push(`'${node.id.name}'`)\n } else if (\n parent.type === \"VariableDeclarator\" &&\n parent.id &&\n parent.id.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.id.name}'`)\n } else if (\n (parent.type === \"AssignmentExpression\" ||\n parent.type === \"AssignmentPattern\") &&\n parent.left &&\n parent.left.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.left.name}'`)\n }\n\n return tokens.join(\" \")\n}\n","import evk from \"eslint-visitor-keys\"\n\nconst typeConversionBinaryOps = Object.freeze(\n new Set([\n \"==\",\n \"!=\",\n \"<\",\n \"<=\",\n \">\",\n \">=\",\n \"<<\",\n \">>\",\n \">>>\",\n \"+\",\n \"-\",\n \"*\",\n \"/\",\n \"%\",\n \"|\",\n \"^\",\n \"&\",\n \"in\",\n ]),\n)\nconst typeConversionUnaryOps = Object.freeze(new Set([\"-\", \"+\", \"!\", \"~\"]))\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an ASTNode.\n */\nfunction isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\nconst visitor = Object.freeze(\n Object.assign(Object.create(null), {\n $visit(node, options, visitorKeys) {\n const { type } = node\n\n if (typeof this[type] === \"function\") {\n return this[type](node, options, visitorKeys)\n }\n\n return this.$visitChildren(node, options, visitorKeys)\n },\n\n $visitChildren(node, options, visitorKeys) {\n const { type } = node\n\n for (const key of visitorKeys[type] || evk.getKeys(node)) {\n const value = node[key]\n\n if (Array.isArray(value)) {\n for (const element of value) {\n if (\n isNode(element) &&\n this.$visit(element, options, visitorKeys)\n ) {\n return true\n }\n }\n } else if (\n isNode(value) &&\n this.$visit(value, options, visitorKeys)\n ) {\n return true\n }\n }\n\n return false\n },\n\n ArrowFunctionExpression() {\n return false\n },\n AssignmentExpression() {\n return true\n },\n AwaitExpression() {\n return true\n },\n BinaryExpression(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n typeConversionBinaryOps.has(node.operator) &&\n (node.left.type !== \"Literal\" || node.right.type !== \"Literal\")\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n CallExpression() {\n return true\n },\n FunctionExpression() {\n return false\n },\n ImportExpression() {\n return true\n },\n MemberExpression(node, options, visitorKeys) {\n if (options.considerGetters) {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.property.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n MethodDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n NewExpression() {\n return true\n },\n Property(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n PropertyDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UnaryExpression(node, options, visitorKeys) {\n if (node.operator === \"delete\") {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n typeConversionUnaryOps.has(node.operator) &&\n node.argument.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UpdateExpression() {\n return true\n },\n YieldExpression() {\n return true\n },\n }),\n)\n\n/**\n * Check whether a given node has any side effect or not.\n * @param {Node} node The node to get.\n * @param {SourceCode} sourceCode The source code object.\n * @param {object} [options] The option object.\n * @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects.\n * @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects.\n * @param {object} [options.visitorKeys=evk.KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`.\n * @returns {boolean} `true` if the node has a certain side effect.\n */\nexport function hasSideEffect(\n node,\n sourceCode,\n { considerGetters = false, considerImplicitTypeConversion = false } = {},\n) {\n return visitor.$visit(\n node,\n { considerGetters, considerImplicitTypeConversion },\n sourceCode.visitorKeys || evk.KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate\"\n\n/**\n * Get the left parenthesis of the parent node syntax if it exists.\n * E.g., `if (a) {}` then the `(`.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {Token|null} The left parenthesis of the parent node syntax\n */\nfunction getParentSyntaxParen(node, sourceCode) {\n const parent = node.parent\n\n switch (parent.type) {\n case \"CallExpression\":\n case \"NewExpression\":\n if (parent.arguments.length === 1 && parent.arguments[0] === node) {\n return sourceCode.getTokenAfter(\n parent.callee,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"DoWhileStatement\":\n if (parent.test === node) {\n return sourceCode.getTokenAfter(\n parent.body,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"IfStatement\":\n case \"WhileStatement\":\n if (parent.test === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"ImportExpression\":\n if (parent.source === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"SwitchStatement\":\n if (parent.discriminant === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"WithStatement\":\n if (parent.object === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n default:\n return null\n }\n}\n\n/**\n * Check whether a given node is parenthesized or not.\n * @param {number} times The number of parantheses.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized the given times.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized.\n */\nexport function isParenthesized(\n timesOrNode,\n nodeOrSourceCode,\n optionalSourceCode,\n) {\n let times, node, sourceCode, maybeLeftParen, maybeRightParen\n if (typeof timesOrNode === \"number\") {\n times = timesOrNode | 0\n node = nodeOrSourceCode\n sourceCode = optionalSourceCode\n if (!(times >= 1)) {\n throw new TypeError(\"'times' should be a positive integer.\")\n }\n } else {\n times = 1\n node = timesOrNode\n sourceCode = nodeOrSourceCode\n }\n\n if (\n node == null ||\n // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}`\n (node.parent.type === \"CatchClause\" && node.parent.param === node)\n ) {\n return false\n }\n\n maybeLeftParen = maybeRightParen = node\n do {\n maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen)\n maybeRightParen = sourceCode.getTokenAfter(maybeRightParen)\n } while (\n maybeLeftParen != null &&\n maybeRightParen != null &&\n isOpeningParenToken(maybeLeftParen) &&\n isClosingParenToken(maybeRightParen) &&\n // Avoid false positive such as `if (a) {}`\n maybeLeftParen !== getParentSyntaxParen(node, sourceCode) &&\n --times > 0\n )\n\n return times === 0\n}\n","/**\n * @author Toru Nagashima \n * See LICENSE file in root directory for full license.\n */\n\nconst placeholder = /\\$(?:[$&`']|[1-9][0-9]?)/gu\n\n/** @type {WeakMap} */\nconst internal = new WeakMap()\n\n/**\n * Check whether a given character is escaped or not.\n * @param {string} str The string to check.\n * @param {number} index The location of the character to check.\n * @returns {boolean} `true` if the character is escaped.\n */\nfunction isEscaped(str, index) {\n let escaped = false\n for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) {\n escaped = !escaped\n }\n return escaped\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {string} replacement The new substring to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceS(matcher, str, replacement) {\n const chunks = []\n let index = 0\n\n /** @type {RegExpExecArray} */\n let match = null\n\n /**\n * @param {string} key The placeholder.\n * @returns {string} The replaced string.\n */\n function replacer(key) {\n switch (key) {\n case \"$$\":\n return \"$\"\n case \"$&\":\n return match[0]\n case \"$`\":\n return str.slice(0, match.index)\n case \"$'\":\n return str.slice(match.index + match[0].length)\n default: {\n const i = key.slice(1)\n if (i in match) {\n return match[i]\n }\n return key\n }\n }\n }\n\n for (match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(replacement.replace(placeholder, replacer))\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {(...strs[])=>string} replace The function to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceF(matcher, str, replace) {\n const chunks = []\n let index = 0\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(String(replace(...match, match.index, match.input)))\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * The class to find patterns as considering escape sequences.\n */\nexport class PatternMatcher {\n /**\n * Initialize this matcher.\n * @param {RegExp} pattern The pattern to match.\n * @param {{escaped:boolean}} options The options.\n */\n constructor(pattern, { escaped = false } = {}) {\n if (!(pattern instanceof RegExp)) {\n throw new TypeError(\"'pattern' should be a RegExp instance.\")\n }\n if (!pattern.flags.includes(\"g\")) {\n throw new Error(\"'pattern' should contains 'g' flag.\")\n }\n\n internal.set(this, {\n pattern: new RegExp(pattern.source, pattern.flags),\n escaped: Boolean(escaped),\n })\n }\n\n /**\n * Find the pattern in a given string.\n * @param {string} str The string to find.\n * @returns {IterableIterator} The iterator which iterate the matched information.\n */\n *execAll(str) {\n const { pattern, escaped } = internal.get(this)\n let match = null\n let lastIndex = 0\n\n pattern.lastIndex = 0\n while ((match = pattern.exec(str)) != null) {\n if (escaped || !isEscaped(str, match.index)) {\n lastIndex = pattern.lastIndex\n yield match\n pattern.lastIndex = lastIndex\n }\n }\n }\n\n /**\n * Check whether the pattern is found in a given string.\n * @param {string} str The string to check.\n * @returns {boolean} `true` if the pattern was found in the string.\n */\n test(str) {\n const it = this.execAll(str)\n const ret = it.next()\n return !ret.done\n }\n\n /**\n * Replace a given string.\n * @param {string} str The string to be replaced.\n * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`.\n * @returns {string} The replaced string.\n */\n [Symbol.replace](str, replacer) {\n return typeof replacer === \"function\"\n ? replaceF(this, String(str), replacer)\n : replaceS(this, String(str), String(replacer))\n }\n}\n","import { findVariable } from \"./find-variable\"\nimport { getPropertyName } from \"./get-property-name\"\nimport { getStringIfConstant } from \"./get-string-if-constant\"\n\nconst IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u\nconst has = Function.call.bind(Object.hasOwnProperty)\n\nexport const READ = Symbol(\"read\")\nexport const CALL = Symbol(\"call\")\nexport const CONSTRUCT = Symbol(\"construct\")\nexport const ESM = Symbol(\"esm\")\n\nconst requireCall = { require: { [CALL]: true } }\n\n/**\n * Check whether a given variable is modified or not.\n * @param {Variable} variable The variable to check.\n * @returns {boolean} `true` if the variable is modified.\n */\nfunction isModifiedGlobal(variable) {\n return (\n variable == null ||\n variable.defs.length !== 0 ||\n variable.references.some((r) => r.isWrite())\n )\n}\n\n/**\n * Check if the value of a given node is passed through to the parent syntax as-is.\n * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through.\n * @param {Node} node A node to check.\n * @returns {boolean} `true` if the node is passed through.\n */\nfunction isPassThrough(node) {\n const parent = node.parent\n\n switch (parent && parent.type) {\n case \"ConditionalExpression\":\n return parent.consequent === node || parent.alternate === node\n case \"LogicalExpression\":\n return true\n case \"SequenceExpression\":\n return parent.expressions[parent.expressions.length - 1] === node\n case \"ChainExpression\":\n return true\n\n default:\n return false\n }\n}\n\n/**\n * The reference tracker.\n */\nexport class ReferenceTracker {\n /**\n * Initialize this tracker.\n * @param {Scope} globalScope The global scope.\n * @param {object} [options] The options.\n * @param {\"legacy\"|\"strict\"} [options.mode=\"strict\"] The mode to determine the ImportDeclaration's behavior for CJS modules.\n * @param {string[]} [options.globalObjectNames=[\"global\",\"globalThis\",\"self\",\"window\"]] The variable names for Global Object.\n */\n constructor(\n globalScope,\n {\n mode = \"strict\",\n globalObjectNames = [\"global\", \"globalThis\", \"self\", \"window\"],\n } = {},\n ) {\n this.variableStack = []\n this.globalScope = globalScope\n this.mode = mode\n this.globalObjectNames = globalObjectNames.slice(0)\n }\n\n /**\n * Iterate the references of global variables.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateGlobalReferences(traceMap) {\n for (const key of Object.keys(traceMap)) {\n const nextTraceMap = traceMap[key]\n const path = [key]\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n variable,\n path,\n nextTraceMap,\n true,\n )\n }\n\n for (const key of this.globalObjectNames) {\n const path = []\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n }\n\n /**\n * Iterate the references of CommonJS modules.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateCjsReferences(traceMap) {\n for (const { node } of this.iterateGlobalReferences(requireCall)) {\n const key = getStringIfConstant(node.arguments[0])\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextTraceMap = traceMap[key]\n const path = [key]\n\n if (nextTraceMap[READ]) {\n yield {\n node,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(node, path, nextTraceMap)\n }\n }\n\n /**\n * Iterate the references of ES modules.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateEsmReferences(traceMap) {\n const programNode = this.globalScope.block\n\n for (const node of programNode.body) {\n if (!IMPORT_TYPE.test(node.type) || node.source == null) {\n continue\n }\n const moduleId = node.source.value\n\n if (!has(traceMap, moduleId)) {\n continue\n }\n const nextTraceMap = traceMap[moduleId]\n const path = [moduleId]\n\n if (nextTraceMap[READ]) {\n yield { node, path, type: READ, info: nextTraceMap[READ] }\n }\n\n if (node.type === \"ExportAllDeclaration\") {\n for (const key of Object.keys(nextTraceMap)) {\n const exportTraceMap = nextTraceMap[key]\n if (exportTraceMap[READ]) {\n yield {\n node,\n path: path.concat(key),\n type: READ,\n info: exportTraceMap[READ],\n }\n }\n }\n } else {\n for (const specifier of node.specifiers) {\n const esm = has(nextTraceMap, ESM)\n const it = this._iterateImportReferences(\n specifier,\n path,\n esm\n ? nextTraceMap\n : this.mode === \"legacy\"\n ? { default: nextTraceMap, ...nextTraceMap }\n : { default: nextTraceMap },\n )\n\n if (esm) {\n yield* it\n } else {\n for (const report of it) {\n report.path = report.path.filter(exceptDefault)\n if (\n report.path.length >= 2 ||\n report.type !== READ\n ) {\n yield report\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Iterate the references for a given variable.\n * @param {Variable} variable The variable to iterate that references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @param {boolean} shouldReport = The flag to report those references.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateVariableReferences(variable, path, traceMap, shouldReport) {\n if (this.variableStack.includes(variable)) {\n return\n }\n this.variableStack.push(variable)\n try {\n for (const reference of variable.references) {\n if (!reference.isRead()) {\n continue\n }\n const node = reference.identifier\n\n if (shouldReport && traceMap[READ]) {\n yield { node, path, type: READ, info: traceMap[READ] }\n }\n yield* this._iteratePropertyReferences(node, path, traceMap)\n }\n } finally {\n this.variableStack.pop()\n }\n }\n\n /**\n * Iterate the references for a given AST node.\n * @param rootNode The AST node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n //eslint-disable-next-line complexity\n *_iteratePropertyReferences(rootNode, path, traceMap) {\n let node = rootNode\n while (isPassThrough(node)) {\n node = node.parent\n }\n\n const parent = node.parent\n if (parent.type === \"MemberExpression\") {\n if (parent.object === node) {\n const key = getPropertyName(parent)\n if (key == null || !has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: parent,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n parent,\n path,\n nextTraceMap,\n )\n }\n return\n }\n if (parent.type === \"CallExpression\") {\n if (parent.callee === node && traceMap[CALL]) {\n yield { node: parent, path, type: CALL, info: traceMap[CALL] }\n }\n return\n }\n if (parent.type === \"NewExpression\") {\n if (parent.callee === node && traceMap[CONSTRUCT]) {\n yield {\n node: parent,\n path,\n type: CONSTRUCT,\n info: traceMap[CONSTRUCT],\n }\n }\n return\n }\n if (parent.type === \"AssignmentExpression\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n yield* this._iteratePropertyReferences(parent, path, traceMap)\n }\n return\n }\n if (parent.type === \"AssignmentPattern\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n }\n return\n }\n if (parent.type === \"VariableDeclarator\") {\n if (parent.init === node) {\n yield* this._iterateLhsReferences(parent.id, path, traceMap)\n }\n }\n }\n\n /**\n * Iterate the references for a given Pattern node.\n * @param {Node} patternNode The Pattern node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateLhsReferences(patternNode, path, traceMap) {\n if (patternNode.type === \"Identifier\") {\n const variable = findVariable(this.globalScope, patternNode)\n if (variable != null) {\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n return\n }\n if (patternNode.type === \"ObjectPattern\") {\n for (const property of patternNode.properties) {\n const key = getPropertyName(property)\n\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextPath = path.concat(key)\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: property,\n path: nextPath,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateLhsReferences(\n property.value,\n nextPath,\n nextTraceMap,\n )\n }\n return\n }\n if (patternNode.type === \"AssignmentPattern\") {\n yield* this._iterateLhsReferences(patternNode.left, path, traceMap)\n }\n }\n\n /**\n * Iterate the references for a given ModuleSpecifier node.\n * @param {Node} specifierNode The ModuleSpecifier node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateImportReferences(specifierNode, path, traceMap) {\n const type = specifierNode.type\n\n if (type === \"ImportSpecifier\" || type === \"ImportDefaultSpecifier\") {\n const key =\n type === \"ImportDefaultSpecifier\"\n ? \"default\"\n : specifierNode.imported.name\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: specifierNode,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateVariableReferences(\n findVariable(this.globalScope, specifierNode.local),\n path,\n nextTraceMap,\n false,\n )\n\n return\n }\n\n if (type === \"ImportNamespaceSpecifier\") {\n yield* this._iterateVariableReferences(\n findVariable(this.globalScope, specifierNode.local),\n path,\n traceMap,\n false,\n )\n return\n }\n\n if (type === \"ExportSpecifier\") {\n const key = specifierNode.local.name\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: specifierNode,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n }\n }\n}\n\nReferenceTracker.READ = READ\nReferenceTracker.CALL = CALL\nReferenceTracker.CONSTRUCT = CONSTRUCT\nReferenceTracker.ESM = ESM\n\n/**\n * This is a predicate function for Array#filter.\n * @param {string} name A name part.\n * @param {number} index The index of the name.\n * @returns {boolean} `false` if it's default.\n */\nfunction exceptDefault(name, index) {\n return !(index === 1 && name === \"default\")\n}\n","import { findVariable } from \"./find-variable\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind\"\nimport { getInnermostScope } from \"./get-innermost-scope\"\nimport { getPropertyName } from \"./get-property-name\"\nimport { getStaticValue } from \"./get-static-value\"\nimport { getStringIfConstant } from \"./get-string-if-constant\"\nimport { hasSideEffect } from \"./has-side-effect\"\nimport { isParenthesized } from \"./is-parenthesized\"\nimport { PatternMatcher } from \"./pattern-matcher\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker\"\nimport {\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isSemicolonToken,\n} from \"./token-predicate\"\n\nexport default {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\nexport {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\n"],"names":[],"mappings":";;;;;;;;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ff --git a/node_modules/eslint-utils/index.mjs b/node_modules/eslint-utils/index.mjs new file mode 100644 index 0000000..50edb34 --- /dev/null +++ b/node_modules/eslint-utils/index.mjs @@ -0,0 +1,1914 @@ +/*! @author Toru Nagashima */ +import evk from 'eslint-visitor-keys'; + +/** + * Get the innermost scope which contains a given location. + * @param {Scope} initialScope The initial scope to search. + * @param {Node} node The location to search. + * @returns {Scope} The innermost scope. + */ +function getInnermostScope(initialScope, node) { + const location = node.range[0]; + + let scope = initialScope; + let found = false; + do { + found = false; + for (const childScope of scope.childScopes) { + const range = childScope.block.range; + + if (range[0] <= location && location < range[1]) { + scope = childScope; + found = true; + break + } + } + } while (found) + + return scope +} + +/** + * Find the variable of a given name. + * @param {Scope} initialScope The scope to start finding. + * @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node. + * @returns {Variable|null} The found variable or null. + */ +function findVariable(initialScope, nameOrNode) { + let name = ""; + let scope = initialScope; + + if (typeof nameOrNode === "string") { + name = nameOrNode; + } else { + name = nameOrNode.name; + scope = getInnermostScope(scope, nameOrNode); + } + + while (scope != null) { + const variable = scope.set.get(name); + if (variable != null) { + return variable + } + scope = scope.upper; + } + + return null +} + +/** + * Negate the result of `this` calling. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the result of `this(token)` is `false`. + */ +function negate0(token) { + return !this(token) //eslint-disable-line no-invalid-this +} + +/** + * Creates the negate function of the given function. + * @param {function(Token):boolean} f - The function to negate. + * @returns {function(Token):boolean} Negated function. + */ +function negate(f) { + return negate0.bind(f) +} + +/** + * Checks if the given token is a PunctuatorToken with the given value + * @param {Token} token - The token to check. + * @param {string} value - The value to check. + * @returns {boolean} `true` if the token is a PunctuatorToken with the given value. + */ +function isPunctuatorTokenWithValue(token, value) { + return token.type === "Punctuator" && token.value === value +} + +/** + * Checks if the given token is an arrow token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an arrow token. + */ +function isArrowToken(token) { + return isPunctuatorTokenWithValue(token, "=>") +} + +/** + * Checks if the given token is a comma token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a comma token. + */ +function isCommaToken(token) { + return isPunctuatorTokenWithValue(token, ",") +} + +/** + * Checks if the given token is a semicolon token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a semicolon token. + */ +function isSemicolonToken(token) { + return isPunctuatorTokenWithValue(token, ";") +} + +/** + * Checks if the given token is a colon token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a colon token. + */ +function isColonToken(token) { + return isPunctuatorTokenWithValue(token, ":") +} + +/** + * Checks if the given token is an opening parenthesis token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening parenthesis token. + */ +function isOpeningParenToken(token) { + return isPunctuatorTokenWithValue(token, "(") +} + +/** + * Checks if the given token is a closing parenthesis token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing parenthesis token. + */ +function isClosingParenToken(token) { + return isPunctuatorTokenWithValue(token, ")") +} + +/** + * Checks if the given token is an opening square bracket token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening square bracket token. + */ +function isOpeningBracketToken(token) { + return isPunctuatorTokenWithValue(token, "[") +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing square bracket token. + */ +function isClosingBracketToken(token) { + return isPunctuatorTokenWithValue(token, "]") +} + +/** + * Checks if the given token is an opening brace token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is an opening brace token. + */ +function isOpeningBraceToken(token) { + return isPunctuatorTokenWithValue(token, "{") +} + +/** + * Checks if the given token is a closing brace token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a closing brace token. + */ +function isClosingBraceToken(token) { + return isPunctuatorTokenWithValue(token, "}") +} + +/** + * Checks if the given token is a comment token or not. + * @param {Token} token - The token to check. + * @returns {boolean} `true` if the token is a comment token. + */ +function isCommentToken(token) { + return ["Block", "Line", "Shebang"].includes(token.type) +} + +const isNotArrowToken = negate(isArrowToken); +const isNotCommaToken = negate(isCommaToken); +const isNotSemicolonToken = negate(isSemicolonToken); +const isNotColonToken = negate(isColonToken); +const isNotOpeningParenToken = negate(isOpeningParenToken); +const isNotClosingParenToken = negate(isClosingParenToken); +const isNotOpeningBracketToken = negate(isOpeningBracketToken); +const isNotClosingBracketToken = negate(isClosingBracketToken); +const isNotOpeningBraceToken = negate(isOpeningBraceToken); +const isNotClosingBraceToken = negate(isClosingBraceToken); +const isNotCommentToken = negate(isCommentToken); + +/** + * Get the `(` token of the given function node. + * @param {Node} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {Token} `(` token. + */ +function getOpeningParenOfParams(node, sourceCode) { + return node.id + ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) + : sourceCode.getFirstToken(node, isOpeningParenToken) +} + +/** + * Get the location of the given function node for reporting. + * @param {Node} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {string} The location of the function node for reporting. + */ +function getFunctionHeadLocation(node, sourceCode) { + const parent = node.parent; + let start = null; + let end = null; + + if (node.type === "ArrowFunctionExpression") { + const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); + + start = arrowToken.loc.start; + end = arrowToken.loc.end; + } else if ( + parent.type === "Property" || + parent.type === "MethodDefinition" || + parent.type === "PropertyDefinition" + ) { + start = parent.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else { + start = node.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } + + return { + start: { ...start }, + end: { ...end }, + } +} + +/* globals globalThis, global, self, window */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : typeof global !== "undefined" + ? global + : {}; + +const builtinNames = Object.freeze( + new Set([ + "Array", + "ArrayBuffer", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "Boolean", + "DataView", + "Date", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "Float32Array", + "Float64Array", + "Function", + "Infinity", + "Int16Array", + "Int32Array", + "Int8Array", + "isFinite", + "isNaN", + "isPrototypeOf", + "JSON", + "Map", + "Math", + "NaN", + "Number", + "Object", + "parseFloat", + "parseInt", + "Promise", + "Proxy", + "Reflect", + "RegExp", + "Set", + "String", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "undefined", + "unescape", + "WeakMap", + "WeakSet", + ]), +); +const callAllowed = new Set( + [ + Array.isArray, + typeof BigInt === "function" ? BigInt : undefined, + Boolean, + Date, + Date.parse, + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, + escape, + isFinite, + isNaN, + isPrototypeOf, + ...Object.getOwnPropertyNames(Math) + .map((k) => Math[k]) + .filter((f) => typeof f === "function"), + Number, + Number.isFinite, + Number.isNaN, + Number.parseFloat, + Number.parseInt, + Object, + Object.entries, + Object.is, + Object.isExtensible, + Object.isFrozen, + Object.isSealed, + Object.keys, + Object.values, + parseFloat, + parseInt, + RegExp, + String, + String.fromCharCode, + String.fromCodePoint, + String.raw, + Symbol.for, + Symbol.keyFor, + unescape, + ].filter((f) => typeof f === "function"), +); +const callPassThrough = new Set([ + Object.freeze, + Object.preventExtensions, + Object.seal, +]); + +/** + * Get the property descriptor. + * @param {object} object The object to get. + * @param {string|number|symbol} name The property name to get. + */ +function getPropertyDescriptor(object, name) { + let x = object; + while ((typeof x === "object" || typeof x === "function") && x !== null) { + const d = Object.getOwnPropertyDescriptor(x, name); + if (d) { + return d + } + x = Object.getPrototypeOf(x); + } + return null +} + +/** + * Check if a property is getter or not. + * @param {object} object The object to check. + * @param {string|number|symbol} name The property name to check. + */ +function isGetter(object, name) { + const d = getPropertyDescriptor(object, name); + return d != null && d.get != null +} + +/** + * Get the element values of a given node list. + * @param {Node[]} nodeList The node list to get values. + * @param {Scope|undefined} initialScope The initial scope to find variables. + * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null. + */ +function getElementValues(nodeList, initialScope) { + const valueList = []; + + for (let i = 0; i < nodeList.length; ++i) { + const elementNode = nodeList[i]; + + if (elementNode == null) { + valueList.length = i + 1; + } else if (elementNode.type === "SpreadElement") { + const argument = getStaticValueR(elementNode.argument, initialScope); + if (argument == null) { + return null + } + valueList.push(...argument.value); + } else { + const element = getStaticValueR(elementNode, initialScope); + if (element == null) { + return null + } + valueList.push(element.value); + } + } + + return valueList +} + +const operations = Object.freeze({ + ArrayExpression(node, initialScope) { + const elements = getElementValues(node.elements, initialScope); + return elements != null ? { value: elements } : null + }, + + AssignmentExpression(node, initialScope) { + if (node.operator === "=") { + return getStaticValueR(node.right, initialScope) + } + return null + }, + + //eslint-disable-next-line complexity + BinaryExpression(node, initialScope) { + if (node.operator === "in" || node.operator === "instanceof") { + // Not supported. + return null + } + + const left = getStaticValueR(node.left, initialScope); + const right = getStaticValueR(node.right, initialScope); + if (left != null && right != null) { + switch (node.operator) { + case "==": + return { value: left.value == right.value } //eslint-disable-line eqeqeq + case "!=": + return { value: left.value != right.value } //eslint-disable-line eqeqeq + case "===": + return { value: left.value === right.value } + case "!==": + return { value: left.value !== right.value } + case "<": + return { value: left.value < right.value } + case "<=": + return { value: left.value <= right.value } + case ">": + return { value: left.value > right.value } + case ">=": + return { value: left.value >= right.value } + case "<<": + return { value: left.value << right.value } + case ">>": + return { value: left.value >> right.value } + case ">>>": + return { value: left.value >>> right.value } + case "+": + return { value: left.value + right.value } + case "-": + return { value: left.value - right.value } + case "*": + return { value: left.value * right.value } + case "/": + return { value: left.value / right.value } + case "%": + return { value: left.value % right.value } + case "**": + return { value: Math.pow(left.value, right.value) } + case "|": + return { value: left.value | right.value } + case "^": + return { value: left.value ^ right.value } + case "&": + return { value: left.value & right.value } + + // no default + } + } + + return null + }, + + CallExpression(node, initialScope) { + const calleeNode = node.callee; + const args = getElementValues(node.arguments, initialScope); + + if (args != null) { + if (calleeNode.type === "MemberExpression") { + if (calleeNode.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(calleeNode.object, initialScope); + if (object != null) { + if ( + object.value == null && + (object.optional || node.optional) + ) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue( + calleeNode, + initialScope, + ); + + if (property != null) { + const receiver = object.value; + const methodName = property.value; + if (callAllowed.has(receiver[methodName])) { + return { value: receiver[methodName](...args) } + } + if (callPassThrough.has(receiver[methodName])) { + return { value: args[0] } + } + } + } + } else { + const callee = getStaticValueR(calleeNode, initialScope); + if (callee != null) { + if (callee.value == null && node.optional) { + return { value: undefined, optional: true } + } + const func = callee.value; + if (callAllowed.has(func)) { + return { value: func(...args) } + } + if (callPassThrough.has(func)) { + return { value: args[0] } + } + } + } + } + + return null + }, + + ConditionalExpression(node, initialScope) { + const test = getStaticValueR(node.test, initialScope); + if (test != null) { + return test.value + ? getStaticValueR(node.consequent, initialScope) + : getStaticValueR(node.alternate, initialScope) + } + return null + }, + + ExpressionStatement(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + + Identifier(node, initialScope) { + if (initialScope != null) { + const variable = findVariable(initialScope, node); + + // Built-in globals. + if ( + variable != null && + variable.defs.length === 0 && + builtinNames.has(variable.name) && + variable.name in globalObject + ) { + return { value: globalObject[variable.name] } + } + + // Constants. + if (variable != null && variable.defs.length === 1) { + const def = variable.defs[0]; + if ( + def.parent && + def.parent.kind === "const" && + // TODO(mysticatea): don't support destructuring here. + def.node.id.type === "Identifier" + ) { + return getStaticValueR(def.node.init, initialScope) + } + } + } + return null + }, + + Literal(node) { + //istanbul ignore if : this is implementation-specific behavior. + if ((node.regex != null || node.bigint != null) && node.value == null) { + // It was a RegExp/BigInt literal, but Node.js didn't support it. + return null + } + return { value: node.value } + }, + + LogicalExpression(node, initialScope) { + const left = getStaticValueR(node.left, initialScope); + if (left != null) { + if ( + (node.operator === "||" && Boolean(left.value) === true) || + (node.operator === "&&" && Boolean(left.value) === false) || + (node.operator === "??" && left.value != null) + ) { + return left + } + + const right = getStaticValueR(node.right, initialScope); + if (right != null) { + return right + } + } + + return null + }, + + MemberExpression(node, initialScope) { + if (node.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(node.object, initialScope); + if (object != null) { + if (object.value == null && (object.optional || node.optional)) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue(node, initialScope); + + if (property != null && !isGetter(object.value, property.value)) { + return { value: object.value[property.value] } + } + } + return null + }, + + ChainExpression(node, initialScope) { + const expression = getStaticValueR(node.expression, initialScope); + if (expression != null) { + return { value: expression.value } + } + return null + }, + + NewExpression(node, initialScope) { + const callee = getStaticValueR(node.callee, initialScope); + const args = getElementValues(node.arguments, initialScope); + + if (callee != null && args != null) { + const Func = callee.value; + if (callAllowed.has(Func)) { + return { value: new Func(...args) } + } + } + + return null + }, + + ObjectExpression(node, initialScope) { + const object = {}; + + for (const propertyNode of node.properties) { + if (propertyNode.type === "Property") { + if (propertyNode.kind !== "init") { + return null + } + const key = getStaticPropertyNameValue( + propertyNode, + initialScope, + ); + const value = getStaticValueR(propertyNode.value, initialScope); + if (key == null || value == null) { + return null + } + object[key.value] = value.value; + } else if ( + propertyNode.type === "SpreadElement" || + propertyNode.type === "ExperimentalSpreadProperty" + ) { + const argument = getStaticValueR( + propertyNode.argument, + initialScope, + ); + if (argument == null) { + return null + } + Object.assign(object, argument.value); + } else { + return null + } + } + + return { value: object } + }, + + SequenceExpression(node, initialScope) { + const last = node.expressions[node.expressions.length - 1]; + return getStaticValueR(last, initialScope) + }, + + TaggedTemplateExpression(node, initialScope) { + const tag = getStaticValueR(node.tag, initialScope); + const expressions = getElementValues( + node.quasi.expressions, + initialScope, + ); + + if (tag != null && expressions != null) { + const func = tag.value; + const strings = node.quasi.quasis.map((q) => q.value.cooked); + strings.raw = node.quasi.quasis.map((q) => q.value.raw); + + if (func === String.raw) { + return { value: func(strings, ...expressions) } + } + } + + return null + }, + + TemplateLiteral(node, initialScope) { + const expressions = getElementValues(node.expressions, initialScope); + if (expressions != null) { + let value = node.quasis[0].value.cooked; + for (let i = 0; i < expressions.length; ++i) { + value += expressions[i]; + value += node.quasis[i + 1].value.cooked; + } + return { value } + } + return null + }, + + UnaryExpression(node, initialScope) { + if (node.operator === "delete") { + // Not supported. + return null + } + if (node.operator === "void") { + return { value: undefined } + } + + const arg = getStaticValueR(node.argument, initialScope); + if (arg != null) { + switch (node.operator) { + case "-": + return { value: -arg.value } + case "+": + return { value: +arg.value } //eslint-disable-line no-implicit-coercion + case "!": + return { value: !arg.value } + case "~": + return { value: ~arg.value } + case "typeof": + return { value: typeof arg.value } + + // no default + } + } + + return null + }, +}); + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope|undefined} initialScope The scope to start finding variable. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`. + */ +function getStaticValueR(node, initialScope) { + if (node != null && Object.hasOwnProperty.call(operations, node.type)) { + return operations[node.type](node, initialScope) + } + return null +} + +/** + * Get the static value of property name from a MemberExpression node or a Property node. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the property name of the node, or `null`. + */ +function getStaticPropertyNameValue(node, initialScope) { + const nameNode = node.type === "Property" ? node.key : node.property; + + if (node.computed) { + return getStaticValueR(nameNode, initialScope) + } + + if (nameNode.type === "Identifier") { + return { value: nameNode.name } + } + + if (nameNode.type === "Literal") { + if (nameNode.bigint) { + return { value: nameNode.bigint } + } + return { value: String(nameNode.value) } + } + + return null +} + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`. + */ +function getStaticValue(node, initialScope = null) { + try { + return getStaticValueR(node, initialScope) + } catch (_error) { + return null + } +} + +/** + * Get the value of a given node if it's a literal or a template literal. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant. + * @returns {string|null} The value of the node, or `null`. + */ +function getStringIfConstant(node, initialScope = null) { + // Handle the literals that the platform doesn't support natively. + if (node && node.type === "Literal" && node.value === null) { + if (node.regex) { + return `/${node.regex.pattern}/${node.regex.flags}` + } + if (node.bigint) { + return node.bigint + } + } + + const evaluated = getStaticValue(node, initialScope); + return evaluated && String(evaluated.value) +} + +/** + * Get the property name from a MemberExpression node or a Property node. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {string|null} The property name of the node. + */ +function getPropertyName(node, initialScope) { + switch (node.type) { + case "MemberExpression": + if (node.computed) { + return getStringIfConstant(node.property, initialScope) + } + if (node.property.type === "PrivateIdentifier") { + return null + } + return node.property.name + + case "Property": + case "MethodDefinition": + case "PropertyDefinition": + if (node.computed) { + return getStringIfConstant(node.key, initialScope) + } + if (node.key.type === "Literal") { + return String(node.key.value) + } + if (node.key.type === "PrivateIdentifier") { + return null + } + return node.key.name + + // no default + } + + return null +} + +/** + * Get the name and kind of the given function node. + * @param {ASTNode} node - The function node to get. + * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys. + * @returns {string} The name and kind of the function node. + */ +// eslint-disable-next-line complexity +function getFunctionNameWithKind(node, sourceCode) { + const parent = node.parent; + const tokens = []; + const isObjectMethod = parent.type === "Property" && parent.value === node; + const isClassMethod = + parent.type === "MethodDefinition" && parent.value === node; + const isClassFieldMethod = + parent.type === "PropertyDefinition" && parent.value === node; + + // Modifiers. + if (isClassMethod || isClassFieldMethod) { + if (parent.static) { + tokens.push("static"); + } + if (parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } + } + if (node.async) { + tokens.push("async"); + } + if (node.generator) { + tokens.push("generator"); + } + + // Kinds. + if (isObjectMethod || isClassMethod) { + if (parent.kind === "constructor") { + return "constructor" + } + if (parent.kind === "get") { + tokens.push("getter"); + } else if (parent.kind === "set") { + tokens.push("setter"); + } else { + tokens.push("method"); + } + } else if (isClassFieldMethod) { + tokens.push("method"); + } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); + } + + // Names. + if (isObjectMethod || isClassMethod || isClassFieldMethod) { + if (parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getPropertyName(parent); + if (name) { + tokens.push(`'${name}'`); + } else if (sourceCode) { + const keyText = sourceCode.getText(parent.key); + if (!keyText.includes("\n")) { + tokens.push(`[${keyText}]`); + } + } + } + } else if (node.id) { + tokens.push(`'${node.id.name}'`); + } else if ( + parent.type === "VariableDeclarator" && + parent.id && + parent.id.type === "Identifier" + ) { + tokens.push(`'${parent.id.name}'`); + } else if ( + (parent.type === "AssignmentExpression" || + parent.type === "AssignmentPattern") && + parent.left && + parent.left.type === "Identifier" + ) { + tokens.push(`'${parent.left.name}'`); + } + + return tokens.join(" ") +} + +const typeConversionBinaryOps = Object.freeze( + new Set([ + "==", + "!=", + "<", + "<=", + ">", + ">=", + "<<", + ">>", + ">>>", + "+", + "-", + "*", + "/", + "%", + "|", + "^", + "&", + "in", + ]), +); +const typeConversionUnaryOps = Object.freeze(new Set(["-", "+", "!", "~"])); + +/** + * Check whether the given value is an ASTNode or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ +function isNode(x) { + return x !== null && typeof x === "object" && typeof x.type === "string" +} + +const visitor = Object.freeze( + Object.assign(Object.create(null), { + $visit(node, options, visitorKeys) { + const { type } = node; + + if (typeof this[type] === "function") { + return this[type](node, options, visitorKeys) + } + + return this.$visitChildren(node, options, visitorKeys) + }, + + $visitChildren(node, options, visitorKeys) { + const { type } = node; + + for (const key of visitorKeys[type] || evk.getKeys(node)) { + const value = node[key]; + + if (Array.isArray(value)) { + for (const element of value) { + if ( + isNode(element) && + this.$visit(element, options, visitorKeys) + ) { + return true + } + } + } else if ( + isNode(value) && + this.$visit(value, options, visitorKeys) + ) { + return true + } + } + + return false + }, + + ArrowFunctionExpression() { + return false + }, + AssignmentExpression() { + return true + }, + AwaitExpression() { + return true + }, + BinaryExpression(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + typeConversionBinaryOps.has(node.operator) && + (node.left.type !== "Literal" || node.right.type !== "Literal") + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + CallExpression() { + return true + }, + FunctionExpression() { + return false + }, + ImportExpression() { + return true + }, + MemberExpression(node, options, visitorKeys) { + if (options.considerGetters) { + return true + } + if ( + options.considerImplicitTypeConversion && + node.computed && + node.property.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + MethodDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + NewExpression() { + return true + }, + Property(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + PropertyDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UnaryExpression(node, options, visitorKeys) { + if (node.operator === "delete") { + return true + } + if ( + options.considerImplicitTypeConversion && + typeConversionUnaryOps.has(node.operator) && + node.argument.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UpdateExpression() { + return true + }, + YieldExpression() { + return true + }, + }), +); + +/** + * Check whether a given node has any side effect or not. + * @param {Node} node The node to get. + * @param {SourceCode} sourceCode The source code object. + * @param {object} [options] The option object. + * @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects. + * @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects. + * @param {object} [options.visitorKeys=evk.KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`. + * @returns {boolean} `true` if the node has a certain side effect. + */ +function hasSideEffect( + node, + sourceCode, + { considerGetters = false, considerImplicitTypeConversion = false } = {}, +) { + return visitor.$visit( + node, + { considerGetters, considerImplicitTypeConversion }, + sourceCode.visitorKeys || evk.KEYS, + ) +} + +/** + * Get the left parenthesis of the parent node syntax if it exists. + * E.g., `if (a) {}` then the `(`. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token|null} The left parenthesis of the parent node syntax + */ +function getParentSyntaxParen(node, sourceCode) { + const parent = node.parent; + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + if (parent.arguments.length === 1 && parent.arguments[0] === node) { + return sourceCode.getTokenAfter( + parent.callee, + isOpeningParenToken, + ) + } + return null + + case "DoWhileStatement": + if (parent.test === node) { + return sourceCode.getTokenAfter( + parent.body, + isOpeningParenToken, + ) + } + return null + + case "IfStatement": + case "WhileStatement": + if (parent.test === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "ImportExpression": + if (parent.source === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "SwitchStatement": + if (parent.discriminant === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "WithStatement": + if (parent.object === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + default: + return null + } +} + +/** + * Check whether a given node is parenthesized or not. + * @param {number} times The number of parantheses. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized the given times. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized. + */ +function isParenthesized( + timesOrNode, + nodeOrSourceCode, + optionalSourceCode, +) { + let times, node, sourceCode, maybeLeftParen, maybeRightParen; + if (typeof timesOrNode === "number") { + times = timesOrNode | 0; + node = nodeOrSourceCode; + sourceCode = optionalSourceCode; + if (!(times >= 1)) { + throw new TypeError("'times' should be a positive integer.") + } + } else { + times = 1; + node = timesOrNode; + sourceCode = nodeOrSourceCode; + } + + if ( + node == null || + // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}` + (node.parent.type === "CatchClause" && node.parent.param === node) + ) { + return false + } + + maybeLeftParen = maybeRightParen = node; + do { + maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen); + maybeRightParen = sourceCode.getTokenAfter(maybeRightParen); + } while ( + maybeLeftParen != null && + maybeRightParen != null && + isOpeningParenToken(maybeLeftParen) && + isClosingParenToken(maybeRightParen) && + // Avoid false positive such as `if (a) {}` + maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && + --times > 0 + ) + + return times === 0 +} + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu; + +/** @type {WeakMap} */ +const internal = new WeakMap(); + +/** + * Check whether a given character is escaped or not. + * @param {string} str The string to check. + * @param {number} index The location of the character to check. + * @returns {boolean} `true` if the character is escaped. + */ +function isEscaped(str, index) { + let escaped = false; + for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) { + escaped = !escaped; + } + return escaped +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {string} replacement The new substring to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceS(matcher, str, replacement) { + const chunks = []; + let index = 0; + + /** @type {RegExpExecArray} */ + let match = null; + + /** + * @param {string} key The placeholder. + * @returns {string} The replaced string. + */ + function replacer(key) { + switch (key) { + case "$$": + return "$" + case "$&": + return match[0] + case "$`": + return str.slice(0, match.index) + case "$'": + return str.slice(match.index + match[0].length) + default: { + const i = key.slice(1); + if (i in match) { + return match[i] + } + return key + } + } + } + + for (match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push(replacement.replace(placeholder, replacer)); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {(...strs[])=>string} replace The function to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceF(matcher, str, replace) { + const chunks = []; + let index = 0; + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push(String(replace(...match, match.index, match.input))); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * The class to find patterns as considering escape sequences. + */ +class PatternMatcher { + /** + * Initialize this matcher. + * @param {RegExp} pattern The pattern to match. + * @param {{escaped:boolean}} options The options. + */ + constructor(pattern, { escaped = false } = {}) { + if (!(pattern instanceof RegExp)) { + throw new TypeError("'pattern' should be a RegExp instance.") + } + if (!pattern.flags.includes("g")) { + throw new Error("'pattern' should contains 'g' flag.") + } + + internal.set(this, { + pattern: new RegExp(pattern.source, pattern.flags), + escaped: Boolean(escaped), + }); + } + + /** + * Find the pattern in a given string. + * @param {string} str The string to find. + * @returns {IterableIterator} The iterator which iterate the matched information. + */ + *execAll(str) { + const { pattern, escaped } = internal.get(this); + let match = null; + let lastIndex = 0; + + pattern.lastIndex = 0; + while ((match = pattern.exec(str)) != null) { + if (escaped || !isEscaped(str, match.index)) { + lastIndex = pattern.lastIndex; + yield match; + pattern.lastIndex = lastIndex; + } + } + } + + /** + * Check whether the pattern is found in a given string. + * @param {string} str The string to check. + * @returns {boolean} `true` if the pattern was found in the string. + */ + test(str) { + const it = this.execAll(str); + const ret = it.next(); + return !ret.done + } + + /** + * Replace a given string. + * @param {string} str The string to be replaced. + * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`. + * @returns {string} The replaced string. + */ + [Symbol.replace](str, replacer) { + return typeof replacer === "function" + ? replaceF(this, String(str), replacer) + : replaceS(this, String(str), String(replacer)) + } +} + +const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; +const has = Function.call.bind(Object.hasOwnProperty); + +const READ = Symbol("read"); +const CALL = Symbol("call"); +const CONSTRUCT = Symbol("construct"); +const ESM = Symbol("esm"); + +const requireCall = { require: { [CALL]: true } }; + +/** + * Check whether a given variable is modified or not. + * @param {Variable} variable The variable to check. + * @returns {boolean} `true` if the variable is modified. + */ +function isModifiedGlobal(variable) { + return ( + variable == null || + variable.defs.length !== 0 || + variable.references.some((r) => r.isWrite()) + ) +} + +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = node.parent; + + switch (parent && parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return parent.expressions[parent.expressions.length - 1] === node + case "ChainExpression": + return true + + default: + return false + } +} + +/** + * The reference tracker. + */ +class ReferenceTracker { + /** + * Initialize this tracker. + * @param {Scope} globalScope The global scope. + * @param {object} [options] The options. + * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. + */ + constructor( + globalScope, + { + mode = "strict", + globalObjectNames = ["global", "globalThis", "self", "window"], + } = {}, + ) { + this.variableStack = []; + this.globalScope = globalScope; + this.mode = mode; + this.globalObjectNames = globalObjectNames.slice(0); + } + + /** + * Iterate the references of global variables. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateGlobalReferences(traceMap) { + for (const key of Object.keys(traceMap)) { + const nextTraceMap = traceMap[key]; + const path = [key]; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + variable, + path, + nextTraceMap, + true, + ); + } + + for (const key of this.globalObjectNames) { + const path = []; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + } + + /** + * Iterate the references of CommonJS modules. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateCjsReferences(traceMap) { + for (const { node } of this.iterateGlobalReferences(requireCall)) { + const key = getStringIfConstant(node.arguments[0]); + if (key == null || !has(traceMap, key)) { + continue + } + + const nextTraceMap = traceMap[key]; + const path = [key]; + + if (nextTraceMap[READ]) { + yield { + node, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences(node, path, nextTraceMap); + } + } + + /** + * Iterate the references of ES modules. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *iterateEsmReferences(traceMap) { + const programNode = this.globalScope.block; + + for (const node of programNode.body) { + if (!IMPORT_TYPE.test(node.type) || node.source == null) { + continue + } + const moduleId = node.source.value; + + if (!has(traceMap, moduleId)) { + continue + } + const nextTraceMap = traceMap[moduleId]; + const path = [moduleId]; + + if (nextTraceMap[READ]) { + yield { node, path, type: READ, info: nextTraceMap[READ] }; + } + + if (node.type === "ExportAllDeclaration") { + for (const key of Object.keys(nextTraceMap)) { + const exportTraceMap = nextTraceMap[key]; + if (exportTraceMap[READ]) { + yield { + node, + path: path.concat(key), + type: READ, + info: exportTraceMap[READ], + }; + } + } + } else { + for (const specifier of node.specifiers) { + const esm = has(nextTraceMap, ESM); + const it = this._iterateImportReferences( + specifier, + path, + esm + ? nextTraceMap + : this.mode === "legacy" + ? { default: nextTraceMap, ...nextTraceMap } + : { default: nextTraceMap }, + ); + + if (esm) { + yield* it; + } else { + for (const report of it) { + report.path = report.path.filter(exceptDefault); + if ( + report.path.length >= 2 || + report.type !== READ + ) { + yield report; + } + } + } + } + } + } + } + + /** + * Iterate the references for a given variable. + * @param {Variable} variable The variable to iterate that references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @param {boolean} shouldReport = The flag to report those references. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateVariableReferences(variable, path, traceMap, shouldReport) { + if (this.variableStack.includes(variable)) { + return + } + this.variableStack.push(variable); + try { + for (const reference of variable.references) { + if (!reference.isRead()) { + continue + } + const node = reference.identifier; + + if (shouldReport && traceMap[READ]) { + yield { node, path, type: READ, info: traceMap[READ] }; + } + yield* this._iteratePropertyReferences(node, path, traceMap); + } + } finally { + this.variableStack.pop(); + } + } + + /** + * Iterate the references for a given AST node. + * @param rootNode The AST node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + //eslint-disable-next-line complexity + *_iteratePropertyReferences(rootNode, path, traceMap) { + let node = rootNode; + while (isPassThrough(node)) { + node = node.parent; + } + + const parent = node.parent; + if (parent.type === "MemberExpression") { + if (parent.object === node) { + const key = getPropertyName(parent); + if (key == null || !has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: parent, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + parent, + path, + nextTraceMap, + ); + } + return + } + if (parent.type === "CallExpression") { + if (parent.callee === node && traceMap[CALL]) { + yield { node: parent, path, type: CALL, info: traceMap[CALL] }; + } + return + } + if (parent.type === "NewExpression") { + if (parent.callee === node && traceMap[CONSTRUCT]) { + yield { + node: parent, + path, + type: CONSTRUCT, + info: traceMap[CONSTRUCT], + }; + } + return + } + if (parent.type === "AssignmentExpression") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + yield* this._iteratePropertyReferences(parent, path, traceMap); + } + return + } + if (parent.type === "AssignmentPattern") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + } + return + } + if (parent.type === "VariableDeclarator") { + if (parent.init === node) { + yield* this._iterateLhsReferences(parent.id, path, traceMap); + } + } + } + + /** + * Iterate the references for a given Pattern node. + * @param {Node} patternNode The Pattern node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateLhsReferences(patternNode, path, traceMap) { + if (patternNode.type === "Identifier") { + const variable = findVariable(this.globalScope, patternNode); + if (variable != null) { + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + return + } + if (patternNode.type === "ObjectPattern") { + for (const property of patternNode.properties) { + const key = getPropertyName(property); + + if (key == null || !has(traceMap, key)) { + continue + } + + const nextPath = path.concat(key); + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: property, + path: nextPath, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateLhsReferences( + property.value, + nextPath, + nextTraceMap, + ); + } + return + } + if (patternNode.type === "AssignmentPattern") { + yield* this._iterateLhsReferences(patternNode.left, path, traceMap); + } + } + + /** + * Iterate the references for a given ModuleSpecifier node. + * @param {Node} specifierNode The ModuleSpecifier node to iterate references. + * @param {string[]} path The current path. + * @param {object} traceMap The trace map. + * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references. + */ + *_iterateImportReferences(specifierNode, path, traceMap) { + const type = specifierNode.type; + + if (type === "ImportSpecifier" || type === "ImportDefaultSpecifier") { + const key = + type === "ImportDefaultSpecifier" + ? "default" + : specifierNode.imported.name; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: specifierNode, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateVariableReferences( + findVariable(this.globalScope, specifierNode.local), + path, + nextTraceMap, + false, + ); + + return + } + + if (type === "ImportNamespaceSpecifier") { + yield* this._iterateVariableReferences( + findVariable(this.globalScope, specifierNode.local), + path, + traceMap, + false, + ); + return + } + + if (type === "ExportSpecifier") { + const key = specifierNode.local.name; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: specifierNode, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + } + } +} + +ReferenceTracker.READ = READ; +ReferenceTracker.CALL = CALL; +ReferenceTracker.CONSTRUCT = CONSTRUCT; +ReferenceTracker.ESM = ESM; + +/** + * This is a predicate function for Array#filter. + * @param {string} name A name part. + * @param {number} index The index of the name. + * @returns {boolean} `false` if it's default. + */ +function exceptDefault(name, index) { + return !(index === 1 && name === "default") +} + +var index = { + CALL, + CONSTRUCT, + ESM, + findVariable, + getFunctionHeadLocation, + getFunctionNameWithKind, + getInnermostScope, + getPropertyName, + getStaticValue, + getStringIfConstant, + hasSideEffect, + isArrowToken, + isClosingBraceToken, + isClosingBracketToken, + isClosingParenToken, + isColonToken, + isCommaToken, + isCommentToken, + isNotArrowToken, + isNotClosingBraceToken, + isNotClosingBracketToken, + isNotClosingParenToken, + isNotColonToken, + isNotCommaToken, + isNotCommentToken, + isNotOpeningBraceToken, + isNotOpeningBracketToken, + isNotOpeningParenToken, + isNotSemicolonToken, + isOpeningBraceToken, + isOpeningBracketToken, + isOpeningParenToken, + isParenthesized, + isSemicolonToken, + PatternMatcher, + READ, + ReferenceTracker, +}; + +export default index; +export { CALL, CONSTRUCT, ESM, PatternMatcher, READ, ReferenceTracker, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/eslint-utils/index.mjs.map b/node_modules/eslint-utils/index.mjs.map new file mode 100644 index 0000000..399507f --- /dev/null +++ b/node_modules/eslint-utils/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["src/get-innermost-scope.js","src/find-variable.js","src/token-predicate.js","src/get-function-head-location.js","src/get-static-value.js","src/get-string-if-constant.js","src/get-property-name.js","src/get-function-name-with-kind.js","src/has-side-effect.js","src/is-parenthesized.js","src/pattern-matcher.js","src/reference-tracker.js","src/index.js"],"sourcesContent":["/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = node.range[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = childScope.block.range\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope\"\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/**\n * Negate the result of `this` calling.\n * @param {Token} token The token to check.\n * @returns {boolean} `true` if the result of `this(token)` is `false`.\n */\nfunction negate0(token) {\n return !this(token) //eslint-disable-line no-invalid-this\n}\n\n/**\n * Creates the negate function of the given function.\n * @param {function(Token):boolean} f - The function to negate.\n * @returns {function(Token):boolean} Negated function.\n */\nfunction negate(f) {\n return negate0.bind(f)\n}\n\n/**\n * Checks if the given token is a PunctuatorToken with the given value\n * @param {Token} token - The token to check.\n * @param {string} value - The value to check.\n * @returns {boolean} `true` if the token is a PunctuatorToken with the given value.\n */\nfunction isPunctuatorTokenWithValue(token, value) {\n return token.type === \"Punctuator\" && token.value === value\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return isPunctuatorTokenWithValue(token, \"=>\")\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return isPunctuatorTokenWithValue(token, \",\")\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a semicolon token.\n */\nexport function isSemicolonToken(token) {\n return isPunctuatorTokenWithValue(token, \";\")\n}\n\n/**\n * Checks if the given token is a colon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a colon token.\n */\nexport function isColonToken(token) {\n return isPunctuatorTokenWithValue(token, \":\")\n}\n\n/**\n * Checks if the given token is an opening parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening parenthesis token.\n */\nexport function isOpeningParenToken(token) {\n return isPunctuatorTokenWithValue(token, \"(\")\n}\n\n/**\n * Checks if the given token is a closing parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing parenthesis token.\n */\nexport function isClosingParenToken(token) {\n return isPunctuatorTokenWithValue(token, \")\")\n}\n\n/**\n * Checks if the given token is an opening square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening square bracket token.\n */\nexport function isOpeningBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"[\")\n}\n\n/**\n * Checks if the given token is a closing square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing square bracket token.\n */\nexport function isClosingBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"]\")\n}\n\n/**\n * Checks if the given token is an opening brace token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening brace token.\n */\nexport function isOpeningBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"{\")\n}\n\n/**\n * Checks if the given token is a closing brace token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing brace token.\n */\nexport function isClosingBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"}\")\n}\n\n/**\n * Checks if the given token is a comment token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a comment token.\n */\nexport function isCommentToken(token) {\n return [\"Block\", \"Line\", \"Shebang\"].includes(token.type)\n}\n\nexport const isNotArrowToken = negate(isArrowToken)\nexport const isNotCommaToken = negate(isCommaToken)\nexport const isNotSemicolonToken = negate(isSemicolonToken)\nexport const isNotColonToken = negate(isColonToken)\nexport const isNotOpeningParenToken = negate(isOpeningParenToken)\nexport const isNotClosingParenToken = negate(isClosingParenToken)\nexport const isNotOpeningBracketToken = negate(isOpeningBracketToken)\nexport const isNotClosingBracketToken = negate(isClosingBracketToken)\nexport const isNotOpeningBraceToken = negate(isOpeningBraceToken)\nexport const isNotClosingBraceToken = negate(isClosingBraceToken)\nexport const isNotCommentToken = negate(isCommentToken)\n","import { isArrowToken, isOpeningParenToken } from \"./token-predicate\"\n\n/**\n * Get the `(` token of the given function node.\n * @param {Node} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {Token} `(` token.\n */\nfunction getOpeningParenOfParams(node, sourceCode) {\n return node.id\n ? sourceCode.getTokenAfter(node.id, isOpeningParenToken)\n : sourceCode.getFirstToken(node, isOpeningParenToken)\n}\n\n/**\n * Get the location of the given function node for reporting.\n * @param {Node} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {string} The location of the function node for reporting.\n */\nexport function getFunctionHeadLocation(node, sourceCode) {\n const parent = node.parent\n let start = null\n let end = null\n\n if (node.type === \"ArrowFunctionExpression\") {\n const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken)\n\n start = arrowToken.loc.start\n end = arrowToken.loc.end\n } else if (\n parent.type === \"Property\" ||\n parent.type === \"MethodDefinition\" ||\n parent.type === \"PropertyDefinition\"\n ) {\n start = parent.loc.start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n } else {\n start = node.loc.start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n }\n\n return {\n start: { ...start },\n end: { ...end },\n }\n}\n","/* globals globalThis, global, self, window */\n\nimport { findVariable } from \"./find-variable\"\n\nconst globalObject =\n typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : {}\n\nconst builtinNames = Object.freeze(\n new Set([\n \"Array\",\n \"ArrayBuffer\",\n \"BigInt\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Boolean\",\n \"DataView\",\n \"Date\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"Float32Array\",\n \"Float64Array\",\n \"Function\",\n \"Infinity\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"isFinite\",\n \"isNaN\",\n \"isPrototypeOf\",\n \"JSON\",\n \"Map\",\n \"Math\",\n \"NaN\",\n \"Number\",\n \"Object\",\n \"parseFloat\",\n \"parseInt\",\n \"Promise\",\n \"Proxy\",\n \"Reflect\",\n \"RegExp\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"undefined\",\n \"unescape\",\n \"WeakMap\",\n \"WeakSet\",\n ]),\n)\nconst callAllowed = new Set(\n [\n Array.isArray,\n typeof BigInt === \"function\" ? BigInt : undefined,\n Boolean,\n Date,\n Date.parse,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n escape,\n isFinite,\n isNaN,\n isPrototypeOf,\n ...Object.getOwnPropertyNames(Math)\n .map((k) => Math[k])\n .filter((f) => typeof f === \"function\"),\n Number,\n Number.isFinite,\n Number.isNaN,\n Number.parseFloat,\n Number.parseInt,\n Object,\n Object.entries,\n Object.is,\n Object.isExtensible,\n Object.isFrozen,\n Object.isSealed,\n Object.keys,\n Object.values,\n parseFloat,\n parseInt,\n RegExp,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n Symbol.for,\n Symbol.keyFor,\n unescape,\n ].filter((f) => typeof f === \"function\"),\n)\nconst callPassThrough = new Set([\n Object.freeze,\n Object.preventExtensions,\n Object.seal,\n])\n\n/**\n * Get the property descriptor.\n * @param {object} object The object to get.\n * @param {string|number|symbol} name The property name to get.\n */\nfunction getPropertyDescriptor(object, name) {\n let x = object\n while ((typeof x === \"object\" || typeof x === \"function\") && x !== null) {\n const d = Object.getOwnPropertyDescriptor(x, name)\n if (d) {\n return d\n }\n x = Object.getPrototypeOf(x)\n }\n return null\n}\n\n/**\n * Check if a property is getter or not.\n * @param {object} object The object to check.\n * @param {string|number|symbol} name The property name to check.\n */\nfunction isGetter(object, name) {\n const d = getPropertyDescriptor(object, name)\n return d != null && d.get != null\n}\n\n/**\n * Get the element values of a given node list.\n * @param {Node[]} nodeList The node list to get values.\n * @param {Scope|undefined} initialScope The initial scope to find variables.\n * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null.\n */\nfunction getElementValues(nodeList, initialScope) {\n const valueList = []\n\n for (let i = 0; i < nodeList.length; ++i) {\n const elementNode = nodeList[i]\n\n if (elementNode == null) {\n valueList.length = i + 1\n } else if (elementNode.type === \"SpreadElement\") {\n const argument = getStaticValueR(elementNode.argument, initialScope)\n if (argument == null) {\n return null\n }\n valueList.push(...argument.value)\n } else {\n const element = getStaticValueR(elementNode, initialScope)\n if (element == null) {\n return null\n }\n valueList.push(element.value)\n }\n }\n\n return valueList\n}\n\nconst operations = Object.freeze({\n ArrayExpression(node, initialScope) {\n const elements = getElementValues(node.elements, initialScope)\n return elements != null ? { value: elements } : null\n },\n\n AssignmentExpression(node, initialScope) {\n if (node.operator === \"=\") {\n return getStaticValueR(node.right, initialScope)\n }\n return null\n },\n\n //eslint-disable-next-line complexity\n BinaryExpression(node, initialScope) {\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n // Not supported.\n return null\n }\n\n const left = getStaticValueR(node.left, initialScope)\n const right = getStaticValueR(node.right, initialScope)\n if (left != null && right != null) {\n switch (node.operator) {\n case \"==\":\n return { value: left.value == right.value } //eslint-disable-line eqeqeq\n case \"!=\":\n return { value: left.value != right.value } //eslint-disable-line eqeqeq\n case \"===\":\n return { value: left.value === right.value }\n case \"!==\":\n return { value: left.value !== right.value }\n case \"<\":\n return { value: left.value < right.value }\n case \"<=\":\n return { value: left.value <= right.value }\n case \">\":\n return { value: left.value > right.value }\n case \">=\":\n return { value: left.value >= right.value }\n case \"<<\":\n return { value: left.value << right.value }\n case \">>\":\n return { value: left.value >> right.value }\n case \">>>\":\n return { value: left.value >>> right.value }\n case \"+\":\n return { value: left.value + right.value }\n case \"-\":\n return { value: left.value - right.value }\n case \"*\":\n return { value: left.value * right.value }\n case \"/\":\n return { value: left.value / right.value }\n case \"%\":\n return { value: left.value % right.value }\n case \"**\":\n return { value: Math.pow(left.value, right.value) }\n case \"|\":\n return { value: left.value | right.value }\n case \"^\":\n return { value: left.value ^ right.value }\n case \"&\":\n return { value: left.value & right.value }\n\n // no default\n }\n }\n\n return null\n },\n\n CallExpression(node, initialScope) {\n const calleeNode = node.callee\n const args = getElementValues(node.arguments, initialScope)\n\n if (args != null) {\n if (calleeNode.type === \"MemberExpression\") {\n if (calleeNode.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(calleeNode.object, initialScope)\n if (object != null) {\n if (\n object.value == null &&\n (object.optional || node.optional)\n ) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(\n calleeNode,\n initialScope,\n )\n\n if (property != null) {\n const receiver = object.value\n const methodName = property.value\n if (callAllowed.has(receiver[methodName])) {\n return { value: receiver[methodName](...args) }\n }\n if (callPassThrough.has(receiver[methodName])) {\n return { value: args[0] }\n }\n }\n }\n } else {\n const callee = getStaticValueR(calleeNode, initialScope)\n if (callee != null) {\n if (callee.value == null && node.optional) {\n return { value: undefined, optional: true }\n }\n const func = callee.value\n if (callAllowed.has(func)) {\n return { value: func(...args) }\n }\n if (callPassThrough.has(func)) {\n return { value: args[0] }\n }\n }\n }\n }\n\n return null\n },\n\n ConditionalExpression(node, initialScope) {\n const test = getStaticValueR(node.test, initialScope)\n if (test != null) {\n return test.value\n ? getStaticValueR(node.consequent, initialScope)\n : getStaticValueR(node.alternate, initialScope)\n }\n return null\n },\n\n ExpressionStatement(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n\n Identifier(node, initialScope) {\n if (initialScope != null) {\n const variable = findVariable(initialScope, node)\n\n // Built-in globals.\n if (\n variable != null &&\n variable.defs.length === 0 &&\n builtinNames.has(variable.name) &&\n variable.name in globalObject\n ) {\n return { value: globalObject[variable.name] }\n }\n\n // Constants.\n if (variable != null && variable.defs.length === 1) {\n const def = variable.defs[0]\n if (\n def.parent &&\n def.parent.kind === \"const\" &&\n // TODO(mysticatea): don't support destructuring here.\n def.node.id.type === \"Identifier\"\n ) {\n return getStaticValueR(def.node.init, initialScope)\n }\n }\n }\n return null\n },\n\n Literal(node) {\n //istanbul ignore if : this is implementation-specific behavior.\n if ((node.regex != null || node.bigint != null) && node.value == null) {\n // It was a RegExp/BigInt literal, but Node.js didn't support it.\n return null\n }\n return { value: node.value }\n },\n\n LogicalExpression(node, initialScope) {\n const left = getStaticValueR(node.left, initialScope)\n if (left != null) {\n if (\n (node.operator === \"||\" && Boolean(left.value) === true) ||\n (node.operator === \"&&\" && Boolean(left.value) === false) ||\n (node.operator === \"??\" && left.value != null)\n ) {\n return left\n }\n\n const right = getStaticValueR(node.right, initialScope)\n if (right != null) {\n return right\n }\n }\n\n return null\n },\n\n MemberExpression(node, initialScope) {\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(node.object, initialScope)\n if (object != null) {\n if (object.value == null && (object.optional || node.optional)) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(node, initialScope)\n\n if (property != null && !isGetter(object.value, property.value)) {\n return { value: object.value[property.value] }\n }\n }\n return null\n },\n\n ChainExpression(node, initialScope) {\n const expression = getStaticValueR(node.expression, initialScope)\n if (expression != null) {\n return { value: expression.value }\n }\n return null\n },\n\n NewExpression(node, initialScope) {\n const callee = getStaticValueR(node.callee, initialScope)\n const args = getElementValues(node.arguments, initialScope)\n\n if (callee != null && args != null) {\n const Func = callee.value\n if (callAllowed.has(Func)) {\n return { value: new Func(...args) }\n }\n }\n\n return null\n },\n\n ObjectExpression(node, initialScope) {\n const object = {}\n\n for (const propertyNode of node.properties) {\n if (propertyNode.type === \"Property\") {\n if (propertyNode.kind !== \"init\") {\n return null\n }\n const key = getStaticPropertyNameValue(\n propertyNode,\n initialScope,\n )\n const value = getStaticValueR(propertyNode.value, initialScope)\n if (key == null || value == null) {\n return null\n }\n object[key.value] = value.value\n } else if (\n propertyNode.type === \"SpreadElement\" ||\n propertyNode.type === \"ExperimentalSpreadProperty\"\n ) {\n const argument = getStaticValueR(\n propertyNode.argument,\n initialScope,\n )\n if (argument == null) {\n return null\n }\n Object.assign(object, argument.value)\n } else {\n return null\n }\n }\n\n return { value: object }\n },\n\n SequenceExpression(node, initialScope) {\n const last = node.expressions[node.expressions.length - 1]\n return getStaticValueR(last, initialScope)\n },\n\n TaggedTemplateExpression(node, initialScope) {\n const tag = getStaticValueR(node.tag, initialScope)\n const expressions = getElementValues(\n node.quasi.expressions,\n initialScope,\n )\n\n if (tag != null && expressions != null) {\n const func = tag.value\n const strings = node.quasi.quasis.map((q) => q.value.cooked)\n strings.raw = node.quasi.quasis.map((q) => q.value.raw)\n\n if (func === String.raw) {\n return { value: func(strings, ...expressions) }\n }\n }\n\n return null\n },\n\n TemplateLiteral(node, initialScope) {\n const expressions = getElementValues(node.expressions, initialScope)\n if (expressions != null) {\n let value = node.quasis[0].value.cooked\n for (let i = 0; i < expressions.length; ++i) {\n value += expressions[i]\n value += node.quasis[i + 1].value.cooked\n }\n return { value }\n }\n return null\n },\n\n UnaryExpression(node, initialScope) {\n if (node.operator === \"delete\") {\n // Not supported.\n return null\n }\n if (node.operator === \"void\") {\n return { value: undefined }\n }\n\n const arg = getStaticValueR(node.argument, initialScope)\n if (arg != null) {\n switch (node.operator) {\n case \"-\":\n return { value: -arg.value }\n case \"+\":\n return { value: +arg.value } //eslint-disable-line no-implicit-coercion\n case \"!\":\n return { value: !arg.value }\n case \"~\":\n return { value: ~arg.value }\n case \"typeof\":\n return { value: typeof arg.value }\n\n // no default\n }\n }\n\n return null\n },\n})\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope|undefined} initialScope The scope to start finding variable.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.\n */\nfunction getStaticValueR(node, initialScope) {\n if (node != null && Object.hasOwnProperty.call(operations, node.type)) {\n return operations[node.type](node, initialScope)\n }\n return null\n}\n\n/**\n * Get the static value of property name from a MemberExpression node or a Property node.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the property name of the node, or `null`.\n */\nfunction getStaticPropertyNameValue(node, initialScope) {\n const nameNode = node.type === \"Property\" ? node.key : node.property\n\n if (node.computed) {\n return getStaticValueR(nameNode, initialScope)\n }\n\n if (nameNode.type === \"Identifier\") {\n return { value: nameNode.name }\n }\n\n if (nameNode.type === \"Literal\") {\n if (nameNode.bigint) {\n return { value: nameNode.bigint }\n }\n return { value: String(nameNode.value) }\n }\n\n return null\n}\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible.\n * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.\n */\nexport function getStaticValue(node, initialScope = null) {\n try {\n return getStaticValueR(node, initialScope)\n } catch (_error) {\n return null\n }\n}\n","import { getStaticValue } from \"./get-static-value\"\n\n/**\n * Get the value of a given node if it's a literal or a template literal.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant.\n * @returns {string|null} The value of the node, or `null`.\n */\nexport function getStringIfConstant(node, initialScope = null) {\n // Handle the literals that the platform doesn't support natively.\n if (node && node.type === \"Literal\" && node.value === null) {\n if (node.regex) {\n return `/${node.regex.pattern}/${node.regex.flags}`\n }\n if (node.bigint) {\n return node.bigint\n }\n }\n\n const evaluated = getStaticValue(node, initialScope)\n return evaluated && String(evaluated.value)\n}\n","import { getStringIfConstant } from \"./get-string-if-constant\"\n\n/**\n * Get the property name from a MemberExpression node or a Property node.\n * @param {Node} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {string|null} The property name of the node.\n */\nexport function getPropertyName(node, initialScope) {\n switch (node.type) {\n case \"MemberExpression\":\n if (node.computed) {\n return getStringIfConstant(node.property, initialScope)\n }\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n return node.property.name\n\n case \"Property\":\n case \"MethodDefinition\":\n case \"PropertyDefinition\":\n if (node.computed) {\n return getStringIfConstant(node.key, initialScope)\n }\n if (node.key.type === \"Literal\") {\n return String(node.key.value)\n }\n if (node.key.type === \"PrivateIdentifier\") {\n return null\n }\n return node.key.name\n\n // no default\n }\n\n return null\n}\n","import { getPropertyName } from \"./get-property-name\"\n\n/**\n * Get the name and kind of the given function node.\n * @param {ASTNode} node - The function node to get.\n * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys.\n * @returns {string} The name and kind of the function node.\n */\n// eslint-disable-next-line complexity\nexport function getFunctionNameWithKind(node, sourceCode) {\n const parent = node.parent\n const tokens = []\n const isObjectMethod = parent.type === \"Property\" && parent.value === node\n const isClassMethod =\n parent.type === \"MethodDefinition\" && parent.value === node\n const isClassFieldMethod =\n parent.type === \"PropertyDefinition\" && parent.value === node\n\n // Modifiers.\n if (isClassMethod || isClassFieldMethod) {\n if (parent.static) {\n tokens.push(\"static\")\n }\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(\"private\")\n }\n }\n if (node.async) {\n tokens.push(\"async\")\n }\n if (node.generator) {\n tokens.push(\"generator\")\n }\n\n // Kinds.\n if (isObjectMethod || isClassMethod) {\n if (parent.kind === \"constructor\") {\n return \"constructor\"\n }\n if (parent.kind === \"get\") {\n tokens.push(\"getter\")\n } else if (parent.kind === \"set\") {\n tokens.push(\"setter\")\n } else {\n tokens.push(\"method\")\n }\n } else if (isClassFieldMethod) {\n tokens.push(\"method\")\n } else {\n if (node.type === \"ArrowFunctionExpression\") {\n tokens.push(\"arrow\")\n }\n tokens.push(\"function\")\n }\n\n // Names.\n if (isObjectMethod || isClassMethod || isClassFieldMethod) {\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(`#${parent.key.name}`)\n } else {\n const name = getPropertyName(parent)\n if (name) {\n tokens.push(`'${name}'`)\n } else if (sourceCode) {\n const keyText = sourceCode.getText(parent.key)\n if (!keyText.includes(\"\\n\")) {\n tokens.push(`[${keyText}]`)\n }\n }\n }\n } else if (node.id) {\n tokens.push(`'${node.id.name}'`)\n } else if (\n parent.type === \"VariableDeclarator\" &&\n parent.id &&\n parent.id.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.id.name}'`)\n } else if (\n (parent.type === \"AssignmentExpression\" ||\n parent.type === \"AssignmentPattern\") &&\n parent.left &&\n parent.left.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.left.name}'`)\n }\n\n return tokens.join(\" \")\n}\n","import evk from \"eslint-visitor-keys\"\n\nconst typeConversionBinaryOps = Object.freeze(\n new Set([\n \"==\",\n \"!=\",\n \"<\",\n \"<=\",\n \">\",\n \">=\",\n \"<<\",\n \">>\",\n \">>>\",\n \"+\",\n \"-\",\n \"*\",\n \"/\",\n \"%\",\n \"|\",\n \"^\",\n \"&\",\n \"in\",\n ]),\n)\nconst typeConversionUnaryOps = Object.freeze(new Set([\"-\", \"+\", \"!\", \"~\"]))\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an ASTNode.\n */\nfunction isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\nconst visitor = Object.freeze(\n Object.assign(Object.create(null), {\n $visit(node, options, visitorKeys) {\n const { type } = node\n\n if (typeof this[type] === \"function\") {\n return this[type](node, options, visitorKeys)\n }\n\n return this.$visitChildren(node, options, visitorKeys)\n },\n\n $visitChildren(node, options, visitorKeys) {\n const { type } = node\n\n for (const key of visitorKeys[type] || evk.getKeys(node)) {\n const value = node[key]\n\n if (Array.isArray(value)) {\n for (const element of value) {\n if (\n isNode(element) &&\n this.$visit(element, options, visitorKeys)\n ) {\n return true\n }\n }\n } else if (\n isNode(value) &&\n this.$visit(value, options, visitorKeys)\n ) {\n return true\n }\n }\n\n return false\n },\n\n ArrowFunctionExpression() {\n return false\n },\n AssignmentExpression() {\n return true\n },\n AwaitExpression() {\n return true\n },\n BinaryExpression(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n typeConversionBinaryOps.has(node.operator) &&\n (node.left.type !== \"Literal\" || node.right.type !== \"Literal\")\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n CallExpression() {\n return true\n },\n FunctionExpression() {\n return false\n },\n ImportExpression() {\n return true\n },\n MemberExpression(node, options, visitorKeys) {\n if (options.considerGetters) {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.property.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n MethodDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n NewExpression() {\n return true\n },\n Property(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n PropertyDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UnaryExpression(node, options, visitorKeys) {\n if (node.operator === \"delete\") {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n typeConversionUnaryOps.has(node.operator) &&\n node.argument.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UpdateExpression() {\n return true\n },\n YieldExpression() {\n return true\n },\n }),\n)\n\n/**\n * Check whether a given node has any side effect or not.\n * @param {Node} node The node to get.\n * @param {SourceCode} sourceCode The source code object.\n * @param {object} [options] The option object.\n * @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects.\n * @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects.\n * @param {object} [options.visitorKeys=evk.KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`.\n * @returns {boolean} `true` if the node has a certain side effect.\n */\nexport function hasSideEffect(\n node,\n sourceCode,\n { considerGetters = false, considerImplicitTypeConversion = false } = {},\n) {\n return visitor.$visit(\n node,\n { considerGetters, considerImplicitTypeConversion },\n sourceCode.visitorKeys || evk.KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate\"\n\n/**\n * Get the left parenthesis of the parent node syntax if it exists.\n * E.g., `if (a) {}` then the `(`.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {Token|null} The left parenthesis of the parent node syntax\n */\nfunction getParentSyntaxParen(node, sourceCode) {\n const parent = node.parent\n\n switch (parent.type) {\n case \"CallExpression\":\n case \"NewExpression\":\n if (parent.arguments.length === 1 && parent.arguments[0] === node) {\n return sourceCode.getTokenAfter(\n parent.callee,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"DoWhileStatement\":\n if (parent.test === node) {\n return sourceCode.getTokenAfter(\n parent.body,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"IfStatement\":\n case \"WhileStatement\":\n if (parent.test === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"ImportExpression\":\n if (parent.source === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"SwitchStatement\":\n if (parent.discriminant === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"WithStatement\":\n if (parent.object === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n default:\n return null\n }\n}\n\n/**\n * Check whether a given node is parenthesized or not.\n * @param {number} times The number of parantheses.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized the given times.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized.\n */\nexport function isParenthesized(\n timesOrNode,\n nodeOrSourceCode,\n optionalSourceCode,\n) {\n let times, node, sourceCode, maybeLeftParen, maybeRightParen\n if (typeof timesOrNode === \"number\") {\n times = timesOrNode | 0\n node = nodeOrSourceCode\n sourceCode = optionalSourceCode\n if (!(times >= 1)) {\n throw new TypeError(\"'times' should be a positive integer.\")\n }\n } else {\n times = 1\n node = timesOrNode\n sourceCode = nodeOrSourceCode\n }\n\n if (\n node == null ||\n // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}`\n (node.parent.type === \"CatchClause\" && node.parent.param === node)\n ) {\n return false\n }\n\n maybeLeftParen = maybeRightParen = node\n do {\n maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen)\n maybeRightParen = sourceCode.getTokenAfter(maybeRightParen)\n } while (\n maybeLeftParen != null &&\n maybeRightParen != null &&\n isOpeningParenToken(maybeLeftParen) &&\n isClosingParenToken(maybeRightParen) &&\n // Avoid false positive such as `if (a) {}`\n maybeLeftParen !== getParentSyntaxParen(node, sourceCode) &&\n --times > 0\n )\n\n return times === 0\n}\n","/**\n * @author Toru Nagashima \n * See LICENSE file in root directory for full license.\n */\n\nconst placeholder = /\\$(?:[$&`']|[1-9][0-9]?)/gu\n\n/** @type {WeakMap} */\nconst internal = new WeakMap()\n\n/**\n * Check whether a given character is escaped or not.\n * @param {string} str The string to check.\n * @param {number} index The location of the character to check.\n * @returns {boolean} `true` if the character is escaped.\n */\nfunction isEscaped(str, index) {\n let escaped = false\n for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) {\n escaped = !escaped\n }\n return escaped\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {string} replacement The new substring to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceS(matcher, str, replacement) {\n const chunks = []\n let index = 0\n\n /** @type {RegExpExecArray} */\n let match = null\n\n /**\n * @param {string} key The placeholder.\n * @returns {string} The replaced string.\n */\n function replacer(key) {\n switch (key) {\n case \"$$\":\n return \"$\"\n case \"$&\":\n return match[0]\n case \"$`\":\n return str.slice(0, match.index)\n case \"$'\":\n return str.slice(match.index + match[0].length)\n default: {\n const i = key.slice(1)\n if (i in match) {\n return match[i]\n }\n return key\n }\n }\n }\n\n for (match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(replacement.replace(placeholder, replacer))\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {(...strs[])=>string} replace The function to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceF(matcher, str, replace) {\n const chunks = []\n let index = 0\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(String(replace(...match, match.index, match.input)))\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * The class to find patterns as considering escape sequences.\n */\nexport class PatternMatcher {\n /**\n * Initialize this matcher.\n * @param {RegExp} pattern The pattern to match.\n * @param {{escaped:boolean}} options The options.\n */\n constructor(pattern, { escaped = false } = {}) {\n if (!(pattern instanceof RegExp)) {\n throw new TypeError(\"'pattern' should be a RegExp instance.\")\n }\n if (!pattern.flags.includes(\"g\")) {\n throw new Error(\"'pattern' should contains 'g' flag.\")\n }\n\n internal.set(this, {\n pattern: new RegExp(pattern.source, pattern.flags),\n escaped: Boolean(escaped),\n })\n }\n\n /**\n * Find the pattern in a given string.\n * @param {string} str The string to find.\n * @returns {IterableIterator} The iterator which iterate the matched information.\n */\n *execAll(str) {\n const { pattern, escaped } = internal.get(this)\n let match = null\n let lastIndex = 0\n\n pattern.lastIndex = 0\n while ((match = pattern.exec(str)) != null) {\n if (escaped || !isEscaped(str, match.index)) {\n lastIndex = pattern.lastIndex\n yield match\n pattern.lastIndex = lastIndex\n }\n }\n }\n\n /**\n * Check whether the pattern is found in a given string.\n * @param {string} str The string to check.\n * @returns {boolean} `true` if the pattern was found in the string.\n */\n test(str) {\n const it = this.execAll(str)\n const ret = it.next()\n return !ret.done\n }\n\n /**\n * Replace a given string.\n * @param {string} str The string to be replaced.\n * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`.\n * @returns {string} The replaced string.\n */\n [Symbol.replace](str, replacer) {\n return typeof replacer === \"function\"\n ? replaceF(this, String(str), replacer)\n : replaceS(this, String(str), String(replacer))\n }\n}\n","import { findVariable } from \"./find-variable\"\nimport { getPropertyName } from \"./get-property-name\"\nimport { getStringIfConstant } from \"./get-string-if-constant\"\n\nconst IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u\nconst has = Function.call.bind(Object.hasOwnProperty)\n\nexport const READ = Symbol(\"read\")\nexport const CALL = Symbol(\"call\")\nexport const CONSTRUCT = Symbol(\"construct\")\nexport const ESM = Symbol(\"esm\")\n\nconst requireCall = { require: { [CALL]: true } }\n\n/**\n * Check whether a given variable is modified or not.\n * @param {Variable} variable The variable to check.\n * @returns {boolean} `true` if the variable is modified.\n */\nfunction isModifiedGlobal(variable) {\n return (\n variable == null ||\n variable.defs.length !== 0 ||\n variable.references.some((r) => r.isWrite())\n )\n}\n\n/**\n * Check if the value of a given node is passed through to the parent syntax as-is.\n * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through.\n * @param {Node} node A node to check.\n * @returns {boolean} `true` if the node is passed through.\n */\nfunction isPassThrough(node) {\n const parent = node.parent\n\n switch (parent && parent.type) {\n case \"ConditionalExpression\":\n return parent.consequent === node || parent.alternate === node\n case \"LogicalExpression\":\n return true\n case \"SequenceExpression\":\n return parent.expressions[parent.expressions.length - 1] === node\n case \"ChainExpression\":\n return true\n\n default:\n return false\n }\n}\n\n/**\n * The reference tracker.\n */\nexport class ReferenceTracker {\n /**\n * Initialize this tracker.\n * @param {Scope} globalScope The global scope.\n * @param {object} [options] The options.\n * @param {\"legacy\"|\"strict\"} [options.mode=\"strict\"] The mode to determine the ImportDeclaration's behavior for CJS modules.\n * @param {string[]} [options.globalObjectNames=[\"global\",\"globalThis\",\"self\",\"window\"]] The variable names for Global Object.\n */\n constructor(\n globalScope,\n {\n mode = \"strict\",\n globalObjectNames = [\"global\", \"globalThis\", \"self\", \"window\"],\n } = {},\n ) {\n this.variableStack = []\n this.globalScope = globalScope\n this.mode = mode\n this.globalObjectNames = globalObjectNames.slice(0)\n }\n\n /**\n * Iterate the references of global variables.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateGlobalReferences(traceMap) {\n for (const key of Object.keys(traceMap)) {\n const nextTraceMap = traceMap[key]\n const path = [key]\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n variable,\n path,\n nextTraceMap,\n true,\n )\n }\n\n for (const key of this.globalObjectNames) {\n const path = []\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n }\n\n /**\n * Iterate the references of CommonJS modules.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateCjsReferences(traceMap) {\n for (const { node } of this.iterateGlobalReferences(requireCall)) {\n const key = getStringIfConstant(node.arguments[0])\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextTraceMap = traceMap[key]\n const path = [key]\n\n if (nextTraceMap[READ]) {\n yield {\n node,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(node, path, nextTraceMap)\n }\n }\n\n /**\n * Iterate the references of ES modules.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *iterateEsmReferences(traceMap) {\n const programNode = this.globalScope.block\n\n for (const node of programNode.body) {\n if (!IMPORT_TYPE.test(node.type) || node.source == null) {\n continue\n }\n const moduleId = node.source.value\n\n if (!has(traceMap, moduleId)) {\n continue\n }\n const nextTraceMap = traceMap[moduleId]\n const path = [moduleId]\n\n if (nextTraceMap[READ]) {\n yield { node, path, type: READ, info: nextTraceMap[READ] }\n }\n\n if (node.type === \"ExportAllDeclaration\") {\n for (const key of Object.keys(nextTraceMap)) {\n const exportTraceMap = nextTraceMap[key]\n if (exportTraceMap[READ]) {\n yield {\n node,\n path: path.concat(key),\n type: READ,\n info: exportTraceMap[READ],\n }\n }\n }\n } else {\n for (const specifier of node.specifiers) {\n const esm = has(nextTraceMap, ESM)\n const it = this._iterateImportReferences(\n specifier,\n path,\n esm\n ? nextTraceMap\n : this.mode === \"legacy\"\n ? { default: nextTraceMap, ...nextTraceMap }\n : { default: nextTraceMap },\n )\n\n if (esm) {\n yield* it\n } else {\n for (const report of it) {\n report.path = report.path.filter(exceptDefault)\n if (\n report.path.length >= 2 ||\n report.type !== READ\n ) {\n yield report\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Iterate the references for a given variable.\n * @param {Variable} variable The variable to iterate that references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @param {boolean} shouldReport = The flag to report those references.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateVariableReferences(variable, path, traceMap, shouldReport) {\n if (this.variableStack.includes(variable)) {\n return\n }\n this.variableStack.push(variable)\n try {\n for (const reference of variable.references) {\n if (!reference.isRead()) {\n continue\n }\n const node = reference.identifier\n\n if (shouldReport && traceMap[READ]) {\n yield { node, path, type: READ, info: traceMap[READ] }\n }\n yield* this._iteratePropertyReferences(node, path, traceMap)\n }\n } finally {\n this.variableStack.pop()\n }\n }\n\n /**\n * Iterate the references for a given AST node.\n * @param rootNode The AST node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n //eslint-disable-next-line complexity\n *_iteratePropertyReferences(rootNode, path, traceMap) {\n let node = rootNode\n while (isPassThrough(node)) {\n node = node.parent\n }\n\n const parent = node.parent\n if (parent.type === \"MemberExpression\") {\n if (parent.object === node) {\n const key = getPropertyName(parent)\n if (key == null || !has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: parent,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n parent,\n path,\n nextTraceMap,\n )\n }\n return\n }\n if (parent.type === \"CallExpression\") {\n if (parent.callee === node && traceMap[CALL]) {\n yield { node: parent, path, type: CALL, info: traceMap[CALL] }\n }\n return\n }\n if (parent.type === \"NewExpression\") {\n if (parent.callee === node && traceMap[CONSTRUCT]) {\n yield {\n node: parent,\n path,\n type: CONSTRUCT,\n info: traceMap[CONSTRUCT],\n }\n }\n return\n }\n if (parent.type === \"AssignmentExpression\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n yield* this._iteratePropertyReferences(parent, path, traceMap)\n }\n return\n }\n if (parent.type === \"AssignmentPattern\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n }\n return\n }\n if (parent.type === \"VariableDeclarator\") {\n if (parent.init === node) {\n yield* this._iterateLhsReferences(parent.id, path, traceMap)\n }\n }\n }\n\n /**\n * Iterate the references for a given Pattern node.\n * @param {Node} patternNode The Pattern node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateLhsReferences(patternNode, path, traceMap) {\n if (patternNode.type === \"Identifier\") {\n const variable = findVariable(this.globalScope, patternNode)\n if (variable != null) {\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n return\n }\n if (patternNode.type === \"ObjectPattern\") {\n for (const property of patternNode.properties) {\n const key = getPropertyName(property)\n\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextPath = path.concat(key)\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: property,\n path: nextPath,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateLhsReferences(\n property.value,\n nextPath,\n nextTraceMap,\n )\n }\n return\n }\n if (patternNode.type === \"AssignmentPattern\") {\n yield* this._iterateLhsReferences(patternNode.left, path, traceMap)\n }\n }\n\n /**\n * Iterate the references for a given ModuleSpecifier node.\n * @param {Node} specifierNode The ModuleSpecifier node to iterate references.\n * @param {string[]} path The current path.\n * @param {object} traceMap The trace map.\n * @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.\n */\n *_iterateImportReferences(specifierNode, path, traceMap) {\n const type = specifierNode.type\n\n if (type === \"ImportSpecifier\" || type === \"ImportDefaultSpecifier\") {\n const key =\n type === \"ImportDefaultSpecifier\"\n ? \"default\"\n : specifierNode.imported.name\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: specifierNode,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateVariableReferences(\n findVariable(this.globalScope, specifierNode.local),\n path,\n nextTraceMap,\n false,\n )\n\n return\n }\n\n if (type === \"ImportNamespaceSpecifier\") {\n yield* this._iterateVariableReferences(\n findVariable(this.globalScope, specifierNode.local),\n path,\n traceMap,\n false,\n )\n return\n }\n\n if (type === \"ExportSpecifier\") {\n const key = specifierNode.local.name\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: specifierNode,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n }\n }\n}\n\nReferenceTracker.READ = READ\nReferenceTracker.CALL = CALL\nReferenceTracker.CONSTRUCT = CONSTRUCT\nReferenceTracker.ESM = ESM\n\n/**\n * This is a predicate function for Array#filter.\n * @param {string} name A name part.\n * @param {number} index The index of the name.\n * @returns {boolean} `false` if it's default.\n */\nfunction exceptDefault(name, index) {\n return !(index === 1 && name === \"default\")\n}\n","import { findVariable } from \"./find-variable\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind\"\nimport { getInnermostScope } from \"./get-innermost-scope\"\nimport { getPropertyName } from \"./get-property-name\"\nimport { getStaticValue } from \"./get-static-value\"\nimport { getStringIfConstant } from \"./get-string-if-constant\"\nimport { hasSideEffect } from \"./has-side-effect\"\nimport { isParenthesized } from \"./is-parenthesized\"\nimport { PatternMatcher } from \"./pattern-matcher\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker\"\nimport {\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isSemicolonToken,\n} from \"./token-predicate\"\n\nexport default {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\nexport {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,YAAY,EAAE,IAAI,EAAE;AACtD,IAAI,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAC;AAClC;AACA,IAAI,IAAI,KAAK,GAAG,aAAY;AAC5B,IAAI,IAAI,KAAK,GAAG,MAAK;AACrB,IAAI,GAAG;AACP,QAAQ,KAAK,GAAG,MAAK;AACrB,QAAQ,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,WAAW,EAAE;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E;AACpC,IAAI,OAAO,EAAE,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,SAAS,CAAC;AAC/C,CAAC;;ACvZD,YAAe;AACf,IAAI,IAAI;AACR,IAAI,SAAS;AACb,IAAI,GAAG;AACP,IAAI,YAAY;AAChB,IAAI,uBAAuB;AAC3B,IAAI,uBAAuB;AAC3B,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,mBAAmB;AACvB,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,mBAAmB;AACvB,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,sBAAsB;AAC1B,IAAI,wBAAwB;AAC5B,IAAI,sBAAsB;AAC1B,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,IAAI,sBAAsB;AAC1B,IAAI,wBAAwB;AAC5B,IAAI,sBAAsB;AAC1B,IAAI,mBAAmB;AACvB,IAAI,mBAAmB;AACvB,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,cAAc;AAClB,IAAI,IAAI;AACR,IAAI,gBAAgB;AACpB,CAAC;;;;;"} \ No newline at end of file diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/CHANGELOG.md b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/CHANGELOG.md new file mode 100644 index 0000000..f430297 --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/CHANGELOG.md @@ -0,0 +1,36 @@ +v2.1.0 - May 3, 2021 + +* [`908fdf8`](https://github.com/eslint/eslint-visitor-keys/commit/908fdf8c0d9a352c696c8c1f4901280d1a0795f7) Update: add PrivateIdentifier and PropertyDefinition (#20) (Toru Nagashima) +* [`2d7be11`](https://github.com/eslint/eslint-visitor-keys/commit/2d7be11e4d13ac702c9fe3c529cadbd75b370146) Chore: No longer test in Node.js 13 (#17) (Michaël De Boey) +* [`b41b509`](https://github.com/eslint/eslint-visitor-keys/commit/b41b509b153ecd8d47af46a421122f64e93d4c67) Docs: Update required Node.js version (#15) (Michaël De Boey) + +v2.0.0 - August 14, 2020 + +* [`fb86ca3`](https://github.com/eslint/eslint-visitor-keys/commit/fb86ca315daafc84e23ed9005db40b0892b972a6) Breaking: drop support for Node <10 (#13) (Kai Cataldo) +* [`69383b3`](https://github.com/eslint/eslint-visitor-keys/commit/69383b372915e33ada094880ecc6b6e8f8c7ca4e) Chore: move to GitHub Actions (#14) (Kai Cataldo) + +v1.3.0 - June 19, 2020 + +* [`c92dd7f`](https://github.com/eslint/eslint-visitor-keys/commit/c92dd7ff96f0044dba12d681406a025b92b4c437) Update: add `ChainExpression` node (#12) (Toru Nagashima) + +v1.2.0 - June 4, 2020 + +* [`21f28bf`](https://github.com/eslint/eslint-visitor-keys/commit/21f28bf11be5329d740a8bf6bdbcd0ef13bbf1a2) Update: added exported in exportAllDeclaration key (#10) (Anix) + +v1.1.0 - August 13, 2019 + +* [`9331cc0`](https://github.com/eslint/eslint-visitor-keys/commit/9331cc09e756e65b9044c9186445a474b037fac6) Update: add ImportExpression (#8) (Toru Nagashima) +* [`5967f58`](https://github.com/eslint/eslint-visitor-keys/commit/5967f583b04f17fba9226aaa394e45d476d2b8af) Chore: add supported Node.js versions to CI (#7) (Kai Cataldo) +* [`6f7c60f`](https://github.com/eslint/eslint-visitor-keys/commit/6f7c60fef2ceec9f6323202df718321cec45cab0) Upgrade: eslint-release@1.0.0 (#5) (Teddy Katz) + +v1.0.0 - December 18, 2017 + +* 1f6bd38 Breaking: update keys (#4) (Toru Nagashima) + +v0.1.0 - November 17, 2017 + +* 17b4a88 Chore: update `repository` field in package.json (#3) (Toru Nagashima) +* a5a026b New: eslint-visitor-keys (#1) (Toru Nagashima) +* a1a48b8 Update: Change license to Apache 2 (#2) (Ilya Volodin) +* 2204715 Initial commit (Toru Nagashima) + diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE new file mode 100644 index 0000000..17a2553 --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md new file mode 100644 index 0000000..d7dbe65 --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md @@ -0,0 +1,98 @@ +# eslint-visitor-keys + +[![npm version](https://img.shields.io/npm/v/eslint-visitor-keys.svg)](https://www.npmjs.com/package/eslint-visitor-keys) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-visitor-keys.svg)](http://www.npmtrends.com/eslint-visitor-keys) +[![Build Status](https://travis-ci.org/eslint/eslint-visitor-keys.svg?branch=master)](https://travis-ci.org/eslint/eslint-visitor-keys) +[![Dependency Status](https://david-dm.org/eslint/eslint-visitor-keys.svg)](https://david-dm.org/eslint/eslint-visitor-keys) + +Constants and utilities about visitor keys to traverse AST. + +## 💿 Installation + +Use [npm] to install. + +```bash +$ npm install eslint-visitor-keys +``` + +### Requirements + +- [Node.js] 10.0.0 or later. + +## 📖 Usage + +```js +const evk = require("eslint-visitor-keys") +``` + +### evk.KEYS + +> type: `{ [type: string]: string[] | undefined }` + +Visitor keys. This keys are frozen. + +This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes. + +For example: + +``` +console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"] +``` + +### evk.getKeys(node) + +> type: `(node: object) => string[]` + +Get the visitor keys of a given AST node. + +This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`. + +This will be used to traverse unknown nodes. + +For example: + +``` +const node = { + type: "AssignmentExpression", + left: { type: "Identifier", name: "foo" }, + right: { type: "Literal", value: 0 } +} +console.log(evk.getKeys(node)) // → ["type", "left", "right"] +``` + +### evk.unionWith(additionalKeys) + +> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }` + +Make the union set with `evk.KEYS` and the given keys. + +- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that. +- It removes duplicated keys as keeping the first one. + +For example: + +``` +console.log(evk.unionWith({ + MethodDefinition: ["decorators"] +})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... } +``` + +## 📰 Change log + +See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases). + +## 🍻 Contributing + +Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/). + +### Development commands + +- `npm test` runs tests and measures code coverage. +- `npm run lint` checks source codes with ESLint. +- `npm run coverage` opens the code coverage report of the previous test with your default browser. +- `npm run release` publishes this package to [npm] registory. + + +[npm]: https://www.npmjs.com/ +[Node.js]: https://nodejs.org/en/ +[ESTree]: https://github.com/estree/estree diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js new file mode 100644 index 0000000..cd8a326 --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js @@ -0,0 +1,81 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict"; + +const KEYS = require("./visitor-keys.json"); + +// Types. +const NODE_TYPES = Object.freeze(Object.keys(KEYS)); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +//------------------------------------------------------------------------------ +// Public interfaces +//------------------------------------------------------------------------------ + +module.exports = Object.freeze({ + + /** + * Visitor keys. + * @type {{ [type: string]: string[] | undefined }} + */ + KEYS, + + /** + * Get visitor keys of a given node. + * @param {Object} node The AST node to get keys. + * @returns {string[]} Visitor keys of the node. + */ + getKeys(node) { + return Object.keys(node).filter(filterKey); + }, + + // Disable valid-jsdoc rule because it reports syntax error on the type of @returns. + // eslint-disable-next-line valid-jsdoc + /** + * Make the union set with `KEYS` and given keys. + * @param {Object} additionalKeys The additional keys. + * @returns {{ [type: string]: string[] | undefined }} The union set. + */ + unionWith(additionalKeys) { + const retv = Object.assign({}, KEYS); + + for (const type of Object.keys(additionalKeys)) { + if (retv.hasOwnProperty(type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); + } +}); diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json new file mode 100644 index 0000000..e648ee1 --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json @@ -0,0 +1,289 @@ +{ + "AssignmentExpression": [ + "left", + "right" + ], + "AssignmentPattern": [ + "left", + "right" + ], + "ArrayExpression": [ + "elements" + ], + "ArrayPattern": [ + "elements" + ], + "ArrowFunctionExpression": [ + "params", + "body" + ], + "AwaitExpression": [ + "argument" + ], + "BlockStatement": [ + "body" + ], + "BinaryExpression": [ + "left", + "right" + ], + "BreakStatement": [ + "label" + ], + "CallExpression": [ + "callee", + "arguments" + ], + "CatchClause": [ + "param", + "body" + ], + "ChainExpression": [ + "expression" + ], + "ClassBody": [ + "body" + ], + "ClassDeclaration": [ + "id", + "superClass", + "body" + ], + "ClassExpression": [ + "id", + "superClass", + "body" + ], + "ConditionalExpression": [ + "test", + "consequent", + "alternate" + ], + "ContinueStatement": [ + "label" + ], + "DebuggerStatement": [], + "DoWhileStatement": [ + "body", + "test" + ], + "EmptyStatement": [], + "ExportAllDeclaration": [ + "exported", + "source" + ], + "ExportDefaultDeclaration": [ + "declaration" + ], + "ExportNamedDeclaration": [ + "declaration", + "specifiers", + "source" + ], + "ExportSpecifier": [ + "exported", + "local" + ], + "ExpressionStatement": [ + "expression" + ], + "ExperimentalRestProperty": [ + "argument" + ], + "ExperimentalSpreadProperty": [ + "argument" + ], + "ForStatement": [ + "init", + "test", + "update", + "body" + ], + "ForInStatement": [ + "left", + "right", + "body" + ], + "ForOfStatement": [ + "left", + "right", + "body" + ], + "FunctionDeclaration": [ + "id", + "params", + "body" + ], + "FunctionExpression": [ + "id", + "params", + "body" + ], + "Identifier": [], + "IfStatement": [ + "test", + "consequent", + "alternate" + ], + "ImportDeclaration": [ + "specifiers", + "source" + ], + "ImportDefaultSpecifier": [ + "local" + ], + "ImportExpression": [ + "source" + ], + "ImportNamespaceSpecifier": [ + "local" + ], + "ImportSpecifier": [ + "imported", + "local" + ], + "JSXAttribute": [ + "name", + "value" + ], + "JSXClosingElement": [ + "name" + ], + "JSXElement": [ + "openingElement", + "children", + "closingElement" + ], + "JSXEmptyExpression": [], + "JSXExpressionContainer": [ + "expression" + ], + "JSXIdentifier": [], + "JSXMemberExpression": [ + "object", + "property" + ], + "JSXNamespacedName": [ + "namespace", + "name" + ], + "JSXOpeningElement": [ + "name", + "attributes" + ], + "JSXSpreadAttribute": [ + "argument" + ], + "JSXText": [], + "JSXFragment": [ + "openingFragment", + "children", + "closingFragment" + ], + "Literal": [], + "LabeledStatement": [ + "label", + "body" + ], + "LogicalExpression": [ + "left", + "right" + ], + "MemberExpression": [ + "object", + "property" + ], + "MetaProperty": [ + "meta", + "property" + ], + "MethodDefinition": [ + "key", + "value" + ], + "NewExpression": [ + "callee", + "arguments" + ], + "ObjectExpression": [ + "properties" + ], + "ObjectPattern": [ + "properties" + ], + "PrivateIdentifier": [], + "Program": [ + "body" + ], + "Property": [ + "key", + "value" + ], + "PropertyDefinition": [ + "key", + "value" + ], + "RestElement": [ + "argument" + ], + "ReturnStatement": [ + "argument" + ], + "SequenceExpression": [ + "expressions" + ], + "SpreadElement": [ + "argument" + ], + "Super": [], + "SwitchStatement": [ + "discriminant", + "cases" + ], + "SwitchCase": [ + "test", + "consequent" + ], + "TaggedTemplateExpression": [ + "tag", + "quasi" + ], + "TemplateElement": [], + "TemplateLiteral": [ + "quasis", + "expressions" + ], + "ThisExpression": [], + "ThrowStatement": [ + "argument" + ], + "TryStatement": [ + "block", + "handler", + "finalizer" + ], + "UnaryExpression": [ + "argument" + ], + "UpdateExpression": [ + "argument" + ], + "VariableDeclaration": [ + "declarations" + ], + "VariableDeclarator": [ + "id", + "init" + ], + "WhileStatement": [ + "test", + "body" + ], + "WithStatement": [ + "object", + "body" + ], + "YieldExpression": [ + "argument" + ] +} diff --git a/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json new file mode 100644 index 0000000..775706b --- /dev/null +++ b/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json @@ -0,0 +1,39 @@ +{ + "name": "eslint-visitor-keys", + "version": "2.1.0", + "description": "Constants and utilities about visitor keys to traverse AST.", + "main": "lib/index.js", + "files": [ + "lib" + ], + "engines": { + "node": ">=10" + }, + "dependencies": {}, + "devDependencies": { + "eslint": "^4.7.2", + "eslint-config-eslint": "^4.0.0", + "eslint-release": "^1.0.0", + "mocha": "^3.5.3", + "nyc": "^11.2.1", + "opener": "^1.4.3" + }, + "scripts": { + "lint": "eslint lib tests/lib", + "test": "nyc mocha tests/lib", + "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + }, + "repository": "eslint/eslint-visitor-keys", + "keywords": [], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" + }, + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme" +} diff --git a/node_modules/eslint-utils/package.json b/node_modules/eslint-utils/package.json new file mode 100644 index 0000000..574d120 --- /dev/null +++ b/node_modules/eslint-utils/package.json @@ -0,0 +1,78 @@ +{ + "name": "eslint-utils", + "version": "3.0.0", + "description": "Utilities for ESLint plugins.", + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "sideEffects": false, + "main": "index", + "module": "index.mjs", + "files": [ + "index.*" + ], + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "devDependencies": { + "@mysticatea/eslint-plugin": "^13.0.0", + "codecov": "^3.6.1", + "dot-prop": "^4.2.0", + "eslint": "^7.24.0", + "esm": "^3.2.25", + "espree": "github:eslint/espree#1c744b3a602b783926344811a9459b92afe57444", + "mocha": "^6.2.2", + "npm-run-all": "^4.1.5", + "nyc": "^14.1.1", + "opener": "^1.5.1", + "prettier": "~2.3.0", + "rimraf": "^3.0.0", + "rollup": "^1.25.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "semver": "^7.3.2", + "vuepress": "^1.2.0", + "warun": "^1.0.0" + }, + "peerDependencies": { + "eslint": ">=5" + }, + "scripts": { + "prebuild": "npm run -s clean", + "build": "rollup -c", + "clean": "rimraf .nyc_output coverage index.*", + "codecov": "nyc report -r lcovonly && codecov", + "coverage": "opener ./coverage/lcov-report/index.html", + "docs:build": "vuepress build docs", + "docs:watch": "vuepress dev docs", + "format": "npm run -s format:prettier -- --write", + "format:prettier": "prettier docs/.vuepress/config.js src/**/*.js test/**/*.js rollup.config.js .vscode/*.json *.json .github/**/*.yml *.yml docs/**/*.md *.md", + "lint": "eslint docs/.vuepress/config.js src test rollup.config.js", + "test": "run-s \"format:prettier -- --check\" lint build test:mocha", + "test:mocha": "nyc mocha --reporter dot \"test/*.js\"", + "preversion": "npm test && npm run -s build", + "postversion": "git push && git push --tags", + "prewatch": "npm run -s clean", + "watch": "warun \"{src,test}/**/*.js\" -- npm run -s test:mocha" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mysticatea/eslint-utils.git" + }, + "keywords": [ + "eslint" + ], + "author": "Toru Nagashima", + "license": "MIT", + "bugs": { + "url": "https://github.com/mysticatea/eslint-utils/issues" + }, + "homepage": "https://github.com/mysticatea/eslint-utils#readme", + "funding": "https://github.com/sponsors/mysticatea" +} diff --git a/node_modules/eslint-visitor-keys/LICENSE b/node_modules/eslint-visitor-keys/LICENSE new file mode 100644 index 0000000..17a2553 --- /dev/null +++ b/node_modules/eslint-visitor-keys/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/eslint-visitor-keys/README.md b/node_modules/eslint-visitor-keys/README.md new file mode 100644 index 0000000..8eda5c7 --- /dev/null +++ b/node_modules/eslint-visitor-keys/README.md @@ -0,0 +1,107 @@ +# eslint-visitor-keys + +[![npm version](https://img.shields.io/npm/v/eslint-visitor-keys.svg)](https://www.npmjs.com/package/eslint-visitor-keys) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-visitor-keys.svg)](http://www.npmtrends.com/eslint-visitor-keys) +[![Build Status](https://travis-ci.org/eslint/eslint-visitor-keys.svg?branch=master)](https://travis-ci.org/eslint/eslint-visitor-keys) +[![Dependency Status](https://david-dm.org/eslint/eslint-visitor-keys.svg)](https://david-dm.org/eslint/eslint-visitor-keys) + +Constants and utilities about visitor keys to traverse AST. + +## 💿 Installation + +Use [npm] to install. + +```bash +$ npm install eslint-visitor-keys +``` + +### Requirements + +- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0` + + +## 📖 Usage + +To use in an ESM file: + +```js +import * as evk from "eslint-visitor-keys" +``` + +To use in a CommonJS file: + +```js +const evk = require("eslint-visitor-keys") +``` + +### evk.KEYS + +> type: `{ [type: string]: string[] | undefined }` + +Visitor keys. This keys are frozen. + +This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes. + +For example: + +``` +console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"] +``` + +### evk.getKeys(node) + +> type: `(node: object) => string[]` + +Get the visitor keys of a given AST node. + +This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`. + +This will be used to traverse unknown nodes. + +For example: + +```js +const node = { + type: "AssignmentExpression", + left: { type: "Identifier", name: "foo" }, + right: { type: "Literal", value: 0 } +} +console.log(evk.getKeys(node)) // → ["type", "left", "right"] +``` + +### evk.unionWith(additionalKeys) + +> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }` + +Make the union set with `evk.KEYS` and the given keys. + +- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that. +- It removes duplicated keys as keeping the first one. + +For example: + +```js +console.log(evk.unionWith({ + MethodDefinition: ["decorators"] +})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... } +``` + +## 📰 Change log + +See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases). + +## 🍻 Contributing + +Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/). + +### Development commands + +- `npm test` runs tests and measures code coverage. +- `npm run lint` checks source codes with ESLint. +- `npm run coverage` opens the code coverage report of the previous test with your default browser. +- `npm run release` publishes this package to [npm] registory. + + +[npm]: https://www.npmjs.com/ +[Node.js]: https://nodejs.org/ +[ESTree]: https://github.com/estree/estree diff --git a/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs b/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs new file mode 100644 index 0000000..9d47fd7 --- /dev/null +++ b/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs @@ -0,0 +1,382 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * @typedef {import('./index.js').VisitorKeys} VisitorKeys + */ + +/** + * @type {VisitorKeys} + */ +const KEYS = { + AssignmentExpression: [ + "left", + "right" + ], + AssignmentPattern: [ + "left", + "right" + ], + ArrayExpression: [ + "elements" + ], + ArrayPattern: [ + "elements" + ], + ArrowFunctionExpression: [ + "params", + "body" + ], + AwaitExpression: [ + "argument" + ], + BlockStatement: [ + "body" + ], + BinaryExpression: [ + "left", + "right" + ], + BreakStatement: [ + "label" + ], + CallExpression: [ + "callee", + "arguments" + ], + CatchClause: [ + "param", + "body" + ], + ChainExpression: [ + "expression" + ], + ClassBody: [ + "body" + ], + ClassDeclaration: [ + "id", + "superClass", + "body" + ], + ClassExpression: [ + "id", + "superClass", + "body" + ], + ConditionalExpression: [ + "test", + "consequent", + "alternate" + ], + ContinueStatement: [ + "label" + ], + DebuggerStatement: [], + DoWhileStatement: [ + "body", + "test" + ], + EmptyStatement: [], + ExportAllDeclaration: [ + "exported", + "source" + ], + ExportDefaultDeclaration: [ + "declaration" + ], + ExportNamedDeclaration: [ + "declaration", + "specifiers", + "source" + ], + ExportSpecifier: [ + "exported", + "local" + ], + ExpressionStatement: [ + "expression" + ], + ExperimentalRestProperty: [ + "argument" + ], + ExperimentalSpreadProperty: [ + "argument" + ], + ForStatement: [ + "init", + "test", + "update", + "body" + ], + ForInStatement: [ + "left", + "right", + "body" + ], + ForOfStatement: [ + "left", + "right", + "body" + ], + FunctionDeclaration: [ + "id", + "params", + "body" + ], + FunctionExpression: [ + "id", + "params", + "body" + ], + Identifier: [], + IfStatement: [ + "test", + "consequent", + "alternate" + ], + ImportDeclaration: [ + "specifiers", + "source" + ], + ImportDefaultSpecifier: [ + "local" + ], + ImportExpression: [ + "source" + ], + ImportNamespaceSpecifier: [ + "local" + ], + ImportSpecifier: [ + "imported", + "local" + ], + JSXAttribute: [ + "name", + "value" + ], + JSXClosingElement: [ + "name" + ], + JSXElement: [ + "openingElement", + "children", + "closingElement" + ], + JSXEmptyExpression: [], + JSXExpressionContainer: [ + "expression" + ], + JSXIdentifier: [], + JSXMemberExpression: [ + "object", + "property" + ], + JSXNamespacedName: [ + "namespace", + "name" + ], + JSXOpeningElement: [ + "name", + "attributes" + ], + JSXSpreadAttribute: [ + "argument" + ], + JSXText: [], + JSXFragment: [ + "openingFragment", + "children", + "closingFragment" + ], + JSXClosingFragment: [], + JSXOpeningFragment: [], + Literal: [], + LabeledStatement: [ + "label", + "body" + ], + LogicalExpression: [ + "left", + "right" + ], + MemberExpression: [ + "object", + "property" + ], + MetaProperty: [ + "meta", + "property" + ], + MethodDefinition: [ + "key", + "value" + ], + NewExpression: [ + "callee", + "arguments" + ], + ObjectExpression: [ + "properties" + ], + ObjectPattern: [ + "properties" + ], + PrivateIdentifier: [], + Program: [ + "body" + ], + Property: [ + "key", + "value" + ], + PropertyDefinition: [ + "key", + "value" + ], + RestElement: [ + "argument" + ], + ReturnStatement: [ + "argument" + ], + SequenceExpression: [ + "expressions" + ], + SpreadElement: [ + "argument" + ], + StaticBlock: [ + "body" + ], + Super: [], + SwitchStatement: [ + "discriminant", + "cases" + ], + SwitchCase: [ + "test", + "consequent" + ], + TaggedTemplateExpression: [ + "tag", + "quasi" + ], + TemplateElement: [], + TemplateLiteral: [ + "quasis", + "expressions" + ], + ThisExpression: [], + ThrowStatement: [ + "argument" + ], + TryStatement: [ + "block", + "handler", + "finalizer" + ], + UnaryExpression: [ + "argument" + ], + UpdateExpression: [ + "argument" + ], + VariableDeclaration: [ + "declarations" + ], + VariableDeclarator: [ + "id", + "init" + ], + WhileStatement: [ + "test", + "body" + ], + WithStatement: [ + "object", + "body" + ], + YieldExpression: [ + "argument" + ] +}; + +// Types. +const NODE_TYPES = Object.keys(KEYS); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +function getKeys(node) { + return Object.keys(node).filter(filterKey); +} + +// Disable valid-jsdoc rule because it reports syntax error on the type of @returns. +// eslint-disable-next-line valid-jsdoc +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +function unionWith(additionalKeys) { + const retv = /** @type {{ + [type: string]: ReadonlyArray + }} */ (Object.assign({}, KEYS)); + + for (const type of Object.keys(additionalKeys)) { + if (Object.prototype.hasOwnProperty.call(retv, type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); +} + +exports.KEYS = KEYS; +exports.getKeys = getKeys; +exports.unionWith = unionWith; +//# sourceMappingURL=eslint-visitor-keys.cjs.map diff --git a/node_modules/eslint-visitor-keys/dist/index.d.ts b/node_modules/eslint-visitor-keys/dist/index.d.ts new file mode 100644 index 0000000..d866198 --- /dev/null +++ b/node_modules/eslint-visitor-keys/dist/index.d.ts @@ -0,0 +1,18 @@ +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +export function getKeys(node: object): readonly string[]; +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +export function unionWith(additionalKeys: VisitorKeys): VisitorKeys; +export { KEYS }; +export type VisitorKeys = { + readonly [type: string]: readonly string[]; +}; +import KEYS from "./visitor-keys.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts b/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts new file mode 100644 index 0000000..1919238 --- /dev/null +++ b/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts @@ -0,0 +1,10 @@ +export default KEYS; +export type VisitorKeys = import('./index.js').VisitorKeys; +/** + * @typedef {import('./index.js').VisitorKeys} VisitorKeys + */ +/** + * @type {VisitorKeys} + */ +declare const KEYS: VisitorKeys; +//# sourceMappingURL=visitor-keys.d.ts.map \ No newline at end of file diff --git a/node_modules/eslint-visitor-keys/lib/index.js b/node_modules/eslint-visitor-keys/lib/index.js new file mode 100644 index 0000000..83ebb1f --- /dev/null +++ b/node_modules/eslint-visitor-keys/lib/index.js @@ -0,0 +1,65 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +import KEYS from "./visitor-keys.js"; + +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +export function getKeys(node) { + return Object.keys(node).filter(filterKey); +} + +// Disable valid-jsdoc rule because it reports syntax error on the type of @returns. +// eslint-disable-next-line valid-jsdoc +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +export function unionWith(additionalKeys) { + const retv = /** @type {{ + [type: string]: ReadonlyArray + }} */ (Object.assign({}, KEYS)); + + for (const type of Object.keys(additionalKeys)) { + if (Object.prototype.hasOwnProperty.call(retv, type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); +} + +export { KEYS }; diff --git a/node_modules/eslint-visitor-keys/lib/visitor-keys.js b/node_modules/eslint-visitor-keys/lib/visitor-keys.js new file mode 100644 index 0000000..d456d64 --- /dev/null +++ b/node_modules/eslint-visitor-keys/lib/visitor-keys.js @@ -0,0 +1,312 @@ +/** + * @typedef {import('./index.js').VisitorKeys} VisitorKeys + */ + +/** + * @type {VisitorKeys} + */ +const KEYS = { + AssignmentExpression: [ + "left", + "right" + ], + AssignmentPattern: [ + "left", + "right" + ], + ArrayExpression: [ + "elements" + ], + ArrayPattern: [ + "elements" + ], + ArrowFunctionExpression: [ + "params", + "body" + ], + AwaitExpression: [ + "argument" + ], + BlockStatement: [ + "body" + ], + BinaryExpression: [ + "left", + "right" + ], + BreakStatement: [ + "label" + ], + CallExpression: [ + "callee", + "arguments" + ], + CatchClause: [ + "param", + "body" + ], + ChainExpression: [ + "expression" + ], + ClassBody: [ + "body" + ], + ClassDeclaration: [ + "id", + "superClass", + "body" + ], + ClassExpression: [ + "id", + "superClass", + "body" + ], + ConditionalExpression: [ + "test", + "consequent", + "alternate" + ], + ContinueStatement: [ + "label" + ], + DebuggerStatement: [], + DoWhileStatement: [ + "body", + "test" + ], + EmptyStatement: [], + ExportAllDeclaration: [ + "exported", + "source" + ], + ExportDefaultDeclaration: [ + "declaration" + ], + ExportNamedDeclaration: [ + "declaration", + "specifiers", + "source" + ], + ExportSpecifier: [ + "exported", + "local" + ], + ExpressionStatement: [ + "expression" + ], + ExperimentalRestProperty: [ + "argument" + ], + ExperimentalSpreadProperty: [ + "argument" + ], + ForStatement: [ + "init", + "test", + "update", + "body" + ], + ForInStatement: [ + "left", + "right", + "body" + ], + ForOfStatement: [ + "left", + "right", + "body" + ], + FunctionDeclaration: [ + "id", + "params", + "body" + ], + FunctionExpression: [ + "id", + "params", + "body" + ], + Identifier: [], + IfStatement: [ + "test", + "consequent", + "alternate" + ], + ImportDeclaration: [ + "specifiers", + "source" + ], + ImportDefaultSpecifier: [ + "local" + ], + ImportExpression: [ + "source" + ], + ImportNamespaceSpecifier: [ + "local" + ], + ImportSpecifier: [ + "imported", + "local" + ], + JSXAttribute: [ + "name", + "value" + ], + JSXClosingElement: [ + "name" + ], + JSXElement: [ + "openingElement", + "children", + "closingElement" + ], + JSXEmptyExpression: [], + JSXExpressionContainer: [ + "expression" + ], + JSXIdentifier: [], + JSXMemberExpression: [ + "object", + "property" + ], + JSXNamespacedName: [ + "namespace", + "name" + ], + JSXOpeningElement: [ + "name", + "attributes" + ], + JSXSpreadAttribute: [ + "argument" + ], + JSXText: [], + JSXFragment: [ + "openingFragment", + "children", + "closingFragment" + ], + JSXClosingFragment: [], + JSXOpeningFragment: [], + Literal: [], + LabeledStatement: [ + "label", + "body" + ], + LogicalExpression: [ + "left", + "right" + ], + MemberExpression: [ + "object", + "property" + ], + MetaProperty: [ + "meta", + "property" + ], + MethodDefinition: [ + "key", + "value" + ], + NewExpression: [ + "callee", + "arguments" + ], + ObjectExpression: [ + "properties" + ], + ObjectPattern: [ + "properties" + ], + PrivateIdentifier: [], + Program: [ + "body" + ], + Property: [ + "key", + "value" + ], + PropertyDefinition: [ + "key", + "value" + ], + RestElement: [ + "argument" + ], + ReturnStatement: [ + "argument" + ], + SequenceExpression: [ + "expressions" + ], + SpreadElement: [ + "argument" + ], + StaticBlock: [ + "body" + ], + Super: [], + SwitchStatement: [ + "discriminant", + "cases" + ], + SwitchCase: [ + "test", + "consequent" + ], + TaggedTemplateExpression: [ + "tag", + "quasi" + ], + TemplateElement: [], + TemplateLiteral: [ + "quasis", + "expressions" + ], + ThisExpression: [], + ThrowStatement: [ + "argument" + ], + TryStatement: [ + "block", + "handler", + "finalizer" + ], + UnaryExpression: [ + "argument" + ], + UpdateExpression: [ + "argument" + ], + VariableDeclaration: [ + "declarations" + ], + VariableDeclarator: [ + "id", + "init" + ], + WhileStatement: [ + "test", + "body" + ], + WithStatement: [ + "object", + "body" + ], + YieldExpression: [ + "argument" + ] +}; + +// Types. +const NODE_TYPES = Object.keys(KEYS); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +export default KEYS; diff --git a/node_modules/eslint-visitor-keys/package.json b/node_modules/eslint-visitor-keys/package.json new file mode 100644 index 0000000..5368ad5 --- /dev/null +++ b/node_modules/eslint-visitor-keys/package.json @@ -0,0 +1,62 @@ +{ + "name": "eslint-visitor-keys", + "version": "3.3.0", + "description": "Constants and utilities about visitor keys to traverse AST.", + "type": "module", + "main": "dist/eslint-visitor-keys.cjs", + "types": "./dist/index.d.ts", + "exports": { + ".": [ + { + "import": "./lib/index.js", + "require": "./dist/eslint-visitor-keys.cjs" + }, + "./dist/eslint-visitor-keys.cjs" + ], + "./package.json": "./package.json" + }, + "files": [ + "dist/index.d.ts", + "dist/visitor-keys.d.ts", + "dist/eslint-visitor-keys.cjs", + "lib" + ], + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "devDependencies": { + "c8": "^7.7.3", + "eslint": "^7.29.0", + "eslint-config-eslint": "^7.0.0", + "eslint-plugin-jsdoc": "^35.4.0", + "eslint-plugin-node": "^11.1.0", + "eslint-release": "^3.2.0", + "mocha": "^9.0.1", + "opener": "^1.5.2", + "rollup": "^2.52.1", + "tsd": "^0.19.1", + "typescript": "^4.5.5" + }, + "scripts": { + "prepare": "npm run build", + "build": "rollup -c && npm run tsc", + "lint": "eslint .", + "tsc": "tsc", + "tsd": "tsd", + "test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run tsd", + "coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + }, + "repository": "eslint/eslint-visitor-keys", + "keywords": [], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" + }, + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme" +} diff --git a/node_modules/eslint/LICENSE b/node_modules/eslint/LICENSE new file mode 100644 index 0000000..b607bb3 --- /dev/null +++ b/node_modules/eslint/LICENSE @@ -0,0 +1,19 @@ +Copyright OpenJS Foundation and other contributors, + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/eslint/README.md b/node_modules/eslint/README.md new file mode 100644 index 0000000..56ebb3c --- /dev/null +++ b/node_modules/eslint/README.md @@ -0,0 +1,304 @@ +[![npm version](https://img.shields.io/npm/v/eslint.svg)](https://www.npmjs.com/package/eslint) +[![Downloads](https://img.shields.io/npm/dm/eslint.svg)](https://www.npmjs.com/package/eslint) +[![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_shield) +
+[![Open Collective Backers](https://img.shields.io/opencollective/backers/eslint)](https://opencollective.com/eslint) +[![Open Collective Sponsors](https://img.shields.io/opencollective/sponsors/eslint)](https://opencollective.com/eslint) +[![Follow us on Twitter](https://img.shields.io/twitter/follow/geteslint?label=Follow&style=social)](https://twitter.com/intent/user?screen_name=geteslint) + +# ESLint + +[Website](https://eslint.org) | +[Configuring](https://eslint.org/docs/user-guide/configuring) | +[Rules](https://eslint.org/docs/rules/) | +[Contributing](https://eslint.org/docs/developer-guide/contributing) | +[Reporting Bugs](https://eslint.org/docs/developer-guide/contributing/reporting-bugs) | +[Code of Conduct](https://eslint.org/conduct) | +[Twitter](https://twitter.com/geteslint) | +[Mailing List](https://groups.google.com/group/eslint) | +[Chat Room](https://eslint.org/chat) + +ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions: + +* ESLint uses [Espree](https://github.com/eslint/espree) for JavaScript parsing. +* ESLint uses an AST to evaluate patterns in code. +* ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. + +## Table of Contents + +1. [Installation and Usage](#installation-and-usage) +2. [Configuration](#configuration) +3. [Code of Conduct](#code-of-conduct) +4. [Filing Issues](#filing-issues) +5. [Frequently Asked Questions](#faq) +6. [Releases](#releases) +7. [Security Policy](#security-policy) +8. [Semantic Versioning Policy](#semantic-versioning-policy) +9. [Stylistic Rule Updates](#stylistic-rule-updates) +10. [License](#license) +11. [Team](#team) +12. [Sponsors](#sponsors) +13. [Technology Sponsors](#technology-sponsors) + +## Installation and Usage + +Prerequisites: [Node.js](https://nodejs.org/) (`^12.22.0`, `^14.17.0`, or `>=16.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) + +You can install ESLint using npm: + +```sh +npm install eslint --save-dev +``` + +You should then set up a configuration file: + +```sh +npm init @eslint/config +``` + +After that, you can run ESLint on any file or directory like this: + +```sh +./node_modules/.bin/eslint yourfile.js +``` + +## Configuration + +After running `npm init @eslint/config`, you'll have a `.eslintrc` file in your directory. In it, you'll see some rules configured like this: + +```json +{ + "rules": { + "semi": ["error", "always"], + "quotes": ["error", "double"] + } +} +``` + +The names `"semi"` and `"quotes"` are the names of [rules](https://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values: + +* `"off"` or `0` - turn the rule off +* `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code) +* `"error"` or `2` - turn the rule on as an error (exit code will be 1) + +The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/user-guide/configuring)). + +## Code of Conduct + +ESLint adheres to the [JS Foundation Code of Conduct](https://eslint.org/conduct). + +## Filing Issues + +Before filing an issue, please be sure to read the guidelines for what you're reporting: + +* [Bug Report](https://eslint.org/docs/developer-guide/contributing/reporting-bugs) +* [Propose a New Rule](https://eslint.org/docs/developer-guide/contributing/new-rules) +* [Proposing a Rule Change](https://eslint.org/docs/developer-guide/contributing/rule-changes) +* [Request a Change](https://eslint.org/docs/developer-guide/contributing/changes) + +## Frequently Asked Questions + +### I'm using JSCS, should I migrate to ESLint? + +Yes. [JSCS has reached end of life](https://eslint.org/blog/2016/07/jscs-end-of-life) and is no longer supported. + +We have prepared a [migration guide](https://eslint.org/docs/user-guide/migrating-from-jscs) to help you convert your JSCS settings to an ESLint configuration. + +We are now at or near 100% compatibility with JSCS. If you try ESLint and believe we are not yet compatible with a JSCS rule/configuration, please create an issue (mentioning that it is a JSCS compatibility issue) and we will evaluate it as per our normal process. + +### Does Prettier replace ESLint? + +No, ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use ESLint for everything, or you can combine both using Prettier to format your code and ESLint to catch possible errors. + +### Why can't ESLint find my plugins? + +* Make sure your plugins (and ESLint) are both in your project's `package.json` as devDependencies (or dependencies, if your project uses ESLint at runtime). +* Make sure you have run `npm install` and all your dependencies are installed. +* Make sure your plugins' peerDependencies have been installed as well. You can use `npm view eslint-plugin-myplugin peerDependencies` to see what peer dependencies `eslint-plugin-myplugin` has. + +### Does ESLint support JSX? + +Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/user-guide/configuring)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics. + +### What ECMAScript versions does ESLint support? + +ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring). + +### What about experimental features? + +ESLint's parser only officially supports the latest final ECMAScript standard. We will make changes to core rules in order to avoid crashes on stage 3 ECMAScript syntax proposals (as long as they are implemented using the correct experimental ESTree syntax). We may make changes to core rules to better work with language extensions (such as JSX, Flow, and TypeScript) on a case-by-case basis. + +In other cases (including if rules need to warn on more or fewer cases due to new syntax, rather than just not crashing), we recommend you use other parsers and/or rule plugins. If you are using Babel, you can use [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) and [@babel/eslint-plugin](https://www.npmjs.com/package/@babel/eslint-plugin) to use any option available in Babel. + +Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the [TC39 process](https://tc39.github.io/process-document/)), we will accept issues and pull requests related to the new feature, subject to our [contributing guidelines](https://eslint.org/docs/developer-guide/contributing). Until then, please use the appropriate parser and plugin(s) for your experimental feature. + +### Where to ask for help? + +Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://eslint.org/chat). + +### Why doesn't ESLint lock dependency versions? + +Lock files like `package-lock.json` are helpful for deployed applications. They ensure that dependencies are consistent between environments and across deployments. + +Packages like `eslint` that get published to the npm registry do not include lock files. `npm install eslint` as a user will respect version constraints in ESLint's `package.json`. ESLint and its dependencies will be included in the user's lock file if one exists, but ESLint's own lock file would not be used. + +We intentionally don't lock dependency versions so that we have the latest compatible dependency versions in development and CI that our users get when installing ESLint in a project. + +The Twilio blog has a [deeper dive](https://www.twilio.com/blog/lockfiles-nodejs) to learn more. + +## Releases + +We have scheduled releases every two weeks on Friday or Saturday. You can follow a [release issue](https://github.com/eslint/eslint/issues?q=is%3Aopen+is%3Aissue+label%3Arelease) for updates about the scheduling of any particular release. + +## Security Policy + +ESLint takes security seriously. We work hard to ensure that ESLint is safe for everyone and that security issues are addressed quickly and responsibly. Read the full [security policy](https://github.com/eslint/.github/blob/master/SECURITY.md). + +## Semantic Versioning Policy + +ESLint follows [semantic versioning](https://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint: + +* Patch release (intended to not break your lint build) + * A bug fix in a rule that results in ESLint reporting fewer linting errors. + * A bug fix to the CLI or core (including formatters). + * Improvements to documentation. + * Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage. + * Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone). +* Minor release (might break your lint build) + * A bug fix in a rule that results in ESLint reporting more linting errors. + * A new rule is created. + * A new option to an existing rule that does not result in ESLint reporting more linting errors by default. + * A new addition to an existing rule to support a newly-added language feature (within the last 12 months) that will result in ESLint reporting more linting errors by default. + * An existing rule is deprecated. + * A new CLI capability is created. + * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.). + * A new formatter is created. + * `eslint:recommended` is updated and will result in strictly fewer linting errors (e.g., rule removals). +* Major release (likely to break your lint build) + * `eslint:recommended` is updated and may result in new linting errors (e.g., rule additions, most rule option updates). + * A new option to an existing rule that results in ESLint reporting more linting errors by default. + * An existing formatter is removed. + * Part of the public API is removed or changed in an incompatible way. The public API includes: + * Rule schemas + * Configuration schema + * Command-line options + * Node.js API + * Rule, formatter, parser, plugin APIs + +According to our policy, any minor update may report more linting errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds. + +## Stylistic Rule Updates + +Stylistic rules are frozen according to [our policy](https://eslint.org/blog/2020/05/changes-to-rules-policies) on how we evaluate new rules and rule changes. +This means: + +* **Bug fixes**: We will still fix bugs in stylistic rules. +* **New ECMAScript features**: We will also make sure stylistic rules are compatible with new ECMAScript features. +* **New options**: We will **not** add any new options to stylistic rules unless an option is the only way to fix a bug or support a newly-added ECMAScript feature. + +## License + +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large) + +## Team + +These folks keep the project moving and are resources for help. + + + + + +### Technical Steering Committee (TSC) + +The people who manage releases, review feature requests, and meet regularly to ensure ESLint is properly maintained. + +
+ +
+Nicholas C. Zakas +
+
+ +
+Brandon Mills +
+
+ +
+Milos Djermanovic +
+
+ +### Reviewers + +The people who review and implement new features. + +
+ +
+唯然 +
+
+ +
+Nitin Kumar +
+
+ +### Committers + +The people who review and fix bugs and help triage issues. + +
+ +
+Brett Zamir +
+
+ +
+Bryan Mishkin +
+
+ +
+Sara Soueidan +
+
+ +
+Pig Fang +
+
+ +
+Anix +
+
+ +
+YeonJuan +
+
+ + + +## Sponsors + +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://opencollective.com/eslint) to get your logo on our README and website. + + + +

Platinum Sponsors

+

Automattic

Gold Sponsors

+

Salesforce Airbnb American Express

Silver Sponsors

+

Liftoff

Bronze Sponsors

+

launchdarkly Nx (by Nrwl) Anagram Solver VPS Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Ignition HeroCoders

+ + +## Technology Sponsors + +* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com) +* Hosting for ([eslint.org](https://eslint.org)) is sponsored by [Netlify](https://www.netlify.com) +* Password management is sponsored by [1Password](https://www.1password.com) diff --git a/node_modules/eslint/bin/eslint.js b/node_modules/eslint/bin/eslint.js new file mode 100755 index 0000000..0f76fc9 --- /dev/null +++ b/node_modules/eslint/bin/eslint.js @@ -0,0 +1,142 @@ +#!/usr/bin/env node + +/** + * @fileoverview Main CLI that is run via the eslint command. + * @author Nicholas C. Zakas + */ + +/* eslint no-console:off -- CLI */ + +"use strict"; + +// to use V8's code cache to speed up instantiation time +require("v8-compile-cache"); + +// must do this initialization *before* other requires in order to work +if (process.argv.includes("--debug")) { + require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*"); +} + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Read data from stdin til the end. + * + * Note: See + * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin + * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io + * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html + * - https://github.com/nodejs/node/issues/7439 (historical) + * + * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems + * to read 4096 bytes before blocking and never drains to read further data. + * + * The investigation on the Emacs thread indicates: + * + * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a + * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than + * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for + * > the subprocess to read its end of the pipe, at which time Emacs will + * > write the rest of the stuff. + * @returns {Promise} The read text. + */ +function readStdin() { + return new Promise((resolve, reject) => { + let content = ""; + let chunk = ""; + + process.stdin + .setEncoding("utf8") + .on("readable", () => { + while ((chunk = process.stdin.read()) !== null) { + content += chunk; + } + }) + .on("end", () => resolve(content)) + .on("error", reject); + }); +} + +/** + * Get the error message of a given value. + * @param {any} error The value to get. + * @returns {string} The error message. + */ +function getErrorMessage(error) { + + // Lazy loading because this is used only if an error happened. + const util = require("util"); + + // Foolproof -- third-party module might throw non-object. + if (typeof error !== "object" || error === null) { + return String(error); + } + + // Use templates if `error.messageTemplate` is present. + if (typeof error.messageTemplate === "string") { + try { + const template = require(`../messages/${error.messageTemplate}.js`); + + return template(error.messageData || {}); + } catch { + + // Ignore template error then fallback to use `error.stack`. + } + } + + // Use the stacktrace if it's an error object. + if (typeof error.stack === "string") { + return error.stack; + } + + // Otherwise, dump the object. + return util.format("%o", error); +} + +/** + * Catch and report unexpected error. + * @param {any} error The thrown error object. + * @returns {void} + */ +function onFatalError(error) { + process.exitCode = 2; + + const { version } = require("../package.json"); + const message = getErrorMessage(error); + + console.error(` +Oops! Something went wrong! :( + +ESLint: ${version} + +${message}`); +} + +//------------------------------------------------------------------------------ +// Execution +//------------------------------------------------------------------------------ + +(async function main() { + process.on("uncaughtException", onFatalError); + process.on("unhandledRejection", onFatalError); + + // Call the config initializer if `--init` is present. + if (process.argv.includes("--init")) { + + // `eslint --init` has been moved to `@eslint/create-config` + console.warn("You can also run this command directly using 'npm init @eslint/config'."); + + const spawn = require("cross-spawn"); + + spawn.sync("npm", ["init", "@eslint/config"], { encoding: "utf8", stdio: "inherit" }); + return; + } + + // Otherwise, call the CLI. + process.exitCode = await require("../lib/cli").execute( + process.argv, + process.argv.includes("--stdin") ? await readStdin() : null + ); +}()).catch(onFatalError); diff --git a/node_modules/eslint/conf/config-schema.js b/node_modules/eslint/conf/config-schema.js new file mode 100644 index 0000000..b83f657 --- /dev/null +++ b/node_modules/eslint/conf/config-schema.js @@ -0,0 +1,93 @@ +/* + * STOP!!! DO NOT MODIFY. + * + * This file is part of the ongoing work to move the eslintrc-style config + * system into the @eslint/eslintrc package. This file needs to remain + * unchanged in order for this work to proceed. + * + * If you think you need to change this file, please contact @nzakas first. + * + * Thanks in advance for your cooperation. + */ + +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ + +"use strict"; + +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, + + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; + +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, + + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, + + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, + + $ref: "#/definitions/objectConfig" +}; + +module.exports = configSchema; diff --git a/node_modules/eslint/conf/default-cli-options.js b/node_modules/eslint/conf/default-cli-options.js new file mode 100644 index 0000000..dad03d8 --- /dev/null +++ b/node_modules/eslint/conf/default-cli-options.js @@ -0,0 +1,32 @@ +/** + * @fileoverview Default CLIEngineOptions. + * @author Ian VanSchooten + */ + +"use strict"; + +module.exports = { + configFile: null, + baseConfig: false, + rulePaths: [], + useEslintrc: true, + envs: [], + globals: [], + extensions: null, + ignore: true, + ignorePath: void 0, + cache: false, + + /* + * in order to honor the cacheFile option if specified + * this option should not have a default value otherwise + * it will always be used + */ + cacheLocation: "", + cacheFile: ".eslintcache", + cacheStrategy: "metadata", + fix: false, + allowInlineConfig: true, + reportUnusedDisableDirectives: void 0, + globInputPaths: true +}; diff --git a/node_modules/eslint/conf/eslint-all.js b/node_modules/eslint/conf/eslint-all.js new file mode 100644 index 0000000..10c5304 --- /dev/null +++ b/node_modules/eslint/conf/eslint-all.js @@ -0,0 +1,31 @@ +/** + * @fileoverview Config to enable all rules. + * @author Robert Fletcher + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const builtInRules = require("../lib/rules"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const allRules = {}; + +for (const [ruleId, rule] of builtInRules) { + if (!rule.meta.deprecated) { + allRules[ruleId] = "error"; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {import("../lib/shared/types").ConfigData} */ +module.exports = { rules: allRules }; diff --git a/node_modules/eslint/conf/eslint-recommended.js b/node_modules/eslint/conf/eslint-recommended.js new file mode 100644 index 0000000..6f63985 --- /dev/null +++ b/node_modules/eslint/conf/eslint-recommended.js @@ -0,0 +1,76 @@ +/** + * @fileoverview Configuration applied when a user configuration extends from + * eslint:recommended. + * @author Nicholas C. Zakas + */ + +"use strict"; + +/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */ + +/** @type {import("../lib/shared/types").ConfigData} */ +module.exports = { + rules: { + "constructor-super": "error", + "for-direction": "error", + "getter-return": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-extra-semi": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-import-assign": "error", + "no-inner-declarations": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-mixed-spaces-and-tabs": "error", + "no-new-symbol": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-this-before-super": "error", + "no-undef": "error", + "no-unexpected-multiline": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-vars": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-escape": "error", + "no-with": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error" + } +}; diff --git a/node_modules/eslint/conf/globals.js b/node_modules/eslint/conf/globals.js new file mode 100644 index 0000000..076ffb2 --- /dev/null +++ b/node_modules/eslint/conf/globals.js @@ -0,0 +1,144 @@ +/** + * @fileoverview Globals for ecmaVersion/sourceType + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- + +const commonjs = { + exports: true, + global: false, + module: false, + require: false +}; + +const es3 = { + Array: false, + Boolean: false, + constructor: false, + Date: false, + decodeURI: false, + decodeURIComponent: false, + encodeURI: false, + encodeURIComponent: false, + Error: false, + escape: false, + eval: false, + EvalError: false, + Function: false, + hasOwnProperty: false, + Infinity: false, + isFinite: false, + isNaN: false, + isPrototypeOf: false, + Math: false, + NaN: false, + Number: false, + Object: false, + parseFloat: false, + parseInt: false, + propertyIsEnumerable: false, + RangeError: false, + ReferenceError: false, + RegExp: false, + String: false, + SyntaxError: false, + toLocaleString: false, + toString: false, + TypeError: false, + undefined: false, + unescape: false, + URIError: false, + valueOf: false +}; + +const es5 = { + ...es3, + JSON: false +}; + +const es2015 = { + ...es5, + ArrayBuffer: false, + DataView: false, + Float32Array: false, + Float64Array: false, + Int16Array: false, + Int32Array: false, + Int8Array: false, + Map: false, + Promise: false, + Proxy: false, + Reflect: false, + Set: false, + Symbol: false, + Uint16Array: false, + Uint32Array: false, + Uint8Array: false, + Uint8ClampedArray: false, + WeakMap: false, + WeakSet: false +}; + +// no new globals in ES2016 +const es2016 = { + ...es2015 +}; + +const es2017 = { + ...es2016, + Atomics: false, + SharedArrayBuffer: false +}; + +// no new globals in ES2018 +const es2018 = { + ...es2017 +}; + +// no new globals in ES2019 +const es2019 = { + ...es2018 +}; + +const es2020 = { + ...es2019, + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; + +const es2021 = { + ...es2020, + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +const es2022 = { + ...es2021 +}; + + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +module.exports = { + commonjs, + es3, + es5, + es2015, + es2016, + es2017, + es2018, + es2019, + es2020, + es2021, + es2022 +}; diff --git a/node_modules/eslint/conf/replacements.json b/node_modules/eslint/conf/replacements.json new file mode 100644 index 0000000..c047811 --- /dev/null +++ b/node_modules/eslint/conf/replacements.json @@ -0,0 +1,22 @@ +{ + "rules": { + "generator-star": ["generator-star-spacing"], + "global-strict": ["strict"], + "no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"], + "no-comma-dangle": ["comma-dangle"], + "no-empty-class": ["no-empty-character-class"], + "no-empty-label": ["no-labels"], + "no-extra-strict": ["strict"], + "no-reserved-keys": ["quote-props"], + "no-space-before-semi": ["semi-spacing"], + "no-wrap-func": ["no-extra-parens"], + "space-after-function-name": ["space-before-function-paren"], + "space-after-keywords": ["keyword-spacing"], + "space-before-function-parentheses": ["space-before-function-paren"], + "space-before-keywords": ["keyword-spacing"], + "space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"], + "space-return-throw-case": ["keyword-spacing"], + "space-unary-word-ops": ["space-unary-ops"], + "spaced-line-comment": ["spaced-comment"] + } +} diff --git a/node_modules/eslint/conf/rule-type-list.json b/node_modules/eslint/conf/rule-type-list.json new file mode 100644 index 0000000..f362aa4 --- /dev/null +++ b/node_modules/eslint/conf/rule-type-list.json @@ -0,0 +1,36 @@ +{ + "types": [ + { "name": "problem", "displayName": "Possible Problems", "description": "These rules relate to possible logic errors in code:" }, + { "name": "suggestion", "displayName": "Suggestions", "description": "These rules suggest alternate ways of doing things:" }, + { "name": "layout", "displayName": "Layout & Formatting", "description": "These rules care about how the code looks rather than how it executes:" } + ], + "deprecated": { + "name": "Deprecated", + "description": "These rules have been deprecated in accordance with the deprecation policy, and replaced by newer rules:", + "rules": [] + }, + "removed": { + "name": "Removed", + "description": "These rules from older versions of ESLint (before the deprecation policy existed) have been replaced by newer rules:", + "rules": [ + { "removed": "generator-star", "replacedBy": ["generator-star-spacing"] }, + { "removed": "global-strict", "replacedBy": ["strict"] }, + { "removed": "no-arrow-condition", "replacedBy": ["no-confusing-arrow", "no-constant-condition"] }, + { "removed": "no-comma-dangle", "replacedBy": ["comma-dangle"] }, + { "removed": "no-empty-class", "replacedBy": ["no-empty-character-class"] }, + { "removed": "no-empty-label", "replacedBy": ["no-labels"] }, + { "removed": "no-extra-strict", "replacedBy": ["strict"] }, + { "removed": "no-reserved-keys", "replacedBy": ["quote-props"] }, + { "removed": "no-space-before-semi", "replacedBy": ["semi-spacing"] }, + { "removed": "no-wrap-func", "replacedBy": ["no-extra-parens"] }, + { "removed": "space-after-function-name", "replacedBy": ["space-before-function-paren"] }, + { "removed": "space-after-keywords", "replacedBy": ["keyword-spacing"] }, + { "removed": "space-before-function-parentheses", "replacedBy": ["space-before-function-paren"] }, + { "removed": "space-before-keywords", "replacedBy": ["keyword-spacing"] }, + { "removed": "space-in-brackets", "replacedBy": ["object-curly-spacing", "array-bracket-spacing"] }, + { "removed": "space-return-throw-case", "replacedBy": ["keyword-spacing"] }, + { "removed": "space-unary-word-ops", "replacedBy": ["space-unary-ops"] }, + { "removed": "spaced-line-comment", "replacedBy": ["spaced-comment"] } + ] + } +} diff --git a/node_modules/eslint/lib/api.js b/node_modules/eslint/lib/api.js new file mode 100644 index 0000000..3dde098 --- /dev/null +++ b/node_modules/eslint/lib/api.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Expose out ESLint and CLI to require. + * @author Ian Christian Myers + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const { ESLint } = require("./eslint"); +const { Linter } = require("./linter"); +const { RuleTester } = require("./rule-tester"); +const { SourceCode } = require("./source-code"); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +module.exports = { + Linter, + ESLint, + RuleTester, + SourceCode +}; diff --git a/node_modules/eslint/lib/cli-engine/cli-engine.js b/node_modules/eslint/lib/cli-engine/cli-engine.js new file mode 100644 index 0000000..fdc6619 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -0,0 +1,1067 @@ +/** + * @fileoverview Main CLI object. + * @author Nicholas C. Zakas + */ + +"use strict"; + +/* + * The CLI object should *not* call process.exit() directly. It should only return + * exit codes. This allows other programs to use the CLI object and still control + * when the program exits. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const fs = require("fs"); +const path = require("path"); +const defaultOptions = require("../../conf/default-cli-options"); +const pkg = require("../../package.json"); + + +const { + Legacy: { + ConfigOps, + naming, + CascadingConfigArrayFactory, + IgnorePattern, + getUsedExtractedConfigs, + ModuleResolver + } +} = require("@eslint/eslintrc"); + +const { FileEnumerator } = require("./file-enumerator"); + +const { Linter } = require("../linter"); +const builtInRules = require("../rules"); +const loadRules = require("./load-rules"); +const hash = require("./hash"); +const LintResultCache = require("./lint-result-cache"); + +const debug = require("debug")("eslint:cli-engine"); +const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +// For VSCode IntelliSense +/** @typedef {import("../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */ +/** @typedef {import("../shared/types").LintMessage} LintMessage */ +/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */ +/** @typedef {import("../shared/types").ParserOptions} ParserOptions */ +/** @typedef {import("../shared/types").Plugin} Plugin */ +/** @typedef {import("../shared/types").RuleConf} RuleConf */ +/** @typedef {import("../shared/types").Rule} Rule */ +/** @typedef {import("../shared/types").FormatterFunction} FormatterFunction */ +/** @typedef {ReturnType} ConfigArray */ +/** @typedef {ReturnType} ExtractedConfig */ + +/** + * The options to configure a CLI engine with. + * @typedef {Object} CLIEngineOptions + * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments. + * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this CLIEngine instance + * @property {boolean} [cache] Enable result caching. + * @property {string} [cacheLocation] The cache file to use instead of .eslintcache. + * @property {string} [configFile] The configuration file to use. + * @property {string} [cwd] The value to use for the current working directory. + * @property {string[]} [envs] An array of environments to load. + * @property {string[]|null} [extensions] An array of file extensions to check. + * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean. + * @property {string[]} [fixTypes] Array of rule types to apply fixes for. + * @property {string[]} [globals] An array of global variables to declare. + * @property {boolean} [ignore] False disables use of .eslintignore. + * @property {string} [ignorePath] The ignore file to use instead of .eslintignore. + * @property {string|string[]} [ignorePattern] One or more glob patterns to ignore. + * @property {boolean} [useEslintrc] False disables looking for .eslintrc + * @property {string} [parser] The name of the parser to use. + * @property {ParserOptions} [parserOptions] An object of parserOption settings to use. + * @property {string[]} [plugins] An array of plugins to load. + * @property {Record} [rules] An object of rules to use. + * @property {string[]} [rulePaths] An array of directories to load custom rules from. + * @property {boolean} [reportUnusedDisableDirectives] `true` adds reports for unused eslint-disable directives + * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. + * @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD + */ + +/** + * A linting result. + * @typedef {Object} LintResult + * @property {string} filePath The path to the file that was linted. + * @property {LintMessage[]} messages All of the messages for the result. + * @property {SuppressedLintMessage[]} suppressedMessages All of the suppressed messages for the result. + * @property {number} errorCount Number of errors for the result. + * @property {number} fatalErrorCount Number of fatal errors for the result. + * @property {number} warningCount Number of warnings for the result. + * @property {number} fixableErrorCount Number of fixable errors for the result. + * @property {number} fixableWarningCount Number of fixable warnings for the result. + * @property {string} [source] The source code of the file that was linted. + * @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible. + */ + +/** + * Linting results. + * @typedef {Object} LintReport + * @property {LintResult[]} results All of the result. + * @property {number} errorCount Number of errors for the result. + * @property {number} fatalErrorCount Number of fatal errors for the result. + * @property {number} warningCount Number of warnings for the result. + * @property {number} fixableErrorCount Number of fixable errors for the result. + * @property {number} fixableWarningCount Number of fixable warnings for the result. + * @property {DeprecatedRuleInfo[]} usedDeprecatedRules The list of used deprecated rules. + */ + +/** + * Private data for CLIEngine. + * @typedef {Object} CLIEngineInternalSlots + * @property {Map} additionalPluginPool The map for additional plugins. + * @property {string} cacheFilePath The path to the cache of lint results. + * @property {CascadingConfigArrayFactory} configArrayFactory The factory of configs. + * @property {(filePath: string) => boolean} defaultIgnores The default predicate function to check if a file ignored or not. + * @property {FileEnumerator} fileEnumerator The file enumerator. + * @property {ConfigArray[]} lastConfigArrays The list of config arrays that the last `executeOnFiles` or `executeOnText` used. + * @property {LintResultCache|null} lintResultCache The cache of lint results. + * @property {Linter} linter The linter instance which has loaded rules. + * @property {CLIEngineOptions} options The normalized options of this instance. + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Determines if each fix type in an array is supported by ESLint and throws + * an error if not. + * @param {string[]} fixTypes An array of fix types to check. + * @returns {void} + * @throws {Error} If an invalid fix type is found. + */ +function validateFixTypes(fixTypes) { + for (const fixType of fixTypes) { + if (!validFixTypes.has(fixType)) { + throw new Error(`Invalid fix type "${fixType}" found.`); + } + } +} + +/** + * It will calculate the error and warning count for collection of messages per file + * @param {LintMessage[]} messages Collection of messages + * @returns {Object} Contains the stats + * @private + */ +function calculateStatsPerFile(messages) { + return messages.reduce((stat, message) => { + if (message.fatal || message.severity === 2) { + stat.errorCount++; + if (message.fatal) { + stat.fatalErrorCount++; + } + if (message.fix) { + stat.fixableErrorCount++; + } + } else { + stat.warningCount++; + if (message.fix) { + stat.fixableWarningCount++; + } + } + return stat; + }, { + errorCount: 0, + fatalErrorCount: 0, + warningCount: 0, + fixableErrorCount: 0, + fixableWarningCount: 0 + }); +} + +/** + * It will calculate the error and warning count for collection of results from all files + * @param {LintResult[]} results Collection of messages from all the files + * @returns {Object} Contains the stats + * @private + */ +function calculateStatsPerRun(results) { + return results.reduce((stat, result) => { + stat.errorCount += result.errorCount; + stat.fatalErrorCount += result.fatalErrorCount; + stat.warningCount += result.warningCount; + stat.fixableErrorCount += result.fixableErrorCount; + stat.fixableWarningCount += result.fixableWarningCount; + return stat; + }, { + errorCount: 0, + fatalErrorCount: 0, + warningCount: 0, + fixableErrorCount: 0, + fixableWarningCount: 0 + }); +} + +/** + * Processes an source code using ESLint. + * @param {Object} config The config object. + * @param {string} config.text The source code to verify. + * @param {string} config.cwd The path to the current working directory. + * @param {string|undefined} config.filePath The path to the file of `text`. If this is undefined, it uses ``. + * @param {ConfigArray} config.config The config. + * @param {boolean} config.fix If `true` then it does fix. + * @param {boolean} config.allowInlineConfig If `true` then it uses directive comments. + * @param {boolean} config.reportUnusedDisableDirectives If `true` then it reports unused `eslint-disable` comments. + * @param {FileEnumerator} config.fileEnumerator The file enumerator to check if a path is a target or not. + * @param {Linter} config.linter The linter instance to verify. + * @returns {LintResult} The result of linting. + * @private + */ +function verifyText({ + text, + cwd, + filePath: providedFilePath, + config, + fix, + allowInlineConfig, + reportUnusedDisableDirectives, + fileEnumerator, + linter +}) { + const filePath = providedFilePath || ""; + + debug(`Lint ${filePath}`); + + /* + * Verify. + * `config.extractConfig(filePath)` requires an absolute path, but `linter` + * doesn't know CWD, so it gives `linter` an absolute path always. + */ + const filePathToVerify = filePath === "" ? path.join(cwd, filePath) : filePath; + const { fixed, messages, output } = linter.verifyAndFix( + text, + config, + { + allowInlineConfig, + filename: filePathToVerify, + fix, + reportUnusedDisableDirectives, + + /** + * Check if the linter should adopt a given code block or not. + * @param {string} blockFilename The virtual filename of a code block. + * @returns {boolean} `true` if the linter should adopt the code block. + */ + filterCodeBlock(blockFilename) { + return fileEnumerator.isTargetPath(blockFilename); + } + } + ); + + // Tweak and return. + const result = { + filePath, + messages, + suppressedMessages: linter.getSuppressedMessages(), + ...calculateStatsPerFile(messages) + }; + + if (fixed) { + result.output = output; + } + if ( + result.errorCount + result.warningCount > 0 && + typeof result.output === "undefined" + ) { + result.source = text; + } + + return result; +} + +/** + * Returns result with warning by ignore settings + * @param {string} filePath File path of checked code + * @param {string} baseDir Absolute path of base directory + * @returns {LintResult} Result with single warning + * @private + */ +function createIgnoreResult(filePath, baseDir) { + let message; + const isHidden = filePath.split(path.sep) + .find(segment => /^\./u.test(segment)); + const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules"); + + if (isHidden) { + message = "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!'\") to override."; + } else if (isInNodeModules) { + message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override."; + } else { + message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."; + } + + return { + filePath: path.resolve(filePath), + messages: [ + { + fatal: false, + severity: 1, + message + } + ], + suppressedMessages: [], + errorCount: 0, + fatalErrorCount: 0, + warningCount: 1, + fixableErrorCount: 0, + fixableWarningCount: 0 + }; +} + +/** + * Get a rule. + * @param {string} ruleId The rule ID to get. + * @param {ConfigArray[]} configArrays The config arrays that have plugin rules. + * @returns {Rule|null} The rule or null. + */ +function getRule(ruleId, configArrays) { + for (const configArray of configArrays) { + const rule = configArray.pluginRules.get(ruleId); + + if (rule) { + return rule; + } + } + return builtInRules.get(ruleId) || null; +} + +/** + * Checks whether a message's rule type should be fixed. + * @param {LintMessage} message The message to check. + * @param {ConfigArray[]} lastConfigArrays The list of config arrays that the last `executeOnFiles` or `executeOnText` used. + * @param {string[]} fixTypes An array of fix types to check. + * @returns {boolean} Whether the message should be fixed. + */ +function shouldMessageBeFixed(message, lastConfigArrays, fixTypes) { + if (!message.ruleId) { + return fixTypes.has("directive"); + } + + const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays); + + return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type)); +} + +/** + * Collect used deprecated rules. + * @param {ConfigArray[]} usedConfigArrays The config arrays which were used. + * @returns {IterableIterator} Used deprecated rules. + */ +function *iterateRuleDeprecationWarnings(usedConfigArrays) { + const processedRuleIds = new Set(); + + // Flatten used configs. + /** @type {ExtractedConfig[]} */ + const configs = usedConfigArrays.flatMap(getUsedExtractedConfigs); + + // Traverse rule configs. + for (const config of configs) { + for (const [ruleId, ruleConfig] of Object.entries(config.rules)) { + + // Skip if it was processed. + if (processedRuleIds.has(ruleId)) { + continue; + } + processedRuleIds.add(ruleId); + + // Skip if it's not used. + if (!ConfigOps.getRuleSeverity(ruleConfig)) { + continue; + } + const rule = getRule(ruleId, usedConfigArrays); + + // Skip if it's not deprecated. + if (!(rule && rule.meta && rule.meta.deprecated)) { + continue; + } + + // This rule was used and deprecated. + yield { + ruleId, + replacedBy: rule.meta.replacedBy || [] + }; + } + } +} + +/** + * Checks if the given message is an error message. + * @param {LintMessage} message The message to check. + * @returns {boolean} Whether or not the message is an error message. + * @private + */ +function isErrorMessage(message) { + return message.severity === 2; +} + + +/** + * return the cacheFile to be used by eslint, based on whether the provided parameter is + * a directory or looks like a directory (ends in `path.sep`), in which case the file + * name will be the `cacheFile/.cache_hashOfCWD` + * + * if cacheFile points to a file or looks like a file then it will just use that file + * @param {string} cacheFile The name of file to be used to store the cache + * @param {string} cwd Current working directory + * @returns {string} the resolved path to the cache file + */ +function getCacheFile(cacheFile, cwd) { + + /* + * make sure the path separators are normalized for the environment/os + * keeping the trailing path separator if present + */ + const normalizedCacheFile = path.normalize(cacheFile); + + const resolvedCacheFile = path.resolve(cwd, normalizedCacheFile); + const looksLikeADirectory = normalizedCacheFile.slice(-1) === path.sep; + + /** + * return the name for the cache file in case the provided parameter is a directory + * @returns {string} the resolved path to the cacheFile + */ + function getCacheFileForDirectory() { + return path.join(resolvedCacheFile, `.cache_${hash(cwd)}`); + } + + let fileStats; + + try { + fileStats = fs.lstatSync(resolvedCacheFile); + } catch { + fileStats = null; + } + + + /* + * in case the file exists we need to verify if the provided path + * is a directory or a file. If it is a directory we want to create a file + * inside that directory + */ + if (fileStats) { + + /* + * is a directory or is a file, but the original file the user provided + * looks like a directory but `path.resolve` removed the `last path.sep` + * so we need to still treat this like a directory + */ + if (fileStats.isDirectory() || looksLikeADirectory) { + return getCacheFileForDirectory(); + } + + // is file so just use that file + return resolvedCacheFile; + } + + /* + * here we known the file or directory doesn't exist, + * so we will try to infer if its a directory if it looks like a directory + * for the current operating system. + */ + + // if the last character passed is a path separator we assume is a directory + if (looksLikeADirectory) { + return getCacheFileForDirectory(); + } + + return resolvedCacheFile; +} + +/** + * Convert a string array to a boolean map. + * @param {string[]|null} keys The keys to assign true. + * @param {boolean} defaultValue The default value for each property. + * @param {string} displayName The property name which is used in error message. + * @throws {Error} Requires array. + * @returns {Record} The boolean map. + */ +function toBooleanMap(keys, defaultValue, displayName) { + if (keys && !Array.isArray(keys)) { + throw new Error(`${displayName} must be an array.`); + } + if (keys && keys.length > 0) { + return keys.reduce((map, def) => { + const [key, value] = def.split(":"); + + if (key !== "__proto__") { + map[key] = value === void 0 + ? defaultValue + : value === "true"; + } + + return map; + }, {}); + } + return void 0; +} + +/** + * Create a config data from CLI options. + * @param {CLIEngineOptions} options The options + * @returns {ConfigData|null} The created config data. + */ +function createConfigDataFromOptions(options) { + const { + ignorePattern, + parser, + parserOptions, + plugins, + rules + } = options; + const env = toBooleanMap(options.envs, true, "envs"); + const globals = toBooleanMap(options.globals, false, "globals"); + + if ( + env === void 0 && + globals === void 0 && + (ignorePattern === void 0 || ignorePattern.length === 0) && + parser === void 0 && + parserOptions === void 0 && + plugins === void 0 && + rules === void 0 + ) { + return null; + } + return { + env, + globals, + ignorePatterns: ignorePattern, + parser, + parserOptions, + plugins, + rules + }; +} + +/** + * Checks whether a directory exists at the given location + * @param {string} resolvedPath A path from the CWD + * @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`. + * @returns {boolean} `true` if a directory exists + */ +function directoryExists(resolvedPath) { + try { + return fs.statSync(resolvedPath).isDirectory(); + } catch (error) { + if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) { + return false; + } + throw error; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Core CLI. + */ +class CLIEngine { + + /** + * Creates a new instance of the core CLI engine. + * @param {CLIEngineOptions} providedOptions The options for this instance. + * @param {Object} [additionalData] Additional settings that are not CLIEngineOptions. + * @param {Record|null} [additionalData.preloadedPlugins] Preloaded plugins. + */ + constructor(providedOptions, { preloadedPlugins } = {}) { + const options = Object.assign( + Object.create(null), + defaultOptions, + { cwd: process.cwd() }, + providedOptions + ); + + if (options.fix === void 0) { + options.fix = false; + } + + const additionalPluginPool = new Map(); + + if (preloadedPlugins) { + for (const [id, plugin] of Object.entries(preloadedPlugins)) { + additionalPluginPool.set(id, plugin); + } + } + + const cacheFilePath = getCacheFile( + options.cacheLocation || options.cacheFile, + options.cwd + ); + const configArrayFactory = new CascadingConfigArrayFactory({ + additionalPluginPool, + baseConfig: options.baseConfig || null, + cliConfig: createConfigDataFromOptions(options), + cwd: options.cwd, + ignorePath: options.ignorePath, + resolvePluginsRelativeTo: options.resolvePluginsRelativeTo, + rulePaths: options.rulePaths, + specificConfigPath: options.configFile, + useEslintrc: options.useEslintrc, + builtInRules, + loadRules, + getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"), + getEslintAllConfig: () => require("../../conf/eslint-all.js") + }); + const fileEnumerator = new FileEnumerator({ + configArrayFactory, + cwd: options.cwd, + extensions: options.extensions, + globInputPaths: options.globInputPaths, + errorOnUnmatchedPattern: options.errorOnUnmatchedPattern, + ignore: options.ignore + }); + const lintResultCache = + options.cache ? new LintResultCache(cacheFilePath, options.cacheStrategy) : null; + const linter = new Linter({ cwd: options.cwd }); + + /** @type {ConfigArray[]} */ + const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()]; + + // Store private data. + internalSlotsMap.set(this, { + additionalPluginPool, + cacheFilePath, + configArrayFactory, + defaultIgnores: IgnorePattern.createDefaultIgnore(options.cwd), + fileEnumerator, + lastConfigArrays, + lintResultCache, + linter, + options + }); + + // setup special filter for fixes + if (options.fix && options.fixTypes && options.fixTypes.length > 0) { + debug(`Using fix types ${options.fixTypes}`); + + // throw an error if any invalid fix types are found + validateFixTypes(options.fixTypes); + + // convert to Set for faster lookup + const fixTypes = new Set(options.fixTypes); + + // save original value of options.fix in case it's a function + const originalFix = (typeof options.fix === "function") + ? options.fix : () => true; + + options.fix = message => shouldMessageBeFixed(message, lastConfigArrays, fixTypes) && originalFix(message); + } + } + + getRules() { + const { lastConfigArrays } = internalSlotsMap.get(this); + + return new Map(function *() { + yield* builtInRules; + + for (const configArray of lastConfigArrays) { + yield* configArray.pluginRules; + } + }()); + } + + /** + * Returns results that only contains errors. + * @param {LintResult[]} results The results to filter. + * @returns {LintResult[]} The filtered results. + */ + static getErrorResults(results) { + const filtered = []; + + results.forEach(result => { + const filteredMessages = result.messages.filter(isErrorMessage); + const filteredSuppressedMessages = result.suppressedMessages.filter(isErrorMessage); + + if (filteredMessages.length > 0) { + filtered.push({ + ...result, + messages: filteredMessages, + suppressedMessages: filteredSuppressedMessages, + errorCount: filteredMessages.length, + warningCount: 0, + fixableErrorCount: result.fixableErrorCount, + fixableWarningCount: 0 + }); + } + }); + + return filtered; + } + + /** + * Outputs fixes from the given results to files. + * @param {LintReport} report The report object created by CLIEngine. + * @returns {void} + */ + static outputFixes(report) { + report.results.filter(result => Object.prototype.hasOwnProperty.call(result, "output")).forEach(result => { + fs.writeFileSync(result.filePath, result.output); + }); + } + + /** + * Resolves the patterns passed into executeOnFiles() into glob-based patterns + * for easier handling. + * @param {string[]} patterns The file patterns passed on the command line. + * @returns {string[]} The equivalent glob patterns. + */ + resolveFileGlobPatterns(patterns) { + const { options } = internalSlotsMap.get(this); + + if (options.globInputPaths === false) { + return patterns.filter(Boolean); + } + + const extensions = (options.extensions || [".js"]).map(ext => ext.replace(/^\./u, "")); + const dirSuffix = `/**/*.{${extensions.join(",")}}`; + + return patterns.filter(Boolean).map(pathname => { + const resolvedPath = path.resolve(options.cwd, pathname); + const newPath = directoryExists(resolvedPath) + ? pathname.replace(/[/\\]$/u, "") + dirSuffix + : pathname; + + return path.normalize(newPath).replace(/\\/gu, "/"); + }); + } + + /** + * Executes the current configuration on an array of file and directory names. + * @param {string[]} patterns An array of file and directory names. + * @throws {Error} As may be thrown by `fs.unlinkSync`. + * @returns {LintReport} The results for all files that were linted. + */ + executeOnFiles(patterns) { + const { + cacheFilePath, + fileEnumerator, + lastConfigArrays, + lintResultCache, + linter, + options: { + allowInlineConfig, + cache, + cwd, + fix, + reportUnusedDisableDirectives + } + } = internalSlotsMap.get(this); + const results = []; + const startTime = Date.now(); + + // Clear the last used config arrays. + lastConfigArrays.length = 0; + + // Delete cache file; should this do here? + if (!cache) { + try { + fs.unlinkSync(cacheFilePath); + } catch (error) { + const errorCode = error && error.code; + + // Ignore errors when no such file exists or file system is read only (and cache file does not exist) + if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !fs.existsSync(cacheFilePath))) { + throw error; + } + } + } + + // Iterate source code files. + for (const { config, filePath, ignored } of fileEnumerator.iterateFiles(patterns)) { + if (ignored) { + results.push(createIgnoreResult(filePath, cwd)); + continue; + } + + /* + * Store used configs for: + * - this method uses to collect used deprecated rules. + * - `getRules()` method uses to collect all loaded rules. + * - `--fix-type` option uses to get the loaded rule's meta data. + */ + if (!lastConfigArrays.includes(config)) { + lastConfigArrays.push(config); + } + + // Skip if there is cached result. + if (lintResultCache) { + const cachedResult = + lintResultCache.getCachedLintResults(filePath, config); + + if (cachedResult) { + const hadMessages = + cachedResult.messages && + cachedResult.messages.length > 0; + + if (hadMessages && fix) { + debug(`Reprocessing cached file to allow autofix: ${filePath}`); + } else { + debug(`Skipping file since it hasn't changed: ${filePath}`); + results.push(cachedResult); + continue; + } + } + } + + // Do lint. + const result = verifyText({ + text: fs.readFileSync(filePath, "utf8"), + filePath, + config, + cwd, + fix, + allowInlineConfig, + reportUnusedDisableDirectives, + fileEnumerator, + linter + }); + + results.push(result); + + /* + * Store the lint result in the LintResultCache. + * NOTE: The LintResultCache will remove the file source and any + * other properties that are difficult to serialize, and will + * hydrate those properties back in on future lint runs. + */ + if (lintResultCache) { + lintResultCache.setCachedLintResults(filePath, config, result); + } + } + + // Persist the cache to disk. + if (lintResultCache) { + lintResultCache.reconcile(); + } + + debug(`Linting complete in: ${Date.now() - startTime}ms`); + let usedDeprecatedRules; + + return { + results, + ...calculateStatsPerRun(results), + + // Initialize it lazily because CLI and `ESLint` API don't use it. + get usedDeprecatedRules() { + if (!usedDeprecatedRules) { + usedDeprecatedRules = Array.from( + iterateRuleDeprecationWarnings(lastConfigArrays) + ); + } + return usedDeprecatedRules; + } + }; + } + + /** + * Executes the current configuration on text. + * @param {string} text A string of JavaScript code to lint. + * @param {string} [filename] An optional string representing the texts filename. + * @param {boolean} [warnIgnored] Always warn when a file is ignored + * @returns {LintReport} The results for the linting. + */ + executeOnText(text, filename, warnIgnored) { + const { + configArrayFactory, + fileEnumerator, + lastConfigArrays, + linter, + options: { + allowInlineConfig, + cwd, + fix, + reportUnusedDisableDirectives + } + } = internalSlotsMap.get(this); + const results = []; + const startTime = Date.now(); + const resolvedFilename = filename && path.resolve(cwd, filename); + + + // Clear the last used config arrays. + lastConfigArrays.length = 0; + if (resolvedFilename && this.isPathIgnored(resolvedFilename)) { + if (warnIgnored) { + results.push(createIgnoreResult(resolvedFilename, cwd)); + } + } else { + const config = configArrayFactory.getConfigArrayForFile( + resolvedFilename || "__placeholder__.js" + ); + + /* + * Store used configs for: + * - this method uses to collect used deprecated rules. + * - `getRules()` method uses to collect all loaded rules. + * - `--fix-type` option uses to get the loaded rule's meta data. + */ + lastConfigArrays.push(config); + + // Do lint. + results.push(verifyText({ + text, + filePath: resolvedFilename, + config, + cwd, + fix, + allowInlineConfig, + reportUnusedDisableDirectives, + fileEnumerator, + linter + })); + } + + debug(`Linting complete in: ${Date.now() - startTime}ms`); + let usedDeprecatedRules; + + return { + results, + ...calculateStatsPerRun(results), + + // Initialize it lazily because CLI and `ESLint` API don't use it. + get usedDeprecatedRules() { + if (!usedDeprecatedRules) { + usedDeprecatedRules = Array.from( + iterateRuleDeprecationWarnings(lastConfigArrays) + ); + } + return usedDeprecatedRules; + } + }; + } + + /** + * Returns a configuration object for the given file based on the CLI options. + * This is the same logic used by the ESLint CLI executable to determine + * configuration for each file it processes. + * @param {string} filePath The path of the file to retrieve a config object for. + * @throws {Error} If filepath a directory path. + * @returns {ConfigData} A configuration object for the file. + */ + getConfigForFile(filePath) { + const { configArrayFactory, options } = internalSlotsMap.get(this); + const absolutePath = path.resolve(options.cwd, filePath); + + if (directoryExists(absolutePath)) { + throw Object.assign( + new Error("'filePath' should not be a directory path."), + { messageTemplate: "print-config-with-directory-path" } + ); + } + + return configArrayFactory + .getConfigArrayForFile(absolutePath) + .extractConfig(absolutePath) + .toCompatibleObjectAsConfigFileContent(); + } + + /** + * Checks if a given path is ignored by ESLint. + * @param {string} filePath The path of the file to check. + * @returns {boolean} Whether or not the given path is ignored. + */ + isPathIgnored(filePath) { + const { + configArrayFactory, + defaultIgnores, + options: { cwd, ignore } + } = internalSlotsMap.get(this); + const absolutePath = path.resolve(cwd, filePath); + + if (ignore) { + const config = configArrayFactory + .getConfigArrayForFile(absolutePath) + .extractConfig(absolutePath); + const ignores = config.ignores || defaultIgnores; + + return ignores(absolutePath); + } + + return defaultIgnores(absolutePath); + } + + /** + * Returns the formatter representing the given format or null if the `format` is not a string. + * @param {string} [format] The name of the format to load or the path to a + * custom formatter. + * @throws {any} As may be thrown by requiring of formatter + * @returns {(FormatterFunction|null)} The formatter function or null if the `format` is not a string. + */ + getFormatter(format) { + + // default is stylish + const resolvedFormatName = format || "stylish"; + + // only strings are valid formatters + if (typeof resolvedFormatName === "string") { + + // replace \ with / for Windows compatibility + const normalizedFormatName = resolvedFormatName.replace(/\\/gu, "/"); + + const slots = internalSlotsMap.get(this); + const cwd = slots ? slots.options.cwd : process.cwd(); + const namespace = naming.getNamespaceFromTerm(normalizedFormatName); + + let formatterPath; + + // if there's a slash, then it's a file (TODO: this check seems dubious for scoped npm packages) + if (!namespace && normalizedFormatName.includes("/")) { + formatterPath = path.resolve(cwd, normalizedFormatName); + } else { + try { + const npmFormat = naming.normalizePackageName(normalizedFormatName, "eslint-formatter"); + + formatterPath = ModuleResolver.resolve(npmFormat, path.join(cwd, "__placeholder__.js")); + } catch { + formatterPath = path.resolve(__dirname, "formatters", normalizedFormatName); + } + } + + try { + return require(formatterPath); + } catch (ex) { + if (format === "table" || format === "codeframe") { + ex.message = `The ${format} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${format}\``; + } else { + ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; + } + throw ex; + } + + } else { + return null; + } + } +} + +CLIEngine.version = pkg.version; +CLIEngine.getFormatter = CLIEngine.prototype.getFormatter; + +module.exports = { + CLIEngine, + + /** + * Get the internal slots of a given CLIEngine instance for tests. + * @param {CLIEngine} instance The CLIEngine instance to get. + * @returns {CLIEngineInternalSlots} The internal slots. + */ + getCLIEngineInternalSlots(instance) { + return internalSlotsMap.get(instance); + } +}; diff --git a/node_modules/eslint/lib/cli-engine/file-enumerator.js b/node_modules/eslint/lib/cli-engine/file-enumerator.js new file mode 100644 index 0000000..674e83e --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/file-enumerator.js @@ -0,0 +1,543 @@ +/** + * @fileoverview `FileEnumerator` class. + * + * `FileEnumerator` class has two responsibilities: + * + * 1. Find target files by processing glob patterns. + * 2. Tie each target file and appropriate configuration. + * + * It provides a method: + * + * - `iterateFiles(patterns)` + * Iterate files which are matched by given patterns together with the + * corresponded configuration. This is for `CLIEngine#executeOnFiles()`. + * While iterating files, it loads the configuration file of each directory + * before iterate files on the directory, so we can use the configuration + * files to determine target files. + * + * @example + * const enumerator = new FileEnumerator(); + * const linter = new Linter(); + * + * for (const { config, filePath } of enumerator.iterateFiles(["*.js"])) { + * const code = fs.readFileSync(filePath, "utf8"); + * const messages = linter.verify(code, config, filePath); + * + * console.log(messages); + * } + * + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const fs = require("fs"); +const path = require("path"); +const getGlobParent = require("glob-parent"); +const isGlob = require("is-glob"); +const escapeRegExp = require("escape-string-regexp"); +const { Minimatch } = require("minimatch"); + +const { + Legacy: { + IgnorePattern, + CascadingConfigArrayFactory + } +} = require("@eslint/eslintrc"); +const debug = require("debug")("eslint:file-enumerator"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const minimatchOpts = { dot: true, matchBase: true }; +const dotfilesPattern = /(?:(?:^\.)|(?:[/\\]\.))[^/\\.].*/u; +const NONE = 0; +const IGNORED_SILENTLY = 1; +const IGNORED = 2; + +// For VSCode intellisense +/** @typedef {ReturnType} ConfigArray */ + +/** + * @typedef {Object} FileEnumeratorOptions + * @property {CascadingConfigArrayFactory} [configArrayFactory] The factory for config arrays. + * @property {string} [cwd] The base directory to start lookup. + * @property {string[]} [extensions] The extensions to match files for directory patterns. + * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. + * @property {boolean} [ignore] The flag to check ignored files. + * @property {string[]} [rulePaths] The value of `--rulesdir` option. + */ + +/** + * @typedef {Object} FileAndConfig + * @property {string} filePath The path to a target file. + * @property {ConfigArray} config The config entries of that file. + * @property {boolean} ignored If `true` then this file should be ignored and warned because it was directly specified. + */ + +/** + * @typedef {Object} FileEntry + * @property {string} filePath The path to a target file. + * @property {ConfigArray} config The config entries of that file. + * @property {NONE|IGNORED_SILENTLY|IGNORED} flag The flag. + * - `NONE` means the file is a target file. + * - `IGNORED_SILENTLY` means the file should be ignored silently. + * - `IGNORED` means the file should be ignored and warned because it was directly specified. + */ + +/** + * @typedef {Object} FileEnumeratorInternalSlots + * @property {CascadingConfigArrayFactory} configArrayFactory The factory for config arrays. + * @property {string} cwd The base directory to start lookup. + * @property {RegExp|null} extensionRegExp The RegExp to test if a string ends with specific file extensions. + * @property {boolean} globInputPaths Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. + * @property {boolean} ignoreFlag The flag to check ignored files. + * @property {(filePath:string, dot:boolean) => boolean} defaultIgnores The default predicate function to ignore files. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Check if a string is a glob pattern or not. + * @param {string} pattern A glob pattern. + * @returns {boolean} `true` if the string is a glob pattern. + */ +function isGlobPattern(pattern) { + return isGlob(path.sep === "\\" ? pattern.replace(/\\/gu, "/") : pattern); +} + +/** + * Get stats of a given path. + * @param {string} filePath The path to target file. + * @throws {Error} As may be thrown by `fs.statSync`. + * @returns {fs.Stats|null} The stats. + * @private + */ +function statSafeSync(filePath) { + try { + return fs.statSync(filePath); + } catch (error) { + /* istanbul ignore next */ + if (error.code !== "ENOENT") { + throw error; + } + return null; + } +} + +/** + * Get filenames in a given path to a directory. + * @param {string} directoryPath The path to target directory. + * @throws {Error} As may be thrown by `fs.readdirSync`. + * @returns {import("fs").Dirent[]} The filenames. + * @private + */ +function readdirSafeSync(directoryPath) { + try { + return fs.readdirSync(directoryPath, { withFileTypes: true }); + } catch (error) { + /* istanbul ignore next */ + if (error.code !== "ENOENT") { + throw error; + } + return []; + } +} + +/** + * Create a `RegExp` object to detect extensions. + * @param {string[] | null} extensions The extensions to create. + * @returns {RegExp | null} The created `RegExp` object or null. + */ +function createExtensionRegExp(extensions) { + if (extensions) { + const normalizedExts = extensions.map(ext => escapeRegExp( + ext.startsWith(".") + ? ext.slice(1) + : ext + )); + + return new RegExp( + `.\\.(?:${normalizedExts.join("|")})$`, + "u" + ); + } + return null; +} + +/** + * The error type when no files match a glob. + */ +class NoFilesFoundError extends Error { + + /** + * @param {string} pattern The glob pattern which was not found. + * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled. + */ + constructor(pattern, globDisabled) { + super(`No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`); + this.messageTemplate = "file-not-found"; + this.messageData = { pattern, globDisabled }; + } +} + +/** + * The error type when there are files matched by a glob, but all of them have been ignored. + */ +class AllFilesIgnoredError extends Error { + + /** + * @param {string} pattern The glob pattern which was not found. + */ + constructor(pattern) { + super(`All files matched by '${pattern}' are ignored.`); + this.messageTemplate = "all-files-ignored"; + this.messageData = { pattern }; + } +} + +/** + * This class provides the functionality that enumerates every file which is + * matched by given glob patterns and that configuration. + */ +class FileEnumerator { + + /** + * Initialize this enumerator. + * @param {FileEnumeratorOptions} options The options. + */ + constructor({ + cwd = process.cwd(), + configArrayFactory = new CascadingConfigArrayFactory({ + cwd, + getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"), + getEslintAllConfig: () => require("../../conf/eslint-all.js") + }), + extensions = null, + globInputPaths = true, + errorOnUnmatchedPattern = true, + ignore = true + } = {}) { + internalSlotsMap.set(this, { + configArrayFactory, + cwd, + defaultIgnores: IgnorePattern.createDefaultIgnore(cwd), + extensionRegExp: createExtensionRegExp(extensions), + globInputPaths, + errorOnUnmatchedPattern, + ignoreFlag: ignore + }); + } + + /** + * Check if a given file is target or not. + * @param {string} filePath The path to a candidate file. + * @param {ConfigArray} [providedConfig] Optional. The configuration for the file. + * @returns {boolean} `true` if the file is a target. + */ + isTargetPath(filePath, providedConfig) { + const { + configArrayFactory, + extensionRegExp + } = internalSlotsMap.get(this); + + // If `--ext` option is present, use it. + if (extensionRegExp) { + return extensionRegExp.test(filePath); + } + + // `.js` file is target by default. + if (filePath.endsWith(".js")) { + return true; + } + + // use `overrides[].files` to check additional targets. + const config = + providedConfig || + configArrayFactory.getConfigArrayForFile( + filePath, + { ignoreNotFoundError: true } + ); + + return config.isAdditionalTargetPath(filePath); + } + + /** + * Iterate files which are matched by given glob patterns. + * @param {string|string[]} patternOrPatterns The glob patterns to iterate files. + * @throws {NoFilesFoundError|AllFilesIgnoredError} On an unmatched pattern. + * @returns {IterableIterator} The found files. + */ + *iterateFiles(patternOrPatterns) { + const { globInputPaths, errorOnUnmatchedPattern } = internalSlotsMap.get(this); + const patterns = Array.isArray(patternOrPatterns) + ? patternOrPatterns + : [patternOrPatterns]; + + debug("Start to iterate files: %o", patterns); + + // The set of paths to remove duplicate. + const set = new Set(); + + for (const pattern of patterns) { + let foundRegardlessOfIgnored = false; + let found = false; + + // Skip empty string. + if (!pattern) { + continue; + } + + // Iterate files of this pattern. + for (const { config, filePath, flag } of this._iterateFiles(pattern)) { + foundRegardlessOfIgnored = true; + if (flag === IGNORED_SILENTLY) { + continue; + } + found = true; + + // Remove duplicate paths while yielding paths. + if (!set.has(filePath)) { + set.add(filePath); + yield { + config, + filePath, + ignored: flag === IGNORED + }; + } + } + + // Raise an error if any files were not found. + if (errorOnUnmatchedPattern) { + if (!foundRegardlessOfIgnored) { + throw new NoFilesFoundError( + pattern, + !globInputPaths && isGlob(pattern) + ); + } + if (!found) { + throw new AllFilesIgnoredError(pattern); + } + } + } + + debug(`Complete iterating files: ${JSON.stringify(patterns)}`); + } + + /** + * Iterate files which are matched by a given glob pattern. + * @param {string} pattern The glob pattern to iterate files. + * @returns {IterableIterator} The found files. + */ + _iterateFiles(pattern) { + const { cwd, globInputPaths } = internalSlotsMap.get(this); + const absolutePath = path.resolve(cwd, pattern); + const isDot = dotfilesPattern.test(pattern); + const stat = statSafeSync(absolutePath); + + if (stat && stat.isDirectory()) { + return this._iterateFilesWithDirectory(absolutePath, isDot); + } + if (stat && stat.isFile()) { + return this._iterateFilesWithFile(absolutePath); + } + if (globInputPaths && isGlobPattern(pattern)) { + return this._iterateFilesWithGlob(absolutePath, isDot); + } + + return []; + } + + /** + * Iterate a file which is matched by a given path. + * @param {string} filePath The path to the target file. + * @returns {IterableIterator} The found files. + * @private + */ + _iterateFilesWithFile(filePath) { + debug(`File: ${filePath}`); + + const { configArrayFactory } = internalSlotsMap.get(this); + const config = configArrayFactory.getConfigArrayForFile(filePath); + const ignored = this._isIgnoredFile(filePath, { config, direct: true }); + const flag = ignored ? IGNORED : NONE; + + return [{ config, filePath, flag }]; + } + + /** + * Iterate files in a given path. + * @param {string} directoryPath The path to the target directory. + * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default. + * @returns {IterableIterator} The found files. + * @private + */ + _iterateFilesWithDirectory(directoryPath, dotfiles) { + debug(`Directory: ${directoryPath}`); + + return this._iterateFilesRecursive( + directoryPath, + { dotfiles, recursive: true, selector: null } + ); + } + + /** + * Iterate files which are matched by a given glob pattern. + * @param {string} pattern The glob pattern to iterate files. + * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default. + * @returns {IterableIterator} The found files. + * @private + */ + _iterateFilesWithGlob(pattern, dotfiles) { + debug(`Glob: ${pattern}`); + + const directoryPath = path.resolve(getGlobParent(pattern)); + const globPart = pattern.slice(directoryPath.length + 1); + + /* + * recursive if there are `**` or path separators in the glob part. + * Otherwise, patterns such as `src/*.js`, it doesn't need recursive. + */ + const recursive = /\*\*|\/|\\/u.test(globPart); + const selector = new Minimatch(pattern, minimatchOpts); + + debug(`recursive? ${recursive}`); + + return this._iterateFilesRecursive( + directoryPath, + { dotfiles, recursive, selector } + ); + } + + /** + * Iterate files in a given path. + * @param {string} directoryPath The path to the target directory. + * @param {Object} options The options to iterate files. + * @param {boolean} [options.dotfiles] If `true` then it doesn't skip dot files by default. + * @param {boolean} [options.recursive] If `true` then it dives into sub directories. + * @param {InstanceType} [options.selector] The matcher to choose files. + * @returns {IterableIterator} The found files. + * @private + */ + *_iterateFilesRecursive(directoryPath, options) { + debug(`Enter the directory: ${directoryPath}`); + const { configArrayFactory } = internalSlotsMap.get(this); + + /** @type {ConfigArray|null} */ + let config = null; + + // Enumerate the files of this directory. + for (const entry of readdirSafeSync(directoryPath)) { + const filePath = path.join(directoryPath, entry.name); + const fileInfo = entry.isSymbolicLink() ? statSafeSync(filePath) : entry; + + if (!fileInfo) { + continue; + } + + // Check if the file is matched. + if (fileInfo.isFile()) { + if (!config) { + config = configArrayFactory.getConfigArrayForFile( + filePath, + + /* + * We must ignore `ConfigurationNotFoundError` at this + * point because we don't know if target files exist in + * this directory. + */ + { ignoreNotFoundError: true } + ); + } + const matched = options.selector + + // Started with a glob pattern; choose by the pattern. + ? options.selector.match(filePath) + + // Started with a directory path; choose by file extensions. + : this.isTargetPath(filePath, config); + + if (matched) { + const ignored = this._isIgnoredFile(filePath, { ...options, config }); + const flag = ignored ? IGNORED_SILENTLY : NONE; + + debug(`Yield: ${entry.name}${ignored ? " but ignored" : ""}`); + yield { + config: configArrayFactory.getConfigArrayForFile(filePath), + filePath, + flag + }; + } else { + debug(`Didn't match: ${entry.name}`); + } + + // Dive into the sub directory. + } else if (options.recursive && fileInfo.isDirectory()) { + if (!config) { + config = configArrayFactory.getConfigArrayForFile( + filePath, + { ignoreNotFoundError: true } + ); + } + const ignored = this._isIgnoredFile( + filePath + path.sep, + { ...options, config } + ); + + if (!ignored) { + yield* this._iterateFilesRecursive(filePath, options); + } + } + } + + debug(`Leave the directory: ${directoryPath}`); + } + + /** + * Check if a given file should be ignored. + * @param {string} filePath The path to a file to check. + * @param {Object} options Options + * @param {ConfigArray} [options.config] The config for this file. + * @param {boolean} [options.dotfiles] If `true` then this is not ignore dot files by default. + * @param {boolean} [options.direct] If `true` then this is a direct specified file. + * @returns {boolean} `true` if the file should be ignored. + * @private + */ + _isIgnoredFile(filePath, { + config: providedConfig, + dotfiles = false, + direct = false + }) { + const { + configArrayFactory, + defaultIgnores, + ignoreFlag + } = internalSlotsMap.get(this); + + if (ignoreFlag) { + const config = + providedConfig || + configArrayFactory.getConfigArrayForFile( + filePath, + { ignoreNotFoundError: true } + ); + const ignores = + config.extractConfig(filePath).ignores || defaultIgnores; + + return ignores(filePath, dotfiles); + } + + return !direct && defaultIgnores(filePath, dotfiles); + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { FileEnumerator }; diff --git a/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js b/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js new file mode 100644 index 0000000..f19b6fc --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js @@ -0,0 +1,60 @@ +/** + * @fileoverview CheckStyle XML reporter + * @author Ian Christian Myers + */ +"use strict"; + +const xmlEscape = require("../xml-escape"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns the severity of warning or error + * @param {Object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } + return "warning"; + +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = ""; + + output += ""; + output += ""; + + results.forEach(result => { + const messages = result.messages; + + output += ``; + + messages.forEach(message => { + output += [ + `` + ].join(" "); + }); + + output += ""; + + }); + + output += ""; + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/compact.js b/node_modules/eslint/lib/cli-engine/formatters/compact.js new file mode 100644 index 0000000..2b540bd --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/compact.js @@ -0,0 +1,60 @@ +/** + * @fileoverview Compact reporter + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns the severity of warning or error + * @param {Object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + return "Warning"; + +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = "", + total = 0; + + results.forEach(result => { + + const messages = result.messages; + + total += messages.length; + + messages.forEach(message => { + + output += `${result.filePath}: `; + output += `line ${message.line || 0}`; + output += `, col ${message.column || 0}`; + output += `, ${getMessageType(message)}`; + output += ` - ${message.message}`; + output += message.ruleId ? ` (${message.ruleId})` : ""; + output += "\n"; + + }); + + }); + + if (total > 0) { + output += `\n${total} problem${total !== 1 ? "s" : ""}`; + } + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/html.js b/node_modules/eslint/lib/cli-engine/formatters/html.js new file mode 100644 index 0000000..6e40bbe --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/html.js @@ -0,0 +1,326 @@ +/** + * @fileoverview HTML reporter + * @author Julian Laval + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const encodeHTML = (function() { + const encodeHTMLRules = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" + }; + const matchHTML = /[&<>"']/ug; + + return function(code) { + return code + ? code.toString().replace(matchHTML, m => encodeHTMLRules[m] || m) + : ""; + }; +}()); + +/** + * Get the final HTML document. + * @param {Object} it data for the document. + * @returns {string} HTML document. + */ +function pageTemplate(it) { + const { reportColor, reportSummary, date, results } = it; + + return ` + + + + + ESLint Report + + + + + +
+

ESLint Report

+
+ ${reportSummary} - Generated on ${date} +
+
+ + + ${results} + +
+ + + +`.trimStart(); +} + +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {int} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return (count === 1 ? word : `${word}s`); +} + +/** + * Renders text along the template of x problems (x errors, x warnings) + * @param {string} totalErrors Total errors + * @param {string} totalWarnings Total warnings + * @returns {string} The formatted string, pluralized where necessary + */ +function renderSummary(totalErrors, totalWarnings) { + const totalProblems = totalErrors + totalWarnings; + let renderedText = `${totalProblems} ${pluralize("problem", totalProblems)}`; + + if (totalProblems !== 0) { + renderedText += ` (${totalErrors} ${pluralize("error", totalErrors)}, ${totalWarnings} ${pluralize("warning", totalWarnings)})`; + } + return renderedText; +} + +/** + * Get the color based on whether there are errors/warnings... + * @param {string} totalErrors Total errors + * @param {string} totalWarnings Total warnings + * @returns {int} The color code (0 = green, 1 = yellow, 2 = red) + */ +function renderColor(totalErrors, totalWarnings) { + if (totalErrors !== 0) { + return 2; + } + if (totalWarnings !== 0) { + return 1; + } + return 0; +} + +/** + * Get HTML (table row) describing a single message. + * @param {Object} it data for the message. + * @returns {string} HTML (table row) describing the message. + */ +function messageTemplate(it) { + const { + parentIndex, + lineNumber, + columnNumber, + severityNumber, + severityName, + message, + ruleUrl, + ruleId + } = it; + + return ` + + ${lineNumber}:${columnNumber} + ${severityName} + ${encodeHTML(message)} + + ${ruleId ? ruleId : ""} + + +`.trimStart(); +} + +/** + * Get HTML (table rows) describing the messages. + * @param {Array} messages Messages. + * @param {int} parentIndex Index of the parent HTML row. + * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. + * @returns {string} HTML (table rows) describing the messages. + */ +function renderMessages(messages, parentIndex, rulesMeta) { + + /** + * Get HTML (table row) describing a message. + * @param {Object} message Message. + * @returns {string} HTML (table row) describing a message. + */ + return messages.map(message => { + const lineNumber = message.line || 0; + const columnNumber = message.column || 0; + let ruleUrl; + + if (rulesMeta) { + const meta = rulesMeta[message.ruleId]; + + if (meta && meta.docs && meta.docs.url) { + ruleUrl = meta.docs.url; + } + } + + return messageTemplate({ + parentIndex, + lineNumber, + columnNumber, + severityNumber: message.severity, + severityName: message.severity === 1 ? "Warning" : "Error", + message: message.message, + ruleId: message.ruleId, + ruleUrl + }); + }).join("\n"); +} + +/** + * Get HTML (table row) describing the result for a single file. + * @param {Object} it data for the file. + * @returns {string} HTML (table row) describing the result for the file. + */ +function resultTemplate(it) { + const { color, index, filePath, summary } = it; + + return ` + + + [+] ${encodeHTML(filePath)} + ${encodeHTML(summary)} + + +`.trimStart(); +} + +/** + * Render the results. + * @param {Array} results Test results. + * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. + * @returns {string} HTML string describing the results. + */ +function renderResults(results, rulesMeta) { + return results.map((result, index) => resultTemplate({ + index, + color: renderColor(result.errorCount, result.warningCount), + filePath: result.filePath, + summary: renderSummary(result.errorCount, result.warningCount) + }) + renderMessages(result.messages, index, rulesMeta)).join("\n"); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results, data) { + let totalErrors, + totalWarnings; + + const metaData = data ? data.rulesMeta : {}; + + totalErrors = 0; + totalWarnings = 0; + + // Iterate over results to get totals + results.forEach(result => { + totalErrors += result.errorCount; + totalWarnings += result.warningCount; + }); + + return pageTemplate({ + date: new Date(), + reportColor: renderColor(totalErrors, totalWarnings), + reportSummary: renderSummary(totalErrors, totalWarnings), + results: renderResults(results, metaData) + }); +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js b/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js new file mode 100644 index 0000000..0ca1cba --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js @@ -0,0 +1,41 @@ +/** + * @fileoverview JSLint XML reporter + * @author Ian Christian Myers + */ +"use strict"; + +const xmlEscape = require("../xml-escape"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = ""; + + output += ""; + output += ""; + + results.forEach(result => { + const messages = result.messages; + + output += ``; + + messages.forEach(message => { + output += [ + `` + ].join(" "); + }); + + output += ""; + + }); + + output += ""; + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js new file mode 100644 index 0000000..6899471 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js @@ -0,0 +1,16 @@ +/** + * @fileoverview JSON reporter, including rules metadata + * @author Chris Meyer + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results, data) { + return JSON.stringify({ + results, + metadata: data + }); +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/json.js b/node_modules/eslint/lib/cli-engine/formatters/json.js new file mode 100644 index 0000000..82138af --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/json.js @@ -0,0 +1,13 @@ +/** + * @fileoverview JSON reporter + * @author Burak Yigit Kaya aka BYK + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + return JSON.stringify(results); +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/junit.js b/node_modules/eslint/lib/cli-engine/formatters/junit.js new file mode 100644 index 0000000..a994b4b --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/junit.js @@ -0,0 +1,82 @@ +/** + * @fileoverview jUnit Reporter + * @author Jamund Ferguson + */ +"use strict"; + +const xmlEscape = require("../xml-escape"); +const path = require("path"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns the severity of warning or error + * @param {Object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + return "Warning"; + +} + +/** + * Returns a full file path without extension + * @param {string} filePath input file path + * @returns {string} file path without extension + * @private + */ +function pathWithoutExt(filePath) { + return path.join(path.dirname(filePath), path.basename(filePath, path.extname(filePath))); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = ""; + + output += "\n"; + output += "\n"; + + results.forEach(result => { + + const messages = result.messages; + const classname = pathWithoutExt(result.filePath); + + if (messages.length > 0) { + output += `\n`; + messages.forEach(message => { + const type = message.fatal ? "error" : "failure"; + + output += ``; + output += `<${type} message="${xmlEscape(message.message || "")}">`; + output += ""; + output += ``; + output += "\n"; + }); + output += "\n"; + } else { + output += `\n`; + output += `\n`; + output += "\n"; + } + + }); + + output += "\n"; + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/stylish.js b/node_modules/eslint/lib/cli-engine/formatters/stylish.js new file mode 100644 index 0000000..a808448 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/stylish.js @@ -0,0 +1,101 @@ +/** + * @fileoverview Stylish reporter + * @author Sindre Sorhus + */ +"use strict"; + +const chalk = require("chalk"), + stripAnsi = require("strip-ansi"), + table = require("text-table"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {int} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return (count === 1 ? word : `${word}s`); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = "\n", + errorCount = 0, + warningCount = 0, + fixableErrorCount = 0, + fixableWarningCount = 0, + summaryColor = "yellow"; + + results.forEach(result => { + const messages = result.messages; + + if (messages.length === 0) { + return; + } + + errorCount += result.errorCount; + warningCount += result.warningCount; + fixableErrorCount += result.fixableErrorCount; + fixableWarningCount += result.fixableWarningCount; + + output += `${chalk.underline(result.filePath)}\n`; + + output += `${table( + messages.map(message => { + let messageType; + + if (message.fatal || message.severity === 2) { + messageType = chalk.red("error"); + summaryColor = "red"; + } else { + messageType = chalk.yellow("warning"); + } + + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/([^ ])\.$/u, "$1"), + chalk.dim(message.ruleId || "") + ]; + }), + { + align: ["", "r", "l"], + stringLength(str) { + return stripAnsi(str).length; + } + } + ).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`; + }); + + const total = errorCount + warningCount; + + if (total > 0) { + output += chalk[summaryColor].bold([ + "\u2716 ", total, pluralize(" problem", total), + " (", errorCount, pluralize(" error", errorCount), ", ", + warningCount, pluralize(" warning", warningCount), ")\n" + ].join("")); + + if (fixableErrorCount > 0 || fixableWarningCount > 0) { + output += chalk[summaryColor].bold([ + " ", fixableErrorCount, pluralize(" error", fixableErrorCount), " and ", + fixableWarningCount, pluralize(" warning", fixableWarningCount), + " potentially fixable with the `--fix` option.\n" + ].join("")); + } + } + + // Resets output color, for prevent change on top level + return total > 0 ? chalk.reset(output) : ""; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/tap.js b/node_modules/eslint/lib/cli-engine/formatters/tap.js new file mode 100644 index 0000000..e4148a3 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/tap.js @@ -0,0 +1,95 @@ +/** + * @fileoverview TAP reporter + * @author Jonathan Kingston + */ +"use strict"; + +const yaml = require("js-yaml"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {Object} message Individual error message provided by eslint + * @returns {string} Error level string + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } + return "warning"; +} + +/** + * Takes in a JavaScript object and outputs a TAP diagnostics string + * @param {Object} diagnostic JavaScript object to be embedded as YAML into output. + * @returns {string} diagnostics string with YAML embedded - TAP version 13 compliant + */ +function outputDiagnostics(diagnostic) { + const prefix = " "; + let output = `${prefix}---\n`; + + output += prefix + yaml.dump(diagnostic).split("\n").join(`\n${prefix}`); + output += "...\n"; + return output; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + let output = `TAP version 13\n1..${results.length}\n`; + + results.forEach((result, id) => { + const messages = result.messages; + let testResult = "ok"; + let diagnostics = {}; + + if (messages.length > 0) { + messages.forEach(message => { + const severity = getMessageType(message); + const diagnostic = { + message: message.message, + severity, + data: { + line: message.line || 0, + column: message.column || 0, + ruleId: message.ruleId || "" + } + }; + + // This ensures a warning message is not flagged as error + if (severity === "error") { + testResult = "not ok"; + } + + /* + * If we have multiple messages place them under a messages key + * The first error will be logged as message key + * This is to adhere to TAP 13 loosely defined specification of having a message key + */ + if ("message" in diagnostics) { + if (typeof diagnostics.messages === "undefined") { + diagnostics.messages = []; + } + diagnostics.messages.push(diagnostic); + } else { + diagnostics = diagnostic; + } + }); + } + + output += `${testResult} ${id + 1} - ${result.filePath}\n`; + + // If we have an error include diagnostics + if (messages.length > 0) { + output += outputDiagnostics(diagnostics); + } + + }); + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/unix.js b/node_modules/eslint/lib/cli-engine/formatters/unix.js new file mode 100644 index 0000000..c6c4ebb --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/unix.js @@ -0,0 +1,58 @@ +/** + * @fileoverview unix-style formatter. + * @author oshi-shinobu + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {Object} message Individual error message provided by eslint + * @returns {string} Error level string + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } + return "Warning"; + +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = "", + total = 0; + + results.forEach(result => { + + const messages = result.messages; + + total += messages.length; + + messages.forEach(message => { + + output += `${result.filePath}:`; + output += `${message.line || 0}:`; + output += `${message.column || 0}:`; + output += ` ${message.message} `; + output += `[${getMessageType(message)}${message.ruleId ? `/${message.ruleId}` : ""}]`; + output += "\n"; + + }); + + }); + + if (total > 0) { + output += `\n${total} problem${total !== 1 ? "s" : ""}`; + } + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js b/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js new file mode 100644 index 0000000..0d49431 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js @@ -0,0 +1,63 @@ +/** + * @fileoverview Visual Studio compatible formatter + * @author Ronald Pijnacker + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns the severity of warning or error + * @param {Object} message message object to examine + * @returns {string} severity level + * @private + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } + return "warning"; + +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + let output = "", + total = 0; + + results.forEach(result => { + + const messages = result.messages; + + total += messages.length; + + messages.forEach(message => { + + output += result.filePath; + output += `(${message.line || 0}`; + output += message.column ? `,${message.column}` : ""; + output += `): ${getMessageType(message)}`; + output += message.ruleId ? ` ${message.ruleId}` : ""; + output += ` : ${message.message}`; + output += "\n"; + + }); + + }); + + if (total === 0) { + output += "no problems"; + } else { + output += `\n${total} problem${total !== 1 ? "s" : ""}`; + } + + return output; +}; diff --git a/node_modules/eslint/lib/cli-engine/hash.js b/node_modules/eslint/lib/cli-engine/hash.js new file mode 100644 index 0000000..8e46773 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/hash.js @@ -0,0 +1,35 @@ +/** + * @fileoverview Defining the hashing function in one place. + * @author Michael Ficarra + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const murmur = require("imurmurhash"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +/** + * hash the given string + * @param {string} str the string to hash + * @returns {string} the hash + */ +function hash(str) { + return murmur(str).result().toString(36); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = hash; diff --git a/node_modules/eslint/lib/cli-engine/index.js b/node_modules/eslint/lib/cli-engine/index.js new file mode 100644 index 0000000..52e45a6 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/index.js @@ -0,0 +1,7 @@ +"use strict"; + +const { CLIEngine } = require("./cli-engine"); + +module.exports = { + CLIEngine +}; diff --git a/node_modules/eslint/lib/cli-engine/lint-result-cache.js b/node_modules/eslint/lib/cli-engine/lint-result-cache.js new file mode 100644 index 0000000..e36eb74 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/lint-result-cache.js @@ -0,0 +1,191 @@ +/** + * @fileoverview Utility for caching lint results. + * @author Kevin Partington + */ +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const assert = require("assert"); +const fs = require("fs"); +const fileEntryCache = require("file-entry-cache"); +const stringify = require("json-stable-stringify-without-jsonify"); +const pkg = require("../../package.json"); +const hash = require("./hash"); + +const debug = require("debug")("eslint:lint-result-cache"); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const configHashCache = new WeakMap(); +const nodeVersion = process && process.version; + +const validCacheStrategies = ["metadata", "content"]; +const invalidCacheStrategyErrorMessage = `Cache strategy must be one of: ${validCacheStrategies + .map(strategy => `"${strategy}"`) + .join(", ")}`; + +/** + * Tests whether a provided cacheStrategy is valid + * @param {string} cacheStrategy The cache strategy to use + * @returns {boolean} true if `cacheStrategy` is one of `validCacheStrategies`; false otherwise + */ +function isValidCacheStrategy(cacheStrategy) { + return ( + validCacheStrategies.includes(cacheStrategy) + ); +} + +/** + * Calculates the hash of the config + * @param {ConfigArray} config The config. + * @returns {string} The hash of the config + */ +function hashOfConfigFor(config) { + if (!configHashCache.has(config)) { + configHashCache.set(config, hash(`${pkg.version}_${nodeVersion}_${stringify(config)}`)); + } + + return configHashCache.get(config); +} + +//----------------------------------------------------------------------------- +// Public Interface +//----------------------------------------------------------------------------- + +/** + * Lint result cache. This wraps around the file-entry-cache module, + * transparently removing properties that are difficult or expensive to + * serialize and adding them back in on retrieval. + */ +class LintResultCache { + + /** + * Creates a new LintResultCache instance. + * @param {string} cacheFileLocation The cache file location. + * @param {"metadata" | "content"} cacheStrategy The cache strategy to use. + */ + constructor(cacheFileLocation, cacheStrategy) { + assert(cacheFileLocation, "Cache file location is required"); + assert(cacheStrategy, "Cache strategy is required"); + assert( + isValidCacheStrategy(cacheStrategy), + invalidCacheStrategyErrorMessage + ); + + debug(`Caching results to ${cacheFileLocation}`); + + const useChecksum = cacheStrategy === "content"; + + debug( + `Using "${cacheStrategy}" strategy to detect changes` + ); + + this.fileEntryCache = fileEntryCache.create( + cacheFileLocation, + void 0, + useChecksum + ); + this.cacheFileLocation = cacheFileLocation; + } + + /** + * Retrieve cached lint results for a given file path, if present in the + * cache. If the file is present and has not been changed, rebuild any + * missing result information. + * @param {string} filePath The file for which to retrieve lint results. + * @param {ConfigArray} config The config of the file. + * @returns {Object|null} The rebuilt lint results, or null if the file is + * changed or not in the filesystem. + */ + getCachedLintResults(filePath, config) { + + /* + * Cached lint results are valid if and only if: + * 1. The file is present in the filesystem + * 2. The file has not changed since the time it was previously linted + * 3. The ESLint configuration has not changed since the time the file + * was previously linted + * If any of these are not true, we will not reuse the lint results. + */ + const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath); + const hashOfConfig = hashOfConfigFor(config); + const changed = + fileDescriptor.changed || + fileDescriptor.meta.hashOfConfig !== hashOfConfig; + + if (fileDescriptor.notFound) { + debug(`File not found on the file system: ${filePath}`); + return null; + } + + if (changed) { + debug(`Cache entry not found or no longer valid: ${filePath}`); + return null; + } + + // If source is present but null, need to reread the file from the filesystem. + if ( + fileDescriptor.meta.results && + fileDescriptor.meta.results.source === null + ) { + debug(`Rereading cached result source from filesystem: ${filePath}`); + fileDescriptor.meta.results.source = fs.readFileSync(filePath, "utf-8"); + } + + return fileDescriptor.meta.results; + } + + /** + * Set the cached lint results for a given file path, after removing any + * information that will be both unnecessary and difficult to serialize. + * Avoids caching results with an "output" property (meaning fixes were + * applied), to prevent potentially incorrect results if fixes are not + * written to disk. + * @param {string} filePath The file for which to set lint results. + * @param {ConfigArray} config The config of the file. + * @param {Object} result The lint result to be set for the file. + * @returns {void} + */ + setCachedLintResults(filePath, config, result) { + if (result && Object.prototype.hasOwnProperty.call(result, "output")) { + return; + } + + const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath); + + if (fileDescriptor && !fileDescriptor.notFound) { + debug(`Updating cached result: ${filePath}`); + + // Serialize the result, except that we want to remove the file source if present. + const resultToSerialize = Object.assign({}, result); + + /* + * Set result.source to null. + * In `getCachedLintResults`, if source is explicitly null, we will + * read the file from the filesystem to set the value again. + */ + if (Object.prototype.hasOwnProperty.call(resultToSerialize, "source")) { + resultToSerialize.source = null; + } + + fileDescriptor.meta.results = resultToSerialize; + fileDescriptor.meta.hashOfConfig = hashOfConfigFor(config); + } + } + + /** + * Persists the in-memory cache to disk. + * @returns {void} + */ + reconcile() { + debug(`Persisting cached results: ${this.cacheFileLocation}`); + this.fileEntryCache.reconcile(); + } +} + +module.exports = LintResultCache; diff --git a/node_modules/eslint/lib/cli-engine/load-rules.js b/node_modules/eslint/lib/cli-engine/load-rules.js new file mode 100644 index 0000000..81bab63 --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/load-rules.js @@ -0,0 +1,46 @@ +/** + * @fileoverview Module for loading rules from files and directories. + * @author Michael Ficarra + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const fs = require("fs"), + path = require("path"); + +const rulesDirCache = {}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Load all rule modules from specified directory. + * @param {string} relativeRulesDir Path to rules directory, may be relative. + * @param {string} cwd Current working directory + * @returns {Object} Loaded rule modules. + */ +module.exports = function(relativeRulesDir, cwd) { + const rulesDir = path.resolve(cwd, relativeRulesDir); + + // cache will help performance as IO operation are expensive + if (rulesDirCache[rulesDir]) { + return rulesDirCache[rulesDir]; + } + + const rules = Object.create(null); + + fs.readdirSync(rulesDir).forEach(file => { + if (path.extname(file) !== ".js") { + return; + } + rules[file.slice(0, -3)] = require(path.join(rulesDir, file)); + }); + rulesDirCache[rulesDir] = rules; + + return rules; +}; diff --git a/node_modules/eslint/lib/cli-engine/xml-escape.js b/node_modules/eslint/lib/cli-engine/xml-escape.js new file mode 100644 index 0000000..2e52dba --- /dev/null +++ b/node_modules/eslint/lib/cli-engine/xml-escape.js @@ -0,0 +1,34 @@ +/** + * @fileoverview XML character escaper + * @author George Chung + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Returns the escaped value for a character + * @param {string} s string to examine + * @returns {string} severity level + * @private + */ +module.exports = function(s) { + return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex -- Converting controls to entities + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case "\"": + return """; + case "'": + return "'"; + default: + return `&#${c.charCodeAt(0)};`; + } + }); +}; diff --git a/node_modules/eslint/lib/cli.js b/node_modules/eslint/lib/cli.js new file mode 100644 index 0000000..f09d143 --- /dev/null +++ b/node_modules/eslint/lib/cli.js @@ -0,0 +1,344 @@ +/** + * @fileoverview Main CLI object. + * @author Nicholas C. Zakas + */ + +"use strict"; + +/* + * The CLI object should *not* call process.exit() directly. It should only return + * exit codes. This allows other programs to use the CLI object and still control + * when the program exits. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const fs = require("fs"), + path = require("path"), + { promisify } = require("util"), + { ESLint } = require("./eslint"), + CLIOptions = require("./options"), + log = require("./shared/logging"), + RuntimeInfo = require("./shared/runtime-info"); + +const debug = require("debug")("eslint:cli"); + +//------------------------------------------------------------------------------ +// Types +//------------------------------------------------------------------------------ + +/** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */ +/** @typedef {import("./eslint/eslint").LintMessage} LintMessage */ +/** @typedef {import("./eslint/eslint").LintResult} LintResult */ +/** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const mkdir = promisify(fs.mkdir); +const stat = promisify(fs.stat); +const writeFile = promisify(fs.writeFile); + +/** + * Predicate function for whether or not to apply fixes in quiet mode. + * If a message is a warning, do not apply a fix. + * @param {LintMessage} message The lint result. + * @returns {boolean} True if the lint message is an error (and thus should be + * autofixed), false otherwise. + */ +function quietFixPredicate(message) { + return message.severity === 2; +} + +/** + * Translates the CLI options into the options expected by the CLIEngine. + * @param {ParsedCLIOptions} cliOptions The CLI options to translate. + * @returns {ESLintOptions} The options object for the CLIEngine. + * @private + */ +function translateOptions({ + cache, + cacheFile, + cacheLocation, + cacheStrategy, + config, + env, + errorOnUnmatchedPattern, + eslintrc, + ext, + fix, + fixDryRun, + fixType, + global, + ignore, + ignorePath, + ignorePattern, + inlineConfig, + parser, + parserOptions, + plugin, + quiet, + reportUnusedDisableDirectives, + resolvePluginsRelativeTo, + rule, + rulesdir +}) { + return { + allowInlineConfig: inlineConfig, + cache, + cacheLocation: cacheLocation || cacheFile, + cacheStrategy, + errorOnUnmatchedPattern, + extensions: ext, + fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true), + fixTypes: fixType, + ignore, + ignorePath, + overrideConfig: { + env: env && env.reduce((obj, name) => { + obj[name] = true; + return obj; + }, {}), + globals: global && global.reduce((obj, name) => { + if (name.endsWith(":true")) { + obj[name.slice(0, -5)] = "writable"; + } else { + obj[name] = "readonly"; + } + return obj; + }, {}), + ignorePatterns: ignorePattern, + parser, + parserOptions, + plugins: plugin, + rules: rule + }, + overrideConfigFile: config, + reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0, + resolvePluginsRelativeTo, + rulePaths: rulesdir, + useEslintrc: eslintrc + }; +} + +/** + * Count error messages. + * @param {LintResult[]} results The lint results. + * @returns {{errorCount:number;warningCount:number}} The number of error messages. + */ +function countErrors(results) { + let errorCount = 0; + let fatalErrorCount = 0; + let warningCount = 0; + + for (const result of results) { + errorCount += result.errorCount; + fatalErrorCount += result.fatalErrorCount; + warningCount += result.warningCount; + } + + return { errorCount, fatalErrorCount, warningCount }; +} + +/** + * Check if a given file path is a directory or not. + * @param {string} filePath The path to a file to check. + * @returns {Promise} `true` if the given path is a directory. + */ +async function isDirectory(filePath) { + try { + return (await stat(filePath)).isDirectory(); + } catch (error) { + if (error.code === "ENOENT" || error.code === "ENOTDIR") { + return false; + } + throw error; + } +} + +/** + * Outputs the results of the linting. + * @param {ESLint} engine The ESLint instance to use. + * @param {LintResult[]} results The results to print. + * @param {string} format The name of the formatter to use or the path to the formatter. + * @param {string} outputFile The path for the output file. + * @returns {Promise} True if the printing succeeds, false if not. + * @private + */ +async function printResults(engine, results, format, outputFile) { + let formatter; + + try { + formatter = await engine.loadFormatter(format); + } catch (e) { + log.error(e.message); + return false; + } + + const output = await formatter.format(results); + + if (output) { + if (outputFile) { + const filePath = path.resolve(process.cwd(), outputFile); + + if (await isDirectory(filePath)) { + log.error("Cannot write to output file path, it is a directory: %s", outputFile); + return false; + } + + try { + await mkdir(path.dirname(filePath), { recursive: true }); + await writeFile(filePath, output); + } catch (ex) { + log.error("There was a problem writing the output file:\n%s", ex); + return false; + } + } else { + log.info(output); + } + } + + return true; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as + * for other Node.js programs to effectively run the CLI. + */ +const cli = { + + /** + * Executes the CLI based on an array of arguments that is passed in. + * @param {string|Array|Object} args The arguments to process. + * @param {string} [text] The text to lint (used for TTY). + * @returns {Promise} The exit code for the operation. + */ + async execute(args, text) { + if (Array.isArray(args)) { + debug("CLI args: %o", args.slice(2)); + } + + /** @type {ParsedCLIOptions} */ + let options; + + try { + options = CLIOptions.parse(args); + } catch (error) { + log.error(error.message); + return 2; + } + + const files = options._; + const useStdin = typeof text === "string"; + + if (options.help) { + log.info(CLIOptions.generateHelp()); + return 0; + } + if (options.version) { + log.info(RuntimeInfo.version()); + return 0; + } + if (options.envInfo) { + try { + log.info(RuntimeInfo.environment()); + return 0; + } catch (err) { + log.error(err.message); + return 2; + } + } + + if (options.printConfig) { + if (files.length) { + log.error("The --print-config option must be used with exactly one file name."); + return 2; + } + if (useStdin) { + log.error("The --print-config option is not available for piped-in code."); + return 2; + } + + const engine = new ESLint(translateOptions(options)); + const fileConfig = + await engine.calculateConfigForFile(options.printConfig); + + log.info(JSON.stringify(fileConfig, null, " ")); + return 0; + } + + debug(`Running on ${useStdin ? "text" : "files"}`); + + if (options.fix && options.fixDryRun) { + log.error("The --fix option and the --fix-dry-run option cannot be used together."); + return 2; + } + if (useStdin && options.fix) { + log.error("The --fix option is not available for piped-in code; use --fix-dry-run instead."); + return 2; + } + if (options.fixType && !options.fix && !options.fixDryRun) { + log.error("The --fix-type option requires either --fix or --fix-dry-run."); + return 2; + } + + const engine = new ESLint(translateOptions(options)); + let results; + + if (useStdin) { + results = await engine.lintText(text, { + filePath: options.stdinFilename, + warnIgnored: true + }); + } else { + results = await engine.lintFiles(files); + } + + if (options.fix) { + debug("Fix mode enabled - applying fixes"); + await ESLint.outputFixes(results); + } + + let resultsToPrint = results; + + if (options.quiet) { + debug("Quiet mode enabled - filtering out warnings"); + resultsToPrint = ESLint.getErrorResults(resultsToPrint); + } + + if (await printResults(engine, resultsToPrint, options.format, options.outputFile)) { + + // Errors and warnings from the original unfiltered results should determine the exit code + const { errorCount, fatalErrorCount, warningCount } = countErrors(results); + + const tooManyWarnings = + options.maxWarnings >= 0 && warningCount > options.maxWarnings; + const shouldExitForFatalErrors = + options.exitOnFatalError && fatalErrorCount > 0; + + if (!errorCount && tooManyWarnings) { + log.error( + "ESLint found too many warnings (maximum: %s).", + options.maxWarnings + ); + } + + if (shouldExitForFatalErrors) { + return 2; + } + + return (errorCount || tooManyWarnings) ? 1 : 0; + } + + return 2; + } +}; + +module.exports = cli; diff --git a/node_modules/eslint/lib/config/default-config.js b/node_modules/eslint/lib/config/default-config.js new file mode 100644 index 0000000..a655a6d --- /dev/null +++ b/node_modules/eslint/lib/config/default-config.js @@ -0,0 +1,61 @@ +/** + * @fileoverview Default configuration + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const Rules = require("../rules"); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + + +exports.defaultConfig = [ + { + plugins: { + "@": { + parsers: { + espree: require("espree") + }, + + /* + * Because we try to delay loading rules until absolutely + * necessary, a proxy allows us to hook into the lazy-loading + * aspect of the rules map while still keeping all of the + * relevant configuration inside of the config array. + */ + rules: new Proxy({}, { + get(target, property) { + return Rules.get(property); + }, + + has(target, property) { + return Rules.has(property); + } + }) + } + }, + ignores: [ + "**/node_modules/**", + ".git/**" + ], + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + parser: "@/espree", + parserOptions: {} + } + }, + { + files: ["**/*.cjs"], + languageOptions: { + sourceType: "commonjs" + } + } +]; diff --git a/node_modules/eslint/lib/config/flat-config-array.js b/node_modules/eslint/lib/config/flat-config-array.js new file mode 100644 index 0000000..fbedf13 --- /dev/null +++ b/node_modules/eslint/lib/config/flat-config-array.js @@ -0,0 +1,134 @@ +/** + * @fileoverview Flat Config Array + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const { ConfigArray, ConfigArraySymbol } = require("@humanwhocodes/config-array"); +const { flatConfigSchema } = require("./flat-config-schema"); +const { RuleValidator } = require("./rule-validator"); +const { defaultConfig } = require("./default-config"); +const recommendedConfig = require("../../conf/eslint-recommended"); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const ruleValidator = new RuleValidator(); + +/** + * Splits a plugin identifier in the form a/b/c into two parts: a/b and c. + * @param {string} identifier The identifier to parse. + * @returns {{objectName: string, pluginName: string}} The parts of the plugin + * name. + */ +function splitPluginIdentifier(identifier) { + const parts = identifier.split("/"); + + return { + objectName: parts.pop(), + pluginName: parts.join("/") + }; +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * Represents an array containing configuration information for ESLint. + */ +class FlatConfigArray extends ConfigArray { + + /** + * Creates a new instance. + * @param {*[]} configs An array of configuration information. + * @param {{basePath: string, baseConfig: FlatConfig}} options The options + * to use for the config array instance. + */ + constructor(configs, { basePath, baseConfig = defaultConfig } = {}) { + super(configs, { + basePath, + schema: flatConfigSchema + }); + + if (baseConfig[Symbol.iterator]) { + this.unshift(...baseConfig); + } else { + this.unshift(baseConfig); + } + } + + /* eslint-disable class-methods-use-this -- Desired as instance method */ + /** + * Replaces a config with another config to allow us to put strings + * in the config array that will be replaced by objects before + * normalization. + * @param {Object} config The config to preprocess. + * @returns {Object} The preprocessed config. + */ + [ConfigArraySymbol.preprocessConfig](config) { + if (config === "eslint:recommended") { + return recommendedConfig; + } + + if (config === "eslint:all") { + + /* + * Load `eslint-all.js` here instead of at the top level to avoid loading all rule modules + * when it isn't necessary. `eslint-all.js` reads `meta` of rule objects to filter out deprecated ones, + * so requiring `eslint-all.js` module loads all rule modules as a consequence. + */ + return require("../../conf/eslint-all"); + } + + return config; + } + + /** + * Finalizes the config by replacing plugin references with their objects + * and validating rule option schemas. + * @param {Object} config The config to finalize. + * @returns {Object} The finalized config. + * @throws {TypeError} If the config is invalid. + */ + [ConfigArraySymbol.finalizeConfig](config) { + + const { plugins, languageOptions, processor } = config; + + // Check parser value + if (languageOptions && languageOptions.parser && typeof languageOptions.parser === "string") { + const { pluginName, objectName: parserName } = splitPluginIdentifier(languageOptions.parser); + + if (!plugins || !plugins[pluginName] || !plugins[pluginName].parsers || !plugins[pluginName].parsers[parserName]) { + throw new TypeError(`Key "parser": Could not find "${parserName}" in plugin "${pluginName}".`); + } + + languageOptions.parser = plugins[pluginName].parsers[parserName]; + } + + // Check processor value + if (processor && typeof processor === "string") { + const { pluginName, objectName: processorName } = splitPluginIdentifier(processor); + + if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[processorName]) { + throw new TypeError(`Key "processor": Could not find "${processorName}" in plugin "${pluginName}".`); + } + + config.processor = plugins[pluginName].processors[processorName]; + } + + ruleValidator.validate(config); + + return config; + } + /* eslint-enable class-methods-use-this -- Desired as instance method */ + +} + +exports.FlatConfigArray = FlatConfigArray; diff --git a/node_modules/eslint/lib/config/flat-config-helpers.js b/node_modules/eslint/lib/config/flat-config-helpers.js new file mode 100644 index 0000000..bcc4eb1 --- /dev/null +++ b/node_modules/eslint/lib/config/flat-config-helpers.js @@ -0,0 +1,103 @@ +/** + * @fileoverview Shared functions to work with configs. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +/** + * Parses a ruleId into its plugin and rule parts. + * @param {string} ruleId The rule ID to parse. + * @returns {{pluginName:string,ruleName:string}} The plugin and rule + * parts of the ruleId; + */ +function parseRuleId(ruleId) { + let pluginName, ruleName; + + // distinguish between core rules and plugin rules + if (ruleId.includes("/")) { + pluginName = ruleId.slice(0, ruleId.lastIndexOf("/")); + ruleName = ruleId.slice(pluginName.length + 1); + } else { + pluginName = "@"; + ruleName = ruleId; + } + + return { + pluginName, + ruleName + }; +} + +/** + * Retrieves a rule instance from a given config based on the ruleId. + * @param {string} ruleId The rule ID to look for. + * @param {FlatConfig} config The config to search. + * @returns {import("../shared/types").Rule|undefined} The rule if found + * or undefined if not. + */ +function getRuleFromConfig(ruleId, config) { + + const { pluginName, ruleName } = parseRuleId(ruleId); + + const plugin = config.plugins && config.plugins[pluginName]; + let rule = plugin && plugin.rules && plugin.rules[ruleName]; + + // normalize function rules into objects + if (rule && typeof rule === "function") { + rule = { + create: rule + }; + } + + return rule; +} + +/** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ +function getRuleOptionsSchema(rule) { + + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; +} + + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +module.exports = { + parseRuleId, + getRuleFromConfig, + getRuleOptionsSchema +}; diff --git a/node_modules/eslint/lib/config/flat-config-schema.js b/node_modules/eslint/lib/config/flat-config-schema.js new file mode 100644 index 0000000..cb8e796 --- /dev/null +++ b/node_modules/eslint/lib/config/flat-config-schema.js @@ -0,0 +1,457 @@ +/** + * @fileoverview Flat config schema + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Type Definitions +//----------------------------------------------------------------------------- + +/** + * @typedef ObjectPropertySchema + * @property {Function|string} merge The function or name of the function to call + * to merge multiple objects with this property. + * @property {Function|string} validate The function or name of the function to call + * to validate the value of this property. + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const ruleSeverities = new Map([ + [0, 0], ["off", 0], + [1, 1], ["warn", 1], + [2, 2], ["error", 2] +]); + +const globalVariablesValues = new Set([ + true, "true", "writable", "writeable", + false, "false", "readonly", "readable", null, + "off" +]); + +/** + * Check if a value is a non-null object. + * @param {any} value The value to check. + * @returns {boolean} `true` if the value is a non-null object. + */ +function isNonNullObject(value) { + return typeof value === "object" && value !== null; +} + +/** + * Check if a value is undefined. + * @param {any} value The value to check. + * @returns {boolean} `true` if the value is undefined. + */ +function isUndefined(value) { + return typeof value === "undefined"; +} + +/** + * Deeply merges two objects. + * @param {Object} first The base object. + * @param {Object} second The overrides object. + * @returns {Object} An object with properties from both first and second. + */ +function deepMerge(first = {}, second = {}) { + + /* + * If the second value is an array, just return it. We don't merge + * arrays because order matters and we can't know the correct order. + */ + if (Array.isArray(second)) { + return second; + } + + /* + * First create a result object where properties from the second object + * overwrite properties from the first. This sets up a baseline to use + * later rather than needing to inspect and change every property + * individually. + */ + const result = { + ...first, + ...second + }; + + for (const key of Object.keys(second)) { + + // avoid hairy edge case + if (key === "__proto__") { + continue; + } + + const firstValue = first[key]; + const secondValue = second[key]; + + if (isNonNullObject(firstValue)) { + result[key] = deepMerge(firstValue, secondValue); + } else if (isUndefined(firstValue)) { + if (isNonNullObject(secondValue)) { + result[key] = deepMerge( + Array.isArray(secondValue) ? [] : {}, + secondValue + ); + } else if (!isUndefined(secondValue)) { + result[key] = secondValue; + } + } + } + + return result; + +} + +/** + * Normalizes the rule options config for a given rule by ensuring that + * it is an array and that the first item is 0, 1, or 2. + * @param {Array|string|number} ruleOptions The rule options config. + * @returns {Array} An array of rule options. + */ +function normalizeRuleOptions(ruleOptions) { + + const finalOptions = Array.isArray(ruleOptions) + ? ruleOptions.slice(0) + : [ruleOptions]; + + finalOptions[0] = ruleSeverities.get(finalOptions[0]); + return finalOptions; +} + +//----------------------------------------------------------------------------- +// Assertions +//----------------------------------------------------------------------------- + +/** + * Validates that a value is a valid rule options entry. + * @param {any} value The value to check. + * @returns {void} + * @throws {TypeError} If the value isn't a valid rule options. + */ +function assertIsRuleOptions(value) { + + if (typeof value !== "string" && typeof value !== "number" && !Array.isArray(value)) { + throw new TypeError("Expected a string, number, or array."); + } +} + +/** + * Validates that a value is valid rule severity. + * @param {any} value The value to check. + * @returns {void} + * @throws {TypeError} If the value isn't a valid rule severity. + */ +function assertIsRuleSeverity(value) { + const severity = typeof value === "string" + ? ruleSeverities.get(value.toLowerCase()) + : ruleSeverities.get(value); + + if (typeof severity === "undefined") { + throw new TypeError("Expected severity of \"off\", 0, \"warn\", 1, \"error\", or 2."); + } +} + +/** + * Validates that a given string is the form pluginName/objectName. + * @param {string} value The string to check. + * @returns {void} + * @throws {TypeError} If the string isn't in the correct format. + */ +function assertIsPluginMemberName(value) { + if (!/[@a-z0-9-_$]+(?:\/(?:[a-z0-9-_$]+))+$/iu.test(value)) { + throw new TypeError(`Expected string in the form "pluginName/objectName" but found "${value}".`); + } +} + +/** + * Validates that a value is an object. + * @param {any} value The value to check. + * @returns {void} + * @throws {TypeError} If the value isn't an object. + */ +function assertIsObject(value) { + if (!isNonNullObject(value)) { + throw new TypeError("Expected an object."); + } +} + +/** + * Validates that a value is an object or a string. + * @param {any} value The value to check. + * @returns {void} + * @throws {TypeError} If the value isn't an object or a string. + */ +function assertIsObjectOrString(value) { + if ((!value || typeof value !== "object") && typeof value !== "string") { + throw new TypeError("Expected an object or string."); + } +} + +//----------------------------------------------------------------------------- +// Low-Level Schemas +//----------------------------------------------------------------------------- + +/** @type {ObjectPropertySchema} */ +const booleanSchema = { + merge: "replace", + validate: "boolean" +}; + +/** @type {ObjectPropertySchema} */ +const deepObjectAssignSchema = { + merge(first = {}, second = {}) { + return deepMerge(first, second); + }, + validate: "object" +}; + +//----------------------------------------------------------------------------- +// High-Level Schemas +//----------------------------------------------------------------------------- + +/** @type {ObjectPropertySchema} */ +const globalsSchema = { + merge: "assign", + validate(value) { + + assertIsObject(value); + + for (const key of Object.keys(value)) { + + // avoid hairy edge case + if (key === "__proto__") { + continue; + } + + if (key !== key.trim()) { + throw new TypeError(`Global "${key}" has leading or trailing whitespace.`); + } + + if (!globalVariablesValues.has(value[key])) { + throw new TypeError(`Key "${key}": Expected "readonly", "writable", or "off".`); + } + } + } +}; + +/** @type {ObjectPropertySchema} */ +const parserSchema = { + merge: "replace", + validate(value) { + assertIsObjectOrString(value); + + if (typeof value === "object" && typeof value.parse !== "function" && typeof value.parseForESLint !== "function") { + throw new TypeError("Expected object to have a parse() or parseForESLint() method."); + } + + if (typeof value === "string") { + assertIsPluginMemberName(value); + } + } +}; + +/** @type {ObjectPropertySchema} */ +const pluginsSchema = { + merge(first = {}, second = {}) { + const keys = new Set([...Object.keys(first), ...Object.keys(second)]); + const result = {}; + + // manually validate that plugins are not redefined + for (const key of keys) { + + // avoid hairy edge case + if (key === "__proto__") { + continue; + } + + if (key in first && key in second && first[key] !== second[key]) { + throw new TypeError(`Cannot redefine plugin "${key}".`); + } + + result[key] = second[key] || first[key]; + } + + return result; + }, + validate(value) { + + // first check the value to be sure it's an object + if (value === null || typeof value !== "object") { + throw new TypeError("Expected an object."); + } + + // second check the keys to make sure they are objects + for (const key of Object.keys(value)) { + + // avoid hairy edge case + if (key === "__proto__") { + continue; + } + + if (value[key] === null || typeof value[key] !== "object") { + throw new TypeError(`Key "${key}": Expected an object.`); + } + } + } +}; + +/** @type {ObjectPropertySchema} */ +const processorSchema = { + merge: "replace", + validate(value) { + if (typeof value === "string") { + assertIsPluginMemberName(value); + } else if (value && typeof value === "object") { + if (typeof value.preprocess !== "function" || typeof value.postprocess !== "function") { + throw new TypeError("Object must have a preprocess() and a postprocess() method."); + } + } else { + throw new TypeError("Expected an object or a string."); + } + } +}; + +/** @type {ObjectPropertySchema} */ +const rulesSchema = { + merge(first = {}, second = {}) { + + const result = { + ...first, + ...second + }; + + for (const ruleId of Object.keys(result)) { + + // avoid hairy edge case + if (ruleId === "__proto__") { + + /* eslint-disable-next-line no-proto -- Though deprecated, may still be present */ + delete result.__proto__; + continue; + } + + result[ruleId] = normalizeRuleOptions(result[ruleId]); + + /* + * If either rule config is missing, then the correct + * config is already present and we just need to normalize + * the severity. + */ + if (!(ruleId in first) || !(ruleId in second)) { + continue; + } + + const firstRuleOptions = normalizeRuleOptions(first[ruleId]); + const secondRuleOptions = normalizeRuleOptions(second[ruleId]); + + /* + * If the second rule config only has a severity (length of 1), + * then use that severity and keep the rest of the options from + * the first rule config. + */ + if (secondRuleOptions.length === 1) { + result[ruleId] = [secondRuleOptions[0], ...firstRuleOptions.slice(1)]; + continue; + } + + /* + * In any other situation, then the second rule config takes + * precedence. That means the value at `result[ruleId]` is + * already correct and no further work is necessary. + */ + } + + return result; + }, + + validate(value) { + assertIsObject(value); + + let lastRuleId; + + // Performance: One try-catch has less overhead than one per loop iteration + try { + + /* + * We are not checking the rule schema here because there is no + * guarantee that the rule definition is present at this point. Instead + * we wait and check the rule schema during the finalization step + * of calculating a config. + */ + for (const ruleId of Object.keys(value)) { + + // avoid hairy edge case + if (ruleId === "__proto__") { + continue; + } + + lastRuleId = ruleId; + + const ruleOptions = value[ruleId]; + + assertIsRuleOptions(ruleOptions); + + if (Array.isArray(ruleOptions)) { + assertIsRuleSeverity(ruleOptions[0]); + } else { + assertIsRuleSeverity(ruleOptions); + } + } + } catch (error) { + error.message = `Key "${lastRuleId}": ${error.message}`; + throw error; + } + } +}; + +/** @type {ObjectPropertySchema} */ +const ecmaVersionSchema = { + merge: "replace", + validate(value) { + if (typeof value === "number" || value === "latest") { + return; + } + + throw new TypeError("Expected a number or \"latest\"."); + } +}; + +/** @type {ObjectPropertySchema} */ +const sourceTypeSchema = { + merge: "replace", + validate(value) { + if (typeof value !== "string" || !/^(?:script|module|commonjs)$/u.test(value)) { + throw new TypeError("Expected \"script\", \"module\", or \"commonjs\"."); + } + } +}; + +//----------------------------------------------------------------------------- +// Full schema +//----------------------------------------------------------------------------- + +exports.flatConfigSchema = { + settings: deepObjectAssignSchema, + linterOptions: { + schema: { + noInlineConfig: booleanSchema, + reportUnusedDisableDirectives: booleanSchema + } + }, + languageOptions: { + schema: { + ecmaVersion: ecmaVersionSchema, + sourceType: sourceTypeSchema, + globals: globalsSchema, + parser: parserSchema, + parserOptions: deepObjectAssignSchema + } + }, + processor: processorSchema, + plugins: pluginsSchema, + rules: rulesSchema +}; diff --git a/node_modules/eslint/lib/config/rule-validator.js b/node_modules/eslint/lib/config/rule-validator.js new file mode 100644 index 0000000..0b5858f --- /dev/null +++ b/node_modules/eslint/lib/config/rule-validator.js @@ -0,0 +1,157 @@ +/** + * @fileoverview Rule Validator + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const ajv = require("../shared/ajv")(); +const { + parseRuleId, + getRuleFromConfig, + getRuleOptionsSchema +} = require("./flat-config-helpers"); +const ruleReplacements = require("../../conf/replacements.json"); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Throws a helpful error when a rule cannot be found. + * @param {Object} ruleId The rule identifier. + * @param {string} ruleId.pluginName The ID of the rule to find. + * @param {string} ruleId.ruleName The ID of the rule to find. + * @param {Object} config The config to search in. + * @throws {TypeError} For missing plugin or rule. + * @returns {void} + */ +function throwRuleNotFoundError({ pluginName, ruleName }, config) { + + const ruleId = pluginName === "@" ? ruleName : `${pluginName}/${ruleName}`; + + const errorMessageHeader = `Key "rules": Key "${ruleId}"`; + let errorMessage = `${errorMessageHeader}: Could not find plugin "${pluginName}".`; + + // if the plugin exists then we need to check if the rule exists + if (config.plugins && config.plugins[pluginName]) { + const replacementRuleName = ruleReplacements.rules[ruleName]; + + if (pluginName === "@" && replacementRuleName) { + + errorMessage = `${errorMessageHeader}: Rule "${ruleName}" was removed and replaced by "${replacementRuleName}".`; + + } else { + + errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`; + + // otherwise, let's see if we can find the rule name elsewhere + for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) { + if (otherPlugin.rules && otherPlugin.rules[ruleName]) { + errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`; + break; + } + } + + } + + // falls through to throw error + } + + throw new TypeError(errorMessage); +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * Implements validation functionality for the rules portion of a config. + */ +class RuleValidator { + + /** + * Creates a new instance. + */ + constructor() { + + /** + * A collection of compiled validators for rules that have already + * been validated. + * @type {WeakMap} + */ + this.validators = new WeakMap(); + } + + /** + * Validates all of the rule configurations in a config against each + * rule's schema. + * @param {Object} config The full config to validate. This object must + * contain both the rules section and the plugins section. + * @returns {void} + * @throws {Error} If a rule's configuration does not match its schema. + */ + validate(config) { + + if (!config.rules) { + return; + } + + for (const [ruleId, ruleOptions] of Object.entries(config.rules)) { + + // check for edge case + if (ruleId === "__proto__") { + continue; + } + + /* + * If a rule is disabled, we don't do any validation. This allows + * users to safely set any value to 0 or "off" without worrying + * that it will cause a validation error. + * + * Note: ruleOptions is always an array at this point because + * this validation occurs after FlatConfigArray has merged and + * normalized values. + */ + if (ruleOptions[0] === 0) { + continue; + } + + const rule = getRuleFromConfig(ruleId, config); + + if (!rule) { + throwRuleNotFoundError(parseRuleId(ruleId), config); + } + + // Precompile and cache validator the first time + if (!this.validators.has(rule)) { + const schema = getRuleOptionsSchema(rule); + + if (schema) { + this.validators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = this.validators.get(rule); + + if (validateRule) { + + validateRule(ruleOptions.slice(1)); + + if (validateRule.errors) { + throw new Error(`Key "rules": Key "${ruleId}": ${ + validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("") + }`); + } + } + } + } +} + +exports.RuleValidator = RuleValidator; diff --git a/node_modules/eslint/lib/eslint/eslint.js b/node_modules/eslint/lib/eslint/eslint.js new file mode 100644 index 0000000..9a3bd66 --- /dev/null +++ b/node_modules/eslint/lib/eslint/eslint.js @@ -0,0 +1,697 @@ +/** + * @fileoverview Main API Class + * @author Kai Cataldo + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const path = require("path"); +const fs = require("fs"); +const { promisify } = require("util"); +const { CLIEngine, getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); +const BuiltinRules = require("../rules"); +const { + Legacy: { + ConfigOps: { + getRuleSeverity + } + } +} = require("@eslint/eslintrc"); +const { version } = require("../../package.json"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** @typedef {import("../cli-engine/cli-engine").LintReport} CLIEngineLintReport */ +/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */ +/** @typedef {import("../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../shared/types").LintMessage} LintMessage */ +/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */ +/** @typedef {import("../shared/types").Plugin} Plugin */ +/** @typedef {import("../shared/types").Rule} Rule */ +/** @typedef {import("../shared/types").LintResult} LintResult */ + +/** + * The main formatter object. + * @typedef LoadedFormatter + * @property {function(LintResult[]): string | Promise} format format function. + */ + +/** + * The options with which to configure the ESLint instance. + * @typedef {Object} ESLintOptions + * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments. + * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this instance + * @property {boolean} [cache] Enable result caching. + * @property {string} [cacheLocation] The cache file to use instead of .eslintcache. + * @property {"metadata" | "content"} [cacheStrategy] The strategy used to detect changed files. + * @property {string} [cwd] The value to use for the current working directory. + * @property {boolean} [errorOnUnmatchedPattern] If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. + * @property {string[]} [extensions] An array of file extensions to check. + * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean. + * @property {string[]} [fixTypes] Array of rule types to apply fixes for. + * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. + * @property {boolean} [ignore] False disables use of .eslintignore. + * @property {string} [ignorePath] The ignore file to use instead of .eslintignore. + * @property {ConfigData} [overrideConfig] Override config object, overrides all configs used with this instance + * @property {string} [overrideConfigFile] The configuration file to use. + * @property {Record|null} [plugins] Preloaded plugins. This is a map-like object, keys are plugin IDs and each value is implementation. + * @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives. + * @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD. + * @property {string[]} [rulePaths] An array of directories to load custom rules from. + * @property {boolean} [useEslintrc] False disables looking for .eslintrc.* files. + */ + +/** + * A rules metadata object. + * @typedef {Object} RulesMeta + * @property {string} id The plugin ID. + * @property {Object} definition The plugin definition. + */ + +/** + * Private members for the `ESLint` instance. + * @typedef {Object} ESLintPrivateMembers + * @property {CLIEngine} cliEngine The wrapped CLIEngine instance. + * @property {ESLintOptions} options The options used to instantiate the ESLint instance. + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const writeFile = promisify(fs.writeFile); + +/** + * The map with which to store private class members. + * @type {WeakMap} + */ +const privateMembersMap = new WeakMap(); + +/** + * Check if a given value is a non-empty string or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if `x` is a non-empty string. + */ +function isNonEmptyString(x) { + return typeof x === "string" && x.trim() !== ""; +} + +/** + * Check if a given value is an array of non-empty strings or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if `x` is an array of non-empty strings. + */ +function isArrayOfNonEmptyString(x) { + return Array.isArray(x) && x.every(isNonEmptyString); +} + +/** + * Check if a given value is a valid fix type or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if `x` is valid fix type. + */ +function isFixType(x) { + return x === "directive" || x === "problem" || x === "suggestion" || x === "layout"; +} + +/** + * Check if a given value is an array of fix types or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if `x` is an array of fix types. + */ +function isFixTypeArray(x) { + return Array.isArray(x) && x.every(isFixType); +} + +/** + * The error for invalid options. + */ +class ESLintInvalidOptionsError extends Error { + constructor(messages) { + super(`Invalid Options:\n- ${messages.join("\n- ")}`); + this.code = "ESLINT_INVALID_OPTIONS"; + Error.captureStackTrace(this, ESLintInvalidOptionsError); + } +} + +/** + * Validates and normalizes options for the wrapped CLIEngine instance. + * @param {ESLintOptions} options The options to process. + * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors. + * @returns {ESLintOptions} The normalized options. + */ +function processOptions({ + allowInlineConfig = true, // ← we cannot use `overrideConfig.noInlineConfig` instead because `allowInlineConfig` has side-effect that suppress warnings that show inline configs are ignored. + baseConfig = null, + cache = false, + cacheLocation = ".eslintcache", + cacheStrategy = "metadata", + cwd = process.cwd(), + errorOnUnmatchedPattern = true, + extensions = null, // ← should be null by default because if it's an array then it suppresses RFC20 feature. + fix = false, + fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property. + globInputPaths = true, + ignore = true, + ignorePath = null, // ← should be null by default because if it's a string then it may throw ENOENT. + overrideConfig = null, + overrideConfigFile = null, + plugins = {}, + reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that. + resolvePluginsRelativeTo = null, // ← should be null by default because if it's a string then it suppresses RFC47 feature. + rulePaths = [], + useEslintrc = true, + ...unknownOptions +}) { + const errors = []; + const unknownOptionKeys = Object.keys(unknownOptions); + + if (unknownOptionKeys.length >= 1) { + errors.push(`Unknown options: ${unknownOptionKeys.join(", ")}`); + if (unknownOptionKeys.includes("cacheFile")) { + errors.push("'cacheFile' has been removed. Please use the 'cacheLocation' option instead."); + } + if (unknownOptionKeys.includes("configFile")) { + errors.push("'configFile' has been removed. Please use the 'overrideConfigFile' option instead."); + } + if (unknownOptionKeys.includes("envs")) { + errors.push("'envs' has been removed. Please use the 'overrideConfig.env' option instead."); + } + if (unknownOptionKeys.includes("globals")) { + errors.push("'globals' has been removed. Please use the 'overrideConfig.globals' option instead."); + } + if (unknownOptionKeys.includes("ignorePattern")) { + errors.push("'ignorePattern' has been removed. Please use the 'overrideConfig.ignorePatterns' option instead."); + } + if (unknownOptionKeys.includes("parser")) { + errors.push("'parser' has been removed. Please use the 'overrideConfig.parser' option instead."); + } + if (unknownOptionKeys.includes("parserOptions")) { + errors.push("'parserOptions' has been removed. Please use the 'overrideConfig.parserOptions' option instead."); + } + if (unknownOptionKeys.includes("rules")) { + errors.push("'rules' has been removed. Please use the 'overrideConfig.rules' option instead."); + } + } + if (typeof allowInlineConfig !== "boolean") { + errors.push("'allowInlineConfig' must be a boolean."); + } + if (typeof baseConfig !== "object") { + errors.push("'baseConfig' must be an object or null."); + } + if (typeof cache !== "boolean") { + errors.push("'cache' must be a boolean."); + } + if (!isNonEmptyString(cacheLocation)) { + errors.push("'cacheLocation' must be a non-empty string."); + } + if ( + cacheStrategy !== "metadata" && + cacheStrategy !== "content" + ) { + errors.push("'cacheStrategy' must be any of \"metadata\", \"content\"."); + } + if (!isNonEmptyString(cwd) || !path.isAbsolute(cwd)) { + errors.push("'cwd' must be an absolute path."); + } + if (typeof errorOnUnmatchedPattern !== "boolean") { + errors.push("'errorOnUnmatchedPattern' must be a boolean."); + } + if (!isArrayOfNonEmptyString(extensions) && extensions !== null) { + errors.push("'extensions' must be an array of non-empty strings or null."); + } + if (typeof fix !== "boolean" && typeof fix !== "function") { + errors.push("'fix' must be a boolean or a function."); + } + if (fixTypes !== null && !isFixTypeArray(fixTypes)) { + errors.push("'fixTypes' must be an array of any of \"directive\", \"problem\", \"suggestion\", and \"layout\"."); + } + if (typeof globInputPaths !== "boolean") { + errors.push("'globInputPaths' must be a boolean."); + } + if (typeof ignore !== "boolean") { + errors.push("'ignore' must be a boolean."); + } + if (!isNonEmptyString(ignorePath) && ignorePath !== null) { + errors.push("'ignorePath' must be a non-empty string or null."); + } + if (typeof overrideConfig !== "object") { + errors.push("'overrideConfig' must be an object or null."); + } + if (!isNonEmptyString(overrideConfigFile) && overrideConfigFile !== null) { + errors.push("'overrideConfigFile' must be a non-empty string or null."); + } + if (typeof plugins !== "object") { + errors.push("'plugins' must be an object or null."); + } else if (plugins !== null && Object.keys(plugins).includes("")) { + errors.push("'plugins' must not include an empty string."); + } + if (Array.isArray(plugins)) { + errors.push("'plugins' doesn't add plugins to configuration to load. Please use the 'overrideConfig.plugins' option instead."); + } + if ( + reportUnusedDisableDirectives !== "error" && + reportUnusedDisableDirectives !== "warn" && + reportUnusedDisableDirectives !== "off" && + reportUnusedDisableDirectives !== null + ) { + errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null."); + } + if ( + !isNonEmptyString(resolvePluginsRelativeTo) && + resolvePluginsRelativeTo !== null + ) { + errors.push("'resolvePluginsRelativeTo' must be a non-empty string or null."); + } + if (!isArrayOfNonEmptyString(rulePaths)) { + errors.push("'rulePaths' must be an array of non-empty strings."); + } + if (typeof useEslintrc !== "boolean") { + errors.push("'useEslintrc' must be a boolean."); + } + + if (errors.length > 0) { + throw new ESLintInvalidOptionsError(errors); + } + + return { + allowInlineConfig, + baseConfig, + cache, + cacheLocation, + cacheStrategy, + configFile: overrideConfigFile, + cwd, + errorOnUnmatchedPattern, + extensions, + fix, + fixTypes, + globInputPaths, + ignore, + ignorePath, + reportUnusedDisableDirectives, + resolvePluginsRelativeTo, + rulePaths, + useEslintrc + }; +} + +/** + * Check if a value has one or more properties and that value is not undefined. + * @param {any} obj The value to check. + * @returns {boolean} `true` if `obj` has one or more properties that that value is not undefined. + */ +function hasDefinedProperty(obj) { + if (typeof obj === "object" && obj !== null) { + for (const key in obj) { + if (typeof obj[key] !== "undefined") { + return true; + } + } + } + return false; +} + +/** + * Create rulesMeta object. + * @param {Map} rules a map of rules from which to generate the object. + * @returns {Object} metadata for all enabled rules. + */ +function createRulesMeta(rules) { + return Array.from(rules).reduce((retVal, [id, rule]) => { + retVal[id] = rule.meta; + return retVal; + }, {}); +} + +/** @type {WeakMap} */ +const usedDeprecatedRulesCache = new WeakMap(); + +/** + * Create used deprecated rule list. + * @param {CLIEngine} cliEngine The CLIEngine instance. + * @param {string} maybeFilePath The absolute path to a lint target file or `""`. + * @returns {DeprecatedRuleInfo[]} The used deprecated rule list. + */ +function getOrFindUsedDeprecatedRules(cliEngine, maybeFilePath) { + const { + configArrayFactory, + options: { cwd } + } = getCLIEngineInternalSlots(cliEngine); + const filePath = path.isAbsolute(maybeFilePath) + ? maybeFilePath + : path.join(cwd, "__placeholder__.js"); + const configArray = configArrayFactory.getConfigArrayForFile(filePath); + const config = configArray.extractConfig(filePath); + + // Most files use the same config, so cache it. + if (!usedDeprecatedRulesCache.has(config)) { + const pluginRules = configArray.pluginRules; + const retv = []; + + for (const [ruleId, ruleConf] of Object.entries(config.rules)) { + if (getRuleSeverity(ruleConf) === 0) { + continue; + } + const rule = pluginRules.get(ruleId) || BuiltinRules.get(ruleId); + const meta = rule && rule.meta; + + if (meta && meta.deprecated) { + retv.push({ ruleId, replacedBy: meta.replacedBy || [] }); + } + } + + usedDeprecatedRulesCache.set(config, Object.freeze(retv)); + } + + return usedDeprecatedRulesCache.get(config); +} + +/** + * Processes the linting results generated by a CLIEngine linting report to + * match the ESLint class's API. + * @param {CLIEngine} cliEngine The CLIEngine instance. + * @param {CLIEngineLintReport} report The CLIEngine linting report to process. + * @returns {LintResult[]} The processed linting results. + */ +function processCLIEngineLintReport(cliEngine, { results }) { + const descriptor = { + configurable: true, + enumerable: true, + get() { + return getOrFindUsedDeprecatedRules(cliEngine, this.filePath); + } + }; + + for (const result of results) { + Object.defineProperty(result, "usedDeprecatedRules", descriptor); + } + + return results; +} + +/** + * An Array.prototype.sort() compatible compare function to order results by their file path. + * @param {LintResult} a The first lint result. + * @param {LintResult} b The second lint result. + * @returns {number} An integer representing the order in which the two results should occur. + */ +function compareResultsByFilePath(a, b) { + if (a.filePath < b.filePath) { + return -1; + } + + if (a.filePath > b.filePath) { + return 1; + } + + return 0; +} + +/** + * Main API. + */ +class ESLint { + + /** + * Creates a new instance of the main ESLint API. + * @param {ESLintOptions} options The options for this instance. + */ + constructor(options = {}) { + const processedOptions = processOptions(options); + const cliEngine = new CLIEngine(processedOptions, { preloadedPlugins: options.plugins }); + const { + configArrayFactory, + lastConfigArrays + } = getCLIEngineInternalSlots(cliEngine); + let updated = false; + + /* + * Address `overrideConfig` to set override config. + * Operate the `configArrayFactory` internal slot directly because this + * functionality doesn't exist as the public API of CLIEngine. + */ + if (hasDefinedProperty(options.overrideConfig)) { + configArrayFactory.setOverrideConfig(options.overrideConfig); + updated = true; + } + + // Update caches. + if (updated) { + configArrayFactory.clearCache(); + lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile(); + } + + // Initialize private properties. + privateMembersMap.set(this, { + cliEngine, + options: processedOptions + }); + } + + /** + * The version text. + * @type {string} + */ + static get version() { + return version; + } + + /** + * Outputs fixes from the given results to files. + * @param {LintResult[]} results The lint results. + * @returns {Promise} Returns a promise that is used to track side effects. + */ + static async outputFixes(results) { + if (!Array.isArray(results)) { + throw new Error("'results' must be an array"); + } + + await Promise.all( + results + .filter(result => { + if (typeof result !== "object" || result === null) { + throw new Error("'results' must include only objects"); + } + return ( + typeof result.output === "string" && + path.isAbsolute(result.filePath) + ); + }) + .map(r => writeFile(r.filePath, r.output)) + ); + } + + /** + * Returns results that only contains errors. + * @param {LintResult[]} results The results to filter. + * @returns {LintResult[]} The filtered results. + */ + static getErrorResults(results) { + return CLIEngine.getErrorResults(results); + } + + /** + * Returns meta objects for each rule represented in the lint results. + * @param {LintResult[]} results The results to fetch rules meta for. + * @returns {Object} A mapping of ruleIds to rule meta objects. + */ + getRulesMetaForResults(results) { + + const resultRuleIds = new Set(); + + // first gather all ruleIds from all results + + for (const result of results) { + for (const { ruleId } of result.messages) { + resultRuleIds.add(ruleId); + } + for (const { ruleId } of result.suppressedMessages) { + resultRuleIds.add(ruleId); + } + } + + // create a map of all rules in the results + + const { cliEngine } = privateMembersMap.get(this); + const rules = cliEngine.getRules(); + const resultRules = new Map(); + + for (const [ruleId, rule] of rules) { + if (resultRuleIds.has(ruleId)) { + resultRules.set(ruleId, rule); + } + } + + return createRulesMeta(resultRules); + + } + + /** + * Executes the current configuration on an array of file and directory names. + * @param {string[]} patterns An array of file and directory names. + * @returns {Promise} The results of linting the file patterns given. + */ + async lintFiles(patterns) { + if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) { + throw new Error("'patterns' must be a non-empty string or an array of non-empty strings"); + } + const { cliEngine } = privateMembersMap.get(this); + + return processCLIEngineLintReport( + cliEngine, + cliEngine.executeOnFiles(patterns) + ); + } + + /** + * Executes the current configuration on text. + * @param {string} code A string of JavaScript code to lint. + * @param {Object} [options] The options. + * @param {string} [options.filePath] The path to the file of the source code. + * @param {boolean} [options.warnIgnored] When set to true, warn if given filePath is an ignored path. + * @returns {Promise} The results of linting the string of code given. + */ + async lintText(code, options = {}) { + if (typeof code !== "string") { + throw new Error("'code' must be a string"); + } + if (typeof options !== "object") { + throw new Error("'options' must be an object, null, or undefined"); + } + const { + filePath, + warnIgnored = false, + ...unknownOptions + } = options || {}; + + const unknownOptionKeys = Object.keys(unknownOptions); + + if (unknownOptionKeys.length > 0) { + throw new Error(`'options' must not include the unknown option(s): ${unknownOptionKeys.join(", ")}`); + } + + if (filePath !== void 0 && !isNonEmptyString(filePath)) { + throw new Error("'options.filePath' must be a non-empty string or undefined"); + } + if (typeof warnIgnored !== "boolean") { + throw new Error("'options.warnIgnored' must be a boolean or undefined"); + } + + const { cliEngine } = privateMembersMap.get(this); + + return processCLIEngineLintReport( + cliEngine, + cliEngine.executeOnText(code, filePath, warnIgnored) + ); + } + + /** + * Returns the formatter representing the given formatter name. + * @param {string} [name] The name of the formatter to load. + * The following values are allowed: + * - `undefined` ... Load `stylish` builtin formatter. + * - A builtin formatter name ... Load the builtin formatter. + * - A third-party formatter name: + * - `foo` → `eslint-formatter-foo` + * - `@foo` → `@foo/eslint-formatter` + * - `@foo/bar` → `@foo/eslint-formatter-bar` + * - A file path ... Load the file. + * @returns {Promise} A promise resolving to the formatter object. + * This promise will be rejected if the given formatter was not found or not + * a function. + */ + async loadFormatter(name = "stylish") { + if (typeof name !== "string") { + throw new Error("'name' must be a string"); + } + + const { cliEngine, options } = privateMembersMap.get(this); + const formatter = cliEngine.getFormatter(name); + + if (typeof formatter !== "function") { + throw new Error(`Formatter must be a function, but got a ${typeof formatter}.`); + } + + return { + + /** + * The main formatter method. + * @param {LintResult[]} results The lint results to format. + * @returns {string | Promise} The formatted lint results. + */ + format(results) { + let rulesMeta = null; + + results.sort(compareResultsByFilePath); + + return formatter(results, { + get cwd() { + return options.cwd; + }, + get rulesMeta() { + if (!rulesMeta) { + rulesMeta = createRulesMeta(cliEngine.getRules()); + } + + return rulesMeta; + } + }); + } + }; + } + + /** + * Returns a configuration object for the given file based on the CLI options. + * This is the same logic used by the ESLint CLI executable to determine + * configuration for each file it processes. + * @param {string} filePath The path of the file to retrieve a config object for. + * @returns {Promise} A configuration object for the file. + */ + async calculateConfigForFile(filePath) { + if (!isNonEmptyString(filePath)) { + throw new Error("'filePath' must be a non-empty string"); + } + const { cliEngine } = privateMembersMap.get(this); + + return cliEngine.getConfigForFile(filePath); + } + + /** + * Checks if a given path is ignored by ESLint. + * @param {string} filePath The path of the file to check. + * @returns {Promise} Whether or not the given path is ignored. + */ + async isPathIgnored(filePath) { + if (!isNonEmptyString(filePath)) { + throw new Error("'filePath' must be a non-empty string"); + } + const { cliEngine } = privateMembersMap.get(this); + + return cliEngine.isPathIgnored(filePath); + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + ESLint, + + /** + * Get the private class members of a given ESLint instance for tests. + * @param {ESLint} instance The ESLint instance to get. + * @returns {ESLintPrivateMembers} The instance's private class members. + */ + getESLintPrivateMembers(instance) { + return privateMembersMap.get(instance); + } +}; diff --git a/node_modules/eslint/lib/eslint/index.js b/node_modules/eslint/lib/eslint/index.js new file mode 100644 index 0000000..c9185ee --- /dev/null +++ b/node_modules/eslint/lib/eslint/index.js @@ -0,0 +1,7 @@ +"use strict"; + +const { ESLint } = require("./eslint"); + +module.exports = { + ESLint +}; diff --git a/node_modules/eslint/lib/linter/apply-disable-directives.js b/node_modules/eslint/lib/linter/apply-disable-directives.js new file mode 100644 index 0000000..459c859 --- /dev/null +++ b/node_modules/eslint/lib/linter/apply-disable-directives.js @@ -0,0 +1,341 @@ +/** + * @fileoverview A module that filters reported problems based on `eslint-disable` and `eslint-enable` comments + * @author Teddy Katz + */ + +"use strict"; + +const escapeRegExp = require("escape-string-regexp"); + +/** + * Compares the locations of two objects in a source file + * @param {{line: number, column: number}} itemA The first object + * @param {{line: number, column: number}} itemB The second object + * @returns {number} A value less than 1 if itemA appears before itemB in the source file, greater than 1 if + * itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location. + */ +function compareLocations(itemA, itemB) { + return itemA.line - itemB.line || itemA.column - itemB.column; +} + +/** + * Groups a set of directives into sub-arrays by their parent comment. + * @param {Directive[]} directives Unused directives to be removed. + * @returns {Directive[][]} Directives grouped by their parent comment. + */ +function groupByParentComment(directives) { + const groups = new Map(); + + for (const directive of directives) { + const { unprocessedDirective: { parentComment } } = directive; + + if (groups.has(parentComment)) { + groups.get(parentComment).push(directive); + } else { + groups.set(parentComment, [directive]); + } + } + + return [...groups.values()]; +} + +/** + * Creates removal details for a set of directives within the same comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. + */ +function createIndividualDirectivesRemoval(directives, commentToken) { + + /* + * `commentToken.value` starts right after `//` or `/*`. + * All calculated offsets will be relative to this index. + */ + const commentValueStart = commentToken.range[0] + "//".length; + + // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`) + const listStartOffset = /^\s*\S+\s+/u.exec(commentToken.value)[0].length; + + /* + * Get the list text without any surrounding whitespace. In order to preserve the original + * formatting, we don't want to change that whitespace. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + */ + const listText = commentToken.value + .slice(listStartOffset) // remove directive name and all whitespace before the list + .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists + .trimEnd(); // remove all whitespace after the list + + /* + * We can assume that `listText` contains multiple elements. + * Otherwise, this function wouldn't be called - if there is + * only one rule in the list, then the whole comment must be removed. + */ + + return directives.map(directive => { + const { ruleId } = directive; + + const regex = new RegExp(String.raw`(?:^|\s*,\s*)${escapeRegExp(ruleId)}(?:\s*,\s*|$)`, "u"); + const match = regex.exec(listText); + const matchedText = match[0]; + const matchStartOffset = listStartOffset + match.index; + const matchEndOffset = matchStartOffset + matchedText.length; + + const firstIndexOfComma = matchedText.indexOf(","); + const lastIndexOfComma = matchedText.lastIndexOf(","); + + let removalStartOffset, removalEndOffset; + + if (firstIndexOfComma !== lastIndexOfComma) { + + /* + * Since there are two commas, this must one of the elements in the middle of the list. + * Matched range starts where the previous rule name ends, and ends where the next rule name starts. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^ + * + * We want to remove only the content between the two commas, and also one of the commas. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset + firstIndexOfComma; + removalEndOffset = matchStartOffset + lastIndexOfComma; + + } else { + + /* + * This is either the first element or the last element. + * + * If this is the first element, matched range starts where the first rule name starts + * and ends where the second rule name starts. This is exactly the range we want + * to remove so that the second rule name will start where the first one was starting + * and thus preserve the original formatting. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + * + * Similarly, if this is the last element, we've already matched the range we want to + * remove. The previous rule name will end where the last one was ending, relative + * to the content on the right side. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset; + removalEndOffset = matchEndOffset; + } + + return { + description: `'${ruleId}'`, + fix: { + range: [ + commentValueStart + removalStartOffset, + commentValueStart + removalEndOffset + ], + text: "" + }, + unprocessedDirective: directive.unprocessedDirective + }; + }); +} + +/** + * Creates a description of deleting an entire unused disable comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output Problem. + */ +function createCommentRemoval(directives, commentToken) { + const { range } = commentToken; + const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`); + + return { + description: ruleIds.length <= 2 + ? ruleIds.join(" or ") + : `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds[ruleIds.length - 1]}`, + fix: { + range, + text: " " + }, + unprocessedDirective: directives[0].unprocessedDirective + }; +} + +/** + * Parses details from directives to create output Problems. + * @param {Directive[]} allDirectives Unused directives to be removed. + * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. + */ +function processUnusedDisableDirectives(allDirectives) { + const directiveGroups = groupByParentComment(allDirectives); + + return directiveGroups.flatMap( + directives => { + const { parentComment } = directives[0].unprocessedDirective; + const remainingRuleIds = new Set(parentComment.ruleIds); + + for (const directive of directives) { + remainingRuleIds.delete(directive.ruleId); + } + + return remainingRuleIds.size + ? createIndividualDirectivesRemoval(directives, parentComment.commentToken) + : [createCommentRemoval(directives, parentComment.commentToken)]; + } + ); +} + +/** + * This is the same as the exported function, except that it + * doesn't handle disable-line and disable-next-line directives, and it always reports unused + * disable directives. + * @param {Object} options options for applying directives. This is the same as the options + * for the exported function, except that `reportUnusedDisableDirectives` is not supported + * (this function always reports unused disable directives). + * @returns {{problems: Problem[], unusedDisableDirectives: Problem[]}} An object with a list + * of problems (including suppressed ones) and unused eslint-disable directives + */ +function applyDirectives(options) { + const problems = []; + const usedDisableDirectives = new Set(); + + for (const problem of options.problems) { + let disableDirectivesForProblem = []; + let nextDirectiveIndex = 0; + + while ( + nextDirectiveIndex < options.directives.length && + compareLocations(options.directives[nextDirectiveIndex], problem) <= 0 + ) { + const directive = options.directives[nextDirectiveIndex++]; + + if (directive.ruleId === null || directive.ruleId === problem.ruleId) { + switch (directive.type) { + case "disable": + disableDirectivesForProblem.push(directive); + break; + + case "enable": + disableDirectivesForProblem = []; + break; + + // no default + } + } + } + + if (disableDirectivesForProblem.length > 0) { + const suppressions = disableDirectivesForProblem.map(directive => ({ + kind: "directive", + justification: directive.unprocessedDirective.justification + })); + + if (problem.suppressions) { + problem.suppressions = problem.suppressions.concat(suppressions); + } else { + problem.suppressions = suppressions; + usedDisableDirectives.add(disableDirectivesForProblem[disableDirectivesForProblem.length - 1]); + } + } + + problems.push(problem); + } + + const unusedDisableDirectivesToReport = options.directives + .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)); + + const processed = processUnusedDisableDirectives(unusedDisableDirectivesToReport); + + const unusedDisableDirectives = processed + .map(({ description, fix, unprocessedDirective }) => { + const { parentComment, type, line, column } = unprocessedDirective; + + return { + ruleId: null, + message: description + ? `Unused eslint-disable directive (no problems were reported from ${description}).` + : "Unused eslint-disable directive (no problems were reported).", + line: type === "disable-next-line" ? parentComment.commentToken.loc.start.line : line, + column: type === "disable-next-line" ? parentComment.commentToken.loc.start.column + 1 : column, + severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, + nodeType: null, + ...options.disableFixes ? {} : { fix } + }; + }); + + return { problems, unusedDisableDirectives }; +} + +/** + * Given a list of directive comments (i.e. metadata about eslint-disable and eslint-enable comments) and a list + * of reported problems, adds the suppression information to the problems. + * @param {Object} options Information about directives and problems + * @param {{ + * type: ("disable"|"enable"|"disable-line"|"disable-next-line"), + * ruleId: (string|null), + * line: number, + * column: number, + * justification: string + * }} options.directives Directive comments found in the file, with one-based columns. + * Two directive comments can only have the same location if they also have the same type (e.g. a single eslint-disable + * comment for two different rules is represented as two directives). + * @param {{ruleId: (string|null), line: number, column: number}[]} options.problems + * A list of problems reported by rules, sorted by increasing location in the file, with one-based columns. + * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives + * @param {boolean} options.disableFixes If true, it doesn't make `fix` properties. + * @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]} + * An object with a list of reported problems, the suppressed of which contain the suppression information. + */ +module.exports = ({ directives, disableFixes, problems, reportUnusedDisableDirectives = "off" }) => { + const blockDirectives = directives + .filter(directive => directive.type === "disable" || directive.type === "enable") + .map(directive => Object.assign({}, directive, { unprocessedDirective: directive })) + .sort(compareLocations); + + const lineDirectives = directives.flatMap(directive => { + switch (directive.type) { + case "disable": + case "enable": + return []; + + case "disable-line": + return [ + { type: "disable", line: directive.line, column: 1, ruleId: directive.ruleId, unprocessedDirective: directive }, + { type: "enable", line: directive.line + 1, column: 0, ruleId: directive.ruleId, unprocessedDirective: directive } + ]; + + case "disable-next-line": + return [ + { type: "disable", line: directive.line + 1, column: 1, ruleId: directive.ruleId, unprocessedDirective: directive }, + { type: "enable", line: directive.line + 2, column: 0, ruleId: directive.ruleId, unprocessedDirective: directive } + ]; + + default: + throw new TypeError(`Unrecognized directive type '${directive.type}'`); + } + }).sort(compareLocations); + + const blockDirectivesResult = applyDirectives({ + problems, + directives: blockDirectives, + disableFixes, + reportUnusedDisableDirectives + }); + const lineDirectivesResult = applyDirectives({ + problems: blockDirectivesResult.problems, + directives: lineDirectives, + disableFixes, + reportUnusedDisableDirectives + }); + + return reportUnusedDisableDirectives !== "off" + ? lineDirectivesResult.problems + .concat(blockDirectivesResult.unusedDisableDirectives) + .concat(lineDirectivesResult.unusedDisableDirectives) + .sort(compareLocations) + : lineDirectivesResult.problems; +}; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js new file mode 100644 index 0000000..2dcc273 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js @@ -0,0 +1,844 @@ +/** + * @fileoverview A class of the code path analyzer. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const assert = require("assert"), + { breakableTypePattern } = require("../../shared/ast-utils"), + CodePath = require("./code-path"), + CodePathSegment = require("./code-path-segment"), + IdGenerator = require("./id-generator"), + debug = require("./debug-helpers"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given node is a `case` node (not `default` node). + * @param {ASTNode} node A `SwitchCase` node to check. + * @returns {boolean} `true` if the node is a `case` node (not `default` node). + */ +function isCaseNode(node) { + return Boolean(node.test); +} + +/** + * Checks if a given node appears as the value of a PropertyDefinition node. + * @param {ASTNode} node THe node to check. + * @returns {boolean} `true` if the node is a PropertyDefinition value, + * false if not. + */ +function isPropertyDefinitionValue(node) { + const parent = node.parent; + + return parent && parent.type === "PropertyDefinition" && parent.value === node; +} + +/** + * Checks whether the given logical operator is taken into account for the code + * path analysis. + * @param {string} operator The operator found in the LogicalExpression node + * @returns {boolean} `true` if the operator is "&&" or "||" or "??" + */ +function isHandledLogicalOperator(operator) { + return operator === "&&" || operator === "||" || operator === "??"; +} + +/** + * Checks whether the given assignment operator is a logical assignment operator. + * Logical assignments are taken into account for the code path analysis + * because of their short-circuiting semantics. + * @param {string} operator The operator found in the AssignmentExpression node + * @returns {boolean} `true` if the operator is "&&=" or "||=" or "??=" + */ +function isLogicalAssignmentOperator(operator) { + return operator === "&&=" || operator === "||=" || operator === "??="; +} + +/** + * Gets the label if the parent node of a given node is a LabeledStatement. + * @param {ASTNode} node A node to get. + * @returns {string|null} The label or `null`. + */ +function getLabel(node) { + if (node.parent.type === "LabeledStatement") { + return node.parent.label.name; + } + return null; +} + +/** + * Checks whether or not a given logical expression node goes different path + * between the `true` case and the `false` case. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a test of a choice statement. + */ +function isForkingByTrueOrFalse(node) { + const parent = node.parent; + + switch (parent.type) { + case "ConditionalExpression": + case "IfStatement": + case "WhileStatement": + case "DoWhileStatement": + case "ForStatement": + return parent.test === node; + + case "LogicalExpression": + return isHandledLogicalOperator(parent.operator); + + case "AssignmentExpression": + return isLogicalAssignmentOperator(parent.operator); + + default: + return false; + } +} + +/** + * Gets the boolean value of a given literal node. + * + * This is used to detect infinity loops (e.g. `while (true) {}`). + * Statements preceded by an infinity loop are unreachable if the loop didn't + * have any `break` statement. + * @param {ASTNode} node A node to get. + * @returns {boolean|undefined} a boolean value if the node is a Literal node, + * otherwise `undefined`. + */ +function getBooleanValueIfSimpleConstant(node) { + if (node.type === "Literal") { + return Boolean(node.value); + } + return void 0; +} + +/** + * Checks that a given identifier node is a reference or not. + * + * This is used to detect the first throwable node in a `try` block. + * @param {ASTNode} node An Identifier node to check. + * @returns {boolean} `true` if the node is a reference. + */ +function isIdentifierReference(node) { + const parent = node.parent; + + switch (parent.type) { + case "LabeledStatement": + case "BreakStatement": + case "ContinueStatement": + case "ArrayPattern": + case "RestElement": + case "ImportSpecifier": + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "CatchClause": + return false; + + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + case "ClassDeclaration": + case "ClassExpression": + case "VariableDeclarator": + return parent.id !== node; + + case "Property": + case "PropertyDefinition": + case "MethodDefinition": + return ( + parent.key !== node || + parent.computed || + parent.shorthand + ); + + case "AssignmentPattern": + return parent.key !== node; + + default: + return true; + } +} + +/** + * Updates the current segment with the head segment. + * This is similar to local branches and tracking branches of git. + * + * To separate the current and the head is in order to not make useless segments. + * + * In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd" + * events are fired. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function forwardCurrentToHead(analyzer, node) { + const codePath = analyzer.codePath; + const state = CodePath.getState(codePath); + const currentSegments = state.currentSegments; + const headSegments = state.headSegments; + const end = Math.max(currentSegments.length, headSegments.length); + let i, currentSegment, headSegment; + + // Fires leaving events. + for (i = 0; i < end; ++i) { + currentSegment = currentSegments[i]; + headSegment = headSegments[i]; + + if (currentSegment !== headSegment && currentSegment) { + debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); + + if (currentSegment.reachable) { + analyzer.emitter.emit( + "onCodePathSegmentEnd", + currentSegment, + node + ); + } + } + } + + // Update state. + state.currentSegments = headSegments; + + // Fires entering events. + for (i = 0; i < end; ++i) { + currentSegment = currentSegments[i]; + headSegment = headSegments[i]; + + if (currentSegment !== headSegment && headSegment) { + debug.dump(`onCodePathSegmentStart ${headSegment.id}`); + + CodePathSegment.markUsed(headSegment); + if (headSegment.reachable) { + analyzer.emitter.emit( + "onCodePathSegmentStart", + headSegment, + node + ); + } + } + } + +} + +/** + * Updates the current segment with empty. + * This is called at the last of functions or the program. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function leaveFromCurrentSegment(analyzer, node) { + const state = CodePath.getState(analyzer.codePath); + const currentSegments = state.currentSegments; + + for (let i = 0; i < currentSegments.length; ++i) { + const currentSegment = currentSegments[i]; + + debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); + if (currentSegment.reachable) { + analyzer.emitter.emit( + "onCodePathSegmentEnd", + currentSegment, + node + ); + } + } + + state.currentSegments = []; +} + +/** + * Updates the code path due to the position of a given node in the parent node + * thereof. + * + * For example, if the node is `parent.consequent`, this creates a fork from the + * current path. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function preprocess(analyzer, node) { + const codePath = analyzer.codePath; + const state = CodePath.getState(codePath); + const parent = node.parent; + + switch (parent.type) { + + // The `arguments.length == 0` case is in `postprocess` function. + case "CallExpression": + if (parent.optional === true && parent.arguments.length >= 1 && parent.arguments[0] === node) { + state.makeOptionalRight(); + } + break; + case "MemberExpression": + if (parent.optional === true && parent.property === node) { + state.makeOptionalRight(); + } + break; + + case "LogicalExpression": + if ( + parent.right === node && + isHandledLogicalOperator(parent.operator) + ) { + state.makeLogicalRight(); + } + break; + + case "AssignmentExpression": + if ( + parent.right === node && + isLogicalAssignmentOperator(parent.operator) + ) { + state.makeLogicalRight(); + } + break; + + case "ConditionalExpression": + case "IfStatement": + + /* + * Fork if this node is at `consequent`/`alternate`. + * `popForkContext()` exists at `IfStatement:exit` and + * `ConditionalExpression:exit`. + */ + if (parent.consequent === node) { + state.makeIfConsequent(); + } else if (parent.alternate === node) { + state.makeIfAlternate(); + } + break; + + case "SwitchCase": + if (parent.consequent[0] === node) { + state.makeSwitchCaseBody(false, !parent.test); + } + break; + + case "TryStatement": + if (parent.handler === node) { + state.makeCatchBlock(); + } else if (parent.finalizer === node) { + state.makeFinallyBlock(); + } + break; + + case "WhileStatement": + if (parent.test === node) { + state.makeWhileTest(getBooleanValueIfSimpleConstant(node)); + } else { + assert(parent.body === node); + state.makeWhileBody(); + } + break; + + case "DoWhileStatement": + if (parent.body === node) { + state.makeDoWhileBody(); + } else { + assert(parent.test === node); + state.makeDoWhileTest(getBooleanValueIfSimpleConstant(node)); + } + break; + + case "ForStatement": + if (parent.test === node) { + state.makeForTest(getBooleanValueIfSimpleConstant(node)); + } else if (parent.update === node) { + state.makeForUpdate(); + } else if (parent.body === node) { + state.makeForBody(); + } + break; + + case "ForInStatement": + case "ForOfStatement": + if (parent.left === node) { + state.makeForInOfLeft(); + } else if (parent.right === node) { + state.makeForInOfRight(); + } else { + assert(parent.body === node); + state.makeForInOfBody(); + } + break; + + case "AssignmentPattern": + + /* + * Fork if this node is at `right`. + * `left` is executed always, so it uses the current path. + * `popForkContext()` exists at `AssignmentPattern:exit`. + */ + if (parent.right === node) { + state.pushForkContext(); + state.forkBypassPath(); + state.forkPath(); + } + break; + + default: + break; + } +} + +/** + * Updates the code path due to the type of a given node in entering. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function processCodePathToEnter(analyzer, node) { + let codePath = analyzer.codePath; + let state = codePath && CodePath.getState(codePath); + const parent = node.parent; + + /** + * Creates a new code path and trigger the onCodePathStart event + * based on the currently selected node. + * @param {string} origin The reason the code path was started. + * @returns {void} + */ + function startCodePath(origin) { + if (codePath) { + + // Emits onCodePathSegmentStart events if updated. + forwardCurrentToHead(analyzer, node); + debug.dumpState(node, state, false); + } + + // Create the code path of this scope. + codePath = analyzer.codePath = new CodePath({ + id: analyzer.idGenerator.next(), + origin, + upper: codePath, + onLooped: analyzer.onLooped + }); + state = CodePath.getState(codePath); + + // Emits onCodePathStart events. + debug.dump(`onCodePathStart ${codePath.id}`); + analyzer.emitter.emit("onCodePathStart", codePath, node); + } + + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to start a new code path in this + * case. + */ + if (isPropertyDefinitionValue(node)) { + startCodePath("class-field-initializer"); + + /* + * Intentional fall through because `node` needs to also be + * processed by the code below. For example, if we have: + * + * class Foo { + * a = () => {} + * } + * + * In this case, we also need start a second code path. + */ + + } + + switch (node.type) { + case "Program": + startCodePath("program"); + break; + + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + startCodePath("function"); + break; + + case "StaticBlock": + startCodePath("class-static-block"); + break; + + case "ChainExpression": + state.pushChainContext(); + break; + case "CallExpression": + if (node.optional === true) { + state.makeOptionalNode(); + } + break; + case "MemberExpression": + if (node.optional === true) { + state.makeOptionalNode(); + } + break; + + case "LogicalExpression": + if (isHandledLogicalOperator(node.operator)) { + state.pushChoiceContext( + node.operator, + isForkingByTrueOrFalse(node) + ); + } + break; + + case "AssignmentExpression": + if (isLogicalAssignmentOperator(node.operator)) { + state.pushChoiceContext( + node.operator.slice(0, -1), // removes `=` from the end + isForkingByTrueOrFalse(node) + ); + } + break; + + case "ConditionalExpression": + case "IfStatement": + state.pushChoiceContext("test", false); + break; + + case "SwitchStatement": + state.pushSwitchContext( + node.cases.some(isCaseNode), + getLabel(node) + ); + break; + + case "TryStatement": + state.pushTryContext(Boolean(node.finalizer)); + break; + + case "SwitchCase": + + /* + * Fork if this node is after the 2st node in `cases`. + * It's similar to `else` blocks. + * The next `test` node is processed in this path. + */ + if (parent.discriminant !== node && parent.cases[0] !== node) { + state.forkPath(); + } + break; + + case "WhileStatement": + case "DoWhileStatement": + case "ForStatement": + case "ForInStatement": + case "ForOfStatement": + state.pushLoopContext(node.type, getLabel(node)); + break; + + case "LabeledStatement": + if (!breakableTypePattern.test(node.body.type)) { + state.pushBreakContext(false, node.label.name); + } + break; + + default: + break; + } + + // Emits onCodePathSegmentStart events if updated. + forwardCurrentToHead(analyzer, node); + debug.dumpState(node, state, false); +} + +/** + * Updates the code path due to the type of a given node in leaving. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function processCodePathToExit(analyzer, node) { + + const codePath = analyzer.codePath; + const state = CodePath.getState(codePath); + let dontForward = false; + + switch (node.type) { + case "ChainExpression": + state.popChainContext(); + break; + + case "IfStatement": + case "ConditionalExpression": + state.popChoiceContext(); + break; + + case "LogicalExpression": + if (isHandledLogicalOperator(node.operator)) { + state.popChoiceContext(); + } + break; + + case "AssignmentExpression": + if (isLogicalAssignmentOperator(node.operator)) { + state.popChoiceContext(); + } + break; + + case "SwitchStatement": + state.popSwitchContext(); + break; + + case "SwitchCase": + + /* + * This is the same as the process at the 1st `consequent` node in + * `preprocess` function. + * Must do if this `consequent` is empty. + */ + if (node.consequent.length === 0) { + state.makeSwitchCaseBody(true, !node.test); + } + if (state.forkContext.reachable) { + dontForward = true; + } + break; + + case "TryStatement": + state.popTryContext(); + break; + + case "BreakStatement": + forwardCurrentToHead(analyzer, node); + state.makeBreak(node.label && node.label.name); + dontForward = true; + break; + + case "ContinueStatement": + forwardCurrentToHead(analyzer, node); + state.makeContinue(node.label && node.label.name); + dontForward = true; + break; + + case "ReturnStatement": + forwardCurrentToHead(analyzer, node); + state.makeReturn(); + dontForward = true; + break; + + case "ThrowStatement": + forwardCurrentToHead(analyzer, node); + state.makeThrow(); + dontForward = true; + break; + + case "Identifier": + if (isIdentifierReference(node)) { + state.makeFirstThrowablePathInTryBlock(); + dontForward = true; + } + break; + + case "CallExpression": + case "ImportExpression": + case "MemberExpression": + case "NewExpression": + case "YieldExpression": + state.makeFirstThrowablePathInTryBlock(); + break; + + case "WhileStatement": + case "DoWhileStatement": + case "ForStatement": + case "ForInStatement": + case "ForOfStatement": + state.popLoopContext(); + break; + + case "AssignmentPattern": + state.popForkContext(); + break; + + case "LabeledStatement": + if (!breakableTypePattern.test(node.body.type)) { + state.popBreakContext(); + } + break; + + default: + break; + } + + // Emits onCodePathSegmentStart events if updated. + if (!dontForward) { + forwardCurrentToHead(analyzer, node); + } + debug.dumpState(node, state, true); +} + +/** + * Updates the code path to finalize the current code path. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. + * @returns {void} + */ +function postprocess(analyzer, node) { + + /** + * Ends the code path for the current node. + * @returns {void} + */ + function endCodePath() { + let codePath = analyzer.codePath; + + // Mark the current path as the final node. + CodePath.getState(codePath).makeFinal(); + + // Emits onCodePathSegmentEnd event of the current segments. + leaveFromCurrentSegment(analyzer, node); + + // Emits onCodePathEnd event of this code path. + debug.dump(`onCodePathEnd ${codePath.id}`); + analyzer.emitter.emit("onCodePathEnd", codePath, node); + debug.dumpDot(codePath); + + codePath = analyzer.codePath = analyzer.codePath.upper; + if (codePath) { + debug.dumpState(node, CodePath.getState(codePath), true); + } + + } + + switch (node.type) { + case "Program": + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + case "StaticBlock": { + endCodePath(); + break; + } + + // The `arguments.length >= 1` case is in `preprocess` function. + case "CallExpression": + if (node.optional === true && node.arguments.length === 0) { + CodePath.getState(analyzer.codePath).makeOptionalRight(); + } + break; + + default: + break; + } + + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to end a code path in this + * case. + * + * We need to check after the other checks in order to close the + * code paths in the correct order for code like this: + * + * + * class Foo { + * a = () => {} + * } + * + * In this case, The ArrowFunctionExpression code path is closed first + * and then we need to close the code path for the PropertyDefinition + * value. + */ + if (isPropertyDefinitionValue(node)) { + endCodePath(); + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The class to analyze code paths. + * This class implements the EventGenerator interface. + */ +class CodePathAnalyzer { + + /** + * @param {EventGenerator} eventGenerator An event generator to wrap. + */ + constructor(eventGenerator) { + this.original = eventGenerator; + this.emitter = eventGenerator.emitter; + this.codePath = null; + this.idGenerator = new IdGenerator("s"); + this.currentNode = null; + this.onLooped = this.onLooped.bind(this); + } + + /** + * Does the process to enter a given AST node. + * This updates state of analysis and calls `enterNode` of the wrapped. + * @param {ASTNode} node A node which is entering. + * @returns {void} + */ + enterNode(node) { + this.currentNode = node; + + // Updates the code path due to node's position in its parent node. + if (node.parent) { + preprocess(this, node); + } + + /* + * Updates the code path. + * And emits onCodePathStart/onCodePathSegmentStart events. + */ + processCodePathToEnter(this, node); + + // Emits node events. + this.original.enterNode(node); + + this.currentNode = null; + } + + /** + * Does the process to leave a given AST node. + * This updates state of analysis and calls `leaveNode` of the wrapped. + * @param {ASTNode} node A node which is leaving. + * @returns {void} + */ + leaveNode(node) { + this.currentNode = node; + + /* + * Updates the code path. + * And emits onCodePathStart/onCodePathSegmentStart events. + */ + processCodePathToExit(this, node); + + // Emits node events. + this.original.leaveNode(node); + + // Emits the last onCodePathStart/onCodePathSegmentStart events. + postprocess(this, node); + + this.currentNode = null; + } + + /** + * This is called on a code path looped. + * Then this raises a looped event. + * @param {CodePathSegment} fromSegment A segment of prev. + * @param {CodePathSegment} toSegment A segment of next. + * @returns {void} + */ + onLooped(fromSegment, toSegment) { + if (fromSegment.reachable && toSegment.reachable) { + debug.dump(`onCodePathSegmentLoop ${fromSegment.id} -> ${toSegment.id}`); + this.emitter.emit( + "onCodePathSegmentLoop", + fromSegment, + toSegment, + this.currentNode + ); + } + } +} + +module.exports = CodePathAnalyzer; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js new file mode 100644 index 0000000..eeedd27 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js @@ -0,0 +1,235 @@ +/** + * @fileoverview A class of the code path segment. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const debug = require("./debug-helpers"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given segment is reachable. + * @param {CodePathSegment} segment A segment to check. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A code path segment. + */ +class CodePathSegment { + + /** + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. + * This array includes unreachable segments. + * @param {boolean} reachable A flag which shows this is reachable. + */ + constructor(id, allPrevSegments, reachable) { + + /** + * The identifier of this code path. + * Rules use it to store additional information of each rule. + * @type {string} + */ + this.id = id; + + /** + * An array of the next segments. + * @type {CodePathSegment[]} + */ + this.nextSegments = []; + + /** + * An array of the previous segments. + * @type {CodePathSegment[]} + */ + this.prevSegments = allPrevSegments.filter(isReachable); + + /** + * An array of the next segments. + * This array includes unreachable segments. + * @type {CodePathSegment[]} + */ + this.allNextSegments = []; + + /** + * An array of the previous segments. + * This array includes unreachable segments. + * @type {CodePathSegment[]} + */ + this.allPrevSegments = allPrevSegments; + + /** + * A flag which shows this is reachable. + * @type {boolean} + */ + this.reachable = reachable; + + // Internal data. + Object.defineProperty(this, "internal", { + value: { + used: false, + loopedPrevSegments: [] + } + }); + + /* istanbul ignore if */ + if (debug.enabled) { + this.internal.nodes = []; + } + } + + /** + * Checks a given previous segment is coming from the end of a loop. + * @param {CodePathSegment} segment A previous segment to check. + * @returns {boolean} `true` if the segment is coming from the end of a loop. + */ + isLoopedPrevSegment(segment) { + return this.internal.loopedPrevSegments.includes(segment); + } + + /** + * Creates the root segment. + * @param {string} id An identifier. + * @returns {CodePathSegment} The created segment. + */ + static newRoot(id) { + return new CodePathSegment(id, [], true); + } + + /** + * Creates a segment that follows given segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. + * @returns {CodePathSegment} The created segment. + */ + static newNext(id, allPrevSegments) { + return new CodePathSegment( + id, + CodePathSegment.flattenUnusedSegments(allPrevSegments), + allPrevSegments.some(isReachable) + ); + } + + /** + * Creates an unreachable segment that follows given segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. + * @returns {CodePathSegment} The created segment. + */ + static newUnreachable(id, allPrevSegments) { + const segment = new CodePathSegment(id, CodePathSegment.flattenUnusedSegments(allPrevSegments), false); + + /* + * In `if (a) return a; foo();` case, the unreachable segment preceded by + * the return statement is not used but must not be remove. + */ + CodePathSegment.markUsed(segment); + + return segment; + } + + /** + * Creates a segment that follows given segments. + * This factory method does not connect with `allPrevSegments`. + * But this inherits `reachable` flag. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. + * @returns {CodePathSegment} The created segment. + */ + static newDisconnected(id, allPrevSegments) { + return new CodePathSegment(id, [], allPrevSegments.some(isReachable)); + } + + /** + * Makes a given segment being used. + * + * And this function registers the segment into the previous segments as a next. + * @param {CodePathSegment} segment A segment to mark. + * @returns {void} + */ + static markUsed(segment) { + if (segment.internal.used) { + return; + } + segment.internal.used = true; + + let i; + + if (segment.reachable) { + for (i = 0; i < segment.allPrevSegments.length; ++i) { + const prevSegment = segment.allPrevSegments[i]; + + prevSegment.allNextSegments.push(segment); + prevSegment.nextSegments.push(segment); + } + } else { + for (i = 0; i < segment.allPrevSegments.length; ++i) { + segment.allPrevSegments[i].allNextSegments.push(segment); + } + } + } + + /** + * Marks a previous segment as looped. + * @param {CodePathSegment} segment A segment. + * @param {CodePathSegment} prevSegment A previous segment to mark. + * @returns {void} + */ + static markPrevSegmentAsLooped(segment, prevSegment) { + segment.internal.loopedPrevSegments.push(prevSegment); + } + + /** + * Replaces unused segments with the previous segments of each unused segment. + * @param {CodePathSegment[]} segments An array of segments to replace. + * @returns {CodePathSegment[]} The replaced array. + */ + static flattenUnusedSegments(segments) { + const done = Object.create(null); + const retv = []; + + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + // Ignores duplicated. + if (done[segment.id]) { + continue; + } + + // Use previous segments if unused. + if (!segment.internal.used) { + for (let j = 0; j < segment.allPrevSegments.length; ++j) { + const prevSegment = segment.allPrevSegments[j]; + + if (!done[prevSegment.id]) { + done[prevSegment.id] = true; + retv.push(prevSegment); + } + } + } else { + done[segment.id] = true; + retv.push(segment); + } + } + + return retv; + } +} + +module.exports = CodePathSegment; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js new file mode 100644 index 0000000..426da8d --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js @@ -0,0 +1,1483 @@ +/** + * @fileoverview A class to manage state of generating a code path. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const CodePathSegment = require("./code-path-segment"), + ForkContext = require("./fork-context"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Adds given segments into the `dest` array. + * If the `others` array does not includes the given segments, adds to the `all` + * array as well. + * + * This adds only reachable and used segments. + * @param {CodePathSegment[]} dest A destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} others Another destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} all The unified destination array (`finalSegments`). + * @param {CodePathSegment[]} segments Segments to add. + * @returns {void} + */ +function addToReturnedOrThrown(dest, others, all, segments) { + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + dest.push(segment); + if (!others.includes(segment)) { + all.push(segment); + } + } +} + +/** + * Gets a loop-context for a `continue` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `continue` statement. + * @returns {LoopContext} A loop-context for a `continue` statement. + */ +function getContinueContext(state, label) { + if (!label) { + return state.loopContext; + } + + let context = state.loopContext; + + while (context) { + if (context.label === label) { + return context; + } + context = context.upper; + } + + /* istanbul ignore next: foolproof (syntax error) */ + return null; +} + +/** + * Gets a context for a `break` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `break` statement. + * @returns {LoopContext|SwitchContext} A context for a `break` statement. + */ +function getBreakContext(state, label) { + let context = state.breakContext; + + while (context) { + if (label ? context.label === label : context.breakable) { + return context; + } + context = context.upper; + } + + /* istanbul ignore next: foolproof (syntax error) */ + return null; +} + +/** + * Gets a context for a `return` statement. + * @param {CodePathState} state A state to get. + * @returns {TryContext|CodePathState} A context for a `return` statement. + */ +function getReturnContext(state) { + let context = state.tryContext; + + while (context) { + if (context.hasFinalizer && context.position !== "finally") { + return context; + } + context = context.upper; + } + + return state; +} + +/** + * Gets a context for a `throw` statement. + * @param {CodePathState} state A state to get. + * @returns {TryContext|CodePathState} A context for a `throw` statement. + */ +function getThrowContext(state) { + let context = state.tryContext; + + while (context) { + if (context.position === "try" || + (context.hasFinalizer && context.position === "catch") + ) { + return context; + } + context = context.upper; + } + + return state; +} + +/** + * Removes a given element from a given array. + * @param {any[]} xs An array to remove the specific element. + * @param {any} x An element to be removed. + * @returns {void} + */ +function remove(xs, x) { + xs.splice(xs.indexOf(x), 1); +} + +/** + * Disconnect given segments. + * + * This is used in a process for switch statements. + * If there is the "default" chunk before other cases, the order is different + * between node's and running's. + * @param {CodePathSegment[]} prevSegments Forward segments to disconnect. + * @param {CodePathSegment[]} nextSegments Backward segments to disconnect. + * @returns {void} + */ +function removeConnection(prevSegments, nextSegments) { + for (let i = 0; i < prevSegments.length; ++i) { + const prevSegment = prevSegments[i]; + const nextSegment = nextSegments[i]; + + remove(prevSegment.nextSegments, nextSegment); + remove(prevSegment.allNextSegments, nextSegment); + remove(nextSegment.prevSegments, prevSegment); + remove(nextSegment.allPrevSegments, prevSegment); + } +} + +/** + * Creates looping path. + * @param {CodePathState} state The instance. + * @param {CodePathSegment[]} unflattenedFromSegments Segments which are source. + * @param {CodePathSegment[]} unflattenedToSegments Segments which are destination. + * @returns {void} + */ +function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { + const fromSegments = CodePathSegment.flattenUnusedSegments(unflattenedFromSegments); + const toSegments = CodePathSegment.flattenUnusedSegments(unflattenedToSegments); + + const end = Math.min(fromSegments.length, toSegments.length); + + for (let i = 0; i < end; ++i) { + const fromSegment = fromSegments[i]; + const toSegment = toSegments[i]; + + if (toSegment.reachable) { + fromSegment.nextSegments.push(toSegment); + } + if (fromSegment.reachable) { + toSegment.prevSegments.push(fromSegment); + } + fromSegment.allNextSegments.push(toSegment); + toSegment.allPrevSegments.push(fromSegment); + + if (toSegment.allPrevSegments.length >= 2) { + CodePathSegment.markPrevSegmentAsLooped(toSegment, fromSegment); + } + + state.notifyLooped(fromSegment, toSegment); + } +} + +/** + * Finalizes segments of `test` chunk of a ForStatement. + * + * - Adds `false` paths to paths which are leaving from the loop. + * - Sets `true` paths to paths which go to the body. + * @param {LoopContext} context A loop context to modify. + * @param {ChoiceContext} choiceContext A choice context of this loop. + * @param {CodePathSegment[]} head The current head paths. + * @returns {void} + */ +function finalizeTestSegmentsOfFor(context, choiceContext, head) { + if (!choiceContext.processed) { + choiceContext.trueForkContext.add(head); + choiceContext.falseForkContext.add(head); + choiceContext.qqForkContext.add(head); + } + + if (context.test !== true) { + context.brokenForkContext.addAll(choiceContext.falseForkContext); + } + context.endOfTestSegments = choiceContext.trueForkContext.makeNext(0, -1); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A class which manages state to analyze code paths. + */ +class CodePathState { + + /** + * @param {IdGenerator} idGenerator An id generator to generate id for code + * path segments. + * @param {Function} onLooped A callback function to notify looping. + */ + constructor(idGenerator, onLooped) { + this.idGenerator = idGenerator; + this.notifyLooped = onLooped; + this.forkContext = ForkContext.newRoot(idGenerator); + this.choiceContext = null; + this.switchContext = null; + this.tryContext = null; + this.loopContext = null; + this.breakContext = null; + this.chainContext = null; + + this.currentSegments = []; + this.initialSegment = this.forkContext.head[0]; + + // returnedSegments and thrownSegments push elements into finalSegments also. + const final = this.finalSegments = []; + const returned = this.returnedForkContext = []; + const thrown = this.thrownForkContext = []; + + returned.add = addToReturnedOrThrown.bind(null, returned, thrown, final); + thrown.add = addToReturnedOrThrown.bind(null, thrown, returned, final); + } + + /** + * The head segments. + * @type {CodePathSegment[]} + */ + get headSegments() { + return this.forkContext.head; + } + + /** + * The parent forking context. + * This is used for the root of new forks. + * @type {ForkContext} + */ + get parentForkContext() { + const current = this.forkContext; + + return current && current.upper; + } + + /** + * Creates and stacks new forking context. + * @param {boolean} forkLeavingPath A flag which shows being in a + * "finally" block. + * @returns {ForkContext} The created context. + */ + pushForkContext(forkLeavingPath) { + this.forkContext = ForkContext.newEmpty( + this.forkContext, + forkLeavingPath + ); + + return this.forkContext; + } + + /** + * Pops and merges the last forking context. + * @returns {ForkContext} The last context. + */ + popForkContext() { + const lastContext = this.forkContext; + + this.forkContext = lastContext.upper; + this.forkContext.replaceHead(lastContext.makeNext(0, -1)); + + return lastContext; + } + + /** + * Creates a new path. + * @returns {void} + */ + forkPath() { + this.forkContext.add(this.parentForkContext.makeNext(-1, -1)); + } + + /** + * Creates a bypass path. + * This is used for such as IfStatement which does not have "else" chunk. + * @returns {void} + */ + forkBypassPath() { + this.forkContext.add(this.parentForkContext.head); + } + + //-------------------------------------------------------------------------- + // ConditionalExpression, LogicalExpression, IfStatement + //-------------------------------------------------------------------------- + + /** + * Creates a context for ConditionalExpression, LogicalExpression, AssignmentExpression (logical assignments only), + * IfStatement, WhileStatement, DoWhileStatement, or ForStatement. + * + * LogicalExpressions have cases that it goes different paths between the + * `true` case and the `false` case. + * + * For Example: + * + * if (a || b) { + * foo(); + * } else { + * bar(); + * } + * + * In this case, `b` is evaluated always in the code path of the `else` + * block, but it's not so in the code path of the `if` block. + * So there are 3 paths. + * + * a -> foo(); + * a -> b -> foo(); + * a -> b -> bar(); + * @param {string} kind A kind string. + * If the new context is LogicalExpression's or AssignmentExpression's, this is `"&&"` or `"||"` or `"??"`. + * If it's IfStatement's or ConditionalExpression's, this is `"test"`. + * Otherwise, this is `"loop"`. + * @param {boolean} isForkingAsResult A flag that shows that goes different + * paths between `true` and `false`. + * @returns {void} + */ + pushChoiceContext(kind, isForkingAsResult) { + this.choiceContext = { + upper: this.choiceContext, + kind, + isForkingAsResult, + trueForkContext: ForkContext.newEmpty(this.forkContext), + falseForkContext: ForkContext.newEmpty(this.forkContext), + qqForkContext: ForkContext.newEmpty(this.forkContext), + processed: false + }; + } + + /** + * Pops the last choice context and finalizes it. + * @throws {Error} (Unreachable.) + * @returns {ChoiceContext} The popped context. + */ + popChoiceContext() { + const context = this.choiceContext; + + this.choiceContext = context.upper; + + const forkContext = this.forkContext; + const headSegments = forkContext.head; + + switch (context.kind) { + case "&&": + case "||": + case "??": + + /* + * If any result were not transferred from child contexts, + * this sets the head segments to both cases. + * The head segments are the path of the right-hand operand. + */ + if (!context.processed) { + context.trueForkContext.add(headSegments); + context.falseForkContext.add(headSegments); + context.qqForkContext.add(headSegments); + } + + /* + * Transfers results to upper context if this context is in + * test chunk. + */ + if (context.isForkingAsResult) { + const parentContext = this.choiceContext; + + parentContext.trueForkContext.addAll(context.trueForkContext); + parentContext.falseForkContext.addAll(context.falseForkContext); + parentContext.qqForkContext.addAll(context.qqForkContext); + parentContext.processed = true; + + return context; + } + + break; + + case "test": + if (!context.processed) { + + /* + * The head segments are the path of the `if` block here. + * Updates the `true` path with the end of the `if` block. + */ + context.trueForkContext.clear(); + context.trueForkContext.add(headSegments); + } else { + + /* + * The head segments are the path of the `else` block here. + * Updates the `false` path with the end of the `else` + * block. + */ + context.falseForkContext.clear(); + context.falseForkContext.add(headSegments); + } + + break; + + case "loop": + + /* + * Loops are addressed in popLoopContext(). + * This is called from popLoopContext(). + */ + return context; + + /* istanbul ignore next */ + default: + throw new Error("unreachable"); + } + + // Merges all paths. + const prevForkContext = context.trueForkContext; + + prevForkContext.addAll(context.falseForkContext); + forkContext.replaceHead(prevForkContext.makeNext(0, -1)); + + return context; + } + + /** + * Makes a code path segment of the right-hand operand of a logical + * expression. + * @throws {Error} (Unreachable.) + * @returns {void} + */ + makeLogicalRight() { + const context = this.choiceContext; + const forkContext = this.forkContext; + + if (context.processed) { + + /* + * This got segments already from the child choice context. + * Creates the next path from own true/false fork context. + */ + let prevForkContext; + + switch (context.kind) { + case "&&": // if true then go to the right-hand side. + prevForkContext = context.trueForkContext; + break; + case "||": // if false then go to the right-hand side. + prevForkContext = context.falseForkContext; + break; + case "??": // Both true/false can short-circuit, so needs the third path to go to the right-hand side. That's qqForkContext. + prevForkContext = context.qqForkContext; + break; + default: + throw new Error("unreachable"); + } + + forkContext.replaceHead(prevForkContext.makeNext(0, -1)); + prevForkContext.clear(); + context.processed = false; + } else { + + /* + * This did not get segments from the child choice context. + * So addresses the head segments. + * The head segments are the path of the left-hand operand. + */ + switch (context.kind) { + case "&&": // the false path can short-circuit. + context.falseForkContext.add(forkContext.head); + break; + case "||": // the true path can short-circuit. + context.trueForkContext.add(forkContext.head); + break; + case "??": // both can short-circuit. + context.trueForkContext.add(forkContext.head); + context.falseForkContext.add(forkContext.head); + break; + default: + throw new Error("unreachable"); + } + + forkContext.replaceHead(forkContext.makeNext(-1, -1)); + } + } + + /** + * Makes a code path segment of the `if` block. + * @returns {void} + */ + makeIfConsequent() { + const context = this.choiceContext; + const forkContext = this.forkContext; + + /* + * If any result were not transferred from child contexts, + * this sets the head segments to both cases. + * The head segments are the path of the test expression. + */ + if (!context.processed) { + context.trueForkContext.add(forkContext.head); + context.falseForkContext.add(forkContext.head); + context.qqForkContext.add(forkContext.head); + } + + context.processed = false; + + // Creates new path from the `true` case. + forkContext.replaceHead( + context.trueForkContext.makeNext(0, -1) + ); + } + + /** + * Makes a code path segment of the `else` block. + * @returns {void} + */ + makeIfAlternate() { + const context = this.choiceContext; + const forkContext = this.forkContext; + + /* + * The head segments are the path of the `if` block. + * Updates the `true` path with the end of the `if` block. + */ + context.trueForkContext.clear(); + context.trueForkContext.add(forkContext.head); + context.processed = true; + + // Creates new path from the `false` case. + forkContext.replaceHead( + context.falseForkContext.makeNext(0, -1) + ); + } + + //-------------------------------------------------------------------------- + // ChainExpression + //-------------------------------------------------------------------------- + + /** + * Push a new `ChainExpression` context to the stack. + * This method is called on entering to each `ChainExpression` node. + * This context is used to count forking in the optional chain then merge them on the exiting from the `ChainExpression` node. + * @returns {void} + */ + pushChainContext() { + this.chainContext = { + upper: this.chainContext, + countChoiceContexts: 0 + }; + } + + /** + * Pop a `ChainExpression` context from the stack. + * This method is called on exiting from each `ChainExpression` node. + * This merges all forks of the last optional chaining. + * @returns {void} + */ + popChainContext() { + const context = this.chainContext; + + this.chainContext = context.upper; + + // pop all choice contexts of this. + for (let i = context.countChoiceContexts; i > 0; --i) { + this.popChoiceContext(); + } + } + + /** + * Create a choice context for optional access. + * This method is called on entering to each `(Call|Member)Expression[optional=true]` node. + * This creates a choice context as similar to `LogicalExpression[operator="??"]` node. + * @returns {void} + */ + makeOptionalNode() { + if (this.chainContext) { + this.chainContext.countChoiceContexts += 1; + this.pushChoiceContext("??", false); + } + } + + /** + * Create a fork. + * This method is called on entering to the `arguments|property` property of each `(Call|Member)Expression` node. + * @returns {void} + */ + makeOptionalRight() { + if (this.chainContext) { + this.makeLogicalRight(); + } + } + + //-------------------------------------------------------------------------- + // SwitchStatement + //-------------------------------------------------------------------------- + + /** + * Creates a context object of SwitchStatement and stacks it. + * @param {boolean} hasCase `true` if the switch statement has one or more + * case parts. + * @param {string|null} label The label text. + * @returns {void} + */ + pushSwitchContext(hasCase, label) { + this.switchContext = { + upper: this.switchContext, + hasCase, + defaultSegments: null, + defaultBodySegments: null, + foundDefault: false, + lastIsDefault: false, + countForks: 0 + }; + + this.pushBreakContext(true, label); + } + + /** + * Pops the last context of SwitchStatement and finalizes it. + * + * - Disposes all forking stack for `case` and `default`. + * - Creates the next code path segment from `context.brokenForkContext`. + * - If the last `SwitchCase` node is not a `default` part, creates a path + * to the `default` body. + * @returns {void} + */ + popSwitchContext() { + const context = this.switchContext; + + this.switchContext = context.upper; + + const forkContext = this.forkContext; + const brokenForkContext = this.popBreakContext().brokenForkContext; + + if (context.countForks === 0) { + + /* + * When there is only one `default` chunk and there is one or more + * `break` statements, even if forks are nothing, it needs to merge + * those. + */ + if (!brokenForkContext.empty) { + brokenForkContext.add(forkContext.makeNext(-1, -1)); + forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); + } + + return; + } + + const lastSegments = forkContext.head; + + this.forkBypassPath(); + const lastCaseSegments = forkContext.head; + + /* + * `brokenForkContext` is used to make the next segment. + * It must add the last segment into `brokenForkContext`. + */ + brokenForkContext.add(lastSegments); + + /* + * A path which is failed in all case test should be connected to path + * of `default` chunk. + */ + if (!context.lastIsDefault) { + if (context.defaultBodySegments) { + + /* + * Remove a link from `default` label to its chunk. + * It's false route. + */ + removeConnection(context.defaultSegments, context.defaultBodySegments); + makeLooped(this, lastCaseSegments, context.defaultBodySegments); + } else { + + /* + * It handles the last case body as broken if `default` chunk + * does not exist. + */ + brokenForkContext.add(lastCaseSegments); + } + } + + // Pops the segment context stack until the entry segment. + for (let i = 0; i < context.countForks; ++i) { + this.forkContext = this.forkContext.upper; + } + + /* + * Creates a path from all brokenForkContext paths. + * This is a path after switch statement. + */ + this.forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); + } + + /** + * Makes a code path segment for a `SwitchCase` node. + * @param {boolean} isEmpty `true` if the body is empty. + * @param {boolean} isDefault `true` if the body is the default case. + * @returns {void} + */ + makeSwitchCaseBody(isEmpty, isDefault) { + const context = this.switchContext; + + if (!context.hasCase) { + return; + } + + /* + * Merge forks. + * The parent fork context has two segments. + * Those are from the current case and the body of the previous case. + */ + const parentForkContext = this.forkContext; + const forkContext = this.pushForkContext(); + + forkContext.add(parentForkContext.makeNext(0, -1)); + + /* + * Save `default` chunk info. + * If the `default` label is not at the last, we must make a path from + * the last `case` to the `default` chunk. + */ + if (isDefault) { + context.defaultSegments = parentForkContext.head; + if (isEmpty) { + context.foundDefault = true; + } else { + context.defaultBodySegments = forkContext.head; + } + } else { + if (!isEmpty && context.foundDefault) { + context.foundDefault = false; + context.defaultBodySegments = forkContext.head; + } + } + + context.lastIsDefault = isDefault; + context.countForks += 1; + } + + //-------------------------------------------------------------------------- + // TryStatement + //-------------------------------------------------------------------------- + + /** + * Creates a context object of TryStatement and stacks it. + * @param {boolean} hasFinalizer `true` if the try statement has a + * `finally` block. + * @returns {void} + */ + pushTryContext(hasFinalizer) { + this.tryContext = { + upper: this.tryContext, + position: "try", + hasFinalizer, + + returnedForkContext: hasFinalizer + ? ForkContext.newEmpty(this.forkContext) + : null, + + thrownForkContext: ForkContext.newEmpty(this.forkContext), + lastOfTryIsReachable: false, + lastOfCatchIsReachable: false + }; + } + + /** + * Pops the last context of TryStatement and finalizes it. + * @returns {void} + */ + popTryContext() { + const context = this.tryContext; + + this.tryContext = context.upper; + + if (context.position === "catch") { + + // Merges two paths from the `try` block and `catch` block merely. + this.popForkContext(); + return; + } + + /* + * The following process is executed only when there is the `finally` + * block. + */ + + const returned = context.returnedForkContext; + const thrown = context.thrownForkContext; + + if (returned.empty && thrown.empty) { + return; + } + + // Separate head to normal paths and leaving paths. + const headSegments = this.forkContext.head; + + this.forkContext = this.forkContext.upper; + const normalSegments = headSegments.slice(0, headSegments.length / 2 | 0); + const leavingSegments = headSegments.slice(headSegments.length / 2 | 0); + + // Forwards the leaving path to upper contexts. + if (!returned.empty) { + getReturnContext(this).returnedForkContext.add(leavingSegments); + } + if (!thrown.empty) { + getThrowContext(this).thrownForkContext.add(leavingSegments); + } + + // Sets the normal path as the next. + this.forkContext.replaceHead(normalSegments); + + /* + * If both paths of the `try` block and the `catch` block are + * unreachable, the next path becomes unreachable as well. + */ + if (!context.lastOfTryIsReachable && !context.lastOfCatchIsReachable) { + this.forkContext.makeUnreachable(); + } + } + + /** + * Makes a code path segment for a `catch` block. + * @returns {void} + */ + makeCatchBlock() { + const context = this.tryContext; + const forkContext = this.forkContext; + const thrown = context.thrownForkContext; + + // Update state. + context.position = "catch"; + context.thrownForkContext = ForkContext.newEmpty(forkContext); + context.lastOfTryIsReachable = forkContext.reachable; + + // Merge thrown paths. + thrown.add(forkContext.head); + const thrownSegments = thrown.makeNext(0, -1); + + // Fork to a bypass and the merged thrown path. + this.pushForkContext(); + this.forkBypassPath(); + this.forkContext.add(thrownSegments); + } + + /** + * Makes a code path segment for a `finally` block. + * + * In the `finally` block, parallel paths are created. The parallel paths + * are used as leaving-paths. The leaving-paths are paths from `return` + * statements and `throw` statements in a `try` block or a `catch` block. + * @returns {void} + */ + makeFinallyBlock() { + const context = this.tryContext; + let forkContext = this.forkContext; + const returned = context.returnedForkContext; + const thrown = context.thrownForkContext; + const headOfLeavingSegments = forkContext.head; + + // Update state. + if (context.position === "catch") { + + // Merges two paths from the `try` block and `catch` block. + this.popForkContext(); + forkContext = this.forkContext; + + context.lastOfCatchIsReachable = forkContext.reachable; + } else { + context.lastOfTryIsReachable = forkContext.reachable; + } + context.position = "finally"; + + if (returned.empty && thrown.empty) { + + // This path does not leave. + return; + } + + /* + * Create a parallel segment from merging returned and thrown. + * This segment will leave at the end of this finally block. + */ + const segments = forkContext.makeNext(-1, -1); + + for (let i = 0; i < forkContext.count; ++i) { + const prevSegsOfLeavingSegment = [headOfLeavingSegments[i]]; + + for (let j = 0; j < returned.segmentsList.length; ++j) { + prevSegsOfLeavingSegment.push(returned.segmentsList[j][i]); + } + for (let j = 0; j < thrown.segmentsList.length; ++j) { + prevSegsOfLeavingSegment.push(thrown.segmentsList[j][i]); + } + + segments.push( + CodePathSegment.newNext( + this.idGenerator.next(), + prevSegsOfLeavingSegment + ) + ); + } + + this.pushForkContext(true); + this.forkContext.add(segments); + } + + /** + * Makes a code path segment from the first throwable node to the `catch` + * block or the `finally` block. + * @returns {void} + */ + makeFirstThrowablePathInTryBlock() { + const forkContext = this.forkContext; + + if (!forkContext.reachable) { + return; + } + + const context = getThrowContext(this); + + if (context === this || + context.position !== "try" || + !context.thrownForkContext.empty + ) { + return; + } + + context.thrownForkContext.add(forkContext.head); + forkContext.replaceHead(forkContext.makeNext(-1, -1)); + } + + //-------------------------------------------------------------------------- + // Loop Statements + //-------------------------------------------------------------------------- + + /** + * Creates a context object of a loop statement and stacks it. + * @param {string} type The type of the node which was triggered. One of + * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, + * and `ForStatement`. + * @param {string|null} label A label of the node which was triggered. + * @throws {Error} (Unreachable - unknown type.) + * @returns {void} + */ + pushLoopContext(type, label) { + const forkContext = this.forkContext; + const breakContext = this.pushBreakContext(true, label); + + switch (type) { + case "WhileStatement": + this.pushChoiceContext("loop", false); + this.loopContext = { + upper: this.loopContext, + type, + label, + test: void 0, + continueDestSegments: null, + brokenForkContext: breakContext.brokenForkContext + }; + break; + + case "DoWhileStatement": + this.pushChoiceContext("loop", false); + this.loopContext = { + upper: this.loopContext, + type, + label, + test: void 0, + entrySegments: null, + continueForkContext: ForkContext.newEmpty(forkContext), + brokenForkContext: breakContext.brokenForkContext + }; + break; + + case "ForStatement": + this.pushChoiceContext("loop", false); + this.loopContext = { + upper: this.loopContext, + type, + label, + test: void 0, + endOfInitSegments: null, + testSegments: null, + endOfTestSegments: null, + updateSegments: null, + endOfUpdateSegments: null, + continueDestSegments: null, + brokenForkContext: breakContext.brokenForkContext + }; + break; + + case "ForInStatement": + case "ForOfStatement": + this.loopContext = { + upper: this.loopContext, + type, + label, + prevSegments: null, + leftSegments: null, + endOfLeftSegments: null, + continueDestSegments: null, + brokenForkContext: breakContext.brokenForkContext + }; + break; + + /* istanbul ignore next */ + default: + throw new Error(`unknown type: "${type}"`); + } + } + + /** + * Pops the last context of a loop statement and finalizes it. + * @throws {Error} (Unreachable - unknown type.) + * @returns {void} + */ + popLoopContext() { + const context = this.loopContext; + + this.loopContext = context.upper; + + const forkContext = this.forkContext; + const brokenForkContext = this.popBreakContext().brokenForkContext; + + // Creates a looped path. + switch (context.type) { + case "WhileStatement": + case "ForStatement": + this.popChoiceContext(); + makeLooped( + this, + forkContext.head, + context.continueDestSegments + ); + break; + + case "DoWhileStatement": { + const choiceContext = this.popChoiceContext(); + + if (!choiceContext.processed) { + choiceContext.trueForkContext.add(forkContext.head); + choiceContext.falseForkContext.add(forkContext.head); + } + if (context.test !== true) { + brokenForkContext.addAll(choiceContext.falseForkContext); + } + + // `true` paths go to looping. + const segmentsList = choiceContext.trueForkContext.segmentsList; + + for (let i = 0; i < segmentsList.length; ++i) { + makeLooped( + this, + segmentsList[i], + context.entrySegments + ); + } + break; + } + + case "ForInStatement": + case "ForOfStatement": + brokenForkContext.add(forkContext.head); + makeLooped( + this, + forkContext.head, + context.leftSegments + ); + break; + + /* istanbul ignore next */ + default: + throw new Error("unreachable"); + } + + // Go next. + if (brokenForkContext.empty) { + forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); + } else { + forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); + } + } + + /** + * Makes a code path segment for the test part of a WhileStatement. + * @param {boolean|undefined} test The test value (only when constant). + * @returns {void} + */ + makeWhileTest(test) { + const context = this.loopContext; + const forkContext = this.forkContext; + const testSegments = forkContext.makeNext(0, -1); + + // Update state. + context.test = test; + context.continueDestSegments = testSegments; + forkContext.replaceHead(testSegments); + } + + /** + * Makes a code path segment for the body part of a WhileStatement. + * @returns {void} + */ + makeWhileBody() { + const context = this.loopContext; + const choiceContext = this.choiceContext; + const forkContext = this.forkContext; + + if (!choiceContext.processed) { + choiceContext.trueForkContext.add(forkContext.head); + choiceContext.falseForkContext.add(forkContext.head); + } + + // Update state. + if (context.test !== true) { + context.brokenForkContext.addAll(choiceContext.falseForkContext); + } + forkContext.replaceHead(choiceContext.trueForkContext.makeNext(0, -1)); + } + + /** + * Makes a code path segment for the body part of a DoWhileStatement. + * @returns {void} + */ + makeDoWhileBody() { + const context = this.loopContext; + const forkContext = this.forkContext; + const bodySegments = forkContext.makeNext(-1, -1); + + // Update state. + context.entrySegments = bodySegments; + forkContext.replaceHead(bodySegments); + } + + /** + * Makes a code path segment for the test part of a DoWhileStatement. + * @param {boolean|undefined} test The test value (only when constant). + * @returns {void} + */ + makeDoWhileTest(test) { + const context = this.loopContext; + const forkContext = this.forkContext; + + context.test = test; + + // Creates paths of `continue` statements. + if (!context.continueForkContext.empty) { + context.continueForkContext.add(forkContext.head); + const testSegments = context.continueForkContext.makeNext(0, -1); + + forkContext.replaceHead(testSegments); + } + } + + /** + * Makes a code path segment for the test part of a ForStatement. + * @param {boolean|undefined} test The test value (only when constant). + * @returns {void} + */ + makeForTest(test) { + const context = this.loopContext; + const forkContext = this.forkContext; + const endOfInitSegments = forkContext.head; + const testSegments = forkContext.makeNext(-1, -1); + + // Update state. + context.test = test; + context.endOfInitSegments = endOfInitSegments; + context.continueDestSegments = context.testSegments = testSegments; + forkContext.replaceHead(testSegments); + } + + /** + * Makes a code path segment for the update part of a ForStatement. + * @returns {void} + */ + makeForUpdate() { + const context = this.loopContext; + const choiceContext = this.choiceContext; + const forkContext = this.forkContext; + + // Make the next paths of the test. + if (context.testSegments) { + finalizeTestSegmentsOfFor( + context, + choiceContext, + forkContext.head + ); + } else { + context.endOfInitSegments = forkContext.head; + } + + // Update state. + const updateSegments = forkContext.makeDisconnected(-1, -1); + + context.continueDestSegments = context.updateSegments = updateSegments; + forkContext.replaceHead(updateSegments); + } + + /** + * Makes a code path segment for the body part of a ForStatement. + * @returns {void} + */ + makeForBody() { + const context = this.loopContext; + const choiceContext = this.choiceContext; + const forkContext = this.forkContext; + + // Update state. + if (context.updateSegments) { + context.endOfUpdateSegments = forkContext.head; + + // `update` -> `test` + if (context.testSegments) { + makeLooped( + this, + context.endOfUpdateSegments, + context.testSegments + ); + } + } else if (context.testSegments) { + finalizeTestSegmentsOfFor( + context, + choiceContext, + forkContext.head + ); + } else { + context.endOfInitSegments = forkContext.head; + } + + let bodySegments = context.endOfTestSegments; + + if (!bodySegments) { + + /* + * If there is not the `test` part, the `body` path comes from the + * `init` part and the `update` part. + */ + const prevForkContext = ForkContext.newEmpty(forkContext); + + prevForkContext.add(context.endOfInitSegments); + if (context.endOfUpdateSegments) { + prevForkContext.add(context.endOfUpdateSegments); + } + + bodySegments = prevForkContext.makeNext(0, -1); + } + context.continueDestSegments = context.continueDestSegments || bodySegments; + forkContext.replaceHead(bodySegments); + } + + /** + * Makes a code path segment for the left part of a ForInStatement and a + * ForOfStatement. + * @returns {void} + */ + makeForInOfLeft() { + const context = this.loopContext; + const forkContext = this.forkContext; + const leftSegments = forkContext.makeDisconnected(-1, -1); + + // Update state. + context.prevSegments = forkContext.head; + context.leftSegments = context.continueDestSegments = leftSegments; + forkContext.replaceHead(leftSegments); + } + + /** + * Makes a code path segment for the right part of a ForInStatement and a + * ForOfStatement. + * @returns {void} + */ + makeForInOfRight() { + const context = this.loopContext; + const forkContext = this.forkContext; + const temp = ForkContext.newEmpty(forkContext); + + temp.add(context.prevSegments); + const rightSegments = temp.makeNext(-1, -1); + + // Update state. + context.endOfLeftSegments = forkContext.head; + forkContext.replaceHead(rightSegments); + } + + /** + * Makes a code path segment for the body part of a ForInStatement and a + * ForOfStatement. + * @returns {void} + */ + makeForInOfBody() { + const context = this.loopContext; + const forkContext = this.forkContext; + const temp = ForkContext.newEmpty(forkContext); + + temp.add(context.endOfLeftSegments); + const bodySegments = temp.makeNext(-1, -1); + + // Make a path: `right` -> `left`. + makeLooped(this, forkContext.head, context.leftSegments); + + // Update state. + context.brokenForkContext.add(forkContext.head); + forkContext.replaceHead(bodySegments); + } + + //-------------------------------------------------------------------------- + // Control Statements + //-------------------------------------------------------------------------- + + /** + * Creates new context for BreakStatement. + * @param {boolean} breakable The flag to indicate it can break by + * an unlabeled BreakStatement. + * @param {string|null} label The label of this context. + * @returns {Object} The new context. + */ + pushBreakContext(breakable, label) { + this.breakContext = { + upper: this.breakContext, + breakable, + label, + brokenForkContext: ForkContext.newEmpty(this.forkContext) + }; + return this.breakContext; + } + + /** + * Removes the top item of the break context stack. + * @returns {Object} The removed context. + */ + popBreakContext() { + const context = this.breakContext; + const forkContext = this.forkContext; + + this.breakContext = context.upper; + + // Process this context here for other than switches and loops. + if (!context.breakable) { + const brokenForkContext = context.brokenForkContext; + + if (!brokenForkContext.empty) { + brokenForkContext.add(forkContext.head); + forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); + } + } + + return context; + } + + /** + * Makes a path for a `break` statement. + * + * It registers the head segment to a context of `break`. + * It makes new unreachable segment, then it set the head with the segment. + * @param {string} label A label of the break statement. + * @returns {void} + */ + makeBreak(label) { + const forkContext = this.forkContext; + + if (!forkContext.reachable) { + return; + } + + const context = getBreakContext(this, label); + + /* istanbul ignore else: foolproof (syntax error) */ + if (context) { + context.brokenForkContext.add(forkContext.head); + } + + forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); + } + + /** + * Makes a path for a `continue` statement. + * + * It makes a looping path. + * It makes new unreachable segment, then it set the head with the segment. + * @param {string} label A label of the continue statement. + * @returns {void} + */ + makeContinue(label) { + const forkContext = this.forkContext; + + if (!forkContext.reachable) { + return; + } + + const context = getContinueContext(this, label); + + /* istanbul ignore else: foolproof (syntax error) */ + if (context) { + if (context.continueDestSegments) { + makeLooped(this, forkContext.head, context.continueDestSegments); + + // If the context is a for-in/of loop, this effects a break also. + if (context.type === "ForInStatement" || + context.type === "ForOfStatement" + ) { + context.brokenForkContext.add(forkContext.head); + } + } else { + context.continueForkContext.add(forkContext.head); + } + } + forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); + } + + /** + * Makes a path for a `return` statement. + * + * It registers the head segment to a context of `return`. + * It makes new unreachable segment, then it set the head with the segment. + * @returns {void} + */ + makeReturn() { + const forkContext = this.forkContext; + + if (forkContext.reachable) { + getReturnContext(this).returnedForkContext.add(forkContext.head); + forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); + } + } + + /** + * Makes a path for a `throw` statement. + * + * It registers the head segment to a context of `throw`. + * It makes new unreachable segment, then it set the head with the segment. + * @returns {void} + */ + makeThrow() { + const forkContext = this.forkContext; + + if (forkContext.reachable) { + getThrowContext(this).thrownForkContext.add(forkContext.head); + forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); + } + } + + /** + * Makes the final path. + * @returns {void} + */ + makeFinal() { + const segments = this.currentSegments; + + if (segments.length > 0 && segments[0].reachable) { + this.returnedForkContext.add(segments); + } + } +} + +module.exports = CodePathState; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path.js new file mode 100644 index 0000000..a028ca6 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/code-path.js @@ -0,0 +1,247 @@ +/** + * @fileoverview A class of the code path. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const CodePathState = require("./code-path-state"); +const IdGenerator = require("./id-generator"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A code path. + */ +class CodePath { + + /** + * Creates a new instance. + * @param {Object} options Options for the function (see below). + * @param {string} options.id An identifier. + * @param {string} options.origin The type of code path origin. + * @param {CodePath|null} options.upper The code path of the upper function scope. + * @param {Function} options.onLooped A callback function to notify looping. + */ + constructor({ id, origin, upper, onLooped }) { + + /** + * The identifier of this code path. + * Rules use it to store additional information of each rule. + * @type {string} + */ + this.id = id; + + /** + * The reason that this code path was started. May be "program", + * "function", "class-field-initializer", or "class-static-block". + * @type {string} + */ + this.origin = origin; + + /** + * The code path of the upper function scope. + * @type {CodePath|null} + */ + this.upper = upper; + + /** + * The code paths of nested function scopes. + * @type {CodePath[]} + */ + this.childCodePaths = []; + + // Initializes internal state. + Object.defineProperty( + this, + "internal", + { value: new CodePathState(new IdGenerator(`${id}_`), onLooped) } + ); + + // Adds this into `childCodePaths` of `upper`. + if (upper) { + upper.childCodePaths.push(this); + } + } + + /** + * Gets the state of a given code path. + * @param {CodePath} codePath A code path to get. + * @returns {CodePathState} The state of the code path. + */ + static getState(codePath) { + return codePath.internal; + } + + /** + * The initial code path segment. + * @type {CodePathSegment} + */ + get initialSegment() { + return this.internal.initialSegment; + } + + /** + * Final code path segments. + * This array is a mix of `returnedSegments` and `thrownSegments`. + * @type {CodePathSegment[]} + */ + get finalSegments() { + return this.internal.finalSegments; + } + + /** + * Final code path segments which is with `return` statements. + * This array contains the last path segment if it's reachable. + * Since the reachable last path returns `undefined`. + * @type {CodePathSegment[]} + */ + get returnedSegments() { + return this.internal.returnedForkContext; + } + + /** + * Final code path segments which is with `throw` statements. + * @type {CodePathSegment[]} + */ + get thrownSegments() { + return this.internal.thrownForkContext; + } + + /** + * Current code path segments. + * @type {CodePathSegment[]} + */ + get currentSegments() { + return this.internal.currentSegments; + } + + /** + * Traverses all segments in this code path. + * + * codePath.traverseSegments(function(segment, controller) { + * // do something. + * }); + * + * This method enumerates segments in order from the head. + * + * The `controller` object has two methods. + * + * - `controller.skip()` - Skip the following segments in this branch. + * - `controller.break()` - Skip all following segments. + * @param {Object} [options] Omittable. + * @param {CodePathSegment} [options.first] The first segment to traverse. + * @param {CodePathSegment} [options.last] The last segment to traverse. + * @param {Function} callback A callback function. + * @returns {void} + */ + traverseSegments(options, callback) { + let resolvedOptions; + let resolvedCallback; + + if (typeof options === "function") { + resolvedCallback = options; + resolvedOptions = {}; + } else { + resolvedOptions = options || {}; + resolvedCallback = callback; + } + + const startSegment = resolvedOptions.first || this.internal.initialSegment; + const lastSegment = resolvedOptions.last; + + let item = null; + let index = 0; + let end = 0; + let segment = null; + const visited = Object.create(null); + const stack = [[startSegment, 0]]; + let skippedSegment = null; + let broken = false; + const controller = { + skip() { + if (stack.length <= 1) { + broken = true; + } else { + skippedSegment = stack[stack.length - 2][0]; + } + }, + break() { + broken = true; + } + }; + + /** + * Checks a given previous segment has been visited. + * @param {CodePathSegment} prevSegment A previous segment to check. + * @returns {boolean} `true` if the segment has been visited. + */ + function isVisited(prevSegment) { + return ( + visited[prevSegment.id] || + segment.isLoopedPrevSegment(prevSegment) + ); + } + + while (stack.length > 0) { + item = stack[stack.length - 1]; + segment = item[0]; + index = item[1]; + + if (index === 0) { + + // Skip if this segment has been visited already. + if (visited[segment.id]) { + stack.pop(); + continue; + } + + // Skip if all previous segments have not been visited. + if (segment !== startSegment && + segment.prevSegments.length > 0 && + !segment.prevSegments.every(isVisited) + ) { + stack.pop(); + continue; + } + + // Reset the flag of skipping if all branches have been skipped. + if (skippedSegment && segment.prevSegments.includes(skippedSegment)) { + skippedSegment = null; + } + visited[segment.id] = true; + + // Call the callback when the first time. + if (!skippedSegment) { + resolvedCallback.call(this, segment, controller); + if (segment === lastSegment) { + controller.skip(); + } + if (broken) { + break; + } + } + } + + // Update the stack. + end = segment.nextSegments.length - 1; + if (index < end) { + item[1] += 1; + stack.push([segment.nextSegments[index], 0]); + } else if (index === end) { + item[0] = segment.nextSegments[index]; + item[1] = 0; + } else { + stack.pop(); + } + } + } +} + +module.exports = CodePath; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js b/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js new file mode 100644 index 0000000..ca64862 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js @@ -0,0 +1,203 @@ +/** + * @fileoverview Helpers to debug for code path analysis. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const debug = require("debug")("eslint:code-path"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets id of a given segment. + * @param {CodePathSegment} segment A segment to get. + * @returns {string} Id of the segment. + */ +/* istanbul ignore next */ +function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc -- Ignoring + return segment.id + (segment.reachable ? "" : "!"); +} + +/** + * Get string for the given node and operation. + * @param {ASTNode} node The node to convert. + * @param {"enter" | "exit" | undefined} label The operation label. + * @returns {string} The string representation. + */ +function nodeToString(node, label) { + const suffix = label ? `:${label}` : ""; + + switch (node.type) { + case "Identifier": return `${node.type}${suffix} (${node.name})`; + case "Literal": return `${node.type}${suffix} (${node.value})`; + default: return `${node.type}${suffix}`; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + + /** + * A flag that debug dumping is enabled or not. + * @type {boolean} + */ + enabled: debug.enabled, + + /** + * Dumps given objects. + * @param {...any} args objects to dump. + * @returns {void} + */ + dump: debug, + + /** + * Dumps the current analyzing state. + * @param {ASTNode} node A node to dump. + * @param {CodePathState} state A state to dump. + * @param {boolean} leaving A flag whether or not it's leaving + * @returns {void} + */ + dumpState: !debug.enabled ? debug : /* istanbul ignore next */ function(node, state, leaving) { + for (let i = 0; i < state.currentSegments.length; ++i) { + const segInternal = state.currentSegments[i].internal; + + if (leaving) { + const last = segInternal.nodes.length - 1; + + if (last >= 0 && segInternal.nodes[last] === nodeToString(node, "enter")) { + segInternal.nodes[last] = nodeToString(node, void 0); + } else { + segInternal.nodes.push(nodeToString(node, "exit")); + } + } else { + segInternal.nodes.push(nodeToString(node, "enter")); + } + } + + debug([ + `${state.currentSegments.map(getId).join(",")})`, + `${node.type}${leaving ? ":exit" : ""}` + ].join(" ")); + }, + + /** + * Dumps a DOT code of a given code path. + * The DOT code can be visualized with Graphvis. + * @param {CodePath} codePath A code path to dump. + * @returns {void} + * @see http://www.graphviz.org + * @see http://www.webgraphviz.com + */ + dumpDot: !debug.enabled ? debug : /* istanbul ignore next */ function(codePath) { + let text = + "\n" + + "digraph {\n" + + "node[shape=box,style=\"rounded,filled\",fillcolor=white];\n" + + "initial[label=\"\",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];\n"; + + if (codePath.returnedSegments.length > 0) { + text += "final[label=\"\",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];\n"; + } + if (codePath.thrownSegments.length > 0) { + text += "thrown[label=\"✘\",shape=circle,width=0.3,height=0.3,fixedsize];\n"; + } + + const traceMap = Object.create(null); + const arrows = this.makeDotArrows(codePath, traceMap); + + for (const id in traceMap) { // eslint-disable-line guard-for-in -- Want ability to traverse prototype + const segment = traceMap[id]; + + text += `${id}[`; + + if (segment.reachable) { + text += "label=\""; + } else { + text += "style=\"rounded,dashed,filled\",fillcolor=\"#FF9800\",label=\"<>\\n"; + } + + if (segment.internal.nodes.length > 0) { + text += segment.internal.nodes.join("\\n"); + } else { + text += "????"; + } + + text += "\"];\n"; + } + + text += `${arrows}\n`; + text += "}"; + debug("DOT", text); + }, + + /** + * Makes a DOT code of a given code path. + * The DOT code can be visualized with Graphvis. + * @param {CodePath} codePath A code path to make DOT. + * @param {Object} traceMap Optional. A map to check whether or not segments had been done. + * @returns {string} A DOT code of the code path. + */ + makeDotArrows(codePath, traceMap) { + const stack = [[codePath.initialSegment, 0]]; + const done = traceMap || Object.create(null); + let lastId = codePath.initialSegment.id; + let text = `initial->${codePath.initialSegment.id}`; + + while (stack.length > 0) { + const item = stack.pop(); + const segment = item[0]; + const index = item[1]; + + if (done[segment.id] && index === 0) { + continue; + } + done[segment.id] = segment; + + const nextSegment = segment.allNextSegments[index]; + + if (!nextSegment) { + continue; + } + + if (lastId === segment.id) { + text += `->${nextSegment.id}`; + } else { + text += `;\n${segment.id}->${nextSegment.id}`; + } + lastId = nextSegment.id; + + stack.unshift([segment, 1 + index]); + stack.push([nextSegment, 0]); + } + + codePath.returnedSegments.forEach(finalSegment => { + if (lastId === finalSegment.id) { + text += "->final"; + } else { + text += `;\n${finalSegment.id}->final`; + } + lastId = null; + }); + + codePath.thrownSegments.forEach(finalSegment => { + if (lastId === finalSegment.id) { + text += "->thrown"; + } else { + text += `;\n${finalSegment.id}->thrown`; + } + lastId = null; + }); + + return `${text};`; + } +}; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js b/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js new file mode 100644 index 0000000..04c59b5 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js @@ -0,0 +1,248 @@ +/** + * @fileoverview A class to operate forking. + * + * This is state of forking. + * This has a fork list and manages it. + * + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const assert = require("assert"), + CodePathSegment = require("./code-path-segment"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets whether or not a given segment is reachable. + * @param {CodePathSegment} segment A segment to get. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +/** + * Creates new segments from the specific range of `context.segmentsList`. + * + * When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and + * `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`. + * This `h` is from `b`, `d`, and `f`. + * @param {ForkContext} context An instance. + * @param {number} begin The first index of the previous segments. + * @param {number} end The last index of the previous segments. + * @param {Function} create A factory function of new segments. + * @returns {CodePathSegment[]} New segments. + */ +function makeSegments(context, begin, end, create) { + const list = context.segmentsList; + + const normalizedBegin = begin >= 0 ? begin : list.length + begin; + const normalizedEnd = end >= 0 ? end : list.length + end; + + const segments = []; + + for (let i = 0; i < context.count; ++i) { + const allPrevSegments = []; + + for (let j = normalizedBegin; j <= normalizedEnd; ++j) { + allPrevSegments.push(list[j][i]); + } + + segments.push(create(context.idGenerator.next(), allPrevSegments)); + } + + return segments; +} + +/** + * `segments` becomes doubly in a `finally` block. Then if a code path exits by a + * control statement (such as `break`, `continue`) from the `finally` block, the + * destination's segments may be half of the source segments. In that case, this + * merges segments. + * @param {ForkContext} context An instance. + * @param {CodePathSegment[]} segments Segments to merge. + * @returns {CodePathSegment[]} The merged segments. + */ +function mergeExtraSegments(context, segments) { + let currentSegments = segments; + + while (currentSegments.length > context.count) { + const merged = []; + + for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) { + merged.push(CodePathSegment.newNext( + context.idGenerator.next(), + [currentSegments[i], currentSegments[i + length]] + )); + } + currentSegments = merged; + } + return currentSegments; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A class to manage forking. + */ +class ForkContext { + + /** + * @param {IdGenerator} idGenerator An identifier generator for segments. + * @param {ForkContext|null} upper An upper fork context. + * @param {number} count A number of parallel segments. + */ + constructor(idGenerator, upper, count) { + this.idGenerator = idGenerator; + this.upper = upper; + this.count = count; + this.segmentsList = []; + } + + /** + * The head segments. + * @type {CodePathSegment[]} + */ + get head() { + const list = this.segmentsList; + + return list.length === 0 ? [] : list[list.length - 1]; + } + + /** + * A flag which shows empty. + * @type {boolean} + */ + get empty() { + return this.segmentsList.length === 0; + } + + /** + * A flag which shows reachable. + * @type {boolean} + */ + get reachable() { + const segments = this.head; + + return segments.length > 0 && segments.some(isReachable); + } + + /** + * Creates new segments from this context. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. + * @returns {CodePathSegment[]} New segments. + */ + makeNext(begin, end) { + return makeSegments(this, begin, end, CodePathSegment.newNext); + } + + /** + * Creates new segments from this context. + * The new segments is always unreachable. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. + * @returns {CodePathSegment[]} New segments. + */ + makeUnreachable(begin, end) { + return makeSegments(this, begin, end, CodePathSegment.newUnreachable); + } + + /** + * Creates new segments from this context. + * The new segments don't have connections for previous segments. + * But these inherit the reachable flag from this context. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. + * @returns {CodePathSegment[]} New segments. + */ + makeDisconnected(begin, end) { + return makeSegments(this, begin, end, CodePathSegment.newDisconnected); + } + + /** + * Adds segments into this context. + * The added segments become the head. + * @param {CodePathSegment[]} segments Segments to add. + * @returns {void} + */ + add(segments) { + assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); + + this.segmentsList.push(mergeExtraSegments(this, segments)); + } + + /** + * Replaces the head segments with given segments. + * The current head segments are removed. + * @param {CodePathSegment[]} segments Segments to add. + * @returns {void} + */ + replaceHead(segments) { + assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); + + this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments)); + } + + /** + * Adds all segments of a given fork context into this context. + * @param {ForkContext} context A fork context to add. + * @returns {void} + */ + addAll(context) { + assert(context.count === this.count); + + const source = context.segmentsList; + + for (let i = 0; i < source.length; ++i) { + this.segmentsList.push(source[i]); + } + } + + /** + * Clears all segments in this context. + * @returns {void} + */ + clear() { + this.segmentsList = []; + } + + /** + * Creates the root fork context. + * @param {IdGenerator} idGenerator An identifier generator for segments. + * @returns {ForkContext} New fork context. + */ + static newRoot(idGenerator) { + const context = new ForkContext(idGenerator, null, 1); + + context.add([CodePathSegment.newRoot(idGenerator.next())]); + + return context; + } + + /** + * Creates an empty fork context preceded by a given context. + * @param {ForkContext} parentContext The parent fork context. + * @param {boolean} forkLeavingPath A flag which shows inside of `finally` block. + * @returns {ForkContext} New fork context. + */ + static newEmpty(parentContext, forkLeavingPath) { + return new ForkContext( + parentContext.idGenerator, + parentContext, + (forkLeavingPath ? 2 : 1) * parentContext.count + ); + } +} + +module.exports = ForkContext; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js b/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js new file mode 100644 index 0000000..83787a4 --- /dev/null +++ b/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js @@ -0,0 +1,45 @@ +/** + * @fileoverview A class of identifiers generator for code path segments. + * + * Each rule uses the identifier of code path segments to store additional + * information of the code path. + * + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A generator for unique ids. + */ +class IdGenerator { + + /** + * @param {string} prefix Optional. A prefix of generated ids. + */ + constructor(prefix) { + this.prefix = String(prefix); + this.n = 0; + } + + /** + * Generates id. + * @returns {string} A generated id. + */ + next() { + this.n = 1 + this.n | 0; + + /* istanbul ignore if */ + if (this.n < 0) { + this.n = 1; + } + + return this.prefix + this.n; + } +} + +module.exports = IdGenerator; diff --git a/node_modules/eslint/lib/linter/config-comment-parser.js b/node_modules/eslint/lib/linter/config-comment-parser.js new file mode 100644 index 0000000..b88c5e6 --- /dev/null +++ b/node_modules/eslint/lib/linter/config-comment-parser.js @@ -0,0 +1,145 @@ +/** + * @fileoverview Config Comment Parser + * @author Nicholas C. Zakas + */ + +/* eslint class-methods-use-this: off -- Methods desired on instance */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const levn = require("levn"), + { + Legacy: { + ConfigOps + } + } = require("@eslint/eslintrc/universal"); + +const debug = require("debug")("eslint:config-comment-parser"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Object to parse ESLint configuration comments inside JavaScript files. + * @name ConfigCommentParser + */ +module.exports = class ConfigCommentParser { + + /** + * Parses a list of "name:string_value" or/and "name" options divided by comma or + * whitespace. Used for "global" and "exported" comments. + * @param {string} string The string to parse. + * @param {Comment} comment The comment node which has the string. + * @returns {Object} Result map object of names and string values, or null values if no value was provided + */ + parseStringConfig(string, comment) { + debug("Parsing String config"); + + const items = {}; + + // Collapse whitespace around `:` and `,` to make parsing easier + const trimmedString = string.replace(/\s*([:,])\s*/gu, "$1"); + + trimmedString.split(/\s|,+/u).forEach(name => { + if (!name) { + return; + } + + // value defaults to null (if not provided), e.g: "foo" => ["foo", null] + const [key, value = null] = name.split(":"); + + items[key] = { value, comment }; + }); + return items; + } + + /** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @param {Object} location Start line and column of comments for potential error message. + * @returns {({success: true, config: Object}|{success: false, error: Problem})} Result map object + */ + parseJsonConfig(string, location) { + debug("Parsing JSON config"); + + let items = {}; + + // Parses a JSON-like comment by the same way as parsing CLI option. + try { + items = levn.parse("Object", string) || {}; + + // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`. + // Also, commaless notations have invalid severity: + // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"} + // Should ignore that case as well. + if (ConfigOps.isEverySeverityValid(items)) { + return { + success: true, + config: items + }; + } + } catch { + + debug("Levn parsing failed; falling back to manual parsing."); + + // ignore to parse the string by a fallback. + } + + /* + * Optionator cannot parse commaless notations. + * But we are supporting that. So this is a fallback for that. + */ + items = {}; + const normalizedString = string.replace(/([-a-zA-Z0-9/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,"); + + try { + items = JSON.parse(`{${normalizedString}}`); + } catch (ex) { + debug("Manual parsing failed."); + + return { + success: false, + error: { + ruleId: null, + fatal: true, + severity: 2, + message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`, + line: location.start.line, + column: location.start.column + 1 + } + }; + + } + + return { + success: true, + config: items + }; + } + + /** + * Parses a config of values separated by comma. + * @param {string} string The string to parse. + * @returns {Object} Result map of values and true values + */ + parseListConfig(string) { + debug("Parsing list config"); + + const items = {}; + + // Collapse whitespace around commas + string.replace(/\s*,\s*/gu, ",").split(/,+/u).forEach(name => { + const trimmedName = name.trim(); + + if (trimmedName) { + items[trimmedName] = true; + } + }); + return items; + } + +}; diff --git a/node_modules/eslint/lib/linter/index.js b/node_modules/eslint/lib/linter/index.js new file mode 100644 index 0000000..25fd769 --- /dev/null +++ b/node_modules/eslint/lib/linter/index.js @@ -0,0 +1,13 @@ +"use strict"; + +const { Linter } = require("./linter"); +const interpolate = require("./interpolate"); +const SourceCodeFixer = require("./source-code-fixer"); + +module.exports = { + Linter, + + // For testers. + SourceCodeFixer, + interpolate +}; diff --git a/node_modules/eslint/lib/linter/interpolate.js b/node_modules/eslint/lib/linter/interpolate.js new file mode 100644 index 0000000..87e06a0 --- /dev/null +++ b/node_modules/eslint/lib/linter/interpolate.js @@ -0,0 +1,28 @@ +/** + * @fileoverview Interpolate keys from an object into a string with {{ }} markers. + * @author Jed Fox + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = (text, data) => { + if (!data) { + return text; + } + + // Substitution content for any {{ }} markers. + return text.replace(/\{\{([^{}]+?)\}\}/gu, (fullMatch, termWithWhitespace) => { + const term = termWithWhitespace.trim(); + + if (term in data) { + return data[term]; + } + + // Preserve old behavior: If parameter name not provided, don't replace it. + return fullMatch; + }); +}; diff --git a/node_modules/eslint/lib/linter/linter.js b/node_modules/eslint/lib/linter/linter.js new file mode 100644 index 0000000..bd1bbb7 --- /dev/null +++ b/node_modules/eslint/lib/linter/linter.js @@ -0,0 +1,2004 @@ +/** + * @fileoverview Main Linter Class + * @author Gyandeep Singh + * @author aladdin-add + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const + path = require("path"), + eslintScope = require("eslint-scope"), + evk = require("eslint-visitor-keys"), + espree = require("espree"), + merge = require("lodash.merge"), + pkg = require("../../package.json"), + astUtils = require("../shared/ast-utils"), + { + Legacy: { + ConfigOps, + ConfigValidator, + environments: BuiltInEnvironments + } + } = require("@eslint/eslintrc/universal"), + Traverser = require("../shared/traverser"), + { SourceCode } = require("../source-code"), + CodePathAnalyzer = require("./code-path-analysis/code-path-analyzer"), + applyDisableDirectives = require("./apply-disable-directives"), + ConfigCommentParser = require("./config-comment-parser"), + NodeEventGenerator = require("./node-event-generator"), + createReportTranslator = require("./report-translator"), + Rules = require("./rules"), + createEmitter = require("./safe-emitter"), + SourceCodeFixer = require("./source-code-fixer"), + timing = require("./timing"), + ruleReplacements = require("../../conf/replacements.json"); +const { getRuleFromConfig } = require("../config/flat-config-helpers"); +const { FlatConfigArray } = require("../config/flat-config-array"); + +const debug = require("debug")("eslint:linter"); +const MAX_AUTOFIX_PASSES = 10; +const DEFAULT_PARSER_NAME = "espree"; +const DEFAULT_ECMA_VERSION = 5; +const commentParser = new ConfigCommentParser(); +const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }; +const parserSymbol = Symbol.for("eslint.RuleTester.parser"); +const globals = require("../../conf/globals"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** @typedef {InstanceType} ConfigArray */ +/** @typedef {InstanceType} ExtractedConfig */ +/** @typedef {import("../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../shared/types").Environment} Environment */ +/** @typedef {import("../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../shared/types").LintMessage} LintMessage */ +/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */ +/** @typedef {import("../shared/types").ParserOptions} ParserOptions */ +/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */ +/** @typedef {import("../shared/types").Processor} Processor */ +/** @typedef {import("../shared/types").Rule} Rule */ + +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ +/** + * @template T + * @typedef {{ [P in keyof T]-?: T[P] }} Required + */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ + +/** + * @typedef {Object} DisableDirective + * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type Type of directive + * @property {number} line The line number + * @property {number} column The column number + * @property {(string|null)} ruleId The rule ID + * @property {string} justification The justification of directive + */ + +/** + * The private data for `Linter` instance. + * @typedef {Object} LinterInternalSlots + * @property {ConfigArray|null} lastConfigArray The `ConfigArray` instance that the last `verify()` call used. + * @property {SourceCode|null} lastSourceCode The `SourceCode` instance that the last `verify()` call used. + * @property {SuppressedLintMessage[]} lastSuppressedMessages The `SuppressedLintMessage[]` instance that the last `verify()` call produced. + * @property {Map} parserMap The loaded parsers. + * @property {Rules} ruleMap The loaded rules. + */ + +/** + * @typedef {Object} VerifyOptions + * @property {boolean} [allowInlineConfig] Allow/disallow inline comments' ability + * to change config once it is set. Defaults to true if not supplied. + * Useful if you want to validate JS without comments overriding rules. + * @property {boolean} [disableFixes] if `true` then the linter doesn't make `fix` + * properties into the lint result. + * @property {string} [filename] the filename of the source code. + * @property {boolean | "off" | "warn" | "error"} [reportUnusedDisableDirectives] Adds reported errors for + * unused `eslint-disable` directives. + */ + +/** + * @typedef {Object} ProcessorOptions + * @property {(filename:string, text:string) => boolean} [filterCodeBlock] the + * predicate function that selects adopt code blocks. + * @property {Processor.postprocess} [postprocess] postprocessor for report + * messages. If provided, this should accept an array of the message lists + * for each code block returned from the preprocessor, apply a mapping to + * the messages as appropriate, and return a one-dimensional array of + * messages. + * @property {Processor.preprocess} [preprocess] preprocessor for source text. + * If provided, this should accept a string of source text, and return an + * array of code blocks to lint. + */ + +/** + * @typedef {Object} FixOptions + * @property {boolean | ((message: LintMessage) => boolean)} [fix] Determines + * whether fixes should be applied. + */ + +/** + * @typedef {Object} InternalOptions + * @property {string | null} warnInlineConfig The config name what `noInlineConfig` setting came from. If `noInlineConfig` setting didn't exist, this is null. If this is a config name, then the linter warns directive comments. + * @property {"off" | "warn" | "error"} reportUnusedDisableDirectives (boolean values were normalized) + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines if a given object is Espree. + * @param {Object} parser The parser to check. + * @returns {boolean} True if the parser is Espree or false if not. + */ +function isEspree(parser) { + return !!(parser === espree || parser[parserSymbol] === espree); +} + +/** + * Retrieves globals for the given ecmaVersion. + * @param {number} ecmaVersion The version to retrieve globals for. + * @returns {Object} The globals for the given ecmaVersion. + */ +function getGlobalsForEcmaVersion(ecmaVersion) { + + switch (ecmaVersion) { + case 3: + return globals.es3; + + case 5: + return globals.es5; + + default: + if (ecmaVersion < 2015) { + return globals[`es${ecmaVersion + 2009}`]; + } + + return globals[`es${ecmaVersion}`]; + } +} + +/** + * Ensures that variables representing built-in properties of the Global Object, + * and any globals declared by special block comments, are present in the global + * scope. + * @param {Scope} globalScope The global scope. + * @param {Object} configGlobals The globals declared in configuration + * @param {{exportedVariables: Object, enabledGlobals: Object}} commentDirectives Directives from comment configuration + * @returns {void} + */ +function addDeclaredGlobals(globalScope, configGlobals, { exportedVariables, enabledGlobals }) { + + // Define configured global variables. + for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(enabledGlobals)])) { + + /* + * `ConfigOps.normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would + * typically be caught when validating a config anyway (validity for inline global comments is checked separately). + */ + const configValue = configGlobals[id] === void 0 ? void 0 : ConfigOps.normalizeConfigGlobal(configGlobals[id]); + const commentValue = enabledGlobals[id] && enabledGlobals[id].value; + const value = commentValue || configValue; + const sourceComments = enabledGlobals[id] && enabledGlobals[id].comments; + + if (value === "off") { + continue; + } + + let variable = globalScope.set.get(id); + + if (!variable) { + variable = new eslintScope.Variable(id, globalScope); + + globalScope.variables.push(variable); + globalScope.set.set(id, variable); + } + + variable.eslintImplicitGlobalSetting = configValue; + variable.eslintExplicitGlobal = sourceComments !== void 0; + variable.eslintExplicitGlobalComments = sourceComments; + variable.writeable = (value === "writable"); + } + + // mark all exported variables as such + Object.keys(exportedVariables).forEach(name => { + const variable = globalScope.set.get(name); + + if (variable) { + variable.eslintUsed = true; + } + }); + + /* + * "through" contains all references which definitions cannot be found. + * Since we augment the global scope using configuration, we need to update + * references and remove the ones that were added by configuration. + */ + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + + if (variable) { + + /* + * Links the variable and the reference. + * And this reference is removed from `Scope#through`. + */ + reference.resolved = variable; + variable.references.push(reference); + + return false; + } + + return true; + }); +} + +/** + * creates a missing-rule message. + * @param {string} ruleId the ruleId to create + * @returns {string} created error message + * @private + */ +function createMissingRuleMessage(ruleId) { + return Object.prototype.hasOwnProperty.call(ruleReplacements.rules, ruleId) + ? `Rule '${ruleId}' was removed and replaced by: ${ruleReplacements.rules[ruleId].join(", ")}` + : `Definition for rule '${ruleId}' was not found.`; +} + +/** + * creates a linting problem + * @param {Object} options to create linting error + * @param {string} [options.ruleId] the ruleId to report + * @param {Object} [options.loc] the loc to report + * @param {string} [options.message] the error message to report + * @param {string} [options.severity] the error message to report + * @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId. + * @private + */ +function createLintingProblem(options) { + const { + ruleId = null, + loc = DEFAULT_ERROR_LOC, + message = createMissingRuleMessage(options.ruleId), + severity = 2 + } = options; + + return { + ruleId, + message, + line: loc.start.line, + column: loc.start.column + 1, + endLine: loc.end.line, + endColumn: loc.end.column + 1, + severity, + nodeType: null + }; +} + +/** + * Creates a collection of disable directives from a comment + * @param {Object} options to create disable directives + * @param {("disable"|"enable"|"disable-line"|"disable-next-line")} options.type The type of directive comment + * @param {token} options.commentToken The Comment token + * @param {string} options.value The value after the directive in the comment + * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`) + * @param {string} options.justification The justification of the directive + * @param {function(string): {create: Function}} options.ruleMapper A map from rule IDs to defined rules + * @returns {Object} Directives and problems from the comment + */ +function createDisableDirectives(options) { + const { commentToken, type, value, justification, ruleMapper } = options; + const ruleIds = Object.keys(commentParser.parseListConfig(value)); + const directiveRules = ruleIds.length ? ruleIds : [null]; + const result = { + directives: [], // valid disable directives + directiveProblems: [] // problems in directives + }; + + const parentComment = { commentToken, ruleIds }; + + for (const ruleId of directiveRules) { + + // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) + if (ruleId === null || !!ruleMapper(ruleId)) { + if (type === "disable-next-line") { + result.directives.push({ + parentComment, + type, + line: commentToken.loc.end.line, + column: commentToken.loc.end.column + 1, + ruleId, + justification + }); + } else { + result.directives.push({ + parentComment, + type, + line: commentToken.loc.start.line, + column: commentToken.loc.start.column + 1, + ruleId, + justification + }); + } + } else { + result.directiveProblems.push(createLintingProblem({ ruleId, loc: commentToken.loc })); + } + } + return result; +} + +/** + * Extract the directive and the justification from a given directive comment and trim them. + * @param {string} value The comment text to extract. + * @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification. + */ +function extractDirectiveComment(value) { + const match = /\s-{2,}\s/u.exec(value); + + if (!match) { + return { directivePart: value.trim(), justificationPart: "" }; + } + + const directive = value.slice(0, match.index).trim(); + const justification = value.slice(match.index + match[0].length).trim(); + + return { directivePart: directive, justificationPart: justification }; +} + +/** + * Parses comments in file to extract file-specific config of rules, globals + * and environments and merges them with global config; also code blocks + * where reporting is disabled or enabled and merges them with reporting config. + * @param {ASTNode} ast The top node of the AST. + * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules + * @param {string|null} warnInlineConfig If a string then it should warn directive comments as disabled. The string value is the config name what the setting came from. + * @returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: Problem[], disableDirectives: DisableDirective[]}} + * A collection of the directive comments that were found, along with any problems that occurred when parsing + */ +function getDirectiveComments(ast, ruleMapper, warnInlineConfig) { + const configuredRules = {}; + const enabledGlobals = Object.create(null); + const exportedVariables = {}; + const problems = []; + const disableDirectives = []; + const validator = new ConfigValidator({ + builtInRules: Rules + }); + + ast.comments.filter(token => token.type !== "Shebang").forEach(comment => { + const { directivePart, justificationPart } = extractDirectiveComment(comment.value); + + const match = /^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u.exec(directivePart); + + if (!match) { + return; + } + const directiveText = match[1]; + const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(directiveText); + + if (comment.type === "Line" && !lineCommentSupported) { + return; + } + + if (warnInlineConfig) { + const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`; + + problems.push(createLintingProblem({ + ruleId: null, + message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`, + loc: comment.loc, + severity: 1 + })); + return; + } + + if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) { + const message = `${directiveText} comment should not span multiple lines.`; + + problems.push(createLintingProblem({ + ruleId: null, + message, + loc: comment.loc + })); + return; + } + + const directiveValue = directivePart.slice(match.index + directiveText.length); + + switch (directiveText) { + case "eslint-disable": + case "eslint-enable": + case "eslint-disable-next-line": + case "eslint-disable-line": { + const directiveType = directiveText.slice("eslint-".length); + const options = { commentToken: comment, type: directiveType, value: directiveValue, justification: justificationPart, ruleMapper }; + const { directives, directiveProblems } = createDisableDirectives(options); + + disableDirectives.push(...directives); + problems.push(...directiveProblems); + break; + } + + case "exported": + Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); + break; + + case "globals": + case "global": + for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { + let normalizedValue; + + try { + normalizedValue = ConfigOps.normalizeConfigGlobal(value); + } catch (err) { + problems.push(createLintingProblem({ + ruleId: null, + loc: comment.loc, + message: err.message + })); + continue; + } + + if (enabledGlobals[id]) { + enabledGlobals[id].comments.push(comment); + enabledGlobals[id].value = normalizedValue; + } else { + enabledGlobals[id] = { + comments: [comment], + value: normalizedValue + }; + } + } + break; + + case "eslint": { + const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); + + if (parseResult.success) { + Object.keys(parseResult.config).forEach(name => { + const rule = ruleMapper(name); + const ruleValue = parseResult.config[name]; + + if (!rule) { + problems.push(createLintingProblem({ ruleId: name, loc: comment.loc })); + return; + } + + try { + validator.validateRuleOptions(rule, name, ruleValue); + } catch (err) { + problems.push(createLintingProblem({ + ruleId: name, + message: err.message, + loc: comment.loc + })); + + // do not apply the config, if found invalid options. + return; + } + + configuredRules[name] = ruleValue; + }); + } else { + problems.push(parseResult.error); + } + + break; + } + + // no default + } + }); + + return { + configuredRules, + enabledGlobals, + exportedVariables, + problems, + disableDirectives + }; +} + +/** + * Normalize ECMAScript version from the initial config + * @param {Parser} parser The parser which uses this options. + * @param {number} ecmaVersion ECMAScript version from the initial config + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersion(parser, ecmaVersion) { + + if (isEspree(parser)) { + if (ecmaVersion === "latest") { + return espree.latestEcmaVersion; + } + } + + /* + * Calculate ECMAScript edition number from official year version starting with + * ES2015, which corresponds with ES6 (or a difference of 2009). + */ + return ecmaVersion >= 2015 ? ecmaVersion - 2009 : ecmaVersion; +} + +/** + * Normalize ECMAScript version from the initial config into languageOptions (year) + * format. + * @param {any} [ecmaVersion] ECMAScript version from the initial config + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersionForLanguageOptions(ecmaVersion) { + + switch (ecmaVersion) { + case 3: + return 3; + + // void 0 = no ecmaVersion specified so use the default + case 5: + case void 0: + return 5; + + default: + if (typeof ecmaVersion === "number") { + return ecmaVersion >= 2015 ? ecmaVersion : ecmaVersion + 2009; + } + } + + /* + * We default to the latest supported ecmaVersion for everything else. + * Remember, this is for languageOptions.ecmaVersion, which sets the version + * that is used for a number of processes inside of ESLint. It's normally + * safe to assume people want the latest unless otherwise specified. + */ + return espree.latestEcmaVersion + 2009; +} + +const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)(?:\*\/|$)/gsu; + +/** + * Checks whether or not there is a comment which has "eslint-env *" in a given text. + * @param {string} text A source code text to check. + * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment. + */ +function findEslintEnv(text) { + let match, retv; + + eslintEnvPattern.lastIndex = 0; + + while ((match = eslintEnvPattern.exec(text)) !== null) { + if (match[0].endsWith("*/")) { + retv = Object.assign( + retv || {}, + commentParser.parseListConfig(extractDirectiveComment(match[1]).directivePart) + ); + } + } + + return retv; +} + +/** + * Convert "/path/to/" to "". + * `CLIEngine#executeOnText()` method gives "/path/to/" if the filename + * was omitted because `configArray.extractConfig()` requires an absolute path. + * But the linter should pass `` to `RuleContext#getFilename()` in that + * case. + * Also, code blocks can have their virtual filename. If the parent filename was + * ``, the virtual filename is `/0_foo.js` or something like (i.e., + * it's not an absolute path). + * @param {string} filename The filename to normalize. + * @returns {string} The normalized filename. + */ +function normalizeFilename(filename) { + const parts = filename.split(path.sep); + const index = parts.lastIndexOf(""); + + return index === -1 ? filename : parts.slice(index).join(path.sep); +} + +/** + * Normalizes the possible options for `linter.verify` and `linter.verifyAndFix` to a + * consistent shape. + * @param {VerifyOptions} providedOptions Options + * @param {ConfigData} config Config. + * @returns {Required & InternalOptions} Normalized options + */ +function normalizeVerifyOptions(providedOptions, config) { + + const linterOptions = config.linterOptions || config; + + // .noInlineConfig for eslintrc, .linterOptions.noInlineConfig for flat + const disableInlineConfig = linterOptions.noInlineConfig === true; + const ignoreInlineConfig = providedOptions.allowInlineConfig === false; + const configNameOfNoInlineConfig = config.configNameOfNoInlineConfig + ? ` (${config.configNameOfNoInlineConfig})` + : ""; + + let reportUnusedDisableDirectives = providedOptions.reportUnusedDisableDirectives; + + if (typeof reportUnusedDisableDirectives === "boolean") { + reportUnusedDisableDirectives = reportUnusedDisableDirectives ? "error" : "off"; + } + if (typeof reportUnusedDisableDirectives !== "string") { + reportUnusedDisableDirectives = + linterOptions.reportUnusedDisableDirectives + ? "warn" : "off"; + } + + return { + filename: normalizeFilename(providedOptions.filename || ""), + allowInlineConfig: !ignoreInlineConfig, + warnInlineConfig: disableInlineConfig && !ignoreInlineConfig + ? `your config${configNameOfNoInlineConfig}` + : null, + reportUnusedDisableDirectives, + disableFixes: Boolean(providedOptions.disableFixes) + }; +} + +/** + * Combines the provided parserOptions with the options from environments + * @param {Parser} parser The parser which uses this options. + * @param {ParserOptions} providedOptions The provided 'parserOptions' key in a config + * @param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments + * @returns {ParserOptions} Resulting parser options after merge + */ +function resolveParserOptions(parser, providedOptions, enabledEnvironments) { + + const parserOptionsFromEnv = enabledEnvironments + .filter(env => env.parserOptions) + .reduce((parserOptions, env) => merge(parserOptions, env.parserOptions), {}); + const mergedParserOptions = merge(parserOptionsFromEnv, providedOptions || {}); + const isModule = mergedParserOptions.sourceType === "module"; + + if (isModule) { + + /* + * can't have global return inside of modules + * TODO: espree validate parserOptions.globalReturn when sourceType is setting to module.(@aladdin-add) + */ + mergedParserOptions.ecmaFeatures = Object.assign({}, mergedParserOptions.ecmaFeatures, { globalReturn: false }); + } + + mergedParserOptions.ecmaVersion = normalizeEcmaVersion(parser, mergedParserOptions.ecmaVersion); + + return mergedParserOptions; +} + +/** + * Converts parserOptions to languageOptions for backwards compatibility with eslintrc. + * @param {ConfigData} config Config object. + * @param {Object} config.globals Global variable definitions. + * @param {Parser} config.parser The parser to use. + * @param {ParserOptions} config.parserOptions The parserOptions to use. + * @returns {LanguageOptions} The languageOptions equivalent. + */ +function createLanguageOptions({ globals: configuredGlobals, parser, parserOptions }) { + + const { + ecmaVersion, + sourceType + } = parserOptions; + + return { + globals: configuredGlobals, + ecmaVersion: normalizeEcmaVersionForLanguageOptions(ecmaVersion), + sourceType, + parser, + parserOptions + }; +} + +/** + * Combines the provided globals object with the globals from environments + * @param {Record} providedGlobals The 'globals' key in a config + * @param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments + * @returns {Record} The resolved globals object + */ +function resolveGlobals(providedGlobals, enabledEnvironments) { + return Object.assign( + {}, + ...enabledEnvironments.filter(env => env.globals).map(env => env.globals), + providedGlobals + ); +} + +/** + * Strips Unicode BOM from a given text. + * @param {string} text A text to strip. + * @returns {string} The stripped text. + */ +function stripUnicodeBOM(text) { + + /* + * Check Unicode BOM. + * In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF. + * http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters + */ + if (text.charCodeAt(0) === 0xFEFF) { + return text.slice(1); + } + return text; +} + +/** + * Get the options for a rule (not including severity), if any + * @param {Array|number} ruleConfig rule configuration + * @returns {Array} of rule options, empty Array if none + */ +function getRuleOptions(ruleConfig) { + if (Array.isArray(ruleConfig)) { + return ruleConfig.slice(1); + } + return []; + +} + +/** + * Analyze scope of the given AST. + * @param {ASTNode} ast The `Program` node to analyze. + * @param {LanguageOptions} languageOptions The parser options. + * @param {Record} visitorKeys The visitor keys. + * @returns {ScopeManager} The analysis result. + */ +function analyzeScope(ast, languageOptions, visitorKeys) { + const parserOptions = languageOptions.parserOptions; + const ecmaFeatures = parserOptions.ecmaFeatures || {}; + const ecmaVersion = languageOptions.ecmaVersion || DEFAULT_ECMA_VERSION; + + return eslintScope.analyze(ast, { + ignoreEval: true, + nodejsScope: ecmaFeatures.globalReturn, + impliedStrict: ecmaFeatures.impliedStrict, + ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6, + sourceType: languageOptions.sourceType || "script", + childVisitorKeys: visitorKeys || evk.KEYS, + fallback: Traverser.getKeys + }); +} + +/** + * Parses text into an AST. Moved out here because the try-catch prevents + * optimization of functions, so it's best to keep the try-catch as isolated + * as possible + * @param {string} text The text to parse. + * @param {LanguageOptions} languageOptions Options to pass to the parser + * @param {string} filePath The path to the file being parsed. + * @returns {{success: false, error: Problem}|{success: true, sourceCode: SourceCode}} + * An object containing the AST and parser services if parsing was successful, or the error if parsing failed + * @private + */ +function parse(text, languageOptions, filePath) { + const textToParse = stripUnicodeBOM(text).replace(astUtils.shebangPattern, (match, captured) => `//${captured}`); + const { ecmaVersion, sourceType, parser } = languageOptions; + const parserOptions = Object.assign( + { ecmaVersion, sourceType }, + languageOptions.parserOptions, + { + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + eslintVisitorKeys: true, + eslintScopeManager: true, + filePath + } + ); + + /* + * Check for parsing errors first. If there's a parsing error, nothing + * else can happen. However, a parsing error does not throw an error + * from this method - it's just considered a fatal error message, a + * problem that ESLint identified just like any other. + */ + try { + debug("Parsing:", filePath); + const parseResult = (typeof parser.parseForESLint === "function") + ? parser.parseForESLint(textToParse, parserOptions) + : { ast: parser.parse(textToParse, parserOptions) }; + + debug("Parsing successful:", filePath); + const ast = parseResult.ast; + const parserServices = parseResult.services || {}; + const visitorKeys = parseResult.visitorKeys || evk.KEYS; + + debug("Scope analysis:", filePath); + const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys); + + debug("Scope analysis successful:", filePath); + + return { + success: true, + + /* + * Save all values that `parseForESLint()` returned. + * If a `SourceCode` object is given as the first parameter instead of source code text, + * linter skips the parsing process and reuses the source code object. + * In that case, linter needs all the values that `parseForESLint()` returned. + */ + sourceCode: new SourceCode({ + text, + ast, + parserServices, + scopeManager, + visitorKeys + }) + }; + } catch (ex) { + + // If the message includes a leading line number, strip it: + const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; + + debug("%s\n%s", message, ex.stack); + + return { + success: false, + error: { + ruleId: null, + fatal: true, + severity: 2, + message, + line: ex.lineNumber, + column: ex.column + } + }; + } +} + +/** + * Gets the scope for the current node + * @param {ScopeManager} scopeManager The scope manager for this AST + * @param {ASTNode} currentNode The node to get the scope of + * @returns {eslint-scope.Scope} The scope information for this node + */ +function getScope(scopeManager, currentNode) { + + // On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope. + const inner = currentNode.type !== "Program"; + + for (let node = currentNode; node; node = node.parent) { + const scope = scopeManager.acquire(node, inner); + + if (scope) { + if (scope.type === "function-expression-name") { + return scope.childScopes[0]; + } + return scope; + } + } + + return scopeManager.scopes[0]; +} + +/** + * Marks a variable as used in the current scope + * @param {ScopeManager} scopeManager The scope manager for this AST. The scope may be mutated by this function. + * @param {ASTNode} currentNode The node currently being traversed + * @param {LanguageOptions} languageOptions The options used to parse this text + * @param {string} name The name of the variable that should be marked as used. + * @returns {boolean} True if the variable was found and marked as used, false if not. + */ +function markVariableAsUsed(scopeManager, currentNode, languageOptions, name) { + const parserOptions = languageOptions.parserOptions; + const sourceType = languageOptions.sourceType; + const hasGlobalReturn = + (parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn) || + sourceType === "commonjs"; + const specialScope = hasGlobalReturn || sourceType === "module"; + const currentScope = getScope(scopeManager, currentNode); + + // Special Node.js scope means we need to start one level deeper + const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope; + + for (let scope = initialScope; scope; scope = scope.upper) { + const variable = scope.variables.find(scopeVar => scopeVar.name === name); + + if (variable) { + variable.eslintUsed = true; + return true; + } + } + + return false; +} + +/** + * Runs a rule, and gets its listeners + * @param {Rule} rule A normalized rule with a `create` method + * @param {Context} ruleContext The context that should be passed to the rule + * @throws {any} Any error during the rule's `create` + * @returns {Object} A map of selector listeners provided by the rule + */ +function createRuleListeners(rule, ruleContext) { + try { + return rule.create(ruleContext); + } catch (ex) { + ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`; + throw ex; + } +} + +/** + * Gets all the ancestors of a given node + * @param {ASTNode} node The node + * @returns {ASTNode[]} All the ancestor nodes in the AST, not including the provided node, starting + * from the root node and going inwards to the parent node. + */ +function getAncestors(node) { + const ancestorsStartingAtParent = []; + + for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + ancestorsStartingAtParent.push(ancestor); + } + + return ancestorsStartingAtParent.reverse(); +} + +// methods that exist on SourceCode object +const DEPRECATED_SOURCECODE_PASSTHROUGHS = { + getSource: "getText", + getSourceLines: "getLines", + getAllComments: "getAllComments", + getNodeByRangeIndex: "getNodeByRangeIndex", + getComments: "getComments", + getCommentsBefore: "getCommentsBefore", + getCommentsAfter: "getCommentsAfter", + getCommentsInside: "getCommentsInside", + getJSDocComment: "getJSDocComment", + getFirstToken: "getFirstToken", + getFirstTokens: "getFirstTokens", + getLastToken: "getLastToken", + getLastTokens: "getLastTokens", + getTokenAfter: "getTokenAfter", + getTokenBefore: "getTokenBefore", + getTokenByRangeStart: "getTokenByRangeStart", + getTokens: "getTokens", + getTokensAfter: "getTokensAfter", + getTokensBefore: "getTokensBefore", + getTokensBetween: "getTokensBetween" +}; + +const BASE_TRAVERSAL_CONTEXT = Object.freeze( + Object.keys(DEPRECATED_SOURCECODE_PASSTHROUGHS).reduce( + (contextInfo, methodName) => + Object.assign(contextInfo, { + [methodName](...args) { + return this.getSourceCode()[DEPRECATED_SOURCECODE_PASSTHROUGHS[methodName]](...args); + } + }), + {} + ) +); + +/** + * Runs the given rules on the given SourceCode object + * @param {SourceCode} sourceCode A SourceCode object for the given text + * @param {Object} configuredRules The rules configuration + * @param {function(string): Rule} ruleMapper A mapper function from rule names to rules + * @param {string | undefined} parserName The name of the parser in the config + * @param {LanguageOptions} languageOptions The options for parsing the code. + * @param {Object} settings The settings that were enabled in the config + * @param {string} filename The reported filename of the code + * @param {boolean} disableFixes If true, it doesn't make `fix` properties. + * @param {string | undefined} cwd cwd of the cli + * @param {string} physicalFilename The full path of the file on disk without any code block information + * @returns {Problem[]} An array of reported problems + */ +function runRules(sourceCode, configuredRules, ruleMapper, parserName, languageOptions, settings, filename, disableFixes, cwd, physicalFilename) { + const emitter = createEmitter(); + const nodeQueue = []; + let currentNode = sourceCode.ast; + + Traverser.traverse(sourceCode.ast, { + enter(node, parent) { + node.parent = parent; + nodeQueue.push({ isEntering: true, node }); + }, + leave(node) { + nodeQueue.push({ isEntering: false, node }); + }, + visitorKeys: sourceCode.visitorKeys + }); + + /* + * Create a frozen object with the ruleContext properties and methods that are shared by all rules. + * All rule contexts will inherit from this object. This avoids the performance penalty of copying all the + * properties once for each rule. + */ + const sharedTraversalContext = Object.freeze( + Object.assign( + Object.create(BASE_TRAVERSAL_CONTEXT), + { + getAncestors: () => getAncestors(currentNode), + getDeclaredVariables: sourceCode.scopeManager.getDeclaredVariables.bind(sourceCode.scopeManager), + getCwd: () => cwd, + getFilename: () => filename, + getPhysicalFilename: () => physicalFilename || filename, + getScope: () => getScope(sourceCode.scopeManager, currentNode), + getSourceCode: () => sourceCode, + markVariableAsUsed: name => markVariableAsUsed(sourceCode.scopeManager, currentNode, languageOptions, name), + parserOptions: { + ...languageOptions.parserOptions + }, + parserPath: parserName, + languageOptions, + parserServices: sourceCode.parserServices, + settings + } + ) + ); + + const lintingProblems = []; + + Object.keys(configuredRules).forEach(ruleId => { + const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]); + + // not load disabled rules + if (severity === 0) { + return; + } + + const rule = ruleMapper(ruleId); + + if (!rule) { + lintingProblems.push(createLintingProblem({ ruleId })); + return; + } + + const messageIds = rule.meta && rule.meta.messages; + let reportTranslator = null; + const ruleContext = Object.freeze( + Object.assign( + Object.create(sharedTraversalContext), + { + id: ruleId, + options: getRuleOptions(configuredRules[ruleId]), + report(...args) { + + /* + * Create a report translator lazily. + * In a vast majority of cases, any given rule reports zero errors on a given + * piece of code. Creating a translator lazily avoids the performance cost of + * creating a new translator function for each rule that usually doesn't get + * called. + * + * Using lazy report translators improves end-to-end performance by about 3% + * with Node 8.4.0. + */ + if (reportTranslator === null) { + reportTranslator = createReportTranslator({ + ruleId, + severity, + sourceCode, + messageIds, + disableFixes + }); + } + const problem = reportTranslator(...args); + + if (problem.fix && !(rule.meta && rule.meta.fixable)) { + throw new Error("Fixable rules must set the `meta.fixable` property to \"code\" or \"whitespace\"."); + } + if (problem.suggestions && !(rule.meta && rule.meta.hasSuggestions === true)) { + if (rule.meta && rule.meta.docs && typeof rule.meta.docs.suggestion !== "undefined") { + + // Encourage migration from the former property name. + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`. `meta.docs.suggestion` is ignored by ESLint."); + } + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); + } + lintingProblems.push(problem); + } + } + ) + ); + + const ruleListeners = timing.enabled ? timing.time(ruleId, createRuleListeners)(rule, ruleContext) : createRuleListeners(rule, ruleContext); + + /** + * Include `ruleId` in error logs + * @param {Function} ruleListener A rule method that listens for a node. + * @returns {Function} ruleListener wrapped in error handler + */ + function addRuleErrorHandler(ruleListener) { + return function ruleErrorHandler(...listenerArgs) { + try { + return ruleListener(...listenerArgs); + } catch (e) { + e.ruleId = ruleId; + throw e; + } + }; + } + + // add all the selectors from the rule as listeners + Object.keys(ruleListeners).forEach(selector => { + const ruleListener = timing.enabled + ? timing.time(ruleId, ruleListeners[selector]) + : ruleListeners[selector]; + + emitter.on( + selector, + addRuleErrorHandler(ruleListener) + ); + }); + }); + + // only run code path analyzer if the top level node is "Program", skip otherwise + const eventGenerator = nodeQueue[0].node.type === "Program" + ? new CodePathAnalyzer(new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys })) + : new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys }); + + nodeQueue.forEach(traversalInfo => { + currentNode = traversalInfo.node; + + try { + if (traversalInfo.isEntering) { + eventGenerator.enterNode(currentNode); + } else { + eventGenerator.leaveNode(currentNode); + } + } catch (err) { + err.currentNode = currentNode; + throw err; + } + }); + + return lintingProblems; +} + +/** + * Ensure the source code to be a string. + * @param {string|SourceCode} textOrSourceCode The text or source code object. + * @returns {string} The source code text. + */ +function ensureText(textOrSourceCode) { + if (typeof textOrSourceCode === "object") { + const { hasBOM, text } = textOrSourceCode; + const bom = hasBOM ? "\uFEFF" : ""; + + return bom + text; + } + + return String(textOrSourceCode); +} + +/** + * Get an environment. + * @param {LinterInternalSlots} slots The internal slots of Linter. + * @param {string} envId The environment ID to get. + * @returns {Environment|null} The environment. + */ +function getEnv(slots, envId) { + return ( + (slots.lastConfigArray && slots.lastConfigArray.pluginEnvironments.get(envId)) || + BuiltInEnvironments.get(envId) || + null + ); +} + +/** + * Get a rule. + * @param {LinterInternalSlots} slots The internal slots of Linter. + * @param {string} ruleId The rule ID to get. + * @returns {Rule|null} The rule. + */ +function getRule(slots, ruleId) { + return ( + (slots.lastConfigArray && slots.lastConfigArray.pluginRules.get(ruleId)) || + slots.ruleMap.get(ruleId) + ); +} + +/** + * Normalize the value of the cwd + * @param {string | undefined} cwd raw value of the cwd, path to a directory that should be considered as the current working directory, can be undefined. + * @returns {string | undefined} normalized cwd + */ +function normalizeCwd(cwd) { + if (cwd) { + return cwd; + } + if (typeof process === "object") { + return process.cwd(); + } + + // It's more explicit to assign the undefined + // eslint-disable-next-line no-undefined -- Consistently returning a value + return undefined; +} + +/** + * The map to store private data. + * @type {WeakMap} + */ +const internalSlotsMap = new WeakMap(); + +/** + * Throws an error when the given linter is in flat config mode. + * @param {Linter} linter The linter to check. + * @returns {void} + * @throws {Error} If the linter is in flat config mode. + */ +function assertEslintrcConfig(linter) { + const { configType } = internalSlotsMap.get(linter); + + if (configType === "flat") { + throw new Error("This method cannot be used with flat config. Add your entries directly into the config array."); + } +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Object that is responsible for verifying JavaScript text + * @name Linter + */ +class Linter { + + /** + * Initialize the Linter. + * @param {Object} [config] the config object + * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. + * @param {"flat"|"eslintrc"} [config.configType="eslintrc"] the type of config used. + */ + constructor({ cwd, configType } = {}) { + internalSlotsMap.set(this, { + cwd: normalizeCwd(cwd), + lastConfigArray: null, + lastSourceCode: null, + lastSuppressedMessages: [], + configType, // TODO: Remove after flat config conversion + parserMap: new Map([["espree", espree]]), + ruleMap: new Rules() + }); + + this.version = pkg.version; + } + + /** + * Getter for package version. + * @static + * @returns {string} The version from package.json. + */ + static get version() { + return pkg.version; + } + + /** + * Same as linter.verify, except without support for processors. + * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. + * @param {ConfigData} providedConfig An ESLintConfig instance to configure everything. + * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. + * @throws {Error} If during rule execution. + * @returns {(LintMessage|SuppressedLintMessage)[]} The results as an array of messages or an empty array if no messages. + */ + _verifyWithoutProcessors(textOrSourceCode, providedConfig, providedOptions) { + const slots = internalSlotsMap.get(this); + const config = providedConfig || {}; + const options = normalizeVerifyOptions(providedOptions, config); + let text; + + // evaluate arguments + if (typeof textOrSourceCode === "string") { + slots.lastSourceCode = null; + text = textOrSourceCode; + } else { + slots.lastSourceCode = textOrSourceCode; + text = textOrSourceCode.text; + } + + // Resolve parser. + let parserName = DEFAULT_PARSER_NAME; + let parser = espree; + + if (typeof config.parser === "object" && config.parser !== null) { + parserName = config.parser.filePath; + parser = config.parser.definition; + } else if (typeof config.parser === "string") { + if (!slots.parserMap.has(config.parser)) { + return [{ + ruleId: null, + fatal: true, + severity: 2, + message: `Configured parser '${config.parser}' was not found.`, + line: 0, + column: 0 + }]; + } + parserName = config.parser; + parser = slots.parserMap.get(config.parser); + } + + // search and apply "eslint-env *". + const envInFile = options.allowInlineConfig && !options.warnInlineConfig + ? findEslintEnv(text) + : {}; + const resolvedEnvConfig = Object.assign({ builtin: true }, config.env, envInFile); + const enabledEnvs = Object.keys(resolvedEnvConfig) + .filter(envName => resolvedEnvConfig[envName]) + .map(envName => getEnv(slots, envName)) + .filter(env => env); + + const parserOptions = resolveParserOptions(parser, config.parserOptions || {}, enabledEnvs); + const configuredGlobals = resolveGlobals(config.globals || {}, enabledEnvs); + const settings = config.settings || {}; + const languageOptions = createLanguageOptions({ + globals: config.globals, + parser, + parserOptions + }); + + if (!slots.lastSourceCode) { + const parseResult = parse( + text, + languageOptions, + options.filename + ); + + if (!parseResult.success) { + return [parseResult.error]; + } + + slots.lastSourceCode = parseResult.sourceCode; + } else { + + /* + * If the given source code object as the first argument does not have scopeManager, analyze the scope. + * This is for backward compatibility (SourceCode is frozen so it cannot rebind). + */ + if (!slots.lastSourceCode.scopeManager) { + slots.lastSourceCode = new SourceCode({ + text: slots.lastSourceCode.text, + ast: slots.lastSourceCode.ast, + parserServices: slots.lastSourceCode.parserServices, + visitorKeys: slots.lastSourceCode.visitorKeys, + scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) + }); + } + } + + const sourceCode = slots.lastSourceCode; + const commentDirectives = options.allowInlineConfig + ? getDirectiveComments(sourceCode.ast, ruleId => getRule(slots, ruleId), options.warnInlineConfig) + : { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] }; + + // augment global scope with declared global variables + addDeclaredGlobals( + sourceCode.scopeManager.scopes[0], + configuredGlobals, + { exportedVariables: commentDirectives.exportedVariables, enabledGlobals: commentDirectives.enabledGlobals } + ); + + const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules); + + let lintingProblems; + + try { + lintingProblems = runRules( + sourceCode, + configuredRules, + ruleId => getRule(slots, ruleId), + parserName, + languageOptions, + settings, + options.filename, + options.disableFixes, + slots.cwd, + providedOptions.physicalFilename + ); + } catch (err) { + err.message += `\nOccurred while linting ${options.filename}`; + debug("An error occurred while traversing"); + debug("Filename:", options.filename); + if (err.currentNode) { + const { line } = err.currentNode.loc.start; + + debug("Line:", line); + err.message += `:${line}`; + } + debug("Parser Options:", parserOptions); + debug("Parser Path:", parserName); + debug("Settings:", settings); + + if (err.ruleId) { + err.message += `\nRule: "${err.ruleId}"`; + } + + throw err; + } + + return applyDisableDirectives({ + directives: commentDirectives.disableDirectives, + disableFixes: options.disableFixes, + problems: lintingProblems + .concat(commentDirectives.problems) + .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), + reportUnusedDisableDirectives: options.reportUnusedDisableDirectives + }); + } + + /** + * Verifies the text against the rules specified by the second argument. + * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. + * @param {ConfigData|ConfigArray} config An ESLintConfig instance to configure everything. + * @param {(string|(VerifyOptions&ProcessorOptions))} [filenameOrOptions] The optional filename of the file being checked. + * If this is not set, the filename will default to '' in the rule context. If + * an object, then it has "filename", "allowInlineConfig", and some properties. + * @returns {LintMessage[]} The results as an array of messages or an empty array if no messages. + */ + verify(textOrSourceCode, config, filenameOrOptions) { + debug("Verify"); + + const { configType } = internalSlotsMap.get(this); + + const options = typeof filenameOrOptions === "string" + ? { filename: filenameOrOptions } + : filenameOrOptions || {}; + + if (config) { + if (configType === "flat") { + + /* + * Because of how Webpack packages up the files, we can't + * compare directly to `FlatConfigArray` using `instanceof` + * because it's not the same `FlatConfigArray` as in the tests. + * So, we work around it by assuming an array is, in fact, a + * `FlatConfigArray` if it has a `getConfig()` method. + */ + let configArray = config; + + if (!Array.isArray(config) || typeof config.getConfig !== "function") { + configArray = new FlatConfigArray(config); + configArray.normalizeSync(); + } + + return this._distinguishSuppressedMessages(this._verifyWithFlatConfigArray(textOrSourceCode, configArray, options, true)); + } + + if (typeof config.extractConfig === "function") { + return this._distinguishSuppressedMessages(this._verifyWithConfigArray(textOrSourceCode, config, options)); + } + } + + /* + * If we get to here, it means `config` is just an object rather + * than a config array so we can go right into linting. + */ + + /* + * `Linter` doesn't support `overrides` property in configuration. + * So we cannot apply multiple processors. + */ + if (options.preprocess || options.postprocess) { + return this._distinguishSuppressedMessages(this._verifyWithProcessor(textOrSourceCode, config, options)); + } + return this._distinguishSuppressedMessages(this._verifyWithoutProcessors(textOrSourceCode, config, options)); + } + + /** + * Verify with a processor. + * @param {string|SourceCode} textOrSourceCode The source code. + * @param {FlatConfig} config The config array. + * @param {VerifyOptions&ProcessorOptions} options The options. + * @param {FlatConfigArray} [configForRecursive] The `ConfigArray` object to apply multiple processors recursively. + * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. + */ + _verifyWithFlatConfigArrayAndProcessor(textOrSourceCode, config, options, configForRecursive) { + const filename = options.filename || ""; + const filenameToExpose = normalizeFilename(filename); + const physicalFilename = options.physicalFilename || filenameToExpose; + const text = ensureText(textOrSourceCode); + const preprocess = options.preprocess || (rawText => [rawText]); + const postprocess = options.postprocess || (messagesList => messagesList.flat()); + const filterCodeBlock = + options.filterCodeBlock || + (blockFilename => blockFilename.endsWith(".js")); + const originalExtname = path.extname(filename); + const messageLists = preprocess(text, filenameToExpose).map((block, i) => { + debug("A code block was found: %o", block.filename || "(unnamed)"); + + // Keep the legacy behavior. + if (typeof block === "string") { + return this._verifyWithFlatConfigArrayAndWithoutProcessors(block, config, options); + } + + const blockText = block.text; + const blockName = path.join(filename, `${i}_${block.filename}`); + + // Skip this block if filtered. + if (!filterCodeBlock(blockName, blockText)) { + debug("This code block was skipped."); + return []; + } + + // Resolve configuration again if the file content or extension was changed. + if (configForRecursive && (text !== blockText || path.extname(blockName) !== originalExtname)) { + debug("Resolving configuration again because the file content or extension was changed."); + return this._verifyWithFlatConfigArray( + blockText, + configForRecursive, + { ...options, filename: blockName, physicalFilename } + ); + } + + // Does lint. + return this._verifyWithFlatConfigArrayAndWithoutProcessors( + blockText, + config, + { ...options, filename: blockName, physicalFilename } + ); + }); + + return postprocess(messageLists, filenameToExpose); + } + + /** + * Same as linter.verify, except without support for processors. + * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. + * @param {FlatConfig} providedConfig An ESLintConfig instance to configure everything. + * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. + * @throws {Error} If during rule execution. + * @returns {(LintMessage|SuppressedLintMessage)[]} The results as an array of messages or an empty array if no messages. + */ + _verifyWithFlatConfigArrayAndWithoutProcessors(textOrSourceCode, providedConfig, providedOptions) { + const slots = internalSlotsMap.get(this); + const config = providedConfig || {}; + const options = normalizeVerifyOptions(providedOptions, config); + let text; + + // evaluate arguments + if (typeof textOrSourceCode === "string") { + slots.lastSourceCode = null; + text = textOrSourceCode; + } else { + slots.lastSourceCode = textOrSourceCode; + text = textOrSourceCode.text; + } + + const languageOptions = config.languageOptions; + + languageOptions.ecmaVersion = normalizeEcmaVersionForLanguageOptions( + languageOptions.ecmaVersion + ); + + // add configured globals and language globals + const configuredGlobals = { + ...(getGlobalsForEcmaVersion(languageOptions.ecmaVersion)), + ...(languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0), + ...languageOptions.globals + }; + + // Espree expects this information to be passed in + if (isEspree(languageOptions.parser)) { + const parserOptions = languageOptions.parserOptions; + + if (languageOptions.sourceType) { + + parserOptions.sourceType = languageOptions.sourceType; + + if ( + parserOptions.sourceType === "module" && + parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn + ) { + parserOptions.ecmaFeatures.globalReturn = false; + } + } + } + + const settings = config.settings || {}; + + if (!slots.lastSourceCode) { + const parseResult = parse( + text, + languageOptions, + options.filename + ); + + if (!parseResult.success) { + return [parseResult.error]; + } + + slots.lastSourceCode = parseResult.sourceCode; + } else { + + /* + * If the given source code object as the first argument does not have scopeManager, analyze the scope. + * This is for backward compatibility (SourceCode is frozen so it cannot rebind). + */ + if (!slots.lastSourceCode.scopeManager) { + slots.lastSourceCode = new SourceCode({ + text: slots.lastSourceCode.text, + ast: slots.lastSourceCode.ast, + parserServices: slots.lastSourceCode.parserServices, + visitorKeys: slots.lastSourceCode.visitorKeys, + scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) + }); + } + } + + const sourceCode = slots.lastSourceCode; + const commentDirectives = options.allowInlineConfig + ? getDirectiveComments( + sourceCode.ast, + ruleId => getRuleFromConfig(ruleId, config), + options.warnInlineConfig + ) + : { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] }; + + // augment global scope with declared global variables + addDeclaredGlobals( + sourceCode.scopeManager.scopes[0], + configuredGlobals, + { exportedVariables: commentDirectives.exportedVariables, enabledGlobals: commentDirectives.enabledGlobals } + ); + + const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules); + + let lintingProblems; + + try { + lintingProblems = runRules( + sourceCode, + configuredRules, + ruleId => getRuleFromConfig(ruleId, config), + void 0, + languageOptions, + settings, + options.filename, + options.disableFixes, + slots.cwd, + providedOptions.physicalFilename + ); + } catch (err) { + err.message += `\nOccurred while linting ${options.filename}`; + debug("An error occurred while traversing"); + debug("Filename:", options.filename); + if (err.currentNode) { + const { line } = err.currentNode.loc.start; + + debug("Line:", line); + err.message += `:${line}`; + } + debug("Parser Options:", languageOptions.parserOptions); + + // debug("Parser Path:", parserName); + debug("Settings:", settings); + + if (err.ruleId) { + err.message += `\nRule: "${err.ruleId}"`; + } + + throw err; + } + + return applyDisableDirectives({ + directives: commentDirectives.disableDirectives, + disableFixes: options.disableFixes, + problems: lintingProblems + .concat(commentDirectives.problems) + .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), + reportUnusedDisableDirectives: options.reportUnusedDisableDirectives + }); + } + + /** + * Verify a given code with `ConfigArray`. + * @param {string|SourceCode} textOrSourceCode The source code. + * @param {ConfigArray} configArray The config array. + * @param {VerifyOptions&ProcessorOptions} options The options. + * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. + */ + _verifyWithConfigArray(textOrSourceCode, configArray, options) { + debug("With ConfigArray: %s", options.filename); + + // Store the config array in order to get plugin envs and rules later. + internalSlotsMap.get(this).lastConfigArray = configArray; + + // Extract the final config for this file. + const config = configArray.extractConfig(options.filename); + const processor = + config.processor && + configArray.pluginProcessors.get(config.processor); + + // Verify. + if (processor) { + debug("Apply the processor: %o", config.processor); + const { preprocess, postprocess, supportsAutofix } = processor; + const disableFixes = options.disableFixes || !supportsAutofix; + + return this._verifyWithProcessor( + textOrSourceCode, + config, + { ...options, disableFixes, postprocess, preprocess }, + configArray + ); + } + return this._verifyWithoutProcessors(textOrSourceCode, config, options); + } + + /** + * Verify a given code with a flat config. + * @param {string|SourceCode} textOrSourceCode The source code. + * @param {FlatConfigArray} configArray The config array. + * @param {VerifyOptions&ProcessorOptions} options The options. + * @param {boolean} [firstCall=false] Indicates if this is being called directly + * from verify(). (TODO: Remove once eslintrc is removed.) + * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. + */ + _verifyWithFlatConfigArray(textOrSourceCode, configArray, options, firstCall = false) { + debug("With flat config: %s", options.filename); + + // we need a filename to match configs against + const filename = options.filename || ""; + + // Store the config array in order to get plugin envs and rules later. + internalSlotsMap.get(this).lastConfigArray = configArray; + const config = configArray.getConfig(filename); + + // Verify. + if (config.processor) { + debug("Apply the processor: %o", config.processor); + const { preprocess, postprocess, supportsAutofix } = config.processor; + const disableFixes = options.disableFixes || !supportsAutofix; + + return this._verifyWithFlatConfigArrayAndProcessor( + textOrSourceCode, + config, + { ...options, filename, disableFixes, postprocess, preprocess }, + configArray + ); + } + + // check for options-based processing + if (firstCall && (options.preprocess || options.postprocess)) { + return this._verifyWithFlatConfigArrayAndProcessor(textOrSourceCode, config, options); + } + + return this._verifyWithFlatConfigArrayAndWithoutProcessors(textOrSourceCode, config, options); + } + + /** + * Verify with a processor. + * @param {string|SourceCode} textOrSourceCode The source code. + * @param {ConfigData|ExtractedConfig} config The config array. + * @param {VerifyOptions&ProcessorOptions} options The options. + * @param {ConfigArray} [configForRecursive] The `ConfigArray` object to apply multiple processors recursively. + * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. + */ + _verifyWithProcessor(textOrSourceCode, config, options, configForRecursive) { + const filename = options.filename || ""; + const filenameToExpose = normalizeFilename(filename); + const physicalFilename = options.physicalFilename || filenameToExpose; + const text = ensureText(textOrSourceCode); + const preprocess = options.preprocess || (rawText => [rawText]); + + const postprocess = options.postprocess || (messagesList => messagesList.flat()); + const filterCodeBlock = + options.filterCodeBlock || + (blockFilename => blockFilename.endsWith(".js")); + const originalExtname = path.extname(filename); + const messageLists = preprocess(text, filenameToExpose).map((block, i) => { + debug("A code block was found: %o", block.filename || "(unnamed)"); + + // Keep the legacy behavior. + if (typeof block === "string") { + return this._verifyWithoutProcessors(block, config, options); + } + + const blockText = block.text; + const blockName = path.join(filename, `${i}_${block.filename}`); + + // Skip this block if filtered. + if (!filterCodeBlock(blockName, blockText)) { + debug("This code block was skipped."); + return []; + } + + // Resolve configuration again if the file content or extension was changed. + if (configForRecursive && (text !== blockText || path.extname(blockName) !== originalExtname)) { + debug("Resolving configuration again because the file content or extension was changed."); + return this._verifyWithConfigArray( + blockText, + configForRecursive, + { ...options, filename: blockName, physicalFilename } + ); + } + + // Does lint. + return this._verifyWithoutProcessors( + blockText, + config, + { ...options, filename: blockName, physicalFilename } + ); + }); + + return postprocess(messageLists, filenameToExpose); + } + + /** + * Given a list of reported problems, distinguish problems between normal messages and suppressed messages. + * The normal messages will be returned and the suppressed messages will be stored as lastSuppressedMessages. + * @param {Problem[]} problems A list of reported problems. + * @returns {LintMessage[]} A list of LintMessage. + */ + _distinguishSuppressedMessages(problems) { + const messages = []; + const suppressedMessages = []; + const slots = internalSlotsMap.get(this); + + for (const problem of problems) { + if (problem.suppressions) { + suppressedMessages.push(problem); + } else { + messages.push(problem); + } + } + + slots.lastSuppressedMessages = suppressedMessages; + + return messages; + } + + /** + * Gets the SourceCode object representing the parsed source. + * @returns {SourceCode} The SourceCode object. + */ + getSourceCode() { + return internalSlotsMap.get(this).lastSourceCode; + } + + /** + * Gets the list of SuppressedLintMessage produced in the last running. + * @returns {SuppressedLintMessage[]} The list of SuppressedLintMessage + */ + getSuppressedMessages() { + return internalSlotsMap.get(this).lastSuppressedMessages; + } + + /** + * Defines a new linting rule. + * @param {string} ruleId A unique rule identifier + * @param {Function | Rule} ruleModule Function from context to object mapping AST node types to event handlers + * @returns {void} + */ + defineRule(ruleId, ruleModule) { + assertEslintrcConfig(this); + internalSlotsMap.get(this).ruleMap.define(ruleId, ruleModule); + } + + /** + * Defines many new linting rules. + * @param {Record} rulesToDefine map from unique rule identifier to rule + * @returns {void} + */ + defineRules(rulesToDefine) { + assertEslintrcConfig(this); + Object.getOwnPropertyNames(rulesToDefine).forEach(ruleId => { + this.defineRule(ruleId, rulesToDefine[ruleId]); + }); + } + + /** + * Gets an object with all loaded rules. + * @returns {Map} All loaded rules + */ + getRules() { + assertEslintrcConfig(this); + const { lastConfigArray, ruleMap } = internalSlotsMap.get(this); + + return new Map(function *() { + yield* ruleMap; + + if (lastConfigArray) { + yield* lastConfigArray.pluginRules; + } + }()); + } + + /** + * Define a new parser module + * @param {string} parserId Name of the parser + * @param {Parser} parserModule The parser object + * @returns {void} + */ + defineParser(parserId, parserModule) { + assertEslintrcConfig(this); + internalSlotsMap.get(this).parserMap.set(parserId, parserModule); + } + + /** + * Performs multiple autofix passes over the text until as many fixes as possible + * have been applied. + * @param {string} text The source text to apply fixes to. + * @param {ConfigData|ConfigArray|FlatConfigArray} config The ESLint config object to use. + * @param {VerifyOptions&ProcessorOptions&FixOptions} options The ESLint options object to use. + * @returns {{fixed:boolean,messages:LintMessage[],output:string}} The result of the fix operation as returned from the + * SourceCodeFixer. + */ + verifyAndFix(text, config, options) { + let messages = [], + fixedResult, + fixed = false, + passNumber = 0, + currentText = text; + const debugTextDescription = options && options.filename || `${text.slice(0, 10)}...`; + const shouldFix = options && typeof options.fix !== "undefined" ? options.fix : true; + + /** + * This loop continues until one of the following is true: + * + * 1. No more fixes have been applied. + * 2. Ten passes have been made. + * + * That means anytime a fix is successfully applied, there will be another pass. + * Essentially, guaranteeing a minimum of two passes. + */ + do { + passNumber++; + + debug(`Linting code for ${debugTextDescription} (pass ${passNumber})`); + messages = this.verify(currentText, config, options); + + debug(`Generating fixed text for ${debugTextDescription} (pass ${passNumber})`); + fixedResult = SourceCodeFixer.applyFixes(currentText, messages, shouldFix); + + /* + * stop if there are any syntax errors. + * 'fixedResult.output' is a empty string. + */ + if (messages.length === 1 && messages[0].fatal) { + break; + } + + // keep track if any fixes were ever applied - important for return value + fixed = fixed || fixedResult.fixed; + + // update to use the fixed output instead of the original text + currentText = fixedResult.output; + + } while ( + fixedResult.fixed && + passNumber < MAX_AUTOFIX_PASSES + ); + + /* + * If the last result had fixes, we need to lint again to be sure we have + * the most up-to-date information. + */ + if (fixedResult.fixed) { + fixedResult.messages = this.verify(currentText, config, options); + } + + // ensure the last result properly reflects if fixes were done + fixedResult.fixed = fixed; + fixedResult.output = currentText; + + return fixedResult; + } +} + +module.exports = { + Linter, + + /** + * Get the internal slots of a given Linter instance for tests. + * @param {Linter} instance The Linter instance to get. + * @returns {LinterInternalSlots} The internal slots. + */ + getLinterInternalSlots(instance) { + return internalSlotsMap.get(instance); + } +}; diff --git a/node_modules/eslint/lib/linter/node-event-generator.js b/node_modules/eslint/lib/linter/node-event-generator.js new file mode 100644 index 0000000..d56bef2 --- /dev/null +++ b/node_modules/eslint/lib/linter/node-event-generator.js @@ -0,0 +1,354 @@ +/** + * @fileoverview The event generator for AST nodes. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const esquery = require("esquery"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * An object describing an AST selector + * @typedef {Object} ASTSelector + * @property {string} rawSelector The string that was parsed into this selector + * @property {boolean} isExit `true` if this should be emitted when exiting the node rather than when entering + * @property {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector + * @property {string[]|null} listenerTypes A list of node types that could possibly cause the selector to match, + * or `null` if all node types could cause a match + * @property {number} attributeCount The total number of classes, pseudo-classes, and attribute queries in this selector + * @property {number} identifierCount The total number of identifier queries in this selector + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Computes the union of one or more arrays + * @param {...any[]} arrays One or more arrays to union + * @returns {any[]} The union of the input arrays + */ +function union(...arrays) { + return [...new Set(arrays.flat())]; +} + +/** + * Computes the intersection of one or more arrays + * @param {...any[]} arrays One or more arrays to intersect + * @returns {any[]} The intersection of the input arrays + */ +function intersection(...arrays) { + if (arrays.length === 0) { + return []; + } + + let result = [...new Set(arrays[0])]; + + for (const array of arrays.slice(1)) { + result = result.filter(x => array.includes(x)); + } + return result; +} + +/** + * Gets the possible types of a selector + * @param {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector + * @returns {string[]|null} The node types that could possibly trigger this selector, or `null` if all node types could trigger it + */ +function getPossibleTypes(parsedSelector) { + switch (parsedSelector.type) { + case "identifier": + return [parsedSelector.value]; + + case "matches": { + const typesForComponents = parsedSelector.selectors.map(getPossibleTypes); + + if (typesForComponents.every(Boolean)) { + return union(...typesForComponents); + } + return null; + } + + case "compound": { + const typesForComponents = parsedSelector.selectors.map(getPossibleTypes).filter(typesForComponent => typesForComponent); + + // If all of the components could match any type, then the compound could also match any type. + if (!typesForComponents.length) { + return null; + } + + /* + * If at least one of the components could only match a particular type, the compound could only match + * the intersection of those types. + */ + return intersection(...typesForComponents); + } + + case "child": + case "descendant": + case "sibling": + case "adjacent": + return getPossibleTypes(parsedSelector.right); + + case "class": + if (parsedSelector.name === "function") { + return ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]; + } + + return null; + + default: + return null; + + } +} + +/** + * Counts the number of class, pseudo-class, and attribute queries in this selector + * @param {Object} parsedSelector An object (from esquery) describing the selector's matching behavior + * @returns {number} The number of class, pseudo-class, and attribute queries in this selector + */ +function countClassAttributes(parsedSelector) { + switch (parsedSelector.type) { + case "child": + case "descendant": + case "sibling": + case "adjacent": + return countClassAttributes(parsedSelector.left) + countClassAttributes(parsedSelector.right); + + case "compound": + case "not": + case "matches": + return parsedSelector.selectors.reduce((sum, childSelector) => sum + countClassAttributes(childSelector), 0); + + case "attribute": + case "field": + case "nth-child": + case "nth-last-child": + return 1; + + default: + return 0; + } +} + +/** + * Counts the number of identifier queries in this selector + * @param {Object} parsedSelector An object (from esquery) describing the selector's matching behavior + * @returns {number} The number of identifier queries + */ +function countIdentifiers(parsedSelector) { + switch (parsedSelector.type) { + case "child": + case "descendant": + case "sibling": + case "adjacent": + return countIdentifiers(parsedSelector.left) + countIdentifiers(parsedSelector.right); + + case "compound": + case "not": + case "matches": + return parsedSelector.selectors.reduce((sum, childSelector) => sum + countIdentifiers(childSelector), 0); + + case "identifier": + return 1; + + default: + return 0; + } +} + +/** + * Compares the specificity of two selector objects, with CSS-like rules. + * @param {ASTSelector} selectorA An AST selector descriptor + * @param {ASTSelector} selectorB Another AST selector descriptor + * @returns {number} + * a value less than 0 if selectorA is less specific than selectorB + * a value greater than 0 if selectorA is more specific than selectorB + * a value less than 0 if selectorA and selectorB have the same specificity, and selectorA <= selectorB alphabetically + * a value greater than 0 if selectorA and selectorB have the same specificity, and selectorA > selectorB alphabetically + */ +function compareSpecificity(selectorA, selectorB) { + return selectorA.attributeCount - selectorB.attributeCount || + selectorA.identifierCount - selectorB.identifierCount || + (selectorA.rawSelector <= selectorB.rawSelector ? -1 : 1); +} + +/** + * Parses a raw selector string, and throws a useful error if parsing fails. + * @param {string} rawSelector A raw AST selector + * @returns {Object} An object (from esquery) describing the matching behavior of this selector + * @throws {Error} An error if the selector is invalid + */ +function tryParseSelector(rawSelector) { + try { + return esquery.parse(rawSelector.replace(/:exit$/u, "")); + } catch (err) { + if (err.location && err.location.start && typeof err.location.start.offset === "number") { + throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.location.start.offset}: ${err.message}`); + } + throw err; + } +} + +const selectorCache = new Map(); + +/** + * Parses a raw selector string, and returns the parsed selector along with specificity and type information. + * @param {string} rawSelector A raw AST selector + * @returns {ASTSelector} A selector descriptor + */ +function parseSelector(rawSelector) { + if (selectorCache.has(rawSelector)) { + return selectorCache.get(rawSelector); + } + + const parsedSelector = tryParseSelector(rawSelector); + + const result = { + rawSelector, + isExit: rawSelector.endsWith(":exit"), + parsedSelector, + listenerTypes: getPossibleTypes(parsedSelector), + attributeCount: countClassAttributes(parsedSelector), + identifierCount: countIdentifiers(parsedSelector) + }; + + selectorCache.set(rawSelector, result); + return result; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The event generator for AST nodes. + * This implements below interface. + * + * ```ts + * interface EventGenerator { + * emitter: SafeEmitter; + * enterNode(node: ASTNode): void; + * leaveNode(node: ASTNode): void; + * } + * ``` + */ +class NodeEventGenerator { + + /** + * @param {SafeEmitter} emitter + * An SafeEmitter which is the destination of events. This emitter must already + * have registered listeners for all of the events that it needs to listen for. + * (See lib/linter/safe-emitter.js for more details on `SafeEmitter`.) + * @param {ESQueryOptions} esqueryOptions `esquery` options for traversing custom nodes. + * @returns {NodeEventGenerator} new instance + */ + constructor(emitter, esqueryOptions) { + this.emitter = emitter; + this.esqueryOptions = esqueryOptions; + this.currentAncestry = []; + this.enterSelectorsByNodeType = new Map(); + this.exitSelectorsByNodeType = new Map(); + this.anyTypeEnterSelectors = []; + this.anyTypeExitSelectors = []; + + emitter.eventNames().forEach(rawSelector => { + const selector = parseSelector(rawSelector); + + if (selector.listenerTypes) { + const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType; + + selector.listenerTypes.forEach(nodeType => { + if (!typeMap.has(nodeType)) { + typeMap.set(nodeType, []); + } + typeMap.get(nodeType).push(selector); + }); + return; + } + const selectors = selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors; + + selectors.push(selector); + }); + + this.anyTypeEnterSelectors.sort(compareSpecificity); + this.anyTypeExitSelectors.sort(compareSpecificity); + this.enterSelectorsByNodeType.forEach(selectorList => selectorList.sort(compareSpecificity)); + this.exitSelectorsByNodeType.forEach(selectorList => selectorList.sort(compareSpecificity)); + } + + /** + * Checks a selector against a node, and emits it if it matches + * @param {ASTNode} node The node to check + * @param {ASTSelector} selector An AST selector descriptor + * @returns {void} + */ + applySelector(node, selector) { + if (esquery.matches(node, selector.parsedSelector, this.currentAncestry, this.esqueryOptions)) { + this.emitter.emit(selector.rawSelector, node); + } + } + + /** + * Applies all appropriate selectors to a node, in specificity order + * @param {ASTNode} node The node to check + * @param {boolean} isExit `false` if the node is currently being entered, `true` if it's currently being exited + * @returns {void} + */ + applySelectors(node, isExit) { + const selectorsByNodeType = (isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType).get(node.type) || []; + const anyTypeSelectors = isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors; + + /* + * selectorsByNodeType and anyTypeSelectors were already sorted by specificity in the constructor. + * Iterate through each of them, applying selectors in the right order. + */ + let selectorsByTypeIndex = 0; + let anyTypeSelectorsIndex = 0; + + while (selectorsByTypeIndex < selectorsByNodeType.length || anyTypeSelectorsIndex < anyTypeSelectors.length) { + if ( + selectorsByTypeIndex >= selectorsByNodeType.length || + anyTypeSelectorsIndex < anyTypeSelectors.length && + compareSpecificity(anyTypeSelectors[anyTypeSelectorsIndex], selectorsByNodeType[selectorsByTypeIndex]) < 0 + ) { + this.applySelector(node, anyTypeSelectors[anyTypeSelectorsIndex++]); + } else { + this.applySelector(node, selectorsByNodeType[selectorsByTypeIndex++]); + } + } + } + + /** + * Emits an event of entering AST node. + * @param {ASTNode} node A node which was entered. + * @returns {void} + */ + enterNode(node) { + if (node.parent) { + this.currentAncestry.unshift(node.parent); + } + this.applySelectors(node, false); + } + + /** + * Emits an event of leaving AST node. + * @param {ASTNode} node A node which was left. + * @returns {void} + */ + leaveNode(node) { + this.applySelectors(node, true); + this.currentAncestry.shift(); + } +} + +module.exports = NodeEventGenerator; diff --git a/node_modules/eslint/lib/linter/report-translator.js b/node_modules/eslint/lib/linter/report-translator.js new file mode 100644 index 0000000..781b313 --- /dev/null +++ b/node_modules/eslint/lib/linter/report-translator.js @@ -0,0 +1,368 @@ +/** + * @fileoverview A helper that translates context.report() calls from the rule API into generic problem objects + * @author Teddy Katz + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const assert = require("assert"); +const ruleFixer = require("./rule-fixer"); +const interpolate = require("./interpolate"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * An error message description + * @typedef {Object} MessageDescriptor + * @property {ASTNode} [node] The reported node + * @property {Location} loc The location of the problem. + * @property {string} message The problem message. + * @property {Object} [data] Optional data to use to fill in placeholders in the + * message. + * @property {Function} [fix] The function to call that creates a fix command. + * @property {Array<{desc?: string, messageId?: string, fix: Function}>} suggest Suggestion descriptions and functions to create a the associated fixes. + */ + +/** + * Information about the report + * @typedef {Object} ReportInfo + * @property {string} ruleId The rule ID + * @property {(0|1|2)} severity Severity of the error + * @property {(string|undefined)} message The message + * @property {(string|undefined)} [messageId] The message ID + * @property {number} line The line number + * @property {number} column The column number + * @property {(number|undefined)} [endLine] The ending line number + * @property {(number|undefined)} [endColumn] The ending column number + * @property {(string|null)} nodeType Type of node + * @property {string} source Source text + * @property {({text: string, range: (number[]|null)}|null)} [fix] The fix object + * @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] Suggestion info + */ + +//------------------------------------------------------------------------------ +// Module Definition +//------------------------------------------------------------------------------ + + +/** + * Translates a multi-argument context.report() call into a single object argument call + * @param {...*} args A list of arguments passed to `context.report` + * @returns {MessageDescriptor} A normalized object containing report information + */ +function normalizeMultiArgReportCall(...args) { + + // If there is one argument, it is considered to be a new-style call already. + if (args.length === 1) { + + // Shallow clone the object to avoid surprises if reusing the descriptor + return Object.assign({}, args[0]); + } + + // If the second argument is a string, the arguments are interpreted as [node, message, data, fix]. + if (typeof args[1] === "string") { + return { + node: args[0], + message: args[1], + data: args[2], + fix: args[3] + }; + } + + // Otherwise, the arguments are interpreted as [node, loc, message, data, fix]. + return { + node: args[0], + loc: args[1], + message: args[2], + data: args[3], + fix: args[4] + }; +} + +/** + * Asserts that either a loc or a node was provided, and the node is valid if it was provided. + * @param {MessageDescriptor} descriptor A descriptor to validate + * @returns {void} + * @throws AssertionError if neither a node nor a loc was provided, or if the node is not an object + */ +function assertValidNodeInfo(descriptor) { + if (descriptor.node) { + assert(typeof descriptor.node === "object", "Node must be an object"); + } else { + assert(descriptor.loc, "Node must be provided when reporting error if location is not provided"); + } +} + +/** + * Normalizes a MessageDescriptor to always have a `loc` with `start` and `end` properties + * @param {MessageDescriptor} descriptor A descriptor for the report from a rule. + * @returns {{start: Location, end: (Location|null)}} An updated location that infers the `start` and `end` properties + * from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor. + */ +function normalizeReportLoc(descriptor) { + if (descriptor.loc) { + if (descriptor.loc.start) { + return descriptor.loc; + } + return { start: descriptor.loc, end: null }; + } + return descriptor.node.loc; +} + +/** + * Check that a fix has a valid range. + * @param {Fix|null} fix The fix to validate. + * @returns {void} + */ +function assertValidFix(fix) { + if (fix) { + assert(fix.range && typeof fix.range[0] === "number" && typeof fix.range[1] === "number", `Fix has invalid range: ${JSON.stringify(fix, null, 2)}`); + } +} + +/** + * Compares items in a fixes array by range. + * @param {Fix} a The first message. + * @param {Fix} b The second message. + * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. + * @private + */ +function compareFixesByRange(a, b) { + return a.range[0] - b.range[0] || a.range[1] - b.range[1]; +} + +/** + * Merges the given fixes array into one. + * @param {Fix[]} fixes The fixes to merge. + * @param {SourceCode} sourceCode The source code object to get the text between fixes. + * @returns {{text: string, range: number[]}} The merged fixes + */ +function mergeFixes(fixes, sourceCode) { + for (const fix of fixes) { + assertValidFix(fix); + } + + if (fixes.length === 0) { + return null; + } + if (fixes.length === 1) { + return fixes[0]; + } + + fixes.sort(compareFixesByRange); + + const originalText = sourceCode.text; + const start = fixes[0].range[0]; + const end = fixes[fixes.length - 1].range[1]; + let text = ""; + let lastPos = Number.MIN_SAFE_INTEGER; + + for (const fix of fixes) { + assert(fix.range[0] >= lastPos, "Fix objects must not be overlapped in a report."); + + if (fix.range[0] >= 0) { + text += originalText.slice(Math.max(0, start, lastPos), fix.range[0]); + } + text += fix.text; + lastPos = fix.range[1]; + } + text += originalText.slice(Math.max(0, start, lastPos), end); + + return { range: [start, end], text }; +} + +/** + * Gets one fix object from the given descriptor. + * If the descriptor retrieves multiple fixes, this merges those to one. + * @param {MessageDescriptor} descriptor The report descriptor. + * @param {SourceCode} sourceCode The source code object to get text between fixes. + * @returns {({text: string, range: number[]}|null)} The fix for the descriptor + */ +function normalizeFixes(descriptor, sourceCode) { + if (typeof descriptor.fix !== "function") { + return null; + } + + // @type {null | Fix | Fix[] | IterableIterator} + const fix = descriptor.fix(ruleFixer); + + // Merge to one. + if (fix && Symbol.iterator in fix) { + return mergeFixes(Array.from(fix), sourceCode); + } + + assertValidFix(fix); + return fix; +} + +/** + * Gets an array of suggestion objects from the given descriptor. + * @param {MessageDescriptor} descriptor The report descriptor. + * @param {SourceCode} sourceCode The source code object to get text between fixes. + * @param {Object} messages Object of meta messages for the rule. + * @returns {Array} The suggestions for the descriptor + */ +function mapSuggestions(descriptor, sourceCode, messages) { + if (!descriptor.suggest || !Array.isArray(descriptor.suggest)) { + return []; + } + + return descriptor.suggest + .map(suggestInfo => { + const computedDesc = suggestInfo.desc || messages[suggestInfo.messageId]; + + return { + ...suggestInfo, + desc: interpolate(computedDesc, suggestInfo.data), + fix: normalizeFixes(suggestInfo, sourceCode) + }; + }) + + // Remove suggestions that didn't provide a fix + .filter(({ fix }) => fix); +} + +/** + * Creates information about the report from a descriptor + * @param {Object} options Information about the problem + * @param {string} options.ruleId Rule ID + * @param {(0|1|2)} options.severity Rule severity + * @param {(ASTNode|null)} options.node Node + * @param {string} options.message Error message + * @param {string} [options.messageId] The error message ID. + * @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location + * @param {{text: string, range: (number[]|null)}} options.fix The fix object + * @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects + * @returns {function(...args): ReportInfo} Function that returns information about the report + */ +function createProblem(options) { + const problem = { + ruleId: options.ruleId, + severity: options.severity, + message: options.message, + line: options.loc.start.line, + column: options.loc.start.column + 1, + nodeType: options.node && options.node.type || null + }; + + /* + * If this isn’t in the conditional, some of the tests fail + * because `messageId` is present in the problem object + */ + if (options.messageId) { + problem.messageId = options.messageId; + } + + if (options.loc.end) { + problem.endLine = options.loc.end.line; + problem.endColumn = options.loc.end.column + 1; + } + + if (options.fix) { + problem.fix = options.fix; + } + + if (options.suggestions && options.suggestions.length > 0) { + problem.suggestions = options.suggestions; + } + + return problem; +} + +/** + * Validates that suggestions are properly defined. Throws if an error is detected. + * @param {Array<{ desc?: string, messageId?: string }>} suggest The incoming suggest data. + * @param {Object} messages Object of meta messages for the rule. + * @returns {void} + */ +function validateSuggestions(suggest, messages) { + if (suggest && Array.isArray(suggest)) { + suggest.forEach(suggestion => { + if (suggestion.messageId) { + const { messageId } = suggestion; + + if (!messages) { + throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}', but no messages were present in the rule metadata.`); + } + + if (!messages[messageId]) { + throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); + } + + if (suggestion.desc) { + throw new TypeError("context.report() called with a suggest option that defines both a 'messageId' and an 'desc'. Please only pass one."); + } + } else if (!suggestion.desc) { + throw new TypeError("context.report() called with a suggest option that doesn't have either a `desc` or `messageId`"); + } + + if (typeof suggestion.fix !== "function") { + throw new TypeError(`context.report() called with a suggest option without a fix function. See: ${suggestion}`); + } + }); + } +} + +/** + * Returns a function that converts the arguments of a `context.report` call from a rule into a reported + * problem for the Node.js API. + * @param {{ruleId: string, severity: number, sourceCode: SourceCode, messageIds: Object, disableFixes: boolean}} metadata Metadata for the reported problem + * @param {SourceCode} sourceCode The `SourceCode` instance for the text being linted + * @returns {function(...args): ReportInfo} Function that returns information about the report + */ + +module.exports = function createReportTranslator(metadata) { + + /* + * `createReportTranslator` gets called once per enabled rule per file. It needs to be very performant. + * The report translator itself (i.e. the function that `createReportTranslator` returns) gets + * called every time a rule reports a problem, which happens much less frequently (usually, the vast + * majority of rules don't report any problems for a given file). + */ + return (...args) => { + const descriptor = normalizeMultiArgReportCall(...args); + const messages = metadata.messageIds; + + assertValidNodeInfo(descriptor); + + let computedMessage; + + if (descriptor.messageId) { + if (!messages) { + throw new TypeError("context.report() called with a messageId, but no messages were present in the rule metadata."); + } + const id = descriptor.messageId; + + if (descriptor.message) { + throw new TypeError("context.report() called with a message and a messageId. Please only pass one."); + } + if (!messages || !Object.prototype.hasOwnProperty.call(messages, id)) { + throw new TypeError(`context.report() called with a messageId of '${id}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); + } + computedMessage = messages[id]; + } else if (descriptor.message) { + computedMessage = descriptor.message; + } else { + throw new TypeError("Missing `message` property in report() call; add a message that describes the linting problem."); + } + + validateSuggestions(descriptor.suggest, messages); + + return createProblem({ + ruleId: metadata.ruleId, + severity: metadata.severity, + node: descriptor.node, + message: interpolate(computedMessage, descriptor.data), + messageId: descriptor.messageId, + loc: normalizeReportLoc(descriptor), + fix: metadata.disableFixes ? null : normalizeFixes(descriptor, metadata.sourceCode), + suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages) + }); + }; +}; diff --git a/node_modules/eslint/lib/linter/rule-fixer.js b/node_modules/eslint/lib/linter/rule-fixer.js new file mode 100644 index 0000000..bdd80d1 --- /dev/null +++ b/node_modules/eslint/lib/linter/rule-fixer.js @@ -0,0 +1,140 @@ +/** + * @fileoverview An object that creates fix commands for rules. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Creates a fix command that inserts text at the specified index in the source text. + * @param {int} index The 0-based index at which to insert the new text. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + * @private + */ +function insertTextAt(index, text) { + return { + range: [index, index], + text + }; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Creates code fixing commands for rules. + */ + +const ruleFixer = Object.freeze({ + + /** + * Creates a fix command that inserts text after the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {ASTNode|Token} nodeOrToken The node or token to insert after. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + insertTextAfter(nodeOrToken, text) { + return this.insertTextAfterRange(nodeOrToken.range, text); + }, + + /** + * Creates a fix command that inserts text after the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {int[]} range The range to replace, first item is start of range, second + * is end of range. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + insertTextAfterRange(range, text) { + return insertTextAt(range[1], text); + }, + + /** + * Creates a fix command that inserts text before the given node or token. + * The fix is not applied until applyFixes() is called. + * @param {ASTNode|Token} nodeOrToken The node or token to insert before. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + insertTextBefore(nodeOrToken, text) { + return this.insertTextBeforeRange(nodeOrToken.range, text); + }, + + /** + * Creates a fix command that inserts text before the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {int[]} range The range to replace, first item is start of range, second + * is end of range. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + insertTextBeforeRange(range, text) { + return insertTextAt(range[0], text); + }, + + /** + * Creates a fix command that replaces text at the node or token. + * The fix is not applied until applyFixes() is called. + * @param {ASTNode|Token} nodeOrToken The node or token to remove. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + replaceText(nodeOrToken, text) { + return this.replaceTextRange(nodeOrToken.range, text); + }, + + /** + * Creates a fix command that replaces text at the specified range in the source text. + * The fix is not applied until applyFixes() is called. + * @param {int[]} range The range to replace, first item is start of range, second + * is end of range. + * @param {string} text The text to insert. + * @returns {Object} The fix command. + */ + replaceTextRange(range, text) { + return { + range, + text + }; + }, + + /** + * Creates a fix command that removes the node or token from the source. + * The fix is not applied until applyFixes() is called. + * @param {ASTNode|Token} nodeOrToken The node or token to remove. + * @returns {Object} The fix command. + */ + remove(nodeOrToken) { + return this.removeRange(nodeOrToken.range); + }, + + /** + * Creates a fix command that removes the specified range of text from the source. + * The fix is not applied until applyFixes() is called. + * @param {int[]} range The range to remove, first item is start of range, second + * is end of range. + * @returns {Object} The fix command. + */ + removeRange(range) { + return { + range, + text: "" + }; + } + +}); + + +module.exports = ruleFixer; diff --git a/node_modules/eslint/lib/linter/rules.js b/node_modules/eslint/lib/linter/rules.js new file mode 100644 index 0000000..647bab6 --- /dev/null +++ b/node_modules/eslint/lib/linter/rules.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Defines a storage for rules. + * @author Nicholas C. Zakas + * @author aladdin-add + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const builtInRules = require("../rules"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Normalizes a rule module to the new-style API + * @param {(Function|{create: Function})} rule A rule object, which can either be a function + * ("old-style") or an object with a `create` method ("new-style") + * @returns {{create: Function}} A new-style rule. + */ +function normalizeRule(rule) { + return typeof rule === "function" ? Object.assign({ create: rule }, rule) : rule; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A storage for rules. + */ +class Rules { + constructor() { + this._rules = Object.create(null); + } + + /** + * Registers a rule module for rule id in storage. + * @param {string} ruleId Rule id (file name). + * @param {Function} ruleModule Rule handler. + * @returns {void} + */ + define(ruleId, ruleModule) { + this._rules[ruleId] = normalizeRule(ruleModule); + } + + /** + * Access rule handler by id (file name). + * @param {string} ruleId Rule id (file name). + * @returns {{create: Function, schema: JsonSchema[]}} + * A rule. This is normalized to always have the new-style shape with a `create` method. + */ + get(ruleId) { + if (typeof this._rules[ruleId] === "string") { + this.define(ruleId, require(this._rules[ruleId])); + } + if (this._rules[ruleId]) { + return this._rules[ruleId]; + } + if (builtInRules.has(ruleId)) { + return builtInRules.get(ruleId); + } + + return null; + } + + *[Symbol.iterator]() { + yield* builtInRules; + + for (const ruleId of Object.keys(this._rules)) { + yield [ruleId, this.get(ruleId)]; + } + } +} + +module.exports = Rules; diff --git a/node_modules/eslint/lib/linter/safe-emitter.js b/node_modules/eslint/lib/linter/safe-emitter.js new file mode 100644 index 0000000..f4837c1 --- /dev/null +++ b/node_modules/eslint/lib/linter/safe-emitter.js @@ -0,0 +1,52 @@ +/** + * @fileoverview A variant of EventEmitter which does not give listeners information about each other + * @author Teddy Katz + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * An event emitter + * @typedef {Object} SafeEmitter + * @property {(eventName: string, listenerFunc: Function) => void} on Adds a listener for a given event name + * @property {(eventName: string, arg1?: any, arg2?: any, arg3?: any) => void} emit Emits an event with a given name. + * This calls all the listeners that were listening for that name, with `arg1`, `arg2`, and `arg3` as arguments. + * @property {function(): string[]} eventNames Gets the list of event names that have registered listeners. + */ + +/** + * Creates an object which can listen for and emit events. + * This is similar to the EventEmitter API in Node's standard library, but it has a few differences. + * The goal is to allow multiple modules to attach arbitrary listeners to the same emitter, without + * letting the modules know about each other at all. + * 1. It has no special keys like `error` and `newListener`, which would allow modules to detect when + * another module throws an error or registers a listener. + * 2. It calls listener functions without any `this` value. (`EventEmitter` calls listeners with a + * `this` value of the emitter instance, which would give listeners access to other listeners.) + * @returns {SafeEmitter} An emitter + */ +module.exports = () => { + const listeners = Object.create(null); + + return Object.freeze({ + on(eventName, listener) { + if (eventName in listeners) { + listeners[eventName].push(listener); + } else { + listeners[eventName] = [listener]; + } + }, + emit(eventName, ...args) { + if (eventName in listeners) { + listeners[eventName].forEach(listener => listener(...args)); + } + }, + eventNames() { + return Object.keys(listeners); + } + }); +}; diff --git a/node_modules/eslint/lib/linter/source-code-fixer.js b/node_modules/eslint/lib/linter/source-code-fixer.js new file mode 100644 index 0000000..15386c9 --- /dev/null +++ b/node_modules/eslint/lib/linter/source-code-fixer.js @@ -0,0 +1,152 @@ +/** + * @fileoverview An object that caches and applies source code fixes. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const debug = require("debug")("eslint:source-code-fixer"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const BOM = "\uFEFF"; + +/** + * Compares items in a messages array by range. + * @param {Message} a The first message. + * @param {Message} b The second message. + * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. + * @private + */ +function compareMessagesByFixRange(a, b) { + return a.fix.range[0] - b.fix.range[0] || a.fix.range[1] - b.fix.range[1]; +} + +/** + * Compares items in a messages array by line and column. + * @param {Message} a The first message. + * @param {Message} b The second message. + * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. + * @private + */ +function compareMessagesByLocation(a, b) { + return a.line - b.line || a.column - b.column; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Utility for apply fixes to source code. + * @constructor + */ +function SourceCodeFixer() { + Object.freeze(this); +} + +/** + * Applies the fixes specified by the messages to the given text. Tries to be + * smart about the fixes and won't apply fixes over the same area in the text. + * @param {string} sourceText The text to apply the changes to. + * @param {Message[]} messages The array of messages reported by ESLint. + * @param {boolean|Function} [shouldFix=true] Determines whether each message should be fixed + * @returns {Object} An object containing the fixed text and any unfixed messages. + */ +SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) { + debug("Applying fixes"); + + if (shouldFix === false) { + debug("shouldFix parameter was false, not attempting fixes"); + return { + fixed: false, + messages, + output: sourceText + }; + } + + // clone the array + const remainingMessages = [], + fixes = [], + bom = sourceText.startsWith(BOM) ? BOM : "", + text = bom ? sourceText.slice(1) : sourceText; + let lastPos = Number.NEGATIVE_INFINITY, + output = bom; + + /** + * Try to use the 'fix' from a problem. + * @param {Message} problem The message object to apply fixes from + * @returns {boolean} Whether fix was successfully applied + */ + function attemptFix(problem) { + const fix = problem.fix; + const start = fix.range[0]; + const end = fix.range[1]; + + // Remain it as a problem if it's overlapped or it's a negative range + if (lastPos >= start || start > end) { + remainingMessages.push(problem); + return false; + } + + // Remove BOM. + if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) { + output = ""; + } + + // Make output to this fix. + output += text.slice(Math.max(0, lastPos), Math.max(0, start)); + output += fix.text; + lastPos = end; + return true; + } + + messages.forEach(problem => { + if (Object.prototype.hasOwnProperty.call(problem, "fix")) { + fixes.push(problem); + } else { + remainingMessages.push(problem); + } + }); + + if (fixes.length) { + debug("Found fixes to apply"); + let fixesWereApplied = false; + + for (const problem of fixes.sort(compareMessagesByFixRange)) { + if (typeof shouldFix !== "function" || shouldFix(problem)) { + attemptFix(problem); + + /* + * The only time attemptFix will fail is if a previous fix was + * applied which conflicts with it. So we can mark this as true. + */ + fixesWereApplied = true; + } else { + remainingMessages.push(problem); + } + } + output += text.slice(Math.max(0, lastPos)); + + return { + fixed: fixesWereApplied, + messages: remainingMessages.sort(compareMessagesByLocation), + output + }; + } + + debug("No fixes to apply"); + return { + fixed: false, + messages, + output: bom + text + }; + +}; + +module.exports = SourceCodeFixer; diff --git a/node_modules/eslint/lib/linter/timing.js b/node_modules/eslint/lib/linter/timing.js new file mode 100644 index 0000000..914cbf0 --- /dev/null +++ b/node_modules/eslint/lib/linter/timing.js @@ -0,0 +1,161 @@ +/** + * @fileoverview Tracks performance of individual rules. + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/* istanbul ignore next */ +/** + * Align the string to left + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} ch delimiter character + * @returns {string} modified string + * @private + */ +function alignLeft(str, len, ch) { + return str + new Array(len - str.length + 1).join(ch || " "); +} + +/* istanbul ignore next */ +/** + * Align the string to right + * @param {string} str string to evaluate + * @param {int} len length of the string + * @param {string} ch delimiter character + * @returns {string} modified string + * @private + */ +function alignRight(str, len, ch) { + return new Array(len - str.length + 1).join(ch || " ") + str; +} + +//------------------------------------------------------------------------------ +// Module definition +//------------------------------------------------------------------------------ + +const enabled = !!process.env.TIMING; + +const HEADERS = ["Rule", "Time (ms)", "Relative"]; +const ALIGN = [alignLeft, alignRight, alignRight]; + +/** + * Decide how many rules to show in the output list. + * @returns {number} the number of rules to show + */ +function getListSize() { + const MINIMUM_SIZE = 10; + + if (typeof process.env.TIMING !== "string") { + return MINIMUM_SIZE; + } + + if (process.env.TIMING.toLowerCase() === "all") { + return Number.POSITIVE_INFINITY; + } + + const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10); + + return TIMING_ENV_VAR_AS_INTEGER > 10 ? TIMING_ENV_VAR_AS_INTEGER : MINIMUM_SIZE; +} + +/* istanbul ignore next */ +/** + * display the data + * @param {Object} data Data object to be displayed + * @returns {void} prints modified string with console.log + * @private + */ +function display(data) { + let total = 0; + const rows = Object.keys(data) + .map(key => { + const time = data[key]; + + total += time; + return [key, time]; + }) + .sort((a, b) => b[1] - a[1]) + .slice(0, getListSize()); + + rows.forEach(row => { + row.push(`${(row[1] * 100 / total).toFixed(1)}%`); + row[1] = row[1].toFixed(3); + }); + + rows.unshift(HEADERS); + + const widths = []; + + rows.forEach(row => { + const len = row.length; + + for (let i = 0; i < len; i++) { + const n = row[i].length; + + if (!widths[i] || n > widths[i]) { + widths[i] = n; + } + } + }); + + const table = rows.map(row => ( + row + .map((cell, index) => ALIGN[index](cell, widths[index])) + .join(" | ") + )); + + table.splice(1, 0, widths.map((width, index) => { + const extraAlignment = index !== 0 && index !== widths.length - 1 ? 2 : 1; + + return ALIGN[index](":", width + extraAlignment, "-"); + }).join("|")); + + console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function +} + +/* istanbul ignore next */ +module.exports = (function() { + + const data = Object.create(null); + + /** + * Time the run + * @param {any} key key from the data object + * @param {Function} fn function to be called + * @returns {Function} function to be executed + * @private + */ + function time(key, fn) { + if (typeof data[key] === "undefined") { + data[key] = 0; + } + + return function(...args) { + let t = process.hrtime(); + const result = fn(...args); + + t = process.hrtime(t); + data[key] += t[0] * 1e3 + t[1] / 1e6; + return result; + }; + } + + if (enabled) { + process.on("exit", () => { + display(data); + }); + } + + return { + time, + enabled, + getListSize + }; + +}()); diff --git a/node_modules/eslint/lib/options.js b/node_modules/eslint/lib/options.js new file mode 100644 index 0000000..6d06e3d --- /dev/null +++ b/node_modules/eslint/lib/options.js @@ -0,0 +1,323 @@ +/** + * @fileoverview Options configuration for optionator. + * @author George Zahariev + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const optionator = require("optionator"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * The options object parsed by Optionator. + * @typedef {Object} ParsedCLIOptions + * @property {boolean} cache Only check changed files + * @property {string} cacheFile Path to the cache file. Deprecated: use --cache-location + * @property {string} [cacheLocation] Path to the cache file or directory + * @property {"metadata" | "content"} cacheStrategy Strategy to use for detecting changed files in the cache + * @property {boolean} [color] Force enabling/disabling of color + * @property {string} [config] Use this configuration, overriding .eslintrc.* config options if present + * @property {boolean} debug Output debugging information + * @property {string[]} [env] Specify environments + * @property {boolean} envInfo Output execution environment information + * @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched + * @property {boolean} eslintrc Disable use of configuration from .eslintrc.* + * @property {string[]} [ext] Specify JavaScript file extensions + * @property {boolean} fix Automatically fix problems + * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system + * @property {("directive" | "problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (directive, problem, suggestion, layout) + * @property {string} format Use a specific output format + * @property {string[]} [global] Define global variables + * @property {boolean} [help] Show help + * @property {boolean} ignore Disable use of ignore files and patterns + * @property {string} [ignorePath] Specify path of ignore file + * @property {string[]} [ignorePattern] Pattern of files to ignore (in addition to those in .eslintignore) + * @property {boolean} init Run config initialization wizard + * @property {boolean} inlineConfig Prevent comments from changing config or rules + * @property {number} maxWarnings Number of warnings to trigger nonzero exit code + * @property {string} [outputFile] Specify file to write report to + * @property {string} [parser] Specify the parser to be used + * @property {Object} [parserOptions] Specify parser options + * @property {string[]} [plugin] Specify plugins + * @property {string} [printConfig] Print the configuration for the given file + * @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable directives + * @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default + * @property {Object} [rule] Specify rules + * @property {string[]} [rulesdir] Load additional rules from this directory. Deprecated: Use rules from plugins + * @property {boolean} stdin Lint code provided on + * @property {string} [stdinFilename] Specify filename to process STDIN as + * @property {boolean} quiet Report errors only + * @property {boolean} [version] Output the version number + * @property {string[]} _ Positional filenames or patterns + */ + +//------------------------------------------------------------------------------ +// Initialization and Public Interface +//------------------------------------------------------------------------------ + +// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)" +module.exports = optionator({ + prepend: "eslint [options] file.js [file.js] [dir]", + defaults: { + concatRepeatedArrays: true, + mergeRepeatedObjects: true + }, + options: [ + { + heading: "Basic configuration" + }, + { + option: "eslintrc", + type: "Boolean", + default: "true", + description: "Disable use of configuration from .eslintrc.*" + }, + { + option: "config", + alias: "c", + type: "path::String", + description: "Use this configuration, overriding .eslintrc.* config options if present" + }, + { + option: "env", + type: "[String]", + description: "Specify environments" + }, + { + option: "ext", + type: "[String]", + description: "Specify JavaScript file extensions" + }, + { + option: "global", + type: "[String]", + description: "Define global variables" + }, + { + option: "parser", + type: "String", + description: "Specify the parser to be used" + }, + { + option: "parser-options", + type: "Object", + description: "Specify parser options" + }, + { + option: "resolve-plugins-relative-to", + type: "path::String", + description: "A folder where plugins should be resolved from, CWD by default" + }, + { + heading: "Specifying rules and plugins" + }, + { + option: "plugin", + type: "[String]", + description: "Specify plugins" + }, + { + option: "rule", + type: "Object", + description: "Specify rules" + }, + { + option: "rulesdir", + type: "[path::String]", + description: "Load additional rules from this directory. Deprecated: Use rules from plugins" + }, + { + heading: "Fixing problems" + }, + { + option: "fix", + type: "Boolean", + default: false, + description: "Automatically fix problems" + }, + { + option: "fix-dry-run", + type: "Boolean", + default: false, + description: "Automatically fix problems without saving the changes to the file system" + }, + { + option: "fix-type", + type: "Array", + description: "Specify the types of fixes to apply (directive, problem, suggestion, layout)" + }, + { + heading: "Ignoring files" + }, + { + option: "ignore-path", + type: "path::String", + description: "Specify path of ignore file" + }, + { + option: "ignore", + type: "Boolean", + default: "true", + description: "Disable use of ignore files and patterns" + }, + { + option: "ignore-pattern", + type: "[String]", + description: "Pattern of files to ignore (in addition to those in .eslintignore)", + concatRepeatedArrays: [true, { + oneValuePerFlag: true + }] + }, + { + heading: "Using stdin" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Lint code provided on " + }, + { + option: "stdin-filename", + type: "String", + description: "Specify filename to process STDIN as" + }, + { + heading: "Handling warnings" + }, + { + option: "quiet", + type: "Boolean", + default: "false", + description: "Report errors only" + }, + { + option: "max-warnings", + type: "Int", + default: "-1", + description: "Number of warnings to trigger nonzero exit code" + }, + { + heading: "Output" + }, + { + option: "output-file", + alias: "o", + type: "path::String", + description: "Specify file to write report to" + }, + { + option: "format", + alias: "f", + type: "String", + default: "stylish", + description: "Use a specific output format" + }, + { + option: "color", + type: "Boolean", + alias: "no-color", + description: "Force enabling/disabling of color" + }, + { + heading: "Inline configuration comments" + }, + { + option: "inline-config", + type: "Boolean", + default: "true", + description: "Prevent comments from changing config or rules" + }, + { + option: "report-unused-disable-directives", + type: "Boolean", + default: void 0, + description: "Adds reported errors for unused eslint-disable directives" + }, + { + heading: "Caching" + }, + { + option: "cache", + type: "Boolean", + default: "false", + description: "Only check changed files" + }, + { + option: "cache-file", + type: "path::String", + default: ".eslintcache", + description: "Path to the cache file. Deprecated: use --cache-location" + }, + { + option: "cache-location", + type: "path::String", + description: "Path to the cache file or directory" + }, + { + option: "cache-strategy", + dependsOn: ["cache"], + type: "String", + default: "metadata", + enum: ["metadata", "content"], + description: "Strategy to use for detecting changed files in the cache" + }, + { + heading: "Miscellaneous" + }, + { + option: "init", + type: "Boolean", + default: "false", + description: "Run config initialization wizard" + }, + { + option: "env-info", + type: "Boolean", + default: "false", + description: "Output execution environment information" + }, + { + option: "error-on-unmatched-pattern", + type: "Boolean", + default: "true", + description: "Prevent errors when pattern is unmatched" + }, + { + option: "exit-on-fatal-error", + type: "Boolean", + default: "false", + description: "Exit with exit code 2 in case of fatal error" + }, + { + option: "debug", + type: "Boolean", + default: false, + description: "Output debugging information" + }, + { + option: "help", + alias: "h", + type: "Boolean", + description: "Show help" + }, + { + option: "version", + alias: "v", + type: "Boolean", + description: "Output the version number" + }, + { + option: "print-config", + type: "path::String", + description: "Print the configuration for the given file" + } + ] +}); diff --git a/node_modules/eslint/lib/rule-tester/flat-rule-tester.js b/node_modules/eslint/lib/rule-tester/flat-rule-tester.js new file mode 100644 index 0000000..b829484 --- /dev/null +++ b/node_modules/eslint/lib/rule-tester/flat-rule-tester.js @@ -0,0 +1,1039 @@ +/** + * @fileoverview Mocha/Jest test wrapper + * @author Ilya Volodin + */ +"use strict"; + +/* eslint-env mocha -- Mocha/Jest wrapper */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const + assert = require("assert"), + util = require("util"), + equal = require("fast-deep-equal"), + Traverser = require("../shared/traverser"), + { getRuleOptionsSchema } = require("../config/flat-config-helpers"), + { Linter, SourceCodeFixer, interpolate } = require("../linter"); +const { FlatConfigArray } = require("../config/flat-config-array"); +const { defaultConfig } = require("../config/default-config"); + +const ajv = require("../shared/ajv")({ strictDefaults: true }); + +const parserSymbol = Symbol.for("eslint.RuleTester.parser"); +const { SourceCode } = require("../source-code"); +const { ConfigArraySymbol } = require("@humanwhocodes/config-array"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** @typedef {import("../shared/types").Parser} Parser */ +/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */ + +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ +/** + * A test case that is expected to pass lint. + * @typedef {Object} ValidTestCase + * @property {string} [name] Name for the test case. + * @property {string} code Code for the test case. + * @property {any[]} [options] Options for the test case. + * @property {LanguageOptions} [languageOptions] The language options to use in the test case. + * @property {{ [name: string]: any }} [settings] Settings for the test case. + * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. + * @property {boolean} [only] Run only this test case or the subset of test cases with this property. + */ + +/** + * A test case that is expected to fail lint. + * @typedef {Object} InvalidTestCase + * @property {string} [name] Name for the test case. + * @property {string} code Code for the test case. + * @property {number | Array} errors Expected errors. + * @property {string | null} [output] The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. + * @property {any[]} [options] Options for the test case. + * @property {{ [name: string]: any }} [settings] Settings for the test case. + * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. + * @property {LanguageOptions} [languageOptions] The language options to use in the test case. + * @property {boolean} [only] Run only this test case or the subset of test cases with this property. + */ + +/** + * A description of a reported error used in a rule tester test. + * @typedef {Object} TestCaseError + * @property {string | RegExp} [message] Message. + * @property {string} [messageId] Message ID. + * @property {string} [type] The type of the reported AST node. + * @property {{ [name: string]: string }} [data] The data used to fill the message template. + * @property {number} [line] The 1-based line number of the reported start location. + * @property {number} [column] The 1-based column number of the reported start location. + * @property {number} [endLine] The 1-based line number of the reported end location. + * @property {number} [endColumn] The 1-based column number of the reported end location. + */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ + +//------------------------------------------------------------------------------ +// Private Members +//------------------------------------------------------------------------------ + +/* + * testerDefaultConfig must not be modified as it allows to reset the tester to + * the initial default configuration + */ +const testerDefaultConfig = { rules: {} }; + +/* + * RuleTester uses this config as its default. This can be overwritten via + * setDefaultConfig(). + */ +let sharedDefaultConfig = { rules: {} }; + +/* + * List every parameters possible on a test case that are not related to eslint + * configuration + */ +const RuleTesterParameters = [ + "name", + "code", + "filename", + "options", + "errors", + "output", + "only" +]; + +/* + * All allowed property names in error objects. + */ +const errorObjectParameters = new Set([ + "message", + "messageId", + "data", + "type", + "line", + "column", + "endLine", + "endColumn", + "suggestions" +]); +const friendlyErrorObjectParameterList = `[${[...errorObjectParameters].map(key => `'${key}'`).join(", ")}]`; + +/* + * All allowed property names in suggestion objects. + */ +const suggestionObjectParameters = new Set([ + "desc", + "messageId", + "data", + "output" +]); +const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`; + +const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); + +/** + * Clones a given value deeply. + * Note: This ignores `parent` property. + * @param {any} x A value to clone. + * @returns {any} A cloned value. + */ +function cloneDeeplyExcludesParent(x) { + if (typeof x === "object" && x !== null) { + if (Array.isArray(x)) { + return x.map(cloneDeeplyExcludesParent); + } + + const retv = {}; + + for (const key in x) { + if (key !== "parent" && hasOwnProperty(x, key)) { + retv[key] = cloneDeeplyExcludesParent(x[key]); + } + } + + return retv; + } + + return x; +} + +/** + * Freezes a given value deeply. + * @param {any} x A value to freeze. + * @returns {void} + */ +function freezeDeeply(x) { + if (typeof x === "object" && x !== null) { + if (Array.isArray(x)) { + x.forEach(freezeDeeply); + } else { + for (const key in x) { + if (key !== "parent" && hasOwnProperty(x, key)) { + freezeDeeply(x[key]); + } + } + } + Object.freeze(x); + } +} + +/** + * Replace control characters by `\u00xx` form. + * @param {string} text The text to sanitize. + * @returns {string} The sanitized text. + */ +function sanitize(text) { + if (typeof text !== "string") { + return ""; + } + return text.replace( + /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex -- Escaping controls + c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` + ); +} + +/** + * Define `start`/`end` properties as throwing error. + * @param {string} objName Object name used for error messages. + * @param {ASTNode} node The node to define. + * @returns {void} + */ +function defineStartEndAsError(objName, node) { + Object.defineProperties(node, { + start: { + get() { + throw new Error(`Use ${objName}.range[0] instead of ${objName}.start`); + }, + configurable: true, + enumerable: false + }, + end: { + get() { + throw new Error(`Use ${objName}.range[1] instead of ${objName}.end`); + }, + configurable: true, + enumerable: false + } + }); +} + + +/** + * Define `start`/`end` properties of all nodes of the given AST as throwing error. + * @param {ASTNode} ast The root node to errorize `start`/`end` properties. + * @param {Object} [visitorKeys] Visitor keys to be used for traversing the given ast. + * @returns {void} + */ +function defineStartEndAsErrorInTree(ast, visitorKeys) { + Traverser.traverse(ast, { visitorKeys, enter: defineStartEndAsError.bind(null, "node") }); + ast.tokens.forEach(defineStartEndAsError.bind(null, "token")); + ast.comments.forEach(defineStartEndAsError.bind(null, "token")); +} + +/** + * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. + * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. + * @param {Parser} parser Parser object. + * @returns {Parser} Wrapped parser object. + */ +function wrapParser(parser) { + + if (typeof parser.parseForESLint === "function") { + return { + [parserSymbol]: parser, + parseForESLint(...args) { + const ret = parser.parseForESLint(...args); + + defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); + return ret; + } + }; + } + + return { + [parserSymbol]: parser, + parse(...args) { + const ast = parser.parse(...args); + + defineStartEndAsErrorInTree(ast); + return ast; + } + }; +} + +/** + * Function to replace `SourceCode.prototype.getComments`. + * @returns {void} + * @throws {Error} Deprecation message. + */ +function getCommentsDeprecation() { + throw new Error( + "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead." + ); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +// default separators for testing +const DESCRIBE = Symbol("describe"); +const IT = Symbol("it"); +const IT_ONLY = Symbol("itOnly"); + +/** + * This is `it` default handler if `it` don't exist. + * @this {Mocha} + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. + * @throws {Error} Any error upon execution of `method`. + * @returns {any} Returned value of `method`. + */ +function itDefaultHandler(text, method) { + try { + return method.call(this); + } catch (err) { + if (err instanceof assert.AssertionError) { + err.message += ` (${util.inspect(err.actual)} ${err.operator} ${util.inspect(err.expected)})`; + } + throw err; + } +} + +/** + * This is `describe` default handler if `describe` don't exist. + * @this {Mocha} + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. + * @returns {any} Returned value of `method`. + */ +function describeDefaultHandler(text, method) { + return method.call(this); +} + +/** + * Mocha test wrapper. + */ +class FlatRuleTester { + + /** + * Creates a new instance of RuleTester. + * @param {Object} [testerConfig] Optional, extra configuration for the tester + */ + constructor(testerConfig = {}) { + + /** + * The configuration to use for this tester. Combination of the tester + * configuration and the default configuration. + * @type {Object} + */ + this.testerConfig = [ + sharedDefaultConfig, + testerConfig, + { rules: { "rule-tester/validate-ast": "error" } } + ]; + + this.linter = new Linter({ configType: "flat" }); + } + + /** + * Set the configuration to use for all future tests + * @param {Object} config the configuration to use. + * @throws {TypeError} If non-object config. + * @returns {void} + */ + static setDefaultConfig(config) { + if (typeof config !== "object") { + throw new TypeError("FlatRuleTester.setDefaultConfig: config must be an object"); + } + sharedDefaultConfig = config; + + // Make sure the rules object exists since it is assumed to exist later + sharedDefaultConfig.rules = sharedDefaultConfig.rules || {}; + } + + /** + * Get the current configuration used for all tests + * @returns {Object} the current configuration + */ + static getDefaultConfig() { + return sharedDefaultConfig; + } + + /** + * Reset the configuration to the initial configuration of the tester removing + * any changes made until now. + * @returns {void} + */ + static resetDefaultConfig() { + sharedDefaultConfig = { + rules: { + ...testerDefaultConfig.rules + } + }; + } + + + /* + * If people use `mocha test.js --watch` command, `describe` and `it` function + * instances are different for each execution. So `describe` and `it` should get fresh instance + * always. + */ + static get describe() { + return ( + this[DESCRIBE] || + (typeof describe === "function" ? describe : describeDefaultHandler) + ); + } + + static set describe(value) { + this[DESCRIBE] = value; + } + + static get it() { + return ( + this[IT] || + (typeof it === "function" ? it : itDefaultHandler) + ); + } + + static set it(value) { + this[IT] = value; + } + + /** + * Adds the `only` property to a test to run it in isolation. + * @param {string | ValidTestCase | InvalidTestCase} item A single test to run by itself. + * @returns {ValidTestCase | InvalidTestCase} The test with `only` set. + */ + static only(item) { + if (typeof item === "string") { + return { code: item, only: true }; + } + + return { ...item, only: true }; + } + + static get itOnly() { + if (typeof this[IT_ONLY] === "function") { + return this[IT_ONLY]; + } + if (typeof this[IT] === "function" && typeof this[IT].only === "function") { + return Function.bind.call(this[IT].only, this[IT]); + } + if (typeof it === "function" && typeof it.only === "function") { + return Function.bind.call(it.only, it); + } + + if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") { + throw new Error( + "Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" + + "See https://eslint.org/docs/developer-guide/nodejs-api#customizing-ruletester for more." + ); + } + if (typeof it === "function") { + throw new Error("The current test framework does not support exclusive tests with `only`."); + } + throw new Error("To use `only`, use RuleTester with a test framework that provides `it.only()` like Mocha."); + } + + static set itOnly(value) { + this[IT_ONLY] = value; + } + + + /** + * Adds a new rule test to execute. + * @param {string} ruleName The name of the rule to run. + * @param {Function} rule The rule to test. + * @param {{ + * valid: (ValidTestCase | string)[], + * invalid: InvalidTestCase[] + * }} test The collection of tests to run. + * @throws {TypeError|Error} If non-object `test`, or if a required + * scenario of the given type is missing. + * @returns {void} + */ + run(ruleName, rule, test) { + + const testerConfig = this.testerConfig, + requiredScenarios = ["valid", "invalid"], + scenarioErrors = [], + linter = this.linter, + ruleId = `rule-to-test/${ruleName}`; + + if (!test || typeof test !== "object") { + throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`); + } + + requiredScenarios.forEach(scenarioType => { + if (!test[scenarioType]) { + scenarioErrors.push(`Could not find any ${scenarioType} test scenarios`); + } + }); + + if (scenarioErrors.length > 0) { + throw new Error([ + `Test Scenarios for rule ${ruleName} is invalid:` + ].concat(scenarioErrors).join("\n")); + } + + const baseConfig = { + plugins: { + + // copy root plugin over + "@": { + + /* + * Parsers are wrapped to detect more errors, so this needs + * to be a new object for each call to run(), otherwise the + * parsers will be wrapped multiple times. + */ + parsers: { + ...defaultConfig[0].plugins["@"].parsers + }, + + /* + * The rules key on the default plugin is a proxy to lazy-load + * just the rules that are needed. So, don't create a new object + * here, just use the default one to keep that performance + * enhancement. + */ + rules: defaultConfig[0].plugins["@"].rules + }, + "rule-to-test": { + rules: { + [ruleName]: Object.assign({}, rule, { + + // Create a wrapper rule that freezes the `context` properties. + create(context) { + freezeDeeply(context.options); + freezeDeeply(context.settings); + freezeDeeply(context.parserOptions); + + // freezeDeeply(context.languageOptions); + + return (typeof rule === "function" ? rule : rule.create)(context); + } + }) + } + } + }, + languageOptions: { + ...defaultConfig[0].languageOptions + } + }; + + /** + * Run the rule for the given item + * @param {string|Object} item Item to run the rule against + * @throws {Error} If an invalid schema. + * @returns {Object} Eslint run result + * @private + */ + function runRuleForItem(item) { + const configs = new FlatConfigArray(testerConfig, { baseConfig }); + + /* + * Modify the returned config so that the parser is wrapped to catch + * access of the start/end properties. This method is called just + * once per code snippet being tested, so each test case gets a clean + * parser. + */ + configs[ConfigArraySymbol.finalizeConfig] = function(...args) { + + // can't do super here :( + const proto = Object.getPrototypeOf(this); + const calculatedConfig = proto[ConfigArraySymbol.finalizeConfig].apply(this, args); + + // wrap the parser to catch start/end property access + calculatedConfig.languageOptions.parser = wrapParser(calculatedConfig.languageOptions.parser); + return calculatedConfig; + }; + + let code, filename, output, beforeAST, afterAST; + + if (typeof item === "string") { + code = item; + } else { + code = item.code; + + /* + * Assumes everything on the item is a config except for the + * parameters used by this tester + */ + const itemConfig = { ...item }; + + for (const parameter of RuleTesterParameters) { + delete itemConfig[parameter]; + } + + // wrap any parsers + if (itemConfig.languageOptions && itemConfig.languageOptions.parser) { + + const parser = itemConfig.languageOptions.parser; + + if (parser && typeof parser !== "object") { + throw new Error("Parser must be an object with a parse() or parseForESLint() method."); + } + + } + + /* + * Create the config object from the tester config and this item + * specific configurations. + */ + configs.push(itemConfig); + } + + if (item.filename) { + filename = item.filename; + } + + let ruleConfig = 1; + + if (hasOwnProperty(item, "options")) { + assert(Array.isArray(item.options), "options must be an array"); + ruleConfig = [1, ...item.options]; + } + + configs.push({ + rules: { + [ruleId]: ruleConfig + } + }); + + const schema = getRuleOptionsSchema(rule); + + /* + * Setup AST getters. + * The goal is to check whether or not AST was modified when + * running the rule under test. + */ + configs.push({ + plugins: { + "rule-tester": { + rules: { + "validate-ast"() { + return { + Program(node) { + beforeAST = cloneDeeplyExcludesParent(node); + }, + "Program:exit"(node) { + afterAST = node; + } + }; + } + } + } + } + }); + + if (schema) { + ajv.validateSchema(schema); + + if (ajv.errors) { + const errors = ajv.errors.map(error => { + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `\t${field}: ${error.message}`; + }).join("\n"); + + throw new Error([`Schema for rule ${ruleName} is invalid:`, errors]); + } + + /* + * `ajv.validateSchema` checks for errors in the structure of the schema (by comparing the schema against a "meta-schema"), + * and it reports those errors individually. However, there are other types of schema errors that only occur when compiling + * the schema (e.g. using invalid defaults in a schema), and only one of these errors can be reported at a time. As a result, + * the schema is compiled here separately from checking for `validateSchema` errors. + */ + try { + ajv.compile(schema); + } catch (err) { + throw new Error(`Schema for rule ${ruleName} is invalid: ${err.message}`); + } + } + + // Verify the code. + const { getComments } = SourceCode.prototype; + let messages; + + // check for validation errors + try { + configs.normalizeSync(); + configs.getConfig("test.js"); + } catch (error) { + error.message = `ESLint configuration in rule-tester is invalid: ${error.message}`; + throw error; + } + + try { + SourceCode.prototype.getComments = getCommentsDeprecation; + messages = linter.verify(code, configs, filename); + } finally { + SourceCode.prototype.getComments = getComments; + } + + const fatalErrorMessage = messages.find(m => m.fatal); + + assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); + + // Verify if autofix makes a syntax error or not. + if (messages.some(m => m.fix)) { + output = SourceCodeFixer.applyFixes(code, messages).output; + const errorMessageInFix = linter.verify(output, configs, filename).find(m => m.fatal); + + assert(!errorMessageInFix, [ + "A fatal parsing error occurred in autofix.", + `Error: ${errorMessageInFix && errorMessageInFix.message}`, + "Autofix output:", + output + ].join("\n")); + } else { + output = code; + } + + return { + messages, + output, + beforeAST, + afterAST: cloneDeeplyExcludesParent(afterAST) + }; + } + + /** + * Check if the AST was changed + * @param {ASTNode} beforeAST AST node before running + * @param {ASTNode} afterAST AST node after running + * @returns {void} + * @private + */ + function assertASTDidntChange(beforeAST, afterAST) { + if (!equal(beforeAST, afterAST)) { + assert.fail("Rule should not modify AST."); + } + } + + /** + * Check if the template is valid or not + * all valid cases go through this + * @param {string|Object} item Item to run the rule against + * @returns {void} + * @private + */ + function testValidTemplate(item) { + const code = typeof item === "object" ? item.code : item; + + assert.ok(typeof code === "string", "Test case must specify a string value for 'code'"); + if (item.name) { + assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); + } + + const result = runRuleForItem(item); + const messages = result.messages; + + assert.strictEqual(messages.length, 0, util.format("Should have no errors but had %d: %s", + messages.length, + util.inspect(messages))); + + assertASTDidntChange(result.beforeAST, result.afterAST); + } + + /** + * Asserts that the message matches its expected value. If the expected + * value is a regular expression, it is checked against the actual + * value. + * @param {string} actual Actual value + * @param {string|RegExp} expected Expected value + * @returns {void} + * @private + */ + function assertMessageMatches(actual, expected) { + if (expected instanceof RegExp) { + + // assert.js doesn't have a built-in RegExp match function + assert.ok( + expected.test(actual), + `Expected '${actual}' to match ${expected}` + ); + } else { + assert.strictEqual(actual, expected); + } + } + + /** + * Check if the template is invalid or not + * all invalid cases go through this. + * @param {string|Object} item Item to run the rule against + * @returns {void} + * @private + */ + function testInvalidTemplate(item) { + assert.ok(typeof item.code === "string", "Test case must specify a string value for 'code'"); + if (item.name) { + assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); + } + assert.ok(item.errors || item.errors === 0, + `Did not specify errors for an invalid test of ${ruleName}`); + + if (Array.isArray(item.errors) && item.errors.length === 0) { + assert.fail("Invalid cases must have at least one error"); + } + + const ruleHasMetaMessages = hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"); + const friendlyIDList = ruleHasMetaMessages ? `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]` : null; + + const result = runRuleForItem(item); + const messages = result.messages; + + if (typeof item.errors === "number") { + + if (item.errors === 0) { + assert.fail("Invalid cases must have 'error' value greater than 0"); + } + + assert.strictEqual(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s", + item.errors, + item.errors === 1 ? "" : "s", + messages.length, + util.inspect(messages))); + } else { + assert.strictEqual( + messages.length, item.errors.length, util.format( + "Should have %d error%s but had %d: %s", + item.errors.length, + item.errors.length === 1 ? "" : "s", + messages.length, + util.inspect(messages) + ) + ); + + const hasMessageOfThisRule = messages.some(m => m.ruleId === ruleId); + + for (let i = 0, l = item.errors.length; i < l; i++) { + const error = item.errors[i]; + const message = messages[i]; + + assert(hasMessageOfThisRule, "Error rule name should be the same as the name of the rule being tested"); + + if (typeof error === "string" || error instanceof RegExp) { + + // Just an error message. + assertMessageMatches(message.message, error); + } else if (typeof error === "object" && error !== null) { + + /* + * Error object. + * This may have a message, messageId, data, node type, line, and/or + * column. + */ + + Object.keys(error).forEach(propertyName => { + assert.ok( + errorObjectParameters.has(propertyName), + `Invalid error property name '${propertyName}'. Expected one of ${friendlyErrorObjectParameterList}.` + ); + }); + + if (hasOwnProperty(error, "message")) { + assert.ok(!hasOwnProperty(error, "messageId"), "Error should not specify both 'message' and a 'messageId'."); + assert.ok(!hasOwnProperty(error, "data"), "Error should not specify both 'data' and 'message'."); + assertMessageMatches(message.message, error.message); + } else if (hasOwnProperty(error, "messageId")) { + assert.ok( + ruleHasMetaMessages, + "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'." + ); + if (!hasOwnProperty(rule.meta.messages, error.messageId)) { + assert(false, `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`); + } + assert.strictEqual( + message.messageId, + error.messageId, + `messageId '${message.messageId}' does not match expected messageId '${error.messageId}'.` + ); + if (hasOwnProperty(error, "data")) { + + /* + * if data was provided, then directly compare the returned message to a synthetic + * interpolated message using the same message ID and data provided in the test. + * See https://github.com/eslint/eslint/issues/9890 for context. + */ + const unformattedOriginalMessage = rule.meta.messages[error.messageId]; + const rehydratedMessage = interpolate(unformattedOriginalMessage, error.data); + + assert.strictEqual( + message.message, + rehydratedMessage, + `Hydrated message "${rehydratedMessage}" does not match "${message.message}"` + ); + } + } + + assert.ok( + hasOwnProperty(error, "data") ? hasOwnProperty(error, "messageId") : true, + "Error must specify 'messageId' if 'data' is used." + ); + + if (error.type) { + assert.strictEqual(message.nodeType, error.type, `Error type should be ${error.type}, found ${message.nodeType}`); + } + + if (hasOwnProperty(error, "line")) { + assert.strictEqual(message.line, error.line, `Error line should be ${error.line}`); + } + + if (hasOwnProperty(error, "column")) { + assert.strictEqual(message.column, error.column, `Error column should be ${error.column}`); + } + + if (hasOwnProperty(error, "endLine")) { + assert.strictEqual(message.endLine, error.endLine, `Error endLine should be ${error.endLine}`); + } + + if (hasOwnProperty(error, "endColumn")) { + assert.strictEqual(message.endColumn, error.endColumn, `Error endColumn should be ${error.endColumn}`); + } + + if (hasOwnProperty(error, "suggestions")) { + + // Support asserting there are no suggestions + if (!error.suggestions || (Array.isArray(error.suggestions) && error.suggestions.length === 0)) { + if (Array.isArray(message.suggestions) && message.suggestions.length > 0) { + assert.fail(`Error should have no suggestions on error with message: "${message.message}"`); + } + } else { + assert.strictEqual(Array.isArray(message.suggestions), true, `Error should have an array of suggestions. Instead received "${message.suggestions}" on error with message: "${message.message}"`); + assert.strictEqual(message.suggestions.length, error.suggestions.length, `Error should have ${error.suggestions.length} suggestions. Instead found ${message.suggestions.length} suggestions`); + + error.suggestions.forEach((expectedSuggestion, index) => { + assert.ok( + typeof expectedSuggestion === "object" && expectedSuggestion !== null, + "Test suggestion in 'suggestions' array must be an object." + ); + Object.keys(expectedSuggestion).forEach(propertyName => { + assert.ok( + suggestionObjectParameters.has(propertyName), + `Invalid suggestion property name '${propertyName}'. Expected one of ${friendlySuggestionObjectParameterList}.` + ); + }); + + const actualSuggestion = message.suggestions[index]; + const suggestionPrefix = `Error Suggestion at index ${index} :`; + + if (hasOwnProperty(expectedSuggestion, "desc")) { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test should not specify both 'desc' and 'data'.` + ); + assert.strictEqual( + actualSuggestion.desc, + expectedSuggestion.desc, + `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` + ); + } + + if (hasOwnProperty(expectedSuggestion, "messageId")) { + assert.ok( + ruleHasMetaMessages, + `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.` + ); + assert.ok( + hasOwnProperty(rule.meta.messages, expectedSuggestion.messageId), + `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.` + ); + assert.strictEqual( + actualSuggestion.messageId, + expectedSuggestion.messageId, + `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.` + ); + if (hasOwnProperty(expectedSuggestion, "data")) { + const unformattedMetaMessage = rule.meta.messages[expectedSuggestion.messageId]; + const rehydratedDesc = interpolate(unformattedMetaMessage, expectedSuggestion.data); + + assert.strictEqual( + actualSuggestion.desc, + rehydratedDesc, + `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".` + ); + } + } else { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` + ); + } + + if (hasOwnProperty(expectedSuggestion, "output")) { + const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; + + assert.strictEqual(codeWithAppliedSuggestion, expectedSuggestion.output, `Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${index} on error with message: "${message.message}"`); + } + }); + } + } + } else { + + // Message was an unexpected type + assert.fail(`Error should be a string, object, or RegExp, but found (${util.inspect(message)})`); + } + } + } + + if (hasOwnProperty(item, "output")) { + if (item.output === null) { + assert.strictEqual( + result.output, + item.code, + "Expected no autofixes to be suggested" + ); + } else { + assert.strictEqual(result.output, item.output, "Output is incorrect."); + } + } else { + assert.strictEqual( + result.output, + item.code, + "The rule fixed the code. Please add 'output' property." + ); + } + + assertASTDidntChange(result.beforeAST, result.afterAST); + } + + /* + * This creates a mocha test suite and pipes all supplied info through + * one of the templates above. + */ + this.constructor.describe(ruleName, () => { + this.constructor.describe("valid", () => { + test.valid.forEach(valid => { + this.constructor[valid.only ? "itOnly" : "it"]( + sanitize(typeof valid === "object" ? valid.name || valid.code : valid), + () => { + testValidTemplate(valid); + } + ); + }); + }); + + this.constructor.describe("invalid", () => { + test.invalid.forEach(invalid => { + this.constructor[invalid.only ? "itOnly" : "it"]( + sanitize(invalid.name || invalid.code), + () => { + testInvalidTemplate(invalid); + } + ); + }); + }); + }); + } +} + +FlatRuleTester[DESCRIBE] = FlatRuleTester[IT] = FlatRuleTester[IT_ONLY] = null; + +module.exports = FlatRuleTester; diff --git a/node_modules/eslint/lib/rule-tester/index.js b/node_modules/eslint/lib/rule-tester/index.js new file mode 100644 index 0000000..f52d140 --- /dev/null +++ b/node_modules/eslint/lib/rule-tester/index.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + RuleTester: require("./rule-tester") +}; diff --git a/node_modules/eslint/lib/rule-tester/rule-tester.js b/node_modules/eslint/lib/rule-tester/rule-tester.js new file mode 100644 index 0000000..398f210 --- /dev/null +++ b/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -0,0 +1,1008 @@ +/** + * @fileoverview Mocha test wrapper + * @author Ilya Volodin + */ +"use strict"; + +/* eslint-env mocha -- Mocha wrapper */ + +/* + * This is a wrapper around mocha to allow for DRY unittests for eslint + * Format: + * RuleTester.run("{ruleName}", { + * valid: [ + * "{code}", + * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings} } + * ], + * invalid: [ + * { code: "{code}", errors: {numErrors} }, + * { code: "{code}", errors: ["{errorMessage}"] }, + * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings}, errors: [{ message: "{errorMessage}", type: "{errorNodeType}"}] } + * ] + * }); + * + * Variables: + * {code} - String that represents the code to be tested + * {options} - Arguments that are passed to the configurable rules. + * {globals} - An object representing a list of variables that are + * registered as globals + * {parser} - String representing the parser to use + * {settings} - An object representing global settings for all rules + * {numErrors} - If failing case doesn't need to check error message, + * this integer will specify how many errors should be + * received + * {errorMessage} - Message that is returned by the rule on failure + * {errorNodeType} - AST node type that is returned by they rule as + * a cause of the failure. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const + assert = require("assert"), + path = require("path"), + util = require("util"), + merge = require("lodash.merge"), + equal = require("fast-deep-equal"), + Traverser = require("../../lib/shared/traverser"), + { getRuleOptionsSchema, validate } = require("../shared/config-validator"), + { Linter, SourceCodeFixer, interpolate } = require("../linter"); + +const ajv = require("../shared/ajv")({ strictDefaults: true }); + +const espreePath = require.resolve("espree"); +const parserSymbol = Symbol.for("eslint.RuleTester.parser"); + +const { SourceCode } = require("../source-code"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** @typedef {import("../shared/types").Parser} Parser */ + +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ +/** + * A test case that is expected to pass lint. + * @typedef {Object} ValidTestCase + * @property {string} [name] Name for the test case. + * @property {string} code Code for the test case. + * @property {any[]} [options] Options for the test case. + * @property {{ [name: string]: any }} [settings] Settings for the test case. + * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. + * @property {string} [parser] The absolute path for the parser. + * @property {{ [name: string]: any }} [parserOptions] Options for the parser. + * @property {{ [name: string]: "readonly" | "writable" | "off" }} [globals] The additional global variables. + * @property {{ [name: string]: boolean }} [env] Environments for the test case. + * @property {boolean} [only] Run only this test case or the subset of test cases with this property. + */ + +/** + * A test case that is expected to fail lint. + * @typedef {Object} InvalidTestCase + * @property {string} [name] Name for the test case. + * @property {string} code Code for the test case. + * @property {number | Array} errors Expected errors. + * @property {string | null} [output] The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. + * @property {any[]} [options] Options for the test case. + * @property {{ [name: string]: any }} [settings] Settings for the test case. + * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. + * @property {string} [parser] The absolute path for the parser. + * @property {{ [name: string]: any }} [parserOptions] Options for the parser. + * @property {{ [name: string]: "readonly" | "writable" | "off" }} [globals] The additional global variables. + * @property {{ [name: string]: boolean }} [env] Environments for the test case. + * @property {boolean} [only] Run only this test case or the subset of test cases with this property. + */ + +/** + * A description of a reported error used in a rule tester test. + * @typedef {Object} TestCaseError + * @property {string | RegExp} [message] Message. + * @property {string} [messageId] Message ID. + * @property {string} [type] The type of the reported AST node. + * @property {{ [name: string]: string }} [data] The data used to fill the message template. + * @property {number} [line] The 1-based line number of the reported start location. + * @property {number} [column] The 1-based column number of the reported start location. + * @property {number} [endLine] The 1-based line number of the reported end location. + * @property {number} [endColumn] The 1-based column number of the reported end location. + */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ + +//------------------------------------------------------------------------------ +// Private Members +//------------------------------------------------------------------------------ + +/* + * testerDefaultConfig must not be modified as it allows to reset the tester to + * the initial default configuration + */ +const testerDefaultConfig = { rules: {} }; +let defaultConfig = { rules: {} }; + +/* + * List every parameters possible on a test case that are not related to eslint + * configuration + */ +const RuleTesterParameters = [ + "name", + "code", + "filename", + "options", + "errors", + "output", + "only" +]; + +/* + * All allowed property names in error objects. + */ +const errorObjectParameters = new Set([ + "message", + "messageId", + "data", + "type", + "line", + "column", + "endLine", + "endColumn", + "suggestions" +]); +const friendlyErrorObjectParameterList = `[${[...errorObjectParameters].map(key => `'${key}'`).join(", ")}]`; + +/* + * All allowed property names in suggestion objects. + */ +const suggestionObjectParameters = new Set([ + "desc", + "messageId", + "data", + "output" +]); +const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`; + +const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); + +/** + * Clones a given value deeply. + * Note: This ignores `parent` property. + * @param {any} x A value to clone. + * @returns {any} A cloned value. + */ +function cloneDeeplyExcludesParent(x) { + if (typeof x === "object" && x !== null) { + if (Array.isArray(x)) { + return x.map(cloneDeeplyExcludesParent); + } + + const retv = {}; + + for (const key in x) { + if (key !== "parent" && hasOwnProperty(x, key)) { + retv[key] = cloneDeeplyExcludesParent(x[key]); + } + } + + return retv; + } + + return x; +} + +/** + * Freezes a given value deeply. + * @param {any} x A value to freeze. + * @returns {void} + */ +function freezeDeeply(x) { + if (typeof x === "object" && x !== null) { + if (Array.isArray(x)) { + x.forEach(freezeDeeply); + } else { + for (const key in x) { + if (key !== "parent" && hasOwnProperty(x, key)) { + freezeDeeply(x[key]); + } + } + } + Object.freeze(x); + } +} + +/** + * Replace control characters by `\u00xx` form. + * @param {string} text The text to sanitize. + * @returns {string} The sanitized text. + */ +function sanitize(text) { + if (typeof text !== "string") { + return ""; + } + return text.replace( + /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex -- Escaping controls + c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` + ); +} + +/** + * Define `start`/`end` properties as throwing error. + * @param {string} objName Object name used for error messages. + * @param {ASTNode} node The node to define. + * @returns {void} + */ +function defineStartEndAsError(objName, node) { + Object.defineProperties(node, { + start: { + get() { + throw new Error(`Use ${objName}.range[0] instead of ${objName}.start`); + }, + configurable: true, + enumerable: false + }, + end: { + get() { + throw new Error(`Use ${objName}.range[1] instead of ${objName}.end`); + }, + configurable: true, + enumerable: false + } + }); +} + + +/** + * Define `start`/`end` properties of all nodes of the given AST as throwing error. + * @param {ASTNode} ast The root node to errorize `start`/`end` properties. + * @param {Object} [visitorKeys] Visitor keys to be used for traversing the given ast. + * @returns {void} + */ +function defineStartEndAsErrorInTree(ast, visitorKeys) { + Traverser.traverse(ast, { visitorKeys, enter: defineStartEndAsError.bind(null, "node") }); + ast.tokens.forEach(defineStartEndAsError.bind(null, "token")); + ast.comments.forEach(defineStartEndAsError.bind(null, "token")); +} + +/** + * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. + * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. + * @param {Parser} parser Parser object. + * @returns {Parser} Wrapped parser object. + */ +function wrapParser(parser) { + + if (typeof parser.parseForESLint === "function") { + return { + [parserSymbol]: parser, + parseForESLint(...args) { + const ret = parser.parseForESLint(...args); + + defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); + return ret; + } + }; + } + + return { + [parserSymbol]: parser, + parse(...args) { + const ast = parser.parse(...args); + + defineStartEndAsErrorInTree(ast); + return ast; + } + }; +} + +/** + * Function to replace `SourceCode.prototype.getComments`. + * @returns {void} + * @throws {Error} Deprecation message. + */ +function getCommentsDeprecation() { + throw new Error( + "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead." + ); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +// default separators for testing +const DESCRIBE = Symbol("describe"); +const IT = Symbol("it"); +const IT_ONLY = Symbol("itOnly"); + +/** + * This is `it` default handler if `it` don't exist. + * @this {Mocha} + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. + * @throws {Error} Any error upon execution of `method`. + * @returns {any} Returned value of `method`. + */ +function itDefaultHandler(text, method) { + try { + return method.call(this); + } catch (err) { + if (err instanceof assert.AssertionError) { + err.message += ` (${util.inspect(err.actual)} ${err.operator} ${util.inspect(err.expected)})`; + } + throw err; + } +} + +/** + * This is `describe` default handler if `describe` don't exist. + * @this {Mocha} + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. + * @returns {any} Returned value of `method`. + */ +function describeDefaultHandler(text, method) { + return method.call(this); +} + +/** + * Mocha test wrapper. + */ +class RuleTester { + + /** + * Creates a new instance of RuleTester. + * @param {Object} [testerConfig] Optional, extra configuration for the tester + */ + constructor(testerConfig) { + + /** + * The configuration to use for this tester. Combination of the tester + * configuration and the default configuration. + * @type {Object} + */ + this.testerConfig = merge( + {}, + defaultConfig, + testerConfig, + { rules: { "rule-tester/validate-ast": "error" } } + ); + + /** + * Rule definitions to define before tests. + * @type {Object} + */ + this.rules = {}; + this.linter = new Linter(); + } + + /** + * Set the configuration to use for all future tests + * @param {Object} config the configuration to use. + * @throws {TypeError} If non-object config. + * @returns {void} + */ + static setDefaultConfig(config) { + if (typeof config !== "object") { + throw new TypeError("RuleTester.setDefaultConfig: config must be an object"); + } + defaultConfig = config; + + // Make sure the rules object exists since it is assumed to exist later + defaultConfig.rules = defaultConfig.rules || {}; + } + + /** + * Get the current configuration used for all tests + * @returns {Object} the current configuration + */ + static getDefaultConfig() { + return defaultConfig; + } + + /** + * Reset the configuration to the initial configuration of the tester removing + * any changes made until now. + * @returns {void} + */ + static resetDefaultConfig() { + defaultConfig = merge({}, testerDefaultConfig); + } + + + /* + * If people use `mocha test.js --watch` command, `describe` and `it` function + * instances are different for each execution. So `describe` and `it` should get fresh instance + * always. + */ + static get describe() { + return ( + this[DESCRIBE] || + (typeof describe === "function" ? describe : describeDefaultHandler) + ); + } + + static set describe(value) { + this[DESCRIBE] = value; + } + + static get it() { + return ( + this[IT] || + (typeof it === "function" ? it : itDefaultHandler) + ); + } + + static set it(value) { + this[IT] = value; + } + + /** + * Adds the `only` property to a test to run it in isolation. + * @param {string | ValidTestCase | InvalidTestCase} item A single test to run by itself. + * @returns {ValidTestCase | InvalidTestCase} The test with `only` set. + */ + static only(item) { + if (typeof item === "string") { + return { code: item, only: true }; + } + + return { ...item, only: true }; + } + + static get itOnly() { + if (typeof this[IT_ONLY] === "function") { + return this[IT_ONLY]; + } + if (typeof this[IT] === "function" && typeof this[IT].only === "function") { + return Function.bind.call(this[IT].only, this[IT]); + } + if (typeof it === "function" && typeof it.only === "function") { + return Function.bind.call(it.only, it); + } + + if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") { + throw new Error( + "Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" + + "See https://eslint.org/docs/developer-guide/nodejs-api#customizing-ruletester for more." + ); + } + if (typeof it === "function") { + throw new Error("The current test framework does not support exclusive tests with `only`."); + } + throw new Error("To use `only`, use RuleTester with a test framework that provides `it.only()` like Mocha."); + } + + static set itOnly(value) { + this[IT_ONLY] = value; + } + + /** + * Define a rule for one particular run of tests. + * @param {string} name The name of the rule to define. + * @param {Function} rule The rule definition. + * @returns {void} + */ + defineRule(name, rule) { + this.rules[name] = rule; + } + + /** + * Adds a new rule test to execute. + * @param {string} ruleName The name of the rule to run. + * @param {Function} rule The rule to test. + * @param {{ + * valid: (ValidTestCase | string)[], + * invalid: InvalidTestCase[] + * }} test The collection of tests to run. + * @throws {TypeError|Error} If non-object `test`, or if a required + * scenario of the given type is missing. + * @returns {void} + */ + run(ruleName, rule, test) { + + const testerConfig = this.testerConfig, + requiredScenarios = ["valid", "invalid"], + scenarioErrors = [], + linter = this.linter; + + if (!test || typeof test !== "object") { + throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`); + } + + requiredScenarios.forEach(scenarioType => { + if (!test[scenarioType]) { + scenarioErrors.push(`Could not find any ${scenarioType} test scenarios`); + } + }); + + if (scenarioErrors.length > 0) { + throw new Error([ + `Test Scenarios for rule ${ruleName} is invalid:` + ].concat(scenarioErrors).join("\n")); + } + + + linter.defineRule(ruleName, Object.assign({}, rule, { + + // Create a wrapper rule that freezes the `context` properties. + create(context) { + freezeDeeply(context.options); + freezeDeeply(context.settings); + freezeDeeply(context.parserOptions); + + return (typeof rule === "function" ? rule : rule.create)(context); + } + })); + + linter.defineRules(this.rules); + + /** + * Run the rule for the given item + * @param {string|Object} item Item to run the rule against + * @throws {Error} If an invalid schema. + * @returns {Object} Eslint run result + * @private + */ + function runRuleForItem(item) { + let config = merge({}, testerConfig), + code, filename, output, beforeAST, afterAST; + + if (typeof item === "string") { + code = item; + } else { + code = item.code; + + /* + * Assumes everything on the item is a config except for the + * parameters used by this tester + */ + const itemConfig = { ...item }; + + for (const parameter of RuleTesterParameters) { + delete itemConfig[parameter]; + } + + /* + * Create the config object from the tester config and this item + * specific configurations. + */ + config = merge( + config, + itemConfig + ); + } + + if (item.filename) { + filename = item.filename; + } + + if (hasOwnProperty(item, "options")) { + assert(Array.isArray(item.options), "options must be an array"); + config.rules[ruleName] = [1].concat(item.options); + } else { + config.rules[ruleName] = 1; + } + + const schema = getRuleOptionsSchema(rule); + + /* + * Setup AST getters. + * The goal is to check whether or not AST was modified when + * running the rule under test. + */ + linter.defineRule("rule-tester/validate-ast", () => ({ + Program(node) { + beforeAST = cloneDeeplyExcludesParent(node); + }, + "Program:exit"(node) { + afterAST = node; + } + })); + + if (typeof config.parser === "string") { + assert(path.isAbsolute(config.parser), "Parsers provided as strings to RuleTester must be absolute paths"); + } else { + config.parser = espreePath; + } + + linter.defineParser(config.parser, wrapParser(require(config.parser))); + + if (schema) { + ajv.validateSchema(schema); + + if (ajv.errors) { + const errors = ajv.errors.map(error => { + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `\t${field}: ${error.message}`; + }).join("\n"); + + throw new Error([`Schema for rule ${ruleName} is invalid:`, errors]); + } + + /* + * `ajv.validateSchema` checks for errors in the structure of the schema (by comparing the schema against a "meta-schema"), + * and it reports those errors individually. However, there are other types of schema errors that only occur when compiling + * the schema (e.g. using invalid defaults in a schema), and only one of these errors can be reported at a time. As a result, + * the schema is compiled here separately from checking for `validateSchema` errors. + */ + try { + ajv.compile(schema); + } catch (err) { + throw new Error(`Schema for rule ${ruleName} is invalid: ${err.message}`); + } + } + + validate(config, "rule-tester", id => (id === ruleName ? rule : null)); + + // Verify the code. + const { getComments } = SourceCode.prototype; + let messages; + + try { + SourceCode.prototype.getComments = getCommentsDeprecation; + messages = linter.verify(code, config, filename); + } finally { + SourceCode.prototype.getComments = getComments; + } + + const fatalErrorMessage = messages.find(m => m.fatal); + + assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); + + // Verify if autofix makes a syntax error or not. + if (messages.some(m => m.fix)) { + output = SourceCodeFixer.applyFixes(code, messages).output; + const errorMessageInFix = linter.verify(output, config, filename).find(m => m.fatal); + + assert(!errorMessageInFix, [ + "A fatal parsing error occurred in autofix.", + `Error: ${errorMessageInFix && errorMessageInFix.message}`, + "Autofix output:", + output + ].join("\n")); + } else { + output = code; + } + + return { + messages, + output, + beforeAST, + afterAST: cloneDeeplyExcludesParent(afterAST) + }; + } + + /** + * Check if the AST was changed + * @param {ASTNode} beforeAST AST node before running + * @param {ASTNode} afterAST AST node after running + * @returns {void} + * @private + */ + function assertASTDidntChange(beforeAST, afterAST) { + if (!equal(beforeAST, afterAST)) { + assert.fail("Rule should not modify AST."); + } + } + + /** + * Check if the template is valid or not + * all valid cases go through this + * @param {string|Object} item Item to run the rule against + * @returns {void} + * @private + */ + function testValidTemplate(item) { + const code = typeof item === "object" ? item.code : item; + + assert.ok(typeof code === "string", "Test case must specify a string value for 'code'"); + if (item.name) { + assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); + } + + const result = runRuleForItem(item); + const messages = result.messages; + + assert.strictEqual(messages.length, 0, util.format("Should have no errors but had %d: %s", + messages.length, + util.inspect(messages))); + + assertASTDidntChange(result.beforeAST, result.afterAST); + } + + /** + * Asserts that the message matches its expected value. If the expected + * value is a regular expression, it is checked against the actual + * value. + * @param {string} actual Actual value + * @param {string|RegExp} expected Expected value + * @returns {void} + * @private + */ + function assertMessageMatches(actual, expected) { + if (expected instanceof RegExp) { + + // assert.js doesn't have a built-in RegExp match function + assert.ok( + expected.test(actual), + `Expected '${actual}' to match ${expected}` + ); + } else { + assert.strictEqual(actual, expected); + } + } + + /** + * Check if the template is invalid or not + * all invalid cases go through this. + * @param {string|Object} item Item to run the rule against + * @returns {void} + * @private + */ + function testInvalidTemplate(item) { + assert.ok(typeof item.code === "string", "Test case must specify a string value for 'code'"); + if (item.name) { + assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); + } + assert.ok(item.errors || item.errors === 0, + `Did not specify errors for an invalid test of ${ruleName}`); + + if (Array.isArray(item.errors) && item.errors.length === 0) { + assert.fail("Invalid cases must have at least one error"); + } + + const ruleHasMetaMessages = hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"); + const friendlyIDList = ruleHasMetaMessages ? `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]` : null; + + const result = runRuleForItem(item); + const messages = result.messages; + + if (typeof item.errors === "number") { + + if (item.errors === 0) { + assert.fail("Invalid cases must have 'error' value greater than 0"); + } + + assert.strictEqual(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s", + item.errors, + item.errors === 1 ? "" : "s", + messages.length, + util.inspect(messages))); + } else { + assert.strictEqual( + messages.length, item.errors.length, util.format( + "Should have %d error%s but had %d: %s", + item.errors.length, + item.errors.length === 1 ? "" : "s", + messages.length, + util.inspect(messages) + ) + ); + + const hasMessageOfThisRule = messages.some(m => m.ruleId === ruleName); + + for (let i = 0, l = item.errors.length; i < l; i++) { + const error = item.errors[i]; + const message = messages[i]; + + assert(hasMessageOfThisRule, "Error rule name should be the same as the name of the rule being tested"); + + if (typeof error === "string" || error instanceof RegExp) { + + // Just an error message. + assertMessageMatches(message.message, error); + } else if (typeof error === "object" && error !== null) { + + /* + * Error object. + * This may have a message, messageId, data, node type, line, and/or + * column. + */ + + Object.keys(error).forEach(propertyName => { + assert.ok( + errorObjectParameters.has(propertyName), + `Invalid error property name '${propertyName}'. Expected one of ${friendlyErrorObjectParameterList}.` + ); + }); + + if (hasOwnProperty(error, "message")) { + assert.ok(!hasOwnProperty(error, "messageId"), "Error should not specify both 'message' and a 'messageId'."); + assert.ok(!hasOwnProperty(error, "data"), "Error should not specify both 'data' and 'message'."); + assertMessageMatches(message.message, error.message); + } else if (hasOwnProperty(error, "messageId")) { + assert.ok( + ruleHasMetaMessages, + "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'." + ); + if (!hasOwnProperty(rule.meta.messages, error.messageId)) { + assert(false, `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`); + } + assert.strictEqual( + message.messageId, + error.messageId, + `messageId '${message.messageId}' does not match expected messageId '${error.messageId}'.` + ); + if (hasOwnProperty(error, "data")) { + + /* + * if data was provided, then directly compare the returned message to a synthetic + * interpolated message using the same message ID and data provided in the test. + * See https://github.com/eslint/eslint/issues/9890 for context. + */ + const unformattedOriginalMessage = rule.meta.messages[error.messageId]; + const rehydratedMessage = interpolate(unformattedOriginalMessage, error.data); + + assert.strictEqual( + message.message, + rehydratedMessage, + `Hydrated message "${rehydratedMessage}" does not match "${message.message}"` + ); + } + } + + assert.ok( + hasOwnProperty(error, "data") ? hasOwnProperty(error, "messageId") : true, + "Error must specify 'messageId' if 'data' is used." + ); + + if (error.type) { + assert.strictEqual(message.nodeType, error.type, `Error type should be ${error.type}, found ${message.nodeType}`); + } + + if (hasOwnProperty(error, "line")) { + assert.strictEqual(message.line, error.line, `Error line should be ${error.line}`); + } + + if (hasOwnProperty(error, "column")) { + assert.strictEqual(message.column, error.column, `Error column should be ${error.column}`); + } + + if (hasOwnProperty(error, "endLine")) { + assert.strictEqual(message.endLine, error.endLine, `Error endLine should be ${error.endLine}`); + } + + if (hasOwnProperty(error, "endColumn")) { + assert.strictEqual(message.endColumn, error.endColumn, `Error endColumn should be ${error.endColumn}`); + } + + if (hasOwnProperty(error, "suggestions")) { + + // Support asserting there are no suggestions + if (!error.suggestions || (Array.isArray(error.suggestions) && error.suggestions.length === 0)) { + if (Array.isArray(message.suggestions) && message.suggestions.length > 0) { + assert.fail(`Error should have no suggestions on error with message: "${message.message}"`); + } + } else { + assert.strictEqual(Array.isArray(message.suggestions), true, `Error should have an array of suggestions. Instead received "${message.suggestions}" on error with message: "${message.message}"`); + assert.strictEqual(message.suggestions.length, error.suggestions.length, `Error should have ${error.suggestions.length} suggestions. Instead found ${message.suggestions.length} suggestions`); + + error.suggestions.forEach((expectedSuggestion, index) => { + assert.ok( + typeof expectedSuggestion === "object" && expectedSuggestion !== null, + "Test suggestion in 'suggestions' array must be an object." + ); + Object.keys(expectedSuggestion).forEach(propertyName => { + assert.ok( + suggestionObjectParameters.has(propertyName), + `Invalid suggestion property name '${propertyName}'. Expected one of ${friendlySuggestionObjectParameterList}.` + ); + }); + + const actualSuggestion = message.suggestions[index]; + const suggestionPrefix = `Error Suggestion at index ${index} :`; + + if (hasOwnProperty(expectedSuggestion, "desc")) { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test should not specify both 'desc' and 'data'.` + ); + assert.strictEqual( + actualSuggestion.desc, + expectedSuggestion.desc, + `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` + ); + } + + if (hasOwnProperty(expectedSuggestion, "messageId")) { + assert.ok( + ruleHasMetaMessages, + `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.` + ); + assert.ok( + hasOwnProperty(rule.meta.messages, expectedSuggestion.messageId), + `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.` + ); + assert.strictEqual( + actualSuggestion.messageId, + expectedSuggestion.messageId, + `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.` + ); + if (hasOwnProperty(expectedSuggestion, "data")) { + const unformattedMetaMessage = rule.meta.messages[expectedSuggestion.messageId]; + const rehydratedDesc = interpolate(unformattedMetaMessage, expectedSuggestion.data); + + assert.strictEqual( + actualSuggestion.desc, + rehydratedDesc, + `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".` + ); + } + } else { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` + ); + } + + if (hasOwnProperty(expectedSuggestion, "output")) { + const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; + + assert.strictEqual(codeWithAppliedSuggestion, expectedSuggestion.output, `Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${index} on error with message: "${message.message}"`); + } + }); + } + } + } else { + + // Message was an unexpected type + assert.fail(`Error should be a string, object, or RegExp, but found (${util.inspect(message)})`); + } + } + } + + if (hasOwnProperty(item, "output")) { + if (item.output === null) { + assert.strictEqual( + result.output, + item.code, + "Expected no autofixes to be suggested" + ); + } else { + assert.strictEqual(result.output, item.output, "Output is incorrect."); + } + } else { + assert.strictEqual( + result.output, + item.code, + "The rule fixed the code. Please add 'output' property." + ); + } + + assertASTDidntChange(result.beforeAST, result.afterAST); + } + + /* + * This creates a mocha test suite and pipes all supplied info through + * one of the templates above. + */ + this.constructor.describe(ruleName, () => { + this.constructor.describe("valid", () => { + test.valid.forEach(valid => { + this.constructor[valid.only ? "itOnly" : "it"]( + sanitize(typeof valid === "object" ? valid.name || valid.code : valid), + () => { + testValidTemplate(valid); + } + ); + }); + }); + + this.constructor.describe("invalid", () => { + test.invalid.forEach(invalid => { + this.constructor[invalid.only ? "itOnly" : "it"]( + sanitize(invalid.name || invalid.code), + () => { + testInvalidTemplate(invalid); + } + ); + }); + }); + }); + } +} + +RuleTester[DESCRIBE] = RuleTester[IT] = RuleTester[IT_ONLY] = null; + +module.exports = RuleTester; diff --git a/node_modules/eslint/lib/rules/accessor-pairs.js b/node_modules/eslint/lib/rules/accessor-pairs.js new file mode 100644 index 0000000..33887af --- /dev/null +++ b/node_modules/eslint/lib/rules/accessor-pairs.js @@ -0,0 +1,354 @@ +/** + * @fileoverview Rule to enforce getter and setter pairs in objects and classes. + * @author Gyandeep Singh + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * Property name if it can be computed statically, otherwise the list of the tokens of the key node. + * @typedef {string|Token[]} Key + */ + +/** + * Accessor nodes with the same key. + * @typedef {Object} AccessorData + * @property {Key} key Accessor's key + * @property {ASTNode[]} getters List of getter nodes. + * @property {ASTNode[]} setters List of setter nodes. + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not the given lists represent the equal tokens in the same order. + * Tokens are compared by their properties, not by instance. + * @param {Token[]} left First list of tokens. + * @param {Token[]} right Second list of tokens. + * @returns {boolean} `true` if the lists have same tokens. + */ +function areEqualTokenLists(left, right) { + if (left.length !== right.length) { + return false; + } + + for (let i = 0; i < left.length; i++) { + const leftToken = left[i], + rightToken = right[i]; + + if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) { + return false; + } + } + + return true; +} + +/** + * Checks whether or not the given keys are equal. + * @param {Key} left First key. + * @param {Key} right Second key. + * @returns {boolean} `true` if the keys are equal. + */ +function areEqualKeys(left, right) { + if (typeof left === "string" && typeof right === "string") { + + // Statically computed names. + return left === right; + } + if (Array.isArray(left) && Array.isArray(right)) { + + // Token lists. + return areEqualTokenLists(left, right); + } + + return false; +} + +/** + * Checks whether or not a given node is of an accessor kind ('get' or 'set'). + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is of an accessor kind. + */ +function isAccessorKind(node) { + return node.kind === "get" || node.kind === "set"; +} + +/** + * Checks whether or not a given node is an argument of a specified method call. + * @param {ASTNode} node A node to check. + * @param {number} index An expected index of the node in arguments. + * @param {string} object An expected name of the object of the method. + * @param {string} property An expected name of the method. + * @returns {boolean} `true` if the node is an argument of the specified method call. + */ +function isArgumentOfMethodCall(node, index, object, property) { + const parent = node.parent; + + return ( + parent.type === "CallExpression" && + astUtils.isSpecificMemberAccess(parent.callee, object, property) && + parent.arguments[index] === node + ); +} + +/** + * Checks whether or not a given node is a property descriptor. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a property descriptor. + */ +function isPropertyDescriptor(node) { + + // Object.defineProperty(obj, "foo", {set: ...}) + if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") || + isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty") + ) { + return true; + } + + /* + * Object.defineProperties(obj, {foo: {set: ...}}) + * Object.create(proto, {foo: {set: ...}}) + */ + const grandparent = node.parent.parent; + + return grandparent.type === "ObjectExpression" && ( + isArgumentOfMethodCall(grandparent, 1, "Object", "create") || + isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties") + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce getter and setter pairs in objects and classes", + recommended: false, + url: "https://eslint.org/docs/rules/accessor-pairs" + }, + + schema: [{ + type: "object", + properties: { + getWithoutSet: { + type: "boolean", + default: false + }, + setWithoutGet: { + type: "boolean", + default: true + }, + enforceForClassMembers: { + type: "boolean", + default: true + } + }, + additionalProperties: false + }], + + messages: { + missingGetterInPropertyDescriptor: "Getter is not present in property descriptor.", + missingSetterInPropertyDescriptor: "Setter is not present in property descriptor.", + missingGetterInObjectLiteral: "Getter is not present for {{ name }}.", + missingSetterInObjectLiteral: "Setter is not present for {{ name }}.", + missingGetterInClass: "Getter is not present for class {{ name }}.", + missingSetterInClass: "Setter is not present for class {{ name }}." + } + }, + create(context) { + const config = context.options[0] || {}; + const checkGetWithoutSet = config.getWithoutSet === true; + const checkSetWithoutGet = config.setWithoutGet !== false; + const enforceForClassMembers = config.enforceForClassMembers !== false; + const sourceCode = context.getSourceCode(); + + /** + * Reports the given node. + * @param {ASTNode} node The node to report. + * @param {string} messageKind "missingGetter" or "missingSetter". + * @returns {void} + * @private + */ + function report(node, messageKind) { + if (node.type === "Property") { + context.report({ + node, + messageId: `${messageKind}InObjectLiteral`, + loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), + data: { name: astUtils.getFunctionNameWithKind(node.value) } + }); + } else if (node.type === "MethodDefinition") { + context.report({ + node, + messageId: `${messageKind}InClass`, + loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), + data: { name: astUtils.getFunctionNameWithKind(node.value) } + }); + } else { + context.report({ + node, + messageId: `${messageKind}InPropertyDescriptor` + }); + } + } + + /** + * Reports each of the nodes in the given list using the same messageId. + * @param {ASTNode[]} nodes Nodes to report. + * @param {string} messageKind "missingGetter" or "missingSetter". + * @returns {void} + * @private + */ + function reportList(nodes, messageKind) { + for (const node of nodes) { + report(node, messageKind); + } + } + + /** + * Creates a new `AccessorData` object for the given getter or setter node. + * @param {ASTNode} node A getter or setter node. + * @returns {AccessorData} New `AccessorData` object that contains the given node. + * @private + */ + function createAccessorData(node) { + const name = astUtils.getStaticPropertyName(node); + const key = (name !== null) ? name : sourceCode.getTokens(node.key); + + return { + key, + getters: node.kind === "get" ? [node] : [], + setters: node.kind === "set" ? [node] : [] + }; + } + + /** + * Merges the given `AccessorData` object into the given accessors list. + * @param {AccessorData[]} accessors The list to merge into. + * @param {AccessorData} accessorData The object to merge. + * @returns {AccessorData[]} The same instance with the merged object. + * @private + */ + function mergeAccessorData(accessors, accessorData) { + const equalKeyElement = accessors.find(a => areEqualKeys(a.key, accessorData.key)); + + if (equalKeyElement) { + equalKeyElement.getters.push(...accessorData.getters); + equalKeyElement.setters.push(...accessorData.setters); + } else { + accessors.push(accessorData); + } + + return accessors; + } + + /** + * Checks accessor pairs in the given list of nodes. + * @param {ASTNode[]} nodes The list to check. + * @returns {void} + * @private + */ + function checkList(nodes) { + const accessors = nodes + .filter(isAccessorKind) + .map(createAccessorData) + .reduce(mergeAccessorData, []); + + for (const { getters, setters } of accessors) { + if (checkSetWithoutGet && setters.length && !getters.length) { + reportList(setters, "missingGetter"); + } + if (checkGetWithoutSet && getters.length && !setters.length) { + reportList(getters, "missingSetter"); + } + } + } + + /** + * Checks accessor pairs in an object literal. + * @param {ASTNode} node `ObjectExpression` node to check. + * @returns {void} + * @private + */ + function checkObjectLiteral(node) { + checkList(node.properties.filter(p => p.type === "Property")); + } + + /** + * Checks accessor pairs in a property descriptor. + * @param {ASTNode} node Property descriptor `ObjectExpression` node to check. + * @returns {void} + * @private + */ + function checkPropertyDescriptor(node) { + const namesToCheck = new Set(node.properties + .filter(p => p.type === "Property" && p.kind === "init" && !p.computed) + .map(({ key }) => key.name)); + + const hasGetter = namesToCheck.has("get"); + const hasSetter = namesToCheck.has("set"); + + if (checkSetWithoutGet && hasSetter && !hasGetter) { + report(node, "missingGetter"); + } + if (checkGetWithoutSet && hasGetter && !hasSetter) { + report(node, "missingSetter"); + } + } + + /** + * Checks the given object expression as an object literal and as a possible property descriptor. + * @param {ASTNode} node `ObjectExpression` node to check. + * @returns {void} + * @private + */ + function checkObjectExpression(node) { + checkObjectLiteral(node); + if (isPropertyDescriptor(node)) { + checkPropertyDescriptor(node); + } + } + + /** + * Checks the given class body. + * @param {ASTNode} node `ClassBody` node to check. + * @returns {void} + * @private + */ + function checkClassBody(node) { + const methodDefinitions = node.body.filter(m => m.type === "MethodDefinition"); + + checkList(methodDefinitions.filter(m => m.static)); + checkList(methodDefinitions.filter(m => !m.static)); + } + + const listeners = {}; + + if (checkSetWithoutGet || checkGetWithoutSet) { + listeners.ObjectExpression = checkObjectExpression; + if (enforceForClassMembers) { + listeners.ClassBody = checkClassBody; + } + } + + return listeners; + } +}; diff --git a/node_modules/eslint/lib/rules/array-bracket-newline.js b/node_modules/eslint/lib/rules/array-bracket-newline.js new file mode 100644 index 0000000..0beb138 --- /dev/null +++ b/node_modules/eslint/lib/rules/array-bracket-newline.js @@ -0,0 +1,258 @@ +/** + * @fileoverview Rule to enforce linebreaks after open and before close array brackets + * @author Jan Peer Stöcklmair + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce linebreaks after opening and before closing array brackets", + recommended: false, + url: "https://eslint.org/docs/rules/array-bracket-newline" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never", "consistent"] + }, + { + type: "object", + properties: { + multiline: { + type: "boolean" + }, + minItems: { + type: ["integer", "null"], + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + unexpectedOpeningLinebreak: "There should be no linebreak after '['.", + unexpectedClosingLinebreak: "There should be no linebreak before ']'.", + missingOpeningLinebreak: "A linebreak is required after '['.", + missingClosingLinebreak: "A linebreak is required before ']'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Normalizes a given option value. + * @param {string|Object|undefined} option An option value to parse. + * @returns {{multiline: boolean, minItems: number}} Normalized option object. + */ + function normalizeOptionValue(option) { + let consistent = false; + let multiline = false; + let minItems = 0; + + if (option) { + if (option === "consistent") { + consistent = true; + minItems = Number.POSITIVE_INFINITY; + } else if (option === "always" || option.minItems === 0) { + minItems = 0; + } else if (option === "never") { + minItems = Number.POSITIVE_INFINITY; + } else { + multiline = Boolean(option.multiline); + minItems = option.minItems || Number.POSITIVE_INFINITY; + } + } else { + consistent = false; + multiline = true; + minItems = Number.POSITIVE_INFINITY; + } + + return { consistent, multiline, minItems }; + } + + /** + * Normalizes a given option value. + * @param {string|Object|undefined} options An option value to parse. + * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. + */ + function normalizeOptions(options) { + const value = normalizeOptionValue(options); + + return { ArrayExpression: value, ArrayPattern: value }; + } + + /** + * Reports that there shouldn't be a linebreak after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoBeginningLinebreak(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "unexpectedOpeningLinebreak", + fix(fixer) { + const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }); + + if (astUtils.isCommentToken(nextToken)) { + return null; + } + + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + + /** + * Reports that there shouldn't be a linebreak before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoEndingLinebreak(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "unexpectedClosingLinebreak", + fix(fixer) { + const previousToken = sourceCode.getTokenBefore(token, { includeComments: true }); + + if (astUtils.isCommentToken(previousToken)) { + return null; + } + + return fixer.removeRange([previousToken.range[1], token.range[0]]); + } + }); + } + + /** + * Reports that there should be a linebreak after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningLinebreak(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingOpeningLinebreak", + fix(fixer) { + return fixer.insertTextAfter(token, "\n"); + } + }); + } + + /** + * Reports that there should be a linebreak before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingLinebreak(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingClosingLinebreak", + fix(fixer) { + return fixer.insertTextBefore(token, "\n"); + } + }); + } + + /** + * Reports a given node if it violated this rule. + * @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node. + * @returns {void} + */ + function check(node) { + const elements = node.elements; + const normalizedOptions = normalizeOptions(context.options[0]); + const options = normalizedOptions[node.type]; + const openBracket = sourceCode.getFirstToken(node); + const closeBracket = sourceCode.getLastToken(node); + const firstIncComment = sourceCode.getTokenAfter(openBracket, { includeComments: true }); + const lastIncComment = sourceCode.getTokenBefore(closeBracket, { includeComments: true }); + const first = sourceCode.getTokenAfter(openBracket); + const last = sourceCode.getTokenBefore(closeBracket); + + const needsLinebreaks = ( + elements.length >= options.minItems || + ( + options.multiline && + elements.length > 0 && + firstIncComment.loc.start.line !== lastIncComment.loc.end.line + ) || + ( + elements.length === 0 && + firstIncComment.type === "Block" && + firstIncComment.loc.start.line !== lastIncComment.loc.end.line && + firstIncComment === lastIncComment + ) || + ( + options.consistent && + openBracket.loc.end.line !== first.loc.start.line + ) + ); + + /* + * Use tokens or comments to check multiline or not. + * But use only tokens to check whether linebreaks are needed. + * This allows: + * var arr = [ // eslint-disable-line foo + * 'a' + * ] + */ + + if (needsLinebreaks) { + if (astUtils.isTokenOnSameLine(openBracket, first)) { + reportRequiredBeginningLinebreak(node, openBracket); + } + if (astUtils.isTokenOnSameLine(last, closeBracket)) { + reportRequiredEndingLinebreak(node, closeBracket); + } + } else { + if (!astUtils.isTokenOnSameLine(openBracket, first)) { + reportNoBeginningLinebreak(node, openBracket); + } + if (!astUtils.isTokenOnSameLine(last, closeBracket)) { + reportNoEndingLinebreak(node, closeBracket); + } + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + ArrayPattern: check, + ArrayExpression: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/array-bracket-spacing.js b/node_modules/eslint/lib/rules/array-bracket-spacing.js new file mode 100644 index 0000000..e4912ec --- /dev/null +++ b/node_modules/eslint/lib/rules/array-bracket-spacing.js @@ -0,0 +1,241 @@ +/** + * @fileoverview Disallows or enforces spaces inside of array brackets. + * @author Jamund Ferguson + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing inside array brackets", + recommended: false, + url: "https://eslint.org/docs/rules/array-bracket-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + singleValue: { + type: "boolean" + }, + objectsInArrays: { + type: "boolean" + }, + arraysInArrays: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.", + unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.", + missingSpaceAfter: "A space is required after '{{tokenValue}}'.", + missingSpaceBefore: "A space is required before '{{tokenValue}}'." + } + }, + create(context) { + const spaced = context.options[0] === "always", + sourceCode = context.getSourceCode(); + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] ? context.options[1][option] === !spaced : false; + } + + const options = { + spaced, + singleElementException: isOptionSet("singleValue"), + objectsInArraysException: isOptionSet("objectsInArrays"), + arraysInArraysException: isOptionSet("arraysInArrays") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + const nextToken = sourceCode.getTokenAfter(token); + + context.report({ + node, + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "unexpectedSpaceAfter", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + const previousToken = sourceCode.getTokenBefore(token); + + context.report({ + node, + loc: { start: previousToken.loc.end, end: token.loc.start }, + messageId: "unexpectedSpaceBefore", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.removeRange([previousToken.range[1], token.range[0]]); + } + }); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceAfter", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceBefore", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + + /** + * Determines if a node is an object type + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the node is an object type. + */ + function isObjectType(node) { + return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern"); + } + + /** + * Determines if a node is an array type + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the node is an array type. + */ + function isArrayType(node) { + return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern"); + } + + /** + * Validates the spacing around array brackets + * @param {ASTNode} node The node we're checking for spacing + * @returns {void} + */ + function validateArraySpacing(node) { + if (options.spaced && node.elements.length === 0) { + return; + } + + const first = sourceCode.getFirstToken(node), + second = sourceCode.getFirstToken(node, 1), + last = node.typeAnnotation + ? sourceCode.getTokenBefore(node.typeAnnotation) + : sourceCode.getLastToken(node), + penultimate = sourceCode.getTokenBefore(last), + firstElement = node.elements[0], + lastElement = node.elements[node.elements.length - 1]; + + const openingBracketMustBeSpaced = + options.objectsInArraysException && isObjectType(firstElement) || + options.arraysInArraysException && isArrayType(firstElement) || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + const closingBracketMustBeSpaced = + options.objectsInArraysException && isObjectType(lastElement) || + options.arraysInArraysException && isArrayType(lastElement) || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + if (astUtils.isTokenOnSameLine(first, second)) { + if (openingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!openingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (first !== penultimate && astUtils.isTokenOnSameLine(penultimate, last)) { + if (closingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ArrayPattern: validateArraySpacing, + ArrayExpression: validateArraySpacing + }; + } +}; diff --git a/node_modules/eslint/lib/rules/array-callback-return.js b/node_modules/eslint/lib/rules/array-callback-return.js new file mode 100644 index 0000000..fba414c --- /dev/null +++ b/node_modules/eslint/lib/rules/array-callback-return.js @@ -0,0 +1,296 @@ +/** + * @fileoverview Rule to enforce return statements in callbacks of array's methods + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; +const TARGET_METHODS = /^(?:every|filter|find(?:Index)?|flatMap|forEach|map|reduce(?:Right)?|some|sort)$/u; + +/** + * Checks a given code path segment is reachable. + * @param {CodePathSegment} segment A segment to check. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +/** + * Checks a given node is a member access which has the specified name's + * property. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a member access which has + * the specified name's property. The node may be a `(Chain|Member)Expression` node. + */ +function isTargetMethod(node) { + return astUtils.isSpecificMemberAccess(node, null, TARGET_METHODS); +} + +/** + * Returns a human-legible description of an array method + * @param {string} arrayMethodName A method name to fully qualify + * @returns {string} the method name prefixed with `Array.` if it is a class method, + * or else `Array.prototype.` if it is an instance method. + */ +function fullMethodName(arrayMethodName) { + if (["from", "of", "isArray"].includes(arrayMethodName)) { + return "Array.".concat(arrayMethodName); + } + return "Array.prototype.".concat(arrayMethodName); +} + +/** + * Checks whether or not a given node is a function expression which is the + * callback of an array method, returning the method name. + * @param {ASTNode} node A node to check. This is one of + * FunctionExpression or ArrowFunctionExpression. + * @returns {string} The method name if the node is a callback method, + * null otherwise. + */ +function getArrayMethodName(node) { + let currentNode = node; + + while (currentNode) { + const parent = currentNode.parent; + + switch (parent.type) { + + /* + * Looks up the destination. e.g., + * foo.every(nativeFoo || function foo() { ... }); + */ + case "LogicalExpression": + case "ConditionalExpression": + case "ChainExpression": + currentNode = parent; + break; + + /* + * If the upper function is IIFE, checks the destination of the return value. + * e.g. + * foo.every((function() { + * // setup... + * return function callback() { ... }; + * })()); + */ + case "ReturnStatement": { + const func = astUtils.getUpperFunction(parent); + + if (func === null || !astUtils.isCallee(func)) { + return null; + } + currentNode = func.parent; + break; + } + + /* + * e.g. + * Array.from([], function() {}); + * list.every(function() {}); + */ + case "CallExpression": + if (astUtils.isArrayFromMethod(parent.callee)) { + if ( + parent.arguments.length >= 2 && + parent.arguments[1] === currentNode + ) { + return "from"; + } + } + if (isTargetMethod(parent.callee)) { + if ( + parent.arguments.length >= 1 && + parent.arguments[0] === currentNode + ) { + return astUtils.getStaticPropertyName(parent.callee); + } + } + return null; + + // Otherwise this node is not target. + default: + return null; + } + } + + /* istanbul ignore next: unreachable */ + return null; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "enforce `return` statements in callbacks of array methods", + recommended: false, + url: "https://eslint.org/docs/rules/array-callback-return" + }, + + schema: [ + { + type: "object", + properties: { + allowImplicit: { + type: "boolean", + default: false + }, + checkForEach: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + expectedAtEnd: "{{arrayMethodName}}() expects a value to be returned at the end of {{name}}.", + expectedInside: "{{arrayMethodName}}() expects a return value from {{name}}.", + expectedReturnValue: "{{arrayMethodName}}() expects a return value from {{name}}.", + expectedNoReturnValue: "{{arrayMethodName}}() expects no useless return value from {{name}}." + } + }, + + create(context) { + + const options = context.options[0] || { allowImplicit: false, checkForEach: false }; + const sourceCode = context.getSourceCode(); + + let funcInfo = { + arrayMethodName: null, + upper: null, + codePath: null, + hasReturn: false, + shouldCheck: false, + node: null + }; + + /** + * Checks whether or not the last code path segment is reachable. + * Then reports this function if the segment is reachable. + * + * If the last code path segment is reachable, there are paths which are not + * returned or thrown. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function checkLastSegment(node) { + + if (!funcInfo.shouldCheck) { + return; + } + + let messageId = null; + + if (funcInfo.arrayMethodName === "forEach") { + if (options.checkForEach && node.type === "ArrowFunctionExpression" && node.expression) { + messageId = "expectedNoReturnValue"; + } + } else { + if (node.body.type === "BlockStatement" && funcInfo.codePath.currentSegments.some(isReachable)) { + messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside"; + } + } + + if (messageId) { + const name = astUtils.getFunctionNameWithKind(node); + + context.report({ + node, + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + messageId, + data: { name, arrayMethodName: fullMethodName(funcInfo.arrayMethodName) } + }); + } + } + + return { + + // Stacks this function's information. + onCodePathStart(codePath, node) { + + let methodName = null; + + if (TARGET_NODE_TYPE.test(node.type)) { + methodName = getArrayMethodName(node); + } + + funcInfo = { + arrayMethodName: methodName, + upper: funcInfo, + codePath, + hasReturn: false, + shouldCheck: + methodName && + !node.async && + !node.generator, + node + }; + }, + + // Pops this function's information. + onCodePathEnd() { + funcInfo = funcInfo.upper; + }, + + // Checks the return statement is valid. + ReturnStatement(node) { + + if (!funcInfo.shouldCheck) { + return; + } + + funcInfo.hasReturn = true; + + let messageId = null; + + if (funcInfo.arrayMethodName === "forEach") { + + // if checkForEach: true, returning a value at any path inside a forEach is not allowed + if (options.checkForEach && node.argument) { + messageId = "expectedNoReturnValue"; + } + } else { + + // if allowImplicit: false, should also check node.argument + if (!options.allowImplicit && !node.argument) { + messageId = "expectedReturnValue"; + } + } + + if (messageId) { + context.report({ + node, + messageId, + data: { + name: astUtils.getFunctionNameWithKind(funcInfo.node), + arrayMethodName: fullMethodName(funcInfo.arrayMethodName) + } + }); + } + }, + + // Reports a given function if the last path is reachable. + "FunctionExpression:exit": checkLastSegment, + "ArrowFunctionExpression:exit": checkLastSegment + }; + } +}; diff --git a/node_modules/eslint/lib/rules/array-element-newline.js b/node_modules/eslint/lib/rules/array-element-newline.js new file mode 100644 index 0000000..77f5fc9 --- /dev/null +++ b/node_modules/eslint/lib/rules/array-element-newline.js @@ -0,0 +1,301 @@ +/** + * @fileoverview Rule to enforce line breaks after each array element + * @author Jan Peer Stöcklmair + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce line breaks after each array element", + recommended: false, + url: "https://eslint.org/docs/rules/array-element-newline" + }, + + fixable: "whitespace", + + schema: { + definitions: { + basicConfig: { + oneOf: [ + { + enum: ["always", "never", "consistent"] + }, + { + type: "object", + properties: { + multiline: { + type: "boolean" + }, + minItems: { + type: ["integer", "null"], + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + }, + items: [ + { + oneOf: [ + { + $ref: "#/definitions/basicConfig" + }, + { + type: "object", + properties: { + ArrayExpression: { + $ref: "#/definitions/basicConfig" + }, + ArrayPattern: { + $ref: "#/definitions/basicConfig" + } + }, + additionalProperties: false, + minProperties: 1 + } + ] + } + ] + }, + + messages: { + unexpectedLineBreak: "There should be no linebreak here.", + missingLineBreak: "There should be a linebreak after this element." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Normalizes a given option value. + * @param {string|Object|undefined} providedOption An option value to parse. + * @returns {{multiline: boolean, minItems: number}} Normalized option object. + */ + function normalizeOptionValue(providedOption) { + let consistent = false; + let multiline = false; + let minItems; + + const option = providedOption || "always"; + + if (!option || option === "always" || option.minItems === 0) { + minItems = 0; + } else if (option === "never") { + minItems = Number.POSITIVE_INFINITY; + } else if (option === "consistent") { + consistent = true; + minItems = Number.POSITIVE_INFINITY; + } else { + multiline = Boolean(option.multiline); + minItems = option.minItems || Number.POSITIVE_INFINITY; + } + + return { consistent, multiline, minItems }; + } + + /** + * Normalizes a given option value. + * @param {string|Object|undefined} options An option value to parse. + * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. + */ + function normalizeOptions(options) { + if (options && (options.ArrayExpression || options.ArrayPattern)) { + let expressionOptions, patternOptions; + + if (options.ArrayExpression) { + expressionOptions = normalizeOptionValue(options.ArrayExpression); + } + + if (options.ArrayPattern) { + patternOptions = normalizeOptionValue(options.ArrayPattern); + } + + return { ArrayExpression: expressionOptions, ArrayPattern: patternOptions }; + } + + const value = normalizeOptionValue(options); + + return { ArrayExpression: value, ArrayPattern: value }; + } + + /** + * Reports that there shouldn't be a line break after the first token + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoLineBreak(token) { + const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); + + context.report({ + loc: { + start: tokenBefore.loc.end, + end: token.loc.start + }, + messageId: "unexpectedLineBreak", + fix(fixer) { + if (astUtils.isCommentToken(tokenBefore)) { + return null; + } + + if (!astUtils.isTokenOnSameLine(tokenBefore, token)) { + return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " "); + } + + /* + * This will check if the comma is on the same line as the next element + * Following array: + * [ + * 1 + * , 2 + * , 3 + * ] + * + * will be fixed to: + * [ + * 1, 2, 3 + * ] + */ + const twoTokensBefore = sourceCode.getTokenBefore(tokenBefore, { includeComments: true }); + + if (astUtils.isCommentToken(twoTokensBefore)) { + return null; + } + + return fixer.replaceTextRange([twoTokensBefore.range[1], tokenBefore.range[0]], ""); + + } + }); + } + + /** + * Reports that there should be a line break after the first token + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredLineBreak(token) { + const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); + + context.report({ + loc: { + start: tokenBefore.loc.end, + end: token.loc.start + }, + messageId: "missingLineBreak", + fix(fixer) { + return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n"); + } + }); + } + + /** + * Reports a given node if it violated this rule. + * @param {ASTNode} node A node to check. This is an ObjectExpression node or an ObjectPattern node. + * @returns {void} + */ + function check(node) { + const elements = node.elements; + const normalizedOptions = normalizeOptions(context.options[0]); + const options = normalizedOptions[node.type]; + + if (!options) { + return; + } + + let elementBreak = false; + + /* + * MULTILINE: true + * loop through every element and check + * if at least one element has linebreaks inside + * this ensures that following is not valid (due to elements are on the same line): + * + * [ + * 1, + * 2, + * 3 + * ] + */ + if (options.multiline) { + elementBreak = elements + .filter(element => element !== null) + .some(element => element.loc.start.line !== element.loc.end.line); + } + + const linebreaksCount = node.elements.map((element, i) => { + const previousElement = elements[i - 1]; + + if (i === 0 || element === null || previousElement === null) { + return false; + } + + const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken); + const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken); + const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken); + + return !astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement); + }).filter(isBreak => isBreak === true).length; + + const needsLinebreaks = ( + elements.length >= options.minItems || + ( + options.multiline && + elementBreak + ) || + ( + options.consistent && + linebreaksCount > 0 && + linebreaksCount < node.elements.length + ) + ); + + elements.forEach((element, i) => { + const previousElement = elements[i - 1]; + + if (i === 0 || element === null || previousElement === null) { + return; + } + + const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken); + const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken); + const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken); + + if (needsLinebreaks) { + if (astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) { + reportRequiredLineBreak(firstTokenOfCurrentElement); + } + } else { + if (!astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) { + reportNoLineBreak(firstTokenOfCurrentElement); + } + } + }); + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + ArrayPattern: check, + ArrayExpression: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/arrow-body-style.js b/node_modules/eslint/lib/rules/arrow-body-style.js new file mode 100644 index 0000000..7a141b0 --- /dev/null +++ b/node_modules/eslint/lib/rules/arrow-body-style.js @@ -0,0 +1,296 @@ +/** + * @fileoverview Rule to require braces in arrow function body. + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require braces around arrow function bodies", + recommended: false, + url: "https://eslint.org/docs/rules/arrow-body-style" + }, + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always", "never"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["as-needed"] + }, + { + type: "object", + properties: { + requireReturnForObjectLiteral: { type: "boolean" } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + fixable: "code", + + messages: { + unexpectedOtherBlock: "Unexpected block statement surrounding arrow body.", + unexpectedEmptyBlock: "Unexpected block statement surrounding arrow body; put a value of `undefined` immediately after the `=>`.", + unexpectedObjectBlock: "Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`.", + unexpectedSingleBlock: "Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`.", + expectedBlock: "Expected block statement surrounding arrow body." + } + }, + + create(context) { + const options = context.options; + const always = options[0] === "always"; + const asNeeded = !options[0] || options[0] === "as-needed"; + const never = options[0] === "never"; + const requireReturnForObjectLiteral = options[1] && options[1].requireReturnForObjectLiteral; + const sourceCode = context.getSourceCode(); + let funcInfo = null; + + /** + * Checks whether the given node has ASI problem or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if it changes semantics if `;` or `}` followed by the token are removed. + */ + function hasASIProblem(token) { + return token && token.type === "Punctuator" && /^[([/`+-]/u.test(token.value); + } + + /** + * Gets the closing parenthesis by the given node. + * @param {ASTNode} node first node after an opening parenthesis. + * @returns {Token} The found closing parenthesis token. + */ + function findClosingParen(node) { + let nodeToCheck = node; + + while (!astUtils.isParenthesised(sourceCode, nodeToCheck)) { + nodeToCheck = nodeToCheck.parent; + } + return sourceCode.getTokenAfter(nodeToCheck); + } + + /** + * Check whether the node is inside of a for loop's init + * @param {ASTNode} node node is inside for loop + * @returns {boolean} `true` if the node is inside of a for loop, else `false` + */ + function isInsideForLoopInitializer(node) { + if (node && node.parent) { + if (node.parent.type === "ForStatement" && node.parent.init === node) { + return true; + } + return isInsideForLoopInitializer(node.parent); + } + return false; + } + + /** + * Determines whether a arrow function body needs braces + * @param {ASTNode} node The arrow function node. + * @returns {void} + */ + function validate(node) { + const arrowBody = node.body; + + if (arrowBody.type === "BlockStatement") { + const blockBody = arrowBody.body; + + if (blockBody.length !== 1 && !never) { + return; + } + + if (asNeeded && requireReturnForObjectLiteral && blockBody[0].type === "ReturnStatement" && + blockBody[0].argument && blockBody[0].argument.type === "ObjectExpression") { + return; + } + + if (never || asNeeded && blockBody[0].type === "ReturnStatement") { + let messageId; + + if (blockBody.length === 0) { + messageId = "unexpectedEmptyBlock"; + } else if (blockBody.length > 1) { + messageId = "unexpectedOtherBlock"; + } else if (blockBody[0].argument === null) { + messageId = "unexpectedSingleBlock"; + } else if (astUtils.isOpeningBraceToken(sourceCode.getFirstToken(blockBody[0], { skip: 1 }))) { + messageId = "unexpectedObjectBlock"; + } else { + messageId = "unexpectedSingleBlock"; + } + + context.report({ + node, + loc: arrowBody.loc, + messageId, + fix(fixer) { + const fixes = []; + + if (blockBody.length !== 1 || + blockBody[0].type !== "ReturnStatement" || + !blockBody[0].argument || + hasASIProblem(sourceCode.getTokenAfter(arrowBody)) + ) { + return fixes; + } + + const openingBrace = sourceCode.getFirstToken(arrowBody); + const closingBrace = sourceCode.getLastToken(arrowBody); + const firstValueToken = sourceCode.getFirstToken(blockBody[0], 1); + const lastValueToken = sourceCode.getLastToken(blockBody[0]); + const commentsExist = + sourceCode.commentsExistBetween(openingBrace, firstValueToken) || + sourceCode.commentsExistBetween(lastValueToken, closingBrace); + + /* + * Remove tokens around the return value. + * If comments don't exist, remove extra spaces as well. + */ + if (commentsExist) { + fixes.push( + fixer.remove(openingBrace), + fixer.remove(closingBrace), + fixer.remove(sourceCode.getTokenAfter(openingBrace)) // return keyword + ); + } else { + fixes.push( + fixer.removeRange([openingBrace.range[0], firstValueToken.range[0]]), + fixer.removeRange([lastValueToken.range[1], closingBrace.range[1]]) + ); + } + + /* + * If the first token of the return value is `{` or the return value is a sequence expression, + * enclose the return value by parentheses to avoid syntax error. + */ + if (astUtils.isOpeningBraceToken(firstValueToken) || blockBody[0].argument.type === "SequenceExpression" || (funcInfo.hasInOperator && isInsideForLoopInitializer(node))) { + if (!astUtils.isParenthesised(sourceCode, blockBody[0].argument)) { + fixes.push( + fixer.insertTextBefore(firstValueToken, "("), + fixer.insertTextAfter(lastValueToken, ")") + ); + } + } + + /* + * If the last token of the return statement is semicolon, remove it. + * Non-block arrow body is an expression, not a statement. + */ + if (astUtils.isSemicolonToken(lastValueToken)) { + fixes.push(fixer.remove(lastValueToken)); + } + + return fixes; + } + }); + } + } else { + if (always || (asNeeded && requireReturnForObjectLiteral && arrowBody.type === "ObjectExpression")) { + context.report({ + node, + loc: arrowBody.loc, + messageId: "expectedBlock", + fix(fixer) { + const fixes = []; + const arrowToken = sourceCode.getTokenBefore(arrowBody, astUtils.isArrowToken); + const [firstTokenAfterArrow, secondTokenAfterArrow] = sourceCode.getTokensAfter(arrowToken, { count: 2 }); + const lastToken = sourceCode.getLastToken(node); + + let parenthesisedObjectLiteral = null; + + if ( + astUtils.isOpeningParenToken(firstTokenAfterArrow) && + astUtils.isOpeningBraceToken(secondTokenAfterArrow) + ) { + const braceNode = sourceCode.getNodeByRangeIndex(secondTokenAfterArrow.range[0]); + + if (braceNode.type === "ObjectExpression") { + parenthesisedObjectLiteral = braceNode; + } + } + + // If the value is object literal, remove parentheses which were forced by syntax. + if (parenthesisedObjectLiteral) { + const openingParenToken = firstTokenAfterArrow; + const openingBraceToken = secondTokenAfterArrow; + + if (astUtils.isTokenOnSameLine(openingParenToken, openingBraceToken)) { + fixes.push(fixer.replaceText(openingParenToken, "{return ")); + } else { + + // Avoid ASI + fixes.push( + fixer.replaceText(openingParenToken, "{"), + fixer.insertTextBefore(openingBraceToken, "return ") + ); + } + + // Closing paren for the object doesn't have to be lastToken, e.g.: () => ({}).foo() + fixes.push(fixer.remove(findClosingParen(parenthesisedObjectLiteral))); + fixes.push(fixer.insertTextAfter(lastToken, "}")); + + } else { + fixes.push(fixer.insertTextBefore(firstTokenAfterArrow, "{return ")); + fixes.push(fixer.insertTextAfter(lastToken, "}")); + } + + return fixes; + } + }); + } + } + } + + return { + "BinaryExpression[operator='in']"() { + let info = funcInfo; + + while (info) { + info.hasInOperator = true; + info = info.upper; + } + }, + ArrowFunctionExpression() { + funcInfo = { + upper: funcInfo, + hasInOperator: false + }; + }, + "ArrowFunctionExpression:exit"(node) { + validate(node); + funcInfo = funcInfo.upper; + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/arrow-parens.js b/node_modules/eslint/lib/rules/arrow-parens.js new file mode 100644 index 0000000..779ab6f --- /dev/null +++ b/node_modules/eslint/lib/rules/arrow-parens.js @@ -0,0 +1,183 @@ +/** + * @fileoverview Rule to require parens in arrow function arguments. + * @author Jxck + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines if the given arrow function has block body. + * @param {ASTNode} node `ArrowFunctionExpression` node. + * @returns {boolean} `true` if the function has block body. + */ +function hasBlockBody(node) { + return node.body.type === "BlockStatement"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require parentheses around arrow function arguments", + recommended: false, + url: "https://eslint.org/docs/rules/arrow-parens" + }, + + fixable: "code", + + schema: [ + { + enum: ["always", "as-needed"] + }, + { + type: "object", + properties: { + requireForBlockBody: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedParens: "Unexpected parentheses around single function argument.", + expectedParens: "Expected parentheses around arrow function argument.", + + unexpectedParensInline: "Unexpected parentheses around single function argument having a body with no curly braces.", + expectedParensBlock: "Expected parentheses around arrow function argument having a body with curly braces." + } + }, + + create(context) { + const asNeeded = context.options[0] === "as-needed"; + const requireForBlockBody = asNeeded && context.options[1] && context.options[1].requireForBlockBody === true; + + const sourceCode = context.getSourceCode(); + + /** + * Finds opening paren of parameters for the given arrow function, if it exists. + * It is assumed that the given arrow function has exactly one parameter. + * @param {ASTNode} node `ArrowFunctionExpression` node. + * @returns {Token|null} the opening paren, or `null` if the given arrow function doesn't have parens of parameters. + */ + function findOpeningParenOfParams(node) { + const tokenBeforeParams = sourceCode.getTokenBefore(node.params[0]); + + if ( + tokenBeforeParams && + astUtils.isOpeningParenToken(tokenBeforeParams) && + node.range[0] <= tokenBeforeParams.range[0] + ) { + return tokenBeforeParams; + } + + return null; + } + + /** + * Finds closing paren of parameters for the given arrow function. + * It is assumed that the given arrow function has parens of parameters and that it has exactly one parameter. + * @param {ASTNode} node `ArrowFunctionExpression` node. + * @returns {Token} the closing paren of parameters. + */ + function getClosingParenOfParams(node) { + return sourceCode.getTokenAfter(node.params[0], astUtils.isClosingParenToken); + } + + /** + * Determines whether the given arrow function has comments inside parens of parameters. + * It is assumed that the given arrow function has parens of parameters. + * @param {ASTNode} node `ArrowFunctionExpression` node. + * @param {Token} openingParen Opening paren of parameters. + * @returns {boolean} `true` if the function has at least one comment inside of parens of parameters. + */ + function hasCommentsInParensOfParams(node, openingParen) { + return sourceCode.commentsExistBetween(openingParen, getClosingParenOfParams(node)); + } + + /** + * Determines whether the given arrow function has unexpected tokens before opening paren of parameters, + * in which case it will be assumed that the existing parens of parameters are necessary. + * Only tokens within the range of the arrow function (tokens that are part of the arrow function) are taken into account. + * Example: (a) => b + * @param {ASTNode} node `ArrowFunctionExpression` node. + * @param {Token} openingParen Opening paren of parameters. + * @returns {boolean} `true` if the function has at least one unexpected token. + */ + function hasUnexpectedTokensBeforeOpeningParen(node, openingParen) { + const expectedCount = node.async ? 1 : 0; + + return sourceCode.getFirstToken(node, { skip: expectedCount }) !== openingParen; + } + + return { + "ArrowFunctionExpression[params.length=1]"(node) { + const shouldHaveParens = !asNeeded || requireForBlockBody && hasBlockBody(node); + const openingParen = findOpeningParenOfParams(node); + const hasParens = openingParen !== null; + const [param] = node.params; + + if (shouldHaveParens && !hasParens) { + context.report({ + node, + messageId: requireForBlockBody ? "expectedParensBlock" : "expectedParens", + loc: param.loc, + *fix(fixer) { + yield fixer.insertTextBefore(param, "("); + yield fixer.insertTextAfter(param, ")"); + } + }); + } + + if ( + !shouldHaveParens && + hasParens && + param.type === "Identifier" && + !param.typeAnnotation && + !node.returnType && + !hasCommentsInParensOfParams(node, openingParen) && + !hasUnexpectedTokensBeforeOpeningParen(node, openingParen) + ) { + context.report({ + node, + messageId: requireForBlockBody ? "unexpectedParensInline" : "unexpectedParens", + loc: param.loc, + *fix(fixer) { + const tokenBeforeOpeningParen = sourceCode.getTokenBefore(openingParen); + const closingParen = getClosingParenOfParams(node); + + if ( + tokenBeforeOpeningParen && + tokenBeforeOpeningParen.range[1] === openingParen.range[0] && + !astUtils.canTokensBeAdjacent(tokenBeforeOpeningParen, sourceCode.getFirstToken(param)) + ) { + yield fixer.insertTextBefore(openingParen, " "); + } + + // remove parens, whitespace inside parens, and possible trailing comma + yield fixer.removeRange([openingParen.range[0], param.range[0]]); + yield fixer.removeRange([param.range[1], closingParen.range[1]]); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/arrow-spacing.js b/node_modules/eslint/lib/rules/arrow-spacing.js new file mode 100644 index 0000000..9fdcdd5 --- /dev/null +++ b/node_modules/eslint/lib/rules/arrow-spacing.js @@ -0,0 +1,161 @@ +/** + * @fileoverview Rule to define spacing before/after arrow function's arrow. + * @author Jxck + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before and after the arrow in arrow functions", + recommended: false, + url: "https://eslint.org/docs/rules/arrow-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + before: { + type: "boolean", + default: true + }, + after: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + expectedBefore: "Missing space before =>.", + unexpectedBefore: "Unexpected space before =>.", + + expectedAfter: "Missing space after =>.", + unexpectedAfter: "Unexpected space after =>." + } + }, + + create(context) { + + // merge rules with default + const rule = Object.assign({}, context.options[0]); + + rule.before = rule.before !== false; + rule.after = rule.after !== false; + + const sourceCode = context.getSourceCode(); + + /** + * Get tokens of arrow(`=>`) and before/after arrow. + * @param {ASTNode} node The arrow function node. + * @returns {Object} Tokens of arrow and before/after arrow. + */ + function getTokens(node) { + const arrow = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken); + + return { + before: sourceCode.getTokenBefore(arrow), + arrow, + after: sourceCode.getTokenAfter(arrow) + }; + } + + /** + * Count spaces before/after arrow(`=>`) token. + * @param {Object} tokens Tokens before/after arrow. + * @returns {Object} count of space before/after arrow. + */ + function countSpaces(tokens) { + const before = tokens.arrow.range[0] - tokens.before.range[1]; + const after = tokens.after.range[0] - tokens.arrow.range[1]; + + return { before, after }; + } + + /** + * Determines whether space(s) before after arrow(`=>`) is satisfy rule. + * if before/after value is `true`, there should be space(s). + * if before/after value is `false`, there should be no space. + * @param {ASTNode} node The arrow function node. + * @returns {void} + */ + function spaces(node) { + const tokens = getTokens(node); + const countSpace = countSpaces(tokens); + + if (rule.before) { + + // should be space(s) before arrow + if (countSpace.before === 0) { + context.report({ + node: tokens.before, + messageId: "expectedBefore", + fix(fixer) { + return fixer.insertTextBefore(tokens.arrow, " "); + } + }); + } + } else { + + // should be no space before arrow + if (countSpace.before > 0) { + context.report({ + node: tokens.before, + messageId: "unexpectedBefore", + fix(fixer) { + return fixer.removeRange([tokens.before.range[1], tokens.arrow.range[0]]); + } + }); + } + } + + if (rule.after) { + + // should be space(s) after arrow + if (countSpace.after === 0) { + context.report({ + node: tokens.after, + messageId: "expectedAfter", + fix(fixer) { + return fixer.insertTextAfter(tokens.arrow, " "); + } + }); + } + } else { + + // should be no space after arrow + if (countSpace.after > 0) { + context.report({ + node: tokens.after, + messageId: "unexpectedAfter", + fix(fixer) { + return fixer.removeRange([tokens.arrow.range[1], tokens.after.range[0]]); + } + }); + } + } + } + + return { + ArrowFunctionExpression: spaces + }; + } +}; diff --git a/node_modules/eslint/lib/rules/block-scoped-var.js b/node_modules/eslint/lib/rules/block-scoped-var.js new file mode 100644 index 0000000..3a27786 --- /dev/null +++ b/node_modules/eslint/lib/rules/block-scoped-var.js @@ -0,0 +1,124 @@ +/** + * @fileoverview Rule to check for "block scoped" variables by binding context + * @author Matt DuVall + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce the use of variables within the scope they are defined", + recommended: false, + url: "https://eslint.org/docs/rules/block-scoped-var" + }, + + schema: [], + + messages: { + outOfScope: "'{{name}}' used outside of binding context." + } + }, + + create(context) { + let stack = []; + + /** + * Makes a block scope. + * @param {ASTNode} node A node of a scope. + * @returns {void} + */ + function enterScope(node) { + stack.push(node.range); + } + + /** + * Pops the last block scope. + * @returns {void} + */ + function exitScope() { + stack.pop(); + } + + /** + * Reports a given reference. + * @param {eslint-scope.Reference} reference A reference to report. + * @returns {void} + */ + function report(reference) { + const identifier = reference.identifier; + + context.report({ node: identifier, messageId: "outOfScope", data: { name: identifier.name } }); + } + + /** + * Finds and reports references which are outside of valid scopes. + * @param {ASTNode} node A node to get variables. + * @returns {void} + */ + function checkForVariables(node) { + if (node.kind !== "var") { + return; + } + + // Defines a predicate to check whether or not a given reference is outside of valid scope. + const scopeRange = stack[stack.length - 1]; + + /** + * Check if a reference is out of scope + * @param {ASTNode} reference node to examine + * @returns {boolean} True is its outside the scope + * @private + */ + function isOutsideOfScope(reference) { + const idRange = reference.identifier.range; + + return idRange[0] < scopeRange[0] || idRange[1] > scopeRange[1]; + } + + // Gets declared variables, and checks its references. + const variables = context.getDeclaredVariables(node); + + for (let i = 0; i < variables.length; ++i) { + + // Reports. + variables[i] + .references + .filter(isOutsideOfScope) + .forEach(report); + } + } + + return { + Program(node) { + stack = [node.range]; + }, + + // Manages scopes. + BlockStatement: enterScope, + "BlockStatement:exit": exitScope, + ForStatement: enterScope, + "ForStatement:exit": exitScope, + ForInStatement: enterScope, + "ForInStatement:exit": exitScope, + ForOfStatement: enterScope, + "ForOfStatement:exit": exitScope, + SwitchStatement: enterScope, + "SwitchStatement:exit": exitScope, + CatchClause: enterScope, + "CatchClause:exit": exitScope, + StaticBlock: enterScope, + "StaticBlock:exit": exitScope, + + // Finds and reports references which are outside of valid scope. + VariableDeclaration: checkForVariables + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/block-spacing.js b/node_modules/eslint/lib/rules/block-spacing.js new file mode 100644 index 0000000..53303a9 --- /dev/null +++ b/node_modules/eslint/lib/rules/block-spacing.js @@ -0,0 +1,171 @@ +/** + * @fileoverview A rule to disallow or enforce spaces inside of single line blocks. + * @author Toru Nagashima + */ + +"use strict"; + +const util = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow or enforce spaces inside of blocks after opening block and before closing block", + recommended: false, + url: "https://eslint.org/docs/rules/block-spacing" + }, + + fixable: "whitespace", + + schema: [ + { enum: ["always", "never"] } + ], + + messages: { + missing: "Requires a space {{location}} '{{token}}'.", + extra: "Unexpected space(s) {{location}} '{{token}}'." + } + }, + + create(context) { + const always = (context.options[0] !== "never"), + messageId = always ? "missing" : "extra", + sourceCode = context.getSourceCode(); + + /** + * Gets the open brace token from a given node. + * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to get. + * @returns {Token} The token of the open brace. + */ + function getOpenBrace(node) { + if (node.type === "SwitchStatement") { + if (node.cases.length > 0) { + return sourceCode.getTokenBefore(node.cases[0]); + } + return sourceCode.getLastToken(node, 1); + } + + if (node.type === "StaticBlock") { + return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token + } + + // "BlockStatement" + return sourceCode.getFirstToken(node); + } + + /** + * Checks whether or not: + * - given tokens are on same line. + * - there is/isn't a space between given tokens. + * @param {Token} left A token to check. + * @param {Token} right The token which is next to `left`. + * @returns {boolean} + * When the option is `"always"`, `true` if there are one or more spaces between given tokens. + * When the option is `"never"`, `true` if there are not any spaces between given tokens. + * If given tokens are not on same line, it's always `true`. + */ + function isValid(left, right) { + return ( + !util.isTokenOnSameLine(left, right) || + sourceCode.isSpaceBetweenTokens(left, right) === always + ); + } + + /** + * Checks and reports invalid spacing style inside braces. + * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to check. + * @returns {void} + */ + function checkSpacingInsideBraces(node) { + + // Gets braces and the first/last token of content. + const openBrace = getOpenBrace(node); + const closeBrace = sourceCode.getLastToken(node); + const firstToken = sourceCode.getTokenAfter(openBrace, { includeComments: true }); + const lastToken = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); + + // Skip if the node is invalid or empty. + if (openBrace.type !== "Punctuator" || + openBrace.value !== "{" || + closeBrace.type !== "Punctuator" || + closeBrace.value !== "}" || + firstToken === closeBrace + ) { + return; + } + + // Skip line comments for option never + if (!always && firstToken.type === "Line") { + return; + } + + // Check. + if (!isValid(openBrace, firstToken)) { + let loc = openBrace.loc; + + if (messageId === "extra") { + loc = { + start: openBrace.loc.end, + end: firstToken.loc.start + }; + } + + context.report({ + node, + loc, + messageId, + data: { + location: "after", + token: openBrace.value + }, + fix(fixer) { + if (always) { + return fixer.insertTextBefore(firstToken, " "); + } + + return fixer.removeRange([openBrace.range[1], firstToken.range[0]]); + } + }); + } + if (!isValid(lastToken, closeBrace)) { + let loc = closeBrace.loc; + + if (messageId === "extra") { + loc = { + start: lastToken.loc.end, + end: closeBrace.loc.start + }; + } + context.report({ + node, + loc, + messageId, + data: { + location: "before", + token: closeBrace.value + }, + fix(fixer) { + if (always) { + return fixer.insertTextAfter(lastToken, " "); + } + + return fixer.removeRange([lastToken.range[1], closeBrace.range[0]]); + } + }); + } + } + + return { + BlockStatement: checkSpacingInsideBraces, + StaticBlock: checkSpacingInsideBraces, + SwitchStatement: checkSpacingInsideBraces + }; + } +}; diff --git a/node_modules/eslint/lib/rules/brace-style.js b/node_modules/eslint/lib/rules/brace-style.js new file mode 100644 index 0000000..f4adb94 --- /dev/null +++ b/node_modules/eslint/lib/rules/brace-style.js @@ -0,0 +1,194 @@ +/** + * @fileoverview Rule to flag block statements that do not use the one true brace style + * @author Ian Christian Myers + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent brace style for blocks", + recommended: false, + url: "https://eslint.org/docs/rules/brace-style" + }, + + schema: [ + { + enum: ["1tbs", "stroustrup", "allman"] + }, + { + type: "object", + properties: { + allowSingleLine: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "whitespace", + + messages: { + nextLineOpen: "Opening curly brace does not appear on the same line as controlling statement.", + sameLineOpen: "Opening curly brace appears on the same line as controlling statement.", + blockSameLine: "Statement inside of curly braces should be on next line.", + nextLineClose: "Closing curly brace does not appear on the same line as the subsequent block.", + singleLineClose: "Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.", + sameLineClose: "Closing curly brace appears on the same line as the subsequent block." + } + }, + + create(context) { + const style = context.options[0] || "1tbs", + params = context.options[1] || {}, + sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Fixes a place where a newline unexpectedly appears + * @param {Token} firstToken The token before the unexpected newline + * @param {Token} secondToken The token after the unexpected newline + * @returns {Function} A fixer function to remove the newlines between the tokens + */ + function removeNewlineBetween(firstToken, secondToken) { + const textRange = [firstToken.range[1], secondToken.range[0]]; + const textBetween = sourceCode.text.slice(textRange[0], textRange[1]); + + // Don't do a fix if there is a comment between the tokens + if (textBetween.trim()) { + return null; + } + return fixer => fixer.replaceTextRange(textRange, " "); + } + + /** + * Validates a pair of curly brackets based on the user's config + * @param {Token} openingCurly The opening curly bracket + * @param {Token} closingCurly The closing curly bracket + * @returns {void} + */ + function validateCurlyPair(openingCurly, closingCurly) { + const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurly); + const tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurly); + const tokenBeforeClosingCurly = sourceCode.getTokenBefore(closingCurly); + const singleLineException = params.allowSingleLine && astUtils.isTokenOnSameLine(openingCurly, closingCurly); + + if (style !== "allman" && !astUtils.isTokenOnSameLine(tokenBeforeOpeningCurly, openingCurly)) { + context.report({ + node: openingCurly, + messageId: "nextLineOpen", + fix: removeNewlineBetween(tokenBeforeOpeningCurly, openingCurly) + }); + } + + if (style === "allman" && astUtils.isTokenOnSameLine(tokenBeforeOpeningCurly, openingCurly) && !singleLineException) { + context.report({ + node: openingCurly, + messageId: "sameLineOpen", + fix: fixer => fixer.insertTextBefore(openingCurly, "\n") + }); + } + + if (astUtils.isTokenOnSameLine(openingCurly, tokenAfterOpeningCurly) && tokenAfterOpeningCurly !== closingCurly && !singleLineException) { + context.report({ + node: openingCurly, + messageId: "blockSameLine", + fix: fixer => fixer.insertTextAfter(openingCurly, "\n") + }); + } + + if (tokenBeforeClosingCurly !== openingCurly && !singleLineException && astUtils.isTokenOnSameLine(tokenBeforeClosingCurly, closingCurly)) { + context.report({ + node: closingCurly, + messageId: "singleLineClose", + fix: fixer => fixer.insertTextBefore(closingCurly, "\n") + }); + } + } + + /** + * Validates the location of a token that appears before a keyword (e.g. a newline before `else`) + * @param {Token} curlyToken The closing curly token. This is assumed to precede a keyword token (such as `else` or `finally`). + * @returns {void} + */ + function validateCurlyBeforeKeyword(curlyToken) { + const keywordToken = sourceCode.getTokenAfter(curlyToken); + + if (style === "1tbs" && !astUtils.isTokenOnSameLine(curlyToken, keywordToken)) { + context.report({ + node: curlyToken, + messageId: "nextLineClose", + fix: removeNewlineBetween(curlyToken, keywordToken) + }); + } + + if (style !== "1tbs" && astUtils.isTokenOnSameLine(curlyToken, keywordToken)) { + context.report({ + node: curlyToken, + messageId: "sameLineClose", + fix: fixer => fixer.insertTextAfter(curlyToken, "\n") + }); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + BlockStatement(node) { + if (!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)) { + validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node)); + } + }, + StaticBlock(node) { + validateCurlyPair( + sourceCode.getFirstToken(node, { skip: 1 }), // skip the `static` token + sourceCode.getLastToken(node) + ); + }, + ClassBody(node) { + validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node)); + }, + SwitchStatement(node) { + const closingCurly = sourceCode.getLastToken(node); + const openingCurly = sourceCode.getTokenBefore(node.cases.length ? node.cases[0] : closingCurly); + + validateCurlyPair(openingCurly, closingCurly); + }, + IfStatement(node) { + if (node.consequent.type === "BlockStatement" && node.alternate) { + + // Handle the keyword after the `if` block (before `else`) + validateCurlyBeforeKeyword(sourceCode.getLastToken(node.consequent)); + } + }, + TryStatement(node) { + + // Handle the keyword after the `try` block (before `catch` or `finally`) + validateCurlyBeforeKeyword(sourceCode.getLastToken(node.block)); + + if (node.handler && node.finalizer) { + + // Handle the keyword after the `catch` block (before `finally`) + validateCurlyBeforeKeyword(sourceCode.getLastToken(node.handler.body)); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/callback-return.js b/node_modules/eslint/lib/rules/callback-return.js new file mode 100644 index 0000000..34b7463 --- /dev/null +++ b/node_modules/eslint/lib/rules/callback-return.js @@ -0,0 +1,187 @@ +/** + * @fileoverview Enforce return after a callback. + * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "require `return` statements after callbacks", + recommended: false, + url: "https://eslint.org/docs/rules/callback-return" + }, + + schema: [{ + type: "array", + items: { type: "string" } + }], + + messages: { + missingReturn: "Expected return with your callback function." + } + }, + + create(context) { + + const callbacks = context.options[0] || ["callback", "cb", "next"], + sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Find the closest parent matching a list of types. + * @param {ASTNode} node The node whose parents we are searching + * @param {Array} types The node types to match + * @returns {ASTNode} The matched node or undefined. + */ + function findClosestParentOfType(node, types) { + if (!node.parent) { + return null; + } + if (!types.includes(node.parent.type)) { + return findClosestParentOfType(node.parent, types); + } + return node.parent; + } + + /** + * Check to see if a node contains only identifiers + * @param {ASTNode} node The node to check + * @returns {boolean} Whether or not the node contains only identifiers + */ + function containsOnlyIdentifiers(node) { + if (node.type === "Identifier") { + return true; + } + + if (node.type === "MemberExpression") { + if (node.object.type === "Identifier") { + return true; + } + if (node.object.type === "MemberExpression") { + return containsOnlyIdentifiers(node.object); + } + } + + return false; + } + + /** + * Check to see if a CallExpression is in our callback list. + * @param {ASTNode} node The node to check against our callback names list. + * @returns {boolean} Whether or not this function matches our callback name. + */ + function isCallback(node) { + return containsOnlyIdentifiers(node.callee) && callbacks.includes(sourceCode.getText(node.callee)); + } + + /** + * Determines whether or not the callback is part of a callback expression. + * @param {ASTNode} node The callback node + * @param {ASTNode} parentNode The expression node + * @returns {boolean} Whether or not this is part of a callback expression + */ + function isCallbackExpression(node, parentNode) { + + // ensure the parent node exists and is an expression + if (!parentNode || parentNode.type !== "ExpressionStatement") { + return false; + } + + // cb() + if (parentNode.expression === node) { + return true; + } + + // special case for cb && cb() and similar + if (parentNode.expression.type === "BinaryExpression" || parentNode.expression.type === "LogicalExpression") { + if (parentNode.expression.right === node) { + return true; + } + } + + return false; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + CallExpression(node) { + + // if we're not a callback we can return + if (!isCallback(node)) { + return; + } + + // find the closest block, return or loop + const closestBlock = findClosestParentOfType(node, ["BlockStatement", "ReturnStatement", "ArrowFunctionExpression"]) || {}; + + // if our parent is a return we know we're ok + if (closestBlock.type === "ReturnStatement") { + return; + } + + // arrow functions don't always have blocks and implicitly return + if (closestBlock.type === "ArrowFunctionExpression") { + return; + } + + // block statements are part of functions and most if statements + if (closestBlock.type === "BlockStatement") { + + // find the last item in the block + const lastItem = closestBlock.body[closestBlock.body.length - 1]; + + // if the callback is the last thing in a block that might be ok + if (isCallbackExpression(node, lastItem)) { + + const parentType = closestBlock.parent.type; + + // but only if the block is part of a function + if (parentType === "FunctionExpression" || + parentType === "FunctionDeclaration" || + parentType === "ArrowFunctionExpression" + ) { + return; + } + + } + + // ending a block with a return is also ok + if (lastItem.type === "ReturnStatement") { + + // but only if the callback is immediately before + if (isCallbackExpression(node, closestBlock.body[closestBlock.body.length - 2])) { + return; + } + } + + } + + // as long as you're the child of a function at this point you should be asked to return + if (findClosestParentOfType(node, ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"])) { + context.report({ node, messageId: "missingReturn" }); + } + + } + + }; + } +}; diff --git a/node_modules/eslint/lib/rules/camelcase.js b/node_modules/eslint/lib/rules/camelcase.js new file mode 100644 index 0000000..e476146 --- /dev/null +++ b/node_modules/eslint/lib/rules/camelcase.js @@ -0,0 +1,398 @@ +/** + * @fileoverview Rule to flag non-camelcased identifiers + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce camelcase naming convention", + recommended: false, + url: "https://eslint.org/docs/rules/camelcase" + }, + + schema: [ + { + type: "object", + properties: { + ignoreDestructuring: { + type: "boolean", + default: false + }, + ignoreImports: { + type: "boolean", + default: false + }, + ignoreGlobals: { + type: "boolean", + default: false + }, + properties: { + enum: ["always", "never"] + }, + allow: { + type: "array", + items: [ + { + type: "string" + } + ], + minItems: 0, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + notCamelCase: "Identifier '{{name}}' is not in camel case.", + notCamelCasePrivate: "#{{name}} is not in camel case." + } + }, + + create(context) { + const options = context.options[0] || {}; + const properties = options.properties === "never" ? "never" : "always"; + const ignoreDestructuring = options.ignoreDestructuring; + const ignoreImports = options.ignoreImports; + const ignoreGlobals = options.ignoreGlobals; + const allow = options.allow || []; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // contains reported nodes to avoid reporting twice on destructuring with shorthand notation + const reported = new Set(); + + /** + * Checks if a string contains an underscore and isn't all upper-case + * @param {string} name The string to check. + * @returns {boolean} if the string is underscored + * @private + */ + function isUnderscored(name) { + const nameBody = name.replace(/^_+|_+$/gu, ""); + + // if there's an underscore, it might be A_CONSTANT, which is okay + return nameBody.includes("_") && nameBody !== nameBody.toUpperCase(); + } + + /** + * Checks if a string match the ignore list + * @param {string} name The string to check. + * @returns {boolean} if the string is ignored + * @private + */ + function isAllowed(name) { + return allow.some( + entry => name === entry || name.match(new RegExp(entry, "u")) + ); + } + + /** + * Checks if a given name is good or not. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is good. + * @private + */ + function isGoodName(name) { + return !isUnderscored(name) || isAllowed(name); + } + + /** + * Checks if a given identifier reference or member expression is an assignment + * target. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is an assignment target. + */ + function isAssignmentTarget(node) { + const parent = node.parent; + + switch (parent.type) { + case "AssignmentExpression": + case "AssignmentPattern": + return parent.left === node; + + case "Property": + return ( + parent.parent.type === "ObjectPattern" && + parent.value === node + ); + case "ArrayPattern": + case "RestElement": + return true; + + default: + return false; + } + } + + /** + * Checks if a given binding identifier uses the original name as-is. + * - If it's in object destructuring or object expression, the original name is its property name. + * - If it's in import declaration, the original name is its exported name. + * @param {ASTNode} node The `Identifier` node to check. + * @returns {boolean} `true` if the identifier uses the original name as-is. + */ + function equalsToOriginalName(node) { + const localName = node.name; + const valueNode = node.parent.type === "AssignmentPattern" + ? node.parent + : node; + const parent = valueNode.parent; + + switch (parent.type) { + case "Property": + return ( + (parent.parent.type === "ObjectPattern" || parent.parent.type === "ObjectExpression") && + parent.value === valueNode && + !parent.computed && + parent.key.type === "Identifier" && + parent.key.name === localName + ); + + case "ImportSpecifier": + return ( + parent.local === node && + astUtils.getModuleExportName(parent.imported) === localName + ); + + default: + return false; + } + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + if (reported.has(node.range[0])) { + return; + } + reported.add(node.range[0]); + + // Report it. + context.report({ + node, + messageId: node.type === "PrivateIdentifier" + ? "notCamelCasePrivate" + : "notCamelCase", + data: { name: node.name } + }); + } + + /** + * Reports an identifier reference or a binding identifier. + * @param {ASTNode} node The `Identifier` node to report. + * @returns {void} + */ + function reportReferenceId(node) { + + /* + * For backward compatibility, if it's in callings then ignore it. + * Not sure why it is. + */ + if ( + node.parent.type === "CallExpression" || + node.parent.type === "NewExpression" + ) { + return; + } + + /* + * For backward compatibility, if it's a default value of + * destructuring/parameters then ignore it. + * Not sure why it is. + */ + if ( + node.parent.type === "AssignmentPattern" && + node.parent.right === node + ) { + return; + } + + /* + * The `ignoreDestructuring` flag skips the identifiers that uses + * the property name as-is. + */ + if (ignoreDestructuring && equalsToOriginalName(node)) { + return; + } + + report(node); + } + + return { + + // Report camelcase of global variable references ------------------ + Program() { + const scope = context.getScope(); + + if (!ignoreGlobals) { + + // Defined globals in config files or directive comments. + for (const variable of scope.variables) { + if ( + variable.identifiers.length > 0 || + isGoodName(variable.name) + ) { + continue; + } + for (const reference of variable.references) { + + /* + * For backward compatibility, this rule reports read-only + * references as well. + */ + reportReferenceId(reference.identifier); + } + } + } + + // Undefined globals. + for (const reference of scope.through) { + const id = reference.identifier; + + if (isGoodName(id.name)) { + continue; + } + + /* + * For backward compatibility, this rule reports read-only + * references as well. + */ + reportReferenceId(id); + } + }, + + // Report camelcase of declared variables -------------------------- + [[ + "VariableDeclaration", + "FunctionDeclaration", + "FunctionExpression", + "ArrowFunctionExpression", + "ClassDeclaration", + "ClassExpression", + "CatchClause" + ]](node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + const id = variable.identifiers[0]; + + // Report declaration. + if (!(ignoreDestructuring && equalsToOriginalName(id))) { + report(id); + } + + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + for (const reference of variable.references) { + if (reference.init) { + continue; // Skip the write references of initializers. + } + reportReferenceId(reference.identifier); + } + } + }, + + // Report camelcase in properties ---------------------------------- + [[ + "ObjectExpression > Property[computed!=true] > Identifier.key", + "MethodDefinition[computed!=true] > Identifier.key", + "PropertyDefinition[computed!=true] > Identifier.key", + "MethodDefinition > PrivateIdentifier.key", + "PropertyDefinition > PrivateIdentifier.key" + ]](node) { + if (properties === "never" || isGoodName(node.name)) { + return; + } + report(node); + }, + "MemberExpression[computed!=true] > Identifier.property"(node) { + if ( + properties === "never" || + !isAssignmentTarget(node.parent) || // ← ignore read-only references. + isGoodName(node.name) + ) { + return; + } + report(node); + }, + + // Report camelcase in import -------------------------------------- + ImportDeclaration(node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + const id = variable.identifiers[0]; + + // Report declaration. + if (!(ignoreImports && equalsToOriginalName(id))) { + report(id); + } + + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + for (const reference of variable.references) { + reportReferenceId(reference.identifier); + } + } + }, + + // Report camelcase in re-export ----------------------------------- + [[ + "ExportAllDeclaration > Identifier.exported", + "ExportSpecifier > Identifier.exported" + ]](node) { + if (isGoodName(node.name)) { + return; + } + report(node); + }, + + // Report camelcase in labels -------------------------------------- + [[ + "LabeledStatement > Identifier.label", + + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + "BreakStatement > Identifier.label", + "ContinueStatement > Identifier.label" + ]](node) { + if (isGoodName(node.name)) { + return; + } + report(node); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/capitalized-comments.js b/node_modules/eslint/lib/rules/capitalized-comments.js new file mode 100644 index 0000000..dffe956 --- /dev/null +++ b/node_modules/eslint/lib/rules/capitalized-comments.js @@ -0,0 +1,300 @@ +/** + * @fileoverview enforce or disallow capitalization of the first letter of a comment + * @author Kevin Partington + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const LETTER_PATTERN = require("./utils/patterns/letters"); +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const DEFAULT_IGNORE_PATTERN = astUtils.COMMENTS_IGNORE_PATTERN, + WHITESPACE = /\s/gu, + MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/u; // TODO: Combine w/ max-len pattern? + +/* + * Base schema body for defining the basic capitalization rule, ignorePattern, + * and ignoreInlineComments values. + * This can be used in a few different ways in the actual schema. + */ +const SCHEMA_BODY = { + type: "object", + properties: { + ignorePattern: { + type: "string" + }, + ignoreInlineComments: { + type: "boolean" + }, + ignoreConsecutiveComments: { + type: "boolean" + } + }, + additionalProperties: false +}; +const DEFAULTS = { + ignorePattern: "", + ignoreInlineComments: false, + ignoreConsecutiveComments: false +}; + +/** + * Get normalized options for either block or line comments from the given + * user-provided options. + * - If the user-provided options is just a string, returns a normalized + * set of options using default values for all other options. + * - If the user-provided options is an object, then a normalized option + * set is returned. Options specified in overrides will take priority + * over options specified in the main options object, which will in + * turn take priority over the rule's defaults. + * @param {Object|string} rawOptions The user-provided options. + * @param {string} which Either "line" or "block". + * @returns {Object} The normalized options. + */ +function getNormalizedOptions(rawOptions, which) { + return Object.assign({}, DEFAULTS, rawOptions[which] || rawOptions); +} + +/** + * Get normalized options for block and line comments. + * @param {Object|string} rawOptions The user-provided options. + * @returns {Object} An object with "Line" and "Block" keys and corresponding + * normalized options objects. + */ +function getAllNormalizedOptions(rawOptions = {}) { + return { + Line: getNormalizedOptions(rawOptions, "line"), + Block: getNormalizedOptions(rawOptions, "block") + }; +} + +/** + * Creates a regular expression for each ignorePattern defined in the rule + * options. + * + * This is done in order to avoid invoking the RegExp constructor repeatedly. + * @param {Object} normalizedOptions The normalized rule options. + * @returns {void} + */ +function createRegExpForIgnorePatterns(normalizedOptions) { + Object.keys(normalizedOptions).forEach(key => { + const ignorePatternStr = normalizedOptions[key].ignorePattern; + + if (ignorePatternStr) { + const regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u"); + + normalizedOptions[key].ignorePatternRegExp = regExp; + } + }); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce or disallow capitalization of the first letter of a comment", + recommended: false, + url: "https://eslint.org/docs/rules/capitalized-comments" + }, + + fixable: "code", + + schema: [ + { enum: ["always", "never"] }, + { + oneOf: [ + SCHEMA_BODY, + { + type: "object", + properties: { + line: SCHEMA_BODY, + block: SCHEMA_BODY + }, + additionalProperties: false + } + ] + } + ], + + messages: { + unexpectedLowercaseComment: "Comments should not begin with a lowercase character.", + unexpectedUppercaseComment: "Comments should not begin with an uppercase character." + } + }, + + create(context) { + + const capitalize = context.options[0] || "always", + normalizedOptions = getAllNormalizedOptions(context.options[1]), + sourceCode = context.getSourceCode(); + + createRegExpForIgnorePatterns(normalizedOptions); + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Checks whether a comment is an inline comment. + * + * For the purpose of this rule, a comment is inline if: + * 1. The comment is preceded by a token on the same line; and + * 2. The command is followed by a token on the same line. + * + * Note that the comment itself need not be single-line! + * + * Also, it follows from this definition that only block comments can + * be considered as possibly inline. This is because line comments + * would consume any following tokens on the same line as the comment. + * @param {ASTNode} comment The comment node to check. + * @returns {boolean} True if the comment is an inline comment, false + * otherwise. + */ + function isInlineComment(comment) { + const previousToken = sourceCode.getTokenBefore(comment, { includeComments: true }), + nextToken = sourceCode.getTokenAfter(comment, { includeComments: true }); + + return Boolean( + previousToken && + nextToken && + comment.loc.start.line === previousToken.loc.end.line && + comment.loc.end.line === nextToken.loc.start.line + ); + } + + /** + * Determine if a comment follows another comment. + * @param {ASTNode} comment The comment to check. + * @returns {boolean} True if the comment follows a valid comment. + */ + function isConsecutiveComment(comment) { + const previousTokenOrComment = sourceCode.getTokenBefore(comment, { includeComments: true }); + + return Boolean( + previousTokenOrComment && + ["Block", "Line"].includes(previousTokenOrComment.type) + ); + } + + /** + * Check a comment to determine if it is valid for this rule. + * @param {ASTNode} comment The comment node to process. + * @param {Object} options The options for checking this comment. + * @returns {boolean} True if the comment is valid, false otherwise. + */ + function isCommentValid(comment, options) { + + // 1. Check for default ignore pattern. + if (DEFAULT_IGNORE_PATTERN.test(comment.value)) { + return true; + } + + // 2. Check for custom ignore pattern. + const commentWithoutAsterisks = comment.value + .replace(/\*/gu, ""); + + if (options.ignorePatternRegExp && options.ignorePatternRegExp.test(commentWithoutAsterisks)) { + return true; + } + + // 3. Check for inline comments. + if (options.ignoreInlineComments && isInlineComment(comment)) { + return true; + } + + // 4. Is this a consecutive comment (and are we tolerating those)? + if (options.ignoreConsecutiveComments && isConsecutiveComment(comment)) { + return true; + } + + // 5. Does the comment start with a possible URL? + if (MAYBE_URL.test(commentWithoutAsterisks)) { + return true; + } + + // 6. Is the initial word character a letter? + const commentWordCharsOnly = commentWithoutAsterisks + .replace(WHITESPACE, ""); + + if (commentWordCharsOnly.length === 0) { + return true; + } + + const firstWordChar = commentWordCharsOnly[0]; + + if (!LETTER_PATTERN.test(firstWordChar)) { + return true; + } + + // 7. Check the case of the initial word character. + const isUppercase = firstWordChar !== firstWordChar.toLocaleLowerCase(), + isLowercase = firstWordChar !== firstWordChar.toLocaleUpperCase(); + + if (capitalize === "always" && isLowercase) { + return false; + } + if (capitalize === "never" && isUppercase) { + return false; + } + + return true; + } + + /** + * Process a comment to determine if it needs to be reported. + * @param {ASTNode} comment The comment node to process. + * @returns {void} + */ + function processComment(comment) { + const options = normalizedOptions[comment.type], + commentValid = isCommentValid(comment, options); + + if (!commentValid) { + const messageId = capitalize === "always" + ? "unexpectedLowercaseComment" + : "unexpectedUppercaseComment"; + + context.report({ + node: null, // Intentionally using loc instead + loc: comment.loc, + messageId, + fix(fixer) { + const match = comment.value.match(LETTER_PATTERN); + + return fixer.replaceTextRange( + + // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*) + [comment.range[0] + match.index + 2, comment.range[0] + match.index + 3], + capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase() + ); + } + }); + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + Program() { + const comments = sourceCode.getAllComments(); + + comments.filter(token => token.type !== "Shebang").forEach(processComment); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/class-methods-use-this.js b/node_modules/eslint/lib/rules/class-methods-use-this.js new file mode 100644 index 0000000..1af6084 --- /dev/null +++ b/node_modules/eslint/lib/rules/class-methods-use-this.js @@ -0,0 +1,187 @@ +/** + * @fileoverview Rule to enforce that all class methods use 'this'. + * @author Patrick Williams + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce that class methods utilize `this`", + recommended: false, + url: "https://eslint.org/docs/rules/class-methods-use-this" + }, + + schema: [{ + type: "object", + properties: { + exceptMethods: { + type: "array", + items: { + type: "string" + } + }, + enforceForClassFields: { + type: "boolean", + default: true + } + }, + additionalProperties: false + }], + + messages: { + missingThis: "Expected 'this' to be used by class {{name}}." + } + }, + create(context) { + const config = Object.assign({}, context.options[0]); + const enforceForClassFields = config.enforceForClassFields !== false; + const exceptMethods = new Set(config.exceptMethods || []); + + const stack = []; + + /** + * Push `this` used flag initialized with `false` onto the stack. + * @returns {void} + */ + function pushContext() { + stack.push(false); + } + + /** + * Pop `this` used flag from the stack. + * @returns {boolean | undefined} `this` used flag + */ + function popContext() { + return stack.pop(); + } + + /** + * Initializes the current context to false and pushes it onto the stack. + * These booleans represent whether 'this' has been used in the context. + * @returns {void} + * @private + */ + function enterFunction() { + pushContext(); + } + + /** + * Check if the node is an instance method + * @param {ASTNode} node node to check + * @returns {boolean} True if its an instance method + * @private + */ + function isInstanceMethod(node) { + switch (node.type) { + case "MethodDefinition": + return !node.static && node.kind !== "constructor"; + case "PropertyDefinition": + return !node.static && enforceForClassFields; + default: + return false; + } + } + + /** + * Check if the node is an instance method not excluded by config + * @param {ASTNode} node node to check + * @returns {boolean} True if it is an instance method, and not excluded by config + * @private + */ + function isIncludedInstanceMethod(node) { + if (isInstanceMethod(node)) { + if (node.computed) { + return true; + } + + const hashIfNeeded = node.key.type === "PrivateIdentifier" ? "#" : ""; + const name = node.key.type === "Literal" + ? astUtils.getStaticStringValue(node.key) + : (node.key.name || ""); + + return !exceptMethods.has(hashIfNeeded + name); + } + return false; + } + + /** + * Checks if we are leaving a function that is a method, and reports if 'this' has not been used. + * Static methods and the constructor are exempt. + * Then pops the context off the stack. + * @param {ASTNode} node A function node that was entered. + * @returns {void} + * @private + */ + function exitFunction(node) { + const methodUsesThis = popContext(); + + if (isIncludedInstanceMethod(node.parent) && !methodUsesThis) { + context.report({ + node, + loc: astUtils.getFunctionHeadLoc(node, context.getSourceCode()), + messageId: "missingThis", + data: { + name: astUtils.getFunctionNameWithKind(node) + } + }); + } + } + + /** + * Mark the current context as having used 'this'. + * @returns {void} + * @private + */ + function markThisUsed() { + if (stack.length) { + stack[stack.length - 1] = true; + } + } + + return { + FunctionDeclaration: enterFunction, + "FunctionDeclaration:exit": exitFunction, + FunctionExpression: enterFunction, + "FunctionExpression:exit": exitFunction, + + /* + * Class field value are implicit functions. + */ + "PropertyDefinition > *.key:exit": pushContext, + "PropertyDefinition:exit": popContext, + + /* + * Class static blocks are implicit functions. They aren't required to use `this`, + * but we have to push context so that it captures any use of `this` in the static block + * separately from enclosing contexts, because static blocks have their own `this` and it + * shouldn't count as used `this` in enclosing contexts. + */ + StaticBlock: pushContext, + "StaticBlock:exit": popContext, + + ThisExpression: markThisUsed, + Super: markThisUsed, + ...( + enforceForClassFields && { + "PropertyDefinition > ArrowFunctionExpression.value": enterFunction, + "PropertyDefinition > ArrowFunctionExpression.value:exit": exitFunction + } + ) + }; + } +}; diff --git a/node_modules/eslint/lib/rules/comma-dangle.js b/node_modules/eslint/lib/rules/comma-dangle.js new file mode 100644 index 0000000..063e1cb --- /dev/null +++ b/node_modules/eslint/lib/rules/comma-dangle.js @@ -0,0 +1,370 @@ +/** + * @fileoverview Rule to forbid or enforce dangling commas. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const DEFAULT_OPTIONS = Object.freeze({ + arrays: "never", + objects: "never", + imports: "never", + exports: "never", + functions: "never" +}); + +/** + * Checks whether or not a trailing comma is allowed in a given node. + * If the `lastItem` is `RestElement` or `RestProperty`, it disallows trailing commas. + * @param {ASTNode} lastItem The node of the last element in the given node. + * @returns {boolean} `true` if a trailing comma is allowed. + */ +function isTrailingCommaAllowed(lastItem) { + return !( + lastItem.type === "RestElement" || + lastItem.type === "RestProperty" || + lastItem.type === "ExperimentalRestProperty" + ); +} + +/** + * Normalize option value. + * @param {string|Object|undefined} optionValue The 1st option value to normalize. + * @param {number} ecmaVersion The normalized ECMAScript version. + * @returns {Object} The normalized option value. + */ +function normalizeOptions(optionValue, ecmaVersion) { + if (typeof optionValue === "string") { + return { + arrays: optionValue, + objects: optionValue, + imports: optionValue, + exports: optionValue, + functions: (!ecmaVersion || ecmaVersion < 8) ? "ignore" : optionValue + }; + } + if (typeof optionValue === "object" && optionValue !== null) { + return { + arrays: optionValue.arrays || DEFAULT_OPTIONS.arrays, + objects: optionValue.objects || DEFAULT_OPTIONS.objects, + imports: optionValue.imports || DEFAULT_OPTIONS.imports, + exports: optionValue.exports || DEFAULT_OPTIONS.exports, + functions: optionValue.functions || DEFAULT_OPTIONS.functions + }; + } + + return DEFAULT_OPTIONS; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow trailing commas", + recommended: false, + url: "https://eslint.org/docs/rules/comma-dangle" + }, + + fixable: "code", + + schema: { + definitions: { + value: { + enum: [ + "always-multiline", + "always", + "never", + "only-multiline" + ] + }, + valueWithIgnore: { + enum: [ + "always-multiline", + "always", + "ignore", + "never", + "only-multiline" + ] + } + }, + type: "array", + items: [ + { + oneOf: [ + { + $ref: "#/definitions/value" + }, + { + type: "object", + properties: { + arrays: { $ref: "#/definitions/valueWithIgnore" }, + objects: { $ref: "#/definitions/valueWithIgnore" }, + imports: { $ref: "#/definitions/valueWithIgnore" }, + exports: { $ref: "#/definitions/valueWithIgnore" }, + functions: { $ref: "#/definitions/valueWithIgnore" } + }, + additionalProperties: false + } + ] + } + ], + additionalItems: false + }, + + messages: { + unexpected: "Unexpected trailing comma.", + missing: "Missing trailing comma." + } + }, + + create(context) { + const options = normalizeOptions(context.options[0], context.parserOptions.ecmaVersion); + + const sourceCode = context.getSourceCode(); + + /** + * Gets the last item of the given node. + * @param {ASTNode} node The node to get. + * @returns {ASTNode|null} The last node or null. + */ + function getLastItem(node) { + + /** + * Returns the last element of an array + * @param {any[]} array The input array + * @returns {any} The last element + */ + function last(array) { + return array[array.length - 1]; + } + + switch (node.type) { + case "ObjectExpression": + case "ObjectPattern": + return last(node.properties); + case "ArrayExpression": + case "ArrayPattern": + return last(node.elements); + case "ImportDeclaration": + case "ExportNamedDeclaration": + return last(node.specifiers); + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + return last(node.params); + case "CallExpression": + case "NewExpression": + return last(node.arguments); + default: + return null; + } + } + + /** + * Gets the trailing comma token of the given node. + * If the trailing comma does not exist, this returns the token which is + * the insertion point of the trailing comma token. + * @param {ASTNode} node The node to get. + * @param {ASTNode} lastItem The last item of the node. + * @returns {Token} The trailing comma token or the insertion point. + */ + function getTrailingToken(node, lastItem) { + switch (node.type) { + case "ObjectExpression": + case "ArrayExpression": + case "CallExpression": + case "NewExpression": + return sourceCode.getLastToken(node, 1); + default: { + const nextToken = sourceCode.getTokenAfter(lastItem); + + if (astUtils.isCommaToken(nextToken)) { + return nextToken; + } + return sourceCode.getLastToken(lastItem); + } + } + } + + /** + * Checks whether or not a given node is multiline. + * This rule handles a given node as multiline when the closing parenthesis + * and the last element are not on the same line. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is multiline. + */ + function isMultiline(node) { + const lastItem = getLastItem(node); + + if (!lastItem) { + return false; + } + + const penultimateToken = getTrailingToken(node, lastItem); + const lastToken = sourceCode.getTokenAfter(penultimateToken); + + return lastToken.loc.end.line !== penultimateToken.loc.end.line; + } + + /** + * Reports a trailing comma if it exists. + * @param {ASTNode} node A node to check. Its type is one of + * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, + * ImportDeclaration, and ExportNamedDeclaration. + * @returns {void} + */ + function forbidTrailingComma(node) { + const lastItem = getLastItem(node); + + if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { + return; + } + + const trailingToken = getTrailingToken(node, lastItem); + + if (astUtils.isCommaToken(trailingToken)) { + context.report({ + node: lastItem, + loc: trailingToken.loc, + messageId: "unexpected", + *fix(fixer) { + yield fixer.remove(trailingToken); + + /* + * Extend the range of the fix to include surrounding tokens to ensure + * that the element after which the comma is removed stays _last_. + * This intentionally makes conflicts in fix ranges with rules that may be + * adding or removing elements in the same autofix pass. + * https://github.com/eslint/eslint/issues/15660 + */ + yield fixer.insertTextBefore(sourceCode.getTokenBefore(trailingToken), ""); + yield fixer.insertTextAfter(sourceCode.getTokenAfter(trailingToken), ""); + } + }); + } + } + + /** + * Reports the last element of a given node if it does not have a trailing + * comma. + * + * If a given node is `ArrayPattern` which has `RestElement`, the trailing + * comma is disallowed, so report if it exists. + * @param {ASTNode} node A node to check. Its type is one of + * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, + * ImportDeclaration, and ExportNamedDeclaration. + * @returns {void} + */ + function forceTrailingComma(node) { + const lastItem = getLastItem(node); + + if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { + return; + } + if (!isTrailingCommaAllowed(lastItem)) { + forbidTrailingComma(node); + return; + } + + const trailingToken = getTrailingToken(node, lastItem); + + if (trailingToken.value !== ",") { + context.report({ + node: lastItem, + loc: { + start: trailingToken.loc.end, + end: astUtils.getNextLocation(sourceCode, trailingToken.loc.end) + }, + messageId: "missing", + *fix(fixer) { + yield fixer.insertTextAfter(trailingToken, ","); + + /* + * Extend the range of the fix to include surrounding tokens to ensure + * that the element after which the comma is inserted stays _last_. + * This intentionally makes conflicts in fix ranges with rules that may be + * adding or removing elements in the same autofix pass. + * https://github.com/eslint/eslint/issues/15660 + */ + yield fixer.insertTextBefore(trailingToken, ""); + yield fixer.insertTextAfter(sourceCode.getTokenAfter(trailingToken), ""); + } + }); + } + } + + /** + * If a given node is multiline, reports the last element of a given node + * when it does not have a trailing comma. + * Otherwise, reports a trailing comma if it exists. + * @param {ASTNode} node A node to check. Its type is one of + * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, + * ImportDeclaration, and ExportNamedDeclaration. + * @returns {void} + */ + function forceTrailingCommaIfMultiline(node) { + if (isMultiline(node)) { + forceTrailingComma(node); + } else { + forbidTrailingComma(node); + } + } + + /** + * Only if a given node is not multiline, reports the last element of a given node + * when it does not have a trailing comma. + * Otherwise, reports a trailing comma if it exists. + * @param {ASTNode} node A node to check. Its type is one of + * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, + * ImportDeclaration, and ExportNamedDeclaration. + * @returns {void} + */ + function allowTrailingCommaIfMultiline(node) { + if (!isMultiline(node)) { + forbidTrailingComma(node); + } + } + + const predicate = { + always: forceTrailingComma, + "always-multiline": forceTrailingCommaIfMultiline, + "only-multiline": allowTrailingCommaIfMultiline, + never: forbidTrailingComma, + ignore: () => {} + }; + + return { + ObjectExpression: predicate[options.objects], + ObjectPattern: predicate[options.objects], + + ArrayExpression: predicate[options.arrays], + ArrayPattern: predicate[options.arrays], + + ImportDeclaration: predicate[options.imports], + + ExportNamedDeclaration: predicate[options.exports], + + FunctionDeclaration: predicate[options.functions], + FunctionExpression: predicate[options.functions], + ArrowFunctionExpression: predicate[options.functions], + CallExpression: predicate[options.functions], + NewExpression: predicate[options.functions] + }; + } +}; diff --git a/node_modules/eslint/lib/rules/comma-spacing.js b/node_modules/eslint/lib/rules/comma-spacing.js new file mode 100644 index 0000000..23a5175 --- /dev/null +++ b/node_modules/eslint/lib/rules/comma-spacing.js @@ -0,0 +1,195 @@ +/** + * @fileoverview Comma spacing - validates spacing before and after comma + * @author Vignesh Anand aka vegetableman. + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before and after commas", + recommended: false, + url: "https://eslint.org/docs/rules/comma-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + before: { + type: "boolean", + default: false + }, + after: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + missing: "A space is required {{loc}} ','.", + unexpected: "There should be no space {{loc}} ','." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + const tokensAndComments = sourceCode.tokensAndComments; + + const options = { + before: context.options[0] ? context.options[0].before : false, + after: context.options[0] ? context.options[0].after : true + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // list of comma tokens to ignore for the check of leading whitespace + const commaTokensToIgnore = []; + + /** + * Reports a spacing error with an appropriate message. + * @param {ASTNode} node The binary expression node to report. + * @param {string} loc Is the error "before" or "after" the comma? + * @param {ASTNode} otherNode The node at the left or right of `node` + * @returns {void} + * @private + */ + function report(node, loc, otherNode) { + context.report({ + node, + fix(fixer) { + if (options[loc]) { + if (loc === "before") { + return fixer.insertTextBefore(node, " "); + } + return fixer.insertTextAfter(node, " "); + + } + let start, end; + const newText = ""; + + if (loc === "before") { + start = otherNode.range[1]; + end = node.range[0]; + } else { + start = node.range[1]; + end = otherNode.range[0]; + } + + return fixer.replaceTextRange([start, end], newText); + + }, + messageId: options[loc] ? "missing" : "unexpected", + data: { + loc + } + }); + } + + /** + * Validates the spacing around a comma token. + * @param {Object} tokens The tokens to be validated. + * @param {Token} tokens.comma The token representing the comma. + * @param {Token} [tokens.left] The last token before the comma. + * @param {Token} [tokens.right] The first token after the comma. + * @param {Token|ASTNode} reportItem The item to use when reporting an error. + * @returns {void} + * @private + */ + function validateCommaItemSpacing(tokens, reportItem) { + if (tokens.left && astUtils.isTokenOnSameLine(tokens.left, tokens.comma) && + (options.before !== sourceCode.isSpaceBetweenTokens(tokens.left, tokens.comma)) + ) { + report(reportItem, "before", tokens.left); + } + + if (tokens.right && astUtils.isClosingParenToken(tokens.right)) { + return; + } + + if (tokens.right && !options.after && tokens.right.type === "Line") { + return; + } + + if (tokens.right && astUtils.isTokenOnSameLine(tokens.comma, tokens.right) && + (options.after !== sourceCode.isSpaceBetweenTokens(tokens.comma, tokens.right)) + ) { + report(reportItem, "after", tokens.right); + } + } + + /** + * Adds null elements of the given ArrayExpression or ArrayPattern node to the ignore list. + * @param {ASTNode} node An ArrayExpression or ArrayPattern node. + * @returns {void} + */ + function addNullElementsToIgnoreList(node) { + let previousToken = sourceCode.getFirstToken(node); + + node.elements.forEach(element => { + let token; + + if (element === null) { + token = sourceCode.getTokenAfter(previousToken); + + if (astUtils.isCommaToken(token)) { + commaTokensToIgnore.push(token); + } + } else { + token = sourceCode.getTokenAfter(element); + } + + previousToken = token; + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "Program:exit"() { + tokensAndComments.forEach((token, i) => { + + if (!astUtils.isCommaToken(token)) { + return; + } + + if (token && token.type === "JSXText") { + return; + } + + const previousToken = tokensAndComments[i - 1]; + const nextToken = tokensAndComments[i + 1]; + + validateCommaItemSpacing({ + comma: token, + left: astUtils.isCommaToken(previousToken) || commaTokensToIgnore.includes(token) ? null : previousToken, + right: astUtils.isCommaToken(nextToken) ? null : nextToken + }, token); + }); + }, + ArrayExpression: addNullElementsToIgnoreList, + ArrayPattern: addNullElementsToIgnoreList + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/comma-style.js b/node_modules/eslint/lib/rules/comma-style.js new file mode 100644 index 0000000..cbcbe3a --- /dev/null +++ b/node_modules/eslint/lib/rules/comma-style.js @@ -0,0 +1,311 @@ +/** + * @fileoverview Comma style - enforces comma styles of two types: last and first + * @author Vignesh Anand aka vegetableman + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent comma style", + recommended: false, + url: "https://eslint.org/docs/rules/comma-style" + }, + + fixable: "code", + + schema: [ + { + enum: ["first", "last"] + }, + { + type: "object", + properties: { + exceptions: { + type: "object", + additionalProperties: { + type: "boolean" + } + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedLineBeforeAndAfterComma: "Bad line breaking before and after ','.", + expectedCommaFirst: "',' should be placed first.", + expectedCommaLast: "',' should be placed last." + } + }, + + create(context) { + const style = context.options[0] || "last", + sourceCode = context.getSourceCode(); + const exceptions = { + ArrayPattern: true, + ArrowFunctionExpression: true, + CallExpression: true, + FunctionDeclaration: true, + FunctionExpression: true, + ImportDeclaration: true, + ObjectPattern: true, + NewExpression: true + }; + + if (context.options.length === 2 && Object.prototype.hasOwnProperty.call(context.options[1], "exceptions")) { + const keys = Object.keys(context.options[1].exceptions); + + for (let i = 0; i < keys.length; i++) { + exceptions[keys[i]] = context.options[1].exceptions[keys[i]]; + } + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Modified text based on the style + * @param {string} styleType Style type + * @param {string} text Source code text + * @returns {string} modified text + * @private + */ + function getReplacedText(styleType, text) { + switch (styleType) { + case "between": + return `,${text.replace(astUtils.LINEBREAK_MATCHER, "")}`; + + case "first": + return `${text},`; + + case "last": + return `,${text}`; + + default: + return ""; + } + } + + /** + * Determines the fixer function for a given style. + * @param {string} styleType comma style + * @param {ASTNode} previousItemToken The token to check. + * @param {ASTNode} commaToken The token to check. + * @param {ASTNode} currentItemToken The token to check. + * @returns {Function} Fixer function + * @private + */ + function getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken) { + const text = + sourceCode.text.slice(previousItemToken.range[1], commaToken.range[0]) + + sourceCode.text.slice(commaToken.range[1], currentItemToken.range[0]); + const range = [previousItemToken.range[1], currentItemToken.range[0]]; + + return function(fixer) { + return fixer.replaceTextRange(range, getReplacedText(styleType, text)); + }; + } + + /** + * Validates the spacing around single items in lists. + * @param {Token} previousItemToken The last token from the previous item. + * @param {Token} commaToken The token representing the comma. + * @param {Token} currentItemToken The first token of the current item. + * @param {Token} reportItem The item to use when reporting an error. + * @returns {void} + * @private + */ + function validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem) { + + // if single line + if (astUtils.isTokenOnSameLine(commaToken, currentItemToken) && + astUtils.isTokenOnSameLine(previousItemToken, commaToken)) { + + // do nothing. + + } else if (!astUtils.isTokenOnSameLine(commaToken, currentItemToken) && + !astUtils.isTokenOnSameLine(previousItemToken, commaToken)) { + + const comment = sourceCode.getCommentsAfter(commaToken)[0]; + const styleType = comment && comment.type === "Block" && astUtils.isTokenOnSameLine(commaToken, comment) + ? style + : "between"; + + // lone comma + context.report({ + node: reportItem, + loc: commaToken.loc, + messageId: "unexpectedLineBeforeAndAfterComma", + fix: getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken) + }); + + } else if (style === "first" && !astUtils.isTokenOnSameLine(commaToken, currentItemToken)) { + + context.report({ + node: reportItem, + loc: commaToken.loc, + messageId: "expectedCommaFirst", + fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken) + }); + + } else if (style === "last" && astUtils.isTokenOnSameLine(commaToken, currentItemToken)) { + + context.report({ + node: reportItem, + loc: commaToken.loc, + messageId: "expectedCommaLast", + fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken) + }); + } + } + + /** + * Checks the comma placement with regards to a declaration/property/element + * @param {ASTNode} node The binary expression node to check + * @param {string} property The property of the node containing child nodes. + * @private + * @returns {void} + */ + function validateComma(node, property) { + const items = node[property], + arrayLiteral = (node.type === "ArrayExpression" || node.type === "ArrayPattern"); + + if (items.length > 1 || arrayLiteral) { + + // seed as opening [ + let previousItemToken = sourceCode.getFirstToken(node); + + items.forEach(item => { + const commaToken = item ? sourceCode.getTokenBefore(item) : previousItemToken, + currentItemToken = item ? sourceCode.getFirstToken(item) : sourceCode.getTokenAfter(commaToken), + reportItem = item || currentItemToken; + + /* + * This works by comparing three token locations: + * - previousItemToken is the last token of the previous item + * - commaToken is the location of the comma before the current item + * - currentItemToken is the first token of the current item + * + * These values get switched around if item is undefined. + * previousItemToken will refer to the last token not belonging + * to the current item, which could be a comma or an opening + * square bracket. currentItemToken could be a comma. + * + * All comparisons are done based on these tokens directly, so + * they are always valid regardless of an undefined item. + */ + if (astUtils.isCommaToken(commaToken)) { + validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem); + } + + if (item) { + const tokenAfterItem = sourceCode.getTokenAfter(item, astUtils.isNotClosingParenToken); + + previousItemToken = tokenAfterItem + ? sourceCode.getTokenBefore(tokenAfterItem) + : sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1]; + } else { + previousItemToken = currentItemToken; + } + }); + + /* + * Special case for array literals that have empty last items, such + * as [ 1, 2, ]. These arrays only have two items show up in the + * AST, so we need to look at the token to verify that there's no + * dangling comma. + */ + if (arrayLiteral) { + + const lastToken = sourceCode.getLastToken(node), + nextToLastToken = sourceCode.getTokenBefore(lastToken); + + if (astUtils.isCommaToken(nextToLastToken)) { + validateCommaItemSpacing( + sourceCode.getTokenBefore(nextToLastToken), + nextToLastToken, + lastToken, + lastToken + ); + } + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + const nodes = {}; + + if (!exceptions.VariableDeclaration) { + nodes.VariableDeclaration = function(node) { + validateComma(node, "declarations"); + }; + } + if (!exceptions.ObjectExpression) { + nodes.ObjectExpression = function(node) { + validateComma(node, "properties"); + }; + } + if (!exceptions.ObjectPattern) { + nodes.ObjectPattern = function(node) { + validateComma(node, "properties"); + }; + } + if (!exceptions.ArrayExpression) { + nodes.ArrayExpression = function(node) { + validateComma(node, "elements"); + }; + } + if (!exceptions.ArrayPattern) { + nodes.ArrayPattern = function(node) { + validateComma(node, "elements"); + }; + } + if (!exceptions.FunctionDeclaration) { + nodes.FunctionDeclaration = function(node) { + validateComma(node, "params"); + }; + } + if (!exceptions.FunctionExpression) { + nodes.FunctionExpression = function(node) { + validateComma(node, "params"); + }; + } + if (!exceptions.ArrowFunctionExpression) { + nodes.ArrowFunctionExpression = function(node) { + validateComma(node, "params"); + }; + } + if (!exceptions.CallExpression) { + nodes.CallExpression = function(node) { + validateComma(node, "arguments"); + }; + } + if (!exceptions.ImportDeclaration) { + nodes.ImportDeclaration = function(node) { + validateComma(node, "specifiers"); + }; + } + if (!exceptions.NewExpression) { + nodes.NewExpression = function(node) { + validateComma(node, "arguments"); + }; + } + + return nodes; + } +}; diff --git a/node_modules/eslint/lib/rules/complexity.js b/node_modules/eslint/lib/rules/complexity.js new file mode 100644 index 0000000..b235555 --- /dev/null +++ b/node_modules/eslint/lib/rules/complexity.js @@ -0,0 +1,165 @@ +/** + * @fileoverview Counts the cyclomatic complexity of each function of the script. See http://en.wikipedia.org/wiki/Cyclomatic_complexity. + * Counts the number of if, conditional, for, while, try, switch/case, + * @author Patrick Brosset + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { upperCaseFirst } = require("../shared/string-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum cyclomatic complexity allowed in a program", + recommended: false, + url: "https://eslint.org/docs/rules/complexity" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + maximum: { + type: "integer", + minimum: 0 + }, + max: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + complex: "{{name}} has a complexity of {{complexity}}. Maximum allowed is {{max}}." + } + }, + + create(context) { + const option = context.options[0]; + let THRESHOLD = 20; + + if ( + typeof option === "object" && + (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) + ) { + THRESHOLD = option.maximum || option.max; + } else if (typeof option === "number") { + THRESHOLD = option; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // Using a stack to store complexity per code path + const complexities = []; + + /** + * Increase the complexity of the code path in context + * @returns {void} + * @private + */ + function increaseComplexity() { + complexities[complexities.length - 1]++; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + onCodePathStart() { + + // The initial complexity is 1, representing one execution path in the CodePath + complexities.push(1); + }, + + // Each branching in the code adds 1 to the complexity + CatchClause: increaseComplexity, + ConditionalExpression: increaseComplexity, + LogicalExpression: increaseComplexity, + ForStatement: increaseComplexity, + ForInStatement: increaseComplexity, + ForOfStatement: increaseComplexity, + IfStatement: increaseComplexity, + WhileStatement: increaseComplexity, + DoWhileStatement: increaseComplexity, + + // Avoid `default` + "SwitchCase[test]": increaseComplexity, + + // Logical assignment operators have short-circuiting behavior + AssignmentExpression(node) { + if (astUtils.isLogicalAssignmentOperator(node.operator)) { + increaseComplexity(); + } + }, + + onCodePathEnd(codePath, node) { + const complexity = complexities.pop(); + + /* + * This rule only evaluates complexity of functions, so "program" is excluded. + * Class field initializers and class static blocks are implicit functions. Therefore, + * they shouldn't contribute to the enclosing function's complexity, but their + * own complexity should be evaluated. + */ + if ( + codePath.origin !== "function" && + codePath.origin !== "class-field-initializer" && + codePath.origin !== "class-static-block" + ) { + return; + } + + if (complexity > THRESHOLD) { + let name; + + if (codePath.origin === "class-field-initializer") { + name = "class field initializer"; + } else if (codePath.origin === "class-static-block") { + name = "class static block"; + } else { + name = astUtils.getFunctionNameWithKind(node); + } + + context.report({ + node, + messageId: "complex", + data: { + name: upperCaseFirst(name), + complexity, + max: THRESHOLD + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/computed-property-spacing.js b/node_modules/eslint/lib/rules/computed-property-spacing.js new file mode 100644 index 0000000..4850a8b --- /dev/null +++ b/node_modules/eslint/lib/rules/computed-property-spacing.js @@ -0,0 +1,205 @@ +/** + * @fileoverview Disallows or enforces spaces inside computed properties. + * @author Jamund Ferguson + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing inside computed property brackets", + recommended: false, + url: "https://eslint.org/docs/rules/computed-property-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + enforceForClassMembers: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.", + unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.", + + missingSpaceBefore: "A space is required before '{{tokenValue}}'.", + missingSpaceAfter: "A space is required after '{{tokenValue}}'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const propertyNameMustBeSpaced = context.options[0] === "always"; // default is "never" + const enforceForClassMembers = !context.options[1] || context.options[1].enforceForClassMembers; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenAfter The token after `token`. + * @returns {void} + */ + function reportNoBeginningSpace(node, token, tokenAfter) { + context.report({ + node, + loc: { start: token.loc.end, end: tokenAfter.loc.start }, + messageId: "unexpectedSpaceAfter", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.removeRange([token.range[1], tokenAfter.range[0]]); + } + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenBefore The token before `token`. + * @returns {void} + */ + function reportNoEndingSpace(node, token, tokenBefore) { + context.report({ + node, + loc: { start: tokenBefore.loc.end, end: token.loc.start }, + messageId: "unexpectedSpaceBefore", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.removeRange([tokenBefore.range[1], token.range[0]]); + } + }); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceAfter", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceBefore", + data: { + tokenValue: token.value + }, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + + /** + * Returns a function that checks the spacing of a node on the property name + * that was passed in. + * @param {string} propertyName The property on the node to check for spacing + * @returns {Function} A function that will check spacing on a node + */ + function checkSpacing(propertyName) { + return function(node) { + if (!node.computed) { + return; + } + + const property = node[propertyName]; + + const before = sourceCode.getTokenBefore(property, astUtils.isOpeningBracketToken), + first = sourceCode.getTokenAfter(before, { includeComments: true }), + after = sourceCode.getTokenAfter(property, astUtils.isClosingBracketToken), + last = sourceCode.getTokenBefore(after, { includeComments: true }); + + if (astUtils.isTokenOnSameLine(before, first)) { + if (propertyNameMustBeSpaced) { + if (!sourceCode.isSpaceBetweenTokens(before, first) && astUtils.isTokenOnSameLine(before, first)) { + reportRequiredBeginningSpace(node, before); + } + } else { + if (sourceCode.isSpaceBetweenTokens(before, first)) { + reportNoBeginningSpace(node, before, first); + } + } + } + + if (astUtils.isTokenOnSameLine(last, after)) { + if (propertyNameMustBeSpaced) { + if (!sourceCode.isSpaceBetweenTokens(last, after) && astUtils.isTokenOnSameLine(last, after)) { + reportRequiredEndingSpace(node, after); + } + } else { + if (sourceCode.isSpaceBetweenTokens(last, after)) { + reportNoEndingSpace(node, after, last); + } + } + } + }; + } + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + const listeners = { + Property: checkSpacing("key"), + MemberExpression: checkSpacing("property") + }; + + if (enforceForClassMembers) { + listeners.MethodDefinition = + listeners.PropertyDefinition = listeners.Property; + } + + return listeners; + + } +}; diff --git a/node_modules/eslint/lib/rules/consistent-return.js b/node_modules/eslint/lib/rules/consistent-return.js new file mode 100644 index 0000000..fffb435 --- /dev/null +++ b/node_modules/eslint/lib/rules/consistent-return.js @@ -0,0 +1,185 @@ +/** + * @fileoverview Rule to flag consistent return values + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { upperCaseFirst } = require("../shared/string-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given code path segment is unreachable. + * @param {CodePathSegment} segment A CodePathSegment to check. + * @returns {boolean} `true` if the segment is unreachable. + */ +function isUnreachable(segment) { + return !segment.reachable; +} + +/** + * Checks whether a given node is a `constructor` method in an ES6 class + * @param {ASTNode} node A node to check + * @returns {boolean} `true` if the node is a `constructor` method + */ +function isClassConstructor(node) { + return node.type === "FunctionExpression" && + node.parent && + node.parent.type === "MethodDefinition" && + node.parent.kind === "constructor"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `return` statements to either always or never specify values", + recommended: false, + url: "https://eslint.org/docs/rules/consistent-return" + }, + + schema: [{ + type: "object", + properties: { + treatUndefinedAsUnspecified: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + missingReturn: "Expected to return a value at the end of {{name}}.", + missingReturnValue: "{{name}} expected a return value.", + unexpectedReturnValue: "{{name}} expected no return value." + } + }, + + create(context) { + const options = context.options[0] || {}; + const treatUndefinedAsUnspecified = options.treatUndefinedAsUnspecified === true; + let funcInfo = null; + + /** + * Checks whether of not the implicit returning is consistent if the last + * code path segment is reachable. + * @param {ASTNode} node A program/function node to check. + * @returns {void} + */ + function checkLastSegment(node) { + let loc, name; + + /* + * Skip if it expected no return value or unreachable. + * When unreachable, all paths are returned or thrown. + */ + if (!funcInfo.hasReturnValue || + funcInfo.codePath.currentSegments.every(isUnreachable) || + astUtils.isES5Constructor(node) || + isClassConstructor(node) + ) { + return; + } + + // Adjust a location and a message. + if (node.type === "Program") { + + // The head of program. + loc = { line: 1, column: 0 }; + name = "program"; + } else if (node.type === "ArrowFunctionExpression") { + + // `=>` token + loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc; + } else if ( + node.parent.type === "MethodDefinition" || + (node.parent.type === "Property" && node.parent.method) + ) { + + // Method name. + loc = node.parent.key.loc; + } else { + + // Function name or `function` keyword. + loc = (node.id || context.getSourceCode().getFirstToken(node)).loc; + } + + if (!name) { + name = astUtils.getFunctionNameWithKind(node); + } + + // Reports. + context.report({ + node, + loc, + messageId: "missingReturn", + data: { name } + }); + } + + return { + + // Initializes/Disposes state of each code path. + onCodePathStart(codePath, node) { + funcInfo = { + upper: funcInfo, + codePath, + hasReturn: false, + hasReturnValue: false, + messageId: "", + node + }; + }, + onCodePathEnd() { + funcInfo = funcInfo.upper; + }, + + // Reports a given return statement if it's inconsistent. + ReturnStatement(node) { + const argument = node.argument; + let hasReturnValue = Boolean(argument); + + if (treatUndefinedAsUnspecified && hasReturnValue) { + hasReturnValue = !astUtils.isSpecificId(argument, "undefined") && argument.operator !== "void"; + } + + if (!funcInfo.hasReturn) { + funcInfo.hasReturn = true; + funcInfo.hasReturnValue = hasReturnValue; + funcInfo.messageId = hasReturnValue ? "missingReturnValue" : "unexpectedReturnValue"; + funcInfo.data = { + name: funcInfo.node.type === "Program" + ? "Program" + : upperCaseFirst(astUtils.getFunctionNameWithKind(funcInfo.node)) + }; + } else if (funcInfo.hasReturnValue !== hasReturnValue) { + context.report({ + node, + messageId: funcInfo.messageId, + data: funcInfo.data + }); + } + }, + + // Reports a given program/function if the implicit returning is not consistent. + "Program:exit": checkLastSegment, + "FunctionDeclaration:exit": checkLastSegment, + "FunctionExpression:exit": checkLastSegment, + "ArrowFunctionExpression:exit": checkLastSegment + }; + } +}; diff --git a/node_modules/eslint/lib/rules/consistent-this.js b/node_modules/eslint/lib/rules/consistent-this.js new file mode 100644 index 0000000..2aa0791 --- /dev/null +++ b/node_modules/eslint/lib/rules/consistent-this.js @@ -0,0 +1,151 @@ +/** + * @fileoverview Rule to enforce consistent naming of "this" context variables + * @author Raphael Pigulla + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce consistent naming when capturing the current execution context", + recommended: false, + url: "https://eslint.org/docs/rules/consistent-this" + }, + + schema: { + type: "array", + items: { + type: "string", + minLength: 1 + }, + uniqueItems: true + }, + + messages: { + aliasNotAssignedToThis: "Designated alias '{{name}}' is not assigned to 'this'.", + unexpectedAlias: "Unexpected alias '{{name}}' for 'this'." + } + }, + + create(context) { + let aliases = []; + + if (context.options.length === 0) { + aliases.push("that"); + } else { + aliases = context.options; + } + + /** + * Reports that a variable declarator or assignment expression is assigning + * a non-'this' value to the specified alias. + * @param {ASTNode} node The assigning node. + * @param {string} name the name of the alias that was incorrectly used. + * @returns {void} + */ + function reportBadAssignment(node, name) { + context.report({ node, messageId: "aliasNotAssignedToThis", data: { name } }); + } + + /** + * Checks that an assignment to an identifier only assigns 'this' to the + * appropriate alias, and the alias is only assigned to 'this'. + * @param {ASTNode} node The assigning node. + * @param {Identifier} name The name of the variable assigned to. + * @param {Expression} value The value of the assignment. + * @returns {void} + */ + function checkAssignment(node, name, value) { + const isThis = value.type === "ThisExpression"; + + if (aliases.includes(name)) { + if (!isThis || node.operator && node.operator !== "=") { + reportBadAssignment(node, name); + } + } else if (isThis) { + context.report({ node, messageId: "unexpectedAlias", data: { name } }); + } + } + + /** + * Ensures that a variable declaration of the alias in a program or function + * is assigned to the correct value. + * @param {string} alias alias the check the assignment of. + * @param {Object} scope scope of the current code we are checking. + * @private + * @returns {void} + */ + function checkWasAssigned(alias, scope) { + const variable = scope.set.get(alias); + + if (!variable) { + return; + } + + if (variable.defs.some(def => def.node.type === "VariableDeclarator" && + def.node.init !== null)) { + return; + } + + /* + * The alias has been declared and not assigned: check it was + * assigned later in the same scope. + */ + if (!variable.references.some(reference => { + const write = reference.writeExpr; + + return ( + reference.from === scope && + write && write.type === "ThisExpression" && + write.parent.operator === "=" + ); + })) { + variable.defs.map(def => def.node).forEach(node => { + reportBadAssignment(node, alias); + }); + } + } + + /** + * Check each alias to ensure that is was assigned to the correct value. + * @returns {void} + */ + function ensureWasAssigned() { + const scope = context.getScope(); + + aliases.forEach(alias => { + checkWasAssigned(alias, scope); + }); + } + + return { + "Program:exit": ensureWasAssigned, + "FunctionExpression:exit": ensureWasAssigned, + "FunctionDeclaration:exit": ensureWasAssigned, + + VariableDeclarator(node) { + const id = node.id; + const isDestructuring = + id.type === "ArrayPattern" || id.type === "ObjectPattern"; + + if (node.init !== null && !isDestructuring) { + checkAssignment(node, id.name, node.init); + } + }, + + AssignmentExpression(node) { + if (node.left.type === "Identifier") { + checkAssignment(node, node.left.name, node.right); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/constructor-super.js b/node_modules/eslint/lib/rules/constructor-super.js new file mode 100644 index 0000000..defdb91 --- /dev/null +++ b/node_modules/eslint/lib/rules/constructor-super.js @@ -0,0 +1,423 @@ +/** + * @fileoverview A rule to verify `super()` callings in constructor. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether a given code path segment is reachable or not. + * @param {CodePathSegment} segment A code path segment to check. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +/** + * Checks whether or not a given node is a constructor. + * @param {ASTNode} node A node to check. This node type is one of + * `Program`, `FunctionDeclaration`, `FunctionExpression`, and + * `ArrowFunctionExpression`. + * @returns {boolean} `true` if the node is a constructor. + */ +function isConstructorFunction(node) { + return ( + node.type === "FunctionExpression" && + node.parent.type === "MethodDefinition" && + node.parent.kind === "constructor" + ); +} + +/** + * Checks whether a given node can be a constructor or not. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node can be a constructor. + */ +function isPossibleConstructor(node) { + if (!node) { + return false; + } + + switch (node.type) { + case "ClassExpression": + case "FunctionExpression": + case "ThisExpression": + case "MemberExpression": + case "CallExpression": + case "NewExpression": + case "ChainExpression": + case "YieldExpression": + case "TaggedTemplateExpression": + case "MetaProperty": + return true; + + case "Identifier": + return node.name !== "undefined"; + + case "AssignmentExpression": + if (["=", "&&="].includes(node.operator)) { + return isPossibleConstructor(node.right); + } + + if (["||=", "??="].includes(node.operator)) { + return ( + isPossibleConstructor(node.left) || + isPossibleConstructor(node.right) + ); + } + + /** + * All other assignment operators are mathematical assignment operators (arithmetic or bitwise). + * An assignment expression with a mathematical operator can either evaluate to a primitive value, + * or throw, depending on the operands. Thus, it cannot evaluate to a constructor function. + */ + return false; + + case "LogicalExpression": + + /* + * If the && operator short-circuits, the left side was falsy and therefore not a constructor, and if + * it doesn't short-circuit, it takes the value from the right side, so the right side must always be a + * possible constructor. A future improvement could verify that the left side could be truthy by + * excluding falsy literals. + */ + if (node.operator === "&&") { + return isPossibleConstructor(node.right); + } + + return ( + isPossibleConstructor(node.left) || + isPossibleConstructor(node.right) + ); + + case "ConditionalExpression": + return ( + isPossibleConstructor(node.alternate) || + isPossibleConstructor(node.consequent) + ); + + case "SequenceExpression": { + const lastExpression = node.expressions[node.expressions.length - 1]; + + return isPossibleConstructor(lastExpression); + } + + default: + return false; + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "require `super()` calls in constructors", + recommended: true, + url: "https://eslint.org/docs/rules/constructor-super" + }, + + schema: [], + + messages: { + missingSome: "Lacked a call of 'super()' in some code paths.", + missingAll: "Expected to call 'super()'.", + + duplicate: "Unexpected duplicate 'super()'.", + badSuper: "Unexpected 'super()' because 'super' is not a constructor.", + unexpected: "Unexpected 'super()'." + } + }, + + create(context) { + + /* + * {{hasExtends: boolean, scope: Scope, codePath: CodePath}[]} + * Information for each constructor. + * - upper: Information of the upper constructor. + * - hasExtends: A flag which shows whether own class has a valid `extends` + * part. + * - scope: The scope of own class. + * - codePath: The code path object of the constructor. + */ + let funcInfo = null; + + /* + * {Map} + * Information for each code path segment. + * - calledInSomePaths: A flag of be called `super()` in some code paths. + * - calledInEveryPaths: A flag of be called `super()` in all code paths. + * - validNodes: + */ + let segInfoMap = Object.create(null); + + /** + * Gets the flag which shows `super()` is called in some paths. + * @param {CodePathSegment} segment A code path segment to get. + * @returns {boolean} The flag which shows `super()` is called in some paths + */ + function isCalledInSomePath(segment) { + return segment.reachable && segInfoMap[segment.id].calledInSomePaths; + } + + /** + * Gets the flag which shows `super()` is called in all paths. + * @param {CodePathSegment} segment A code path segment to get. + * @returns {boolean} The flag which shows `super()` is called in all paths. + */ + function isCalledInEveryPath(segment) { + + /* + * If specific segment is the looped segment of the current segment, + * skip the segment. + * If not skipped, this never becomes true after a loop. + */ + if (segment.nextSegments.length === 1 && + segment.nextSegments[0].isLoopedPrevSegment(segment) + ) { + return true; + } + return segment.reachable && segInfoMap[segment.id].calledInEveryPaths; + } + + return { + + /** + * Stacks a constructor information. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. + * @returns {void} + */ + onCodePathStart(codePath, node) { + if (isConstructorFunction(node)) { + + // Class > ClassBody > MethodDefinition > FunctionExpression + const classNode = node.parent.parent.parent; + const superClass = classNode.superClass; + + funcInfo = { + upper: funcInfo, + isConstructor: true, + hasExtends: Boolean(superClass), + superIsConstructor: isPossibleConstructor(superClass), + codePath + }; + } else { + funcInfo = { + upper: funcInfo, + isConstructor: false, + hasExtends: false, + superIsConstructor: false, + codePath + }; + } + }, + + /** + * Pops a constructor information. + * And reports if `super()` lacked. + * @param {CodePath} codePath A code path which was ended. + * @param {ASTNode} node The current node. + * @returns {void} + */ + onCodePathEnd(codePath, node) { + const hasExtends = funcInfo.hasExtends; + + // Pop. + funcInfo = funcInfo.upper; + + if (!hasExtends) { + return; + } + + // Reports if `super()` lacked. + const segments = codePath.returnedSegments; + const calledInEveryPaths = segments.every(isCalledInEveryPath); + const calledInSomePaths = segments.some(isCalledInSomePath); + + if (!calledInEveryPaths) { + context.report({ + messageId: calledInSomePaths + ? "missingSome" + : "missingAll", + node: node.parent + }); + } + }, + + /** + * Initialize information of a given code path segment. + * @param {CodePathSegment} segment A code path segment to initialize. + * @returns {void} + */ + onCodePathSegmentStart(segment) { + if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { + return; + } + + // Initialize info. + const info = segInfoMap[segment.id] = { + calledInSomePaths: false, + calledInEveryPaths: false, + validNodes: [] + }; + + // When there are previous segments, aggregates these. + const prevSegments = segment.prevSegments; + + if (prevSegments.length > 0) { + info.calledInSomePaths = prevSegments.some(isCalledInSomePath); + info.calledInEveryPaths = prevSegments.every(isCalledInEveryPath); + } + }, + + /** + * Update information of the code path segment when a code path was + * looped. + * @param {CodePathSegment} fromSegment The code path segment of the + * end of a loop. + * @param {CodePathSegment} toSegment A code path segment of the head + * of a loop. + * @returns {void} + */ + onCodePathSegmentLoop(fromSegment, toSegment) { + if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { + return; + } + + // Update information inside of the loop. + const isRealLoop = toSegment.prevSegments.length >= 2; + + funcInfo.codePath.traverseSegments( + { first: toSegment, last: fromSegment }, + segment => { + const info = segInfoMap[segment.id]; + const prevSegments = segment.prevSegments; + + // Updates flags. + info.calledInSomePaths = prevSegments.some(isCalledInSomePath); + info.calledInEveryPaths = prevSegments.every(isCalledInEveryPath); + + // If flags become true anew, reports the valid nodes. + if (info.calledInSomePaths || isRealLoop) { + const nodes = info.validNodes; + + info.validNodes = []; + + for (let i = 0; i < nodes.length; ++i) { + const node = nodes[i]; + + context.report({ + messageId: "duplicate", + node + }); + } + } + } + ); + }, + + /** + * Checks for a call of `super()`. + * @param {ASTNode} node A CallExpression node to check. + * @returns {void} + */ + "CallExpression:exit"(node) { + if (!(funcInfo && funcInfo.isConstructor)) { + return; + } + + // Skips except `super()`. + if (node.callee.type !== "Super") { + return; + } + + // Reports if needed. + if (funcInfo.hasExtends) { + const segments = funcInfo.codePath.currentSegments; + let duplicate = false; + let info = null; + + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + if (segment.reachable) { + info = segInfoMap[segment.id]; + + duplicate = duplicate || info.calledInSomePaths; + info.calledInSomePaths = info.calledInEveryPaths = true; + } + } + + if (info) { + if (duplicate) { + context.report({ + messageId: "duplicate", + node + }); + } else if (!funcInfo.superIsConstructor) { + context.report({ + messageId: "badSuper", + node + }); + } else { + info.validNodes.push(node); + } + } + } else if (funcInfo.codePath.currentSegments.some(isReachable)) { + context.report({ + messageId: "unexpected", + node + }); + } + }, + + /** + * Set the mark to the returned path as `super()` was called. + * @param {ASTNode} node A ReturnStatement node to check. + * @returns {void} + */ + ReturnStatement(node) { + if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { + return; + } + + // Skips if no argument. + if (!node.argument) { + return; + } + + // Returning argument is a substitute of 'super()'. + const segments = funcInfo.codePath.currentSegments; + + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + if (segment.reachable) { + const info = segInfoMap[segment.id]; + + info.calledInSomePaths = info.calledInEveryPaths = true; + } + } + }, + + /** + * Resets state. + * @returns {void} + */ + "Program:exit"() { + segInfoMap = Object.create(null); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/curly.js b/node_modules/eslint/lib/rules/curly.js new file mode 100644 index 0000000..29e7395 --- /dev/null +++ b/node_modules/eslint/lib/rules/curly.js @@ -0,0 +1,486 @@ +/** + * @fileoverview Rule to flag statements without curly braces + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce consistent brace style for all control statements", + recommended: false, + url: "https://eslint.org/docs/rules/curly" + }, + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["all"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["multi", "multi-line", "multi-or-nest"] + }, + { + enum: ["consistent"] + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + fixable: "code", + + messages: { + missingCurlyAfter: "Expected { after '{{name}}'.", + missingCurlyAfterCondition: "Expected { after '{{name}}' condition.", + unexpectedCurlyAfter: "Unnecessary { after '{{name}}'.", + unexpectedCurlyAfterCondition: "Unnecessary { after '{{name}}' condition." + } + }, + + create(context) { + + const multiOnly = (context.options[0] === "multi"); + const multiLine = (context.options[0] === "multi-line"); + const multiOrNest = (context.options[0] === "multi-or-nest"); + const consistent = (context.options[1] === "consistent"); + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines if a given node is a one-liner that's on the same line as it's preceding code. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a one-liner that's on the same line as it's preceding code. + * @private + */ + function isCollapsedOneLiner(node) { + const before = sourceCode.getTokenBefore(node); + const last = sourceCode.getLastToken(node); + const lastExcludingSemicolon = astUtils.isSemicolonToken(last) ? sourceCode.getTokenBefore(last) : last; + + return before.loc.start.line === lastExcludingSemicolon.loc.end.line; + } + + /** + * Determines if a given node is a one-liner. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a one-liner. + * @private + */ + function isOneLiner(node) { + if (node.type === "EmptyStatement") { + return true; + } + + const first = sourceCode.getFirstToken(node); + const last = sourceCode.getLastToken(node); + const lastExcludingSemicolon = astUtils.isSemicolonToken(last) ? sourceCode.getTokenBefore(last) : last; + + return first.loc.start.line === lastExcludingSemicolon.loc.end.line; + } + + /** + * Determines if the given node is a lexical declaration (let, const, function, or class) + * @param {ASTNode} node The node to check + * @returns {boolean} True if the node is a lexical declaration + * @private + */ + function isLexicalDeclaration(node) { + if (node.type === "VariableDeclaration") { + return node.kind === "const" || node.kind === "let"; + } + + return node.type === "FunctionDeclaration" || node.type === "ClassDeclaration"; + } + + /** + * Checks if the given token is an `else` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is an `else` token. + */ + function isElseKeywordToken(token) { + return token.value === "else" && token.type === "Keyword"; + } + + /** + * Determines whether the given node has an `else` keyword token as the first token after. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is followed by an `else` keyword token. + */ + function isFollowedByElseKeyword(node) { + const nextToken = sourceCode.getTokenAfter(node); + + return Boolean(nextToken) && isElseKeywordToken(nextToken); + } + + /** + * Determines if a semicolon needs to be inserted after removing a set of curly brackets, in order to avoid a SyntaxError. + * @param {Token} closingBracket The } token + * @returns {boolean} `true` if a semicolon needs to be inserted after the last statement in the block. + */ + function needsSemicolon(closingBracket) { + const tokenBefore = sourceCode.getTokenBefore(closingBracket); + const tokenAfter = sourceCode.getTokenAfter(closingBracket); + const lastBlockNode = sourceCode.getNodeByRangeIndex(tokenBefore.range[0]); + + if (astUtils.isSemicolonToken(tokenBefore)) { + + // If the last statement already has a semicolon, don't add another one. + return false; + } + + if (!tokenAfter) { + + // If there are no statements after this block, there is no need to add a semicolon. + return false; + } + + if (lastBlockNode.type === "BlockStatement" && lastBlockNode.parent.type !== "FunctionExpression" && lastBlockNode.parent.type !== "ArrowFunctionExpression") { + + /* + * If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), + * don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause + * a SyntaxError if it was followed by `else`. + */ + return false; + } + + if (tokenBefore.loc.end.line === tokenAfter.loc.start.line) { + + // If the next token is on the same line, insert a semicolon. + return true; + } + + if (/^[([/`+-]/u.test(tokenAfter.value)) { + + // If the next token starts with a character that would disrupt ASI, insert a semicolon. + return true; + } + + if (tokenBefore.type === "Punctuator" && (tokenBefore.value === "++" || tokenBefore.value === "--")) { + + // If the last token is ++ or --, insert a semicolon to avoid disrupting ASI. + return true; + } + + // Otherwise, do not insert a semicolon. + return false; + } + + /** + * Determines whether the code represented by the given node contains an `if` statement + * that would become associated with an `else` keyword directly appended to that code. + * + * Examples where it returns `true`: + * + * if (a) + * foo(); + * + * if (a) { + * foo(); + * } + * + * if (a) + * foo(); + * else if (b) + * bar(); + * + * while (a) + * if (b) + * if(c) + * foo(); + * else + * bar(); + * + * Examples where it returns `false`: + * + * if (a) + * foo(); + * else + * bar(); + * + * while (a) { + * if (b) + * if(c) + * foo(); + * else + * bar(); + * } + * + * while (a) + * if (b) { + * if(c) + * foo(); + * } + * else + * bar(); + * @param {ASTNode} node Node representing the code to check. + * @returns {boolean} `true` if an `if` statement within the code would become associated with an `else` appended to that code. + */ + function hasUnsafeIf(node) { + switch (node.type) { + case "IfStatement": + if (!node.alternate) { + return true; + } + return hasUnsafeIf(node.alternate); + case "ForStatement": + case "ForInStatement": + case "ForOfStatement": + case "LabeledStatement": + case "WithStatement": + case "WhileStatement": + return hasUnsafeIf(node.body); + default: + return false; + } + } + + /** + * Determines whether the existing curly braces around the single statement are necessary to preserve the semantics of the code. + * The braces, which make the given block body, are necessary in either of the following situations: + * + * 1. The statement is a lexical declaration. + * 2. Without the braces, an `if` within the statement would become associated with an `else` after the closing brace: + * + * if (a) { + * if (b) + * foo(); + * } + * else + * bar(); + * + * if (a) + * while (b) + * while (c) { + * while (d) + * if (e) + * while(f) + * foo(); + * } + * else + * bar(); + * @param {ASTNode} node `BlockStatement` body with exactly one statement directly inside. The statement can have its own nested statements. + * @returns {boolean} `true` if the braces are necessary - removing them (replacing the given `BlockStatement` body with its single statement content) + * would change the semantics of the code or produce a syntax error. + */ + function areBracesNecessary(node) { + const statement = node.body[0]; + + return isLexicalDeclaration(statement) || + hasUnsafeIf(statement) && isFollowedByElseKeyword(node); + } + + /** + * Prepares to check the body of a node to see if it's a block statement. + * @param {ASTNode} node The node to report if there's a problem. + * @param {ASTNode} body The body node to check for blocks. + * @param {string} name The name to report if there's a problem. + * @param {{ condition: boolean }} opts Options to pass to the report functions + * @returns {Object} a prepared check object, with "actual", "expected", "check" properties. + * "actual" will be `true` or `false` whether the body is already a block statement. + * "expected" will be `true` or `false` if the body should be a block statement or not, or + * `null` if it doesn't matter, depending on the rule options. It can be modified to change + * the final behavior of "check". + * "check" will be a function reporting appropriate problems depending on the other + * properties. + */ + function prepareCheck(node, body, name, opts) { + const hasBlock = (body.type === "BlockStatement"); + let expected = null; + + if (hasBlock && (body.body.length !== 1 || areBracesNecessary(body))) { + expected = true; + } else if (multiOnly) { + expected = false; + } else if (multiLine) { + if (!isCollapsedOneLiner(body)) { + expected = true; + } + + // otherwise, the body is allowed to have braces or not to have braces + + } else if (multiOrNest) { + if (hasBlock) { + const statement = body.body[0]; + const leadingCommentsInBlock = sourceCode.getCommentsBefore(statement); + + expected = !isOneLiner(statement) || leadingCommentsInBlock.length > 0; + } else { + expected = !isOneLiner(body); + } + } else { + + // default "all" + expected = true; + } + + return { + actual: hasBlock, + expected, + check() { + if (this.expected !== null && this.expected !== this.actual) { + if (this.expected) { + context.report({ + node, + loc: body.loc, + messageId: opts && opts.condition ? "missingCurlyAfterCondition" : "missingCurlyAfter", + data: { + name + }, + fix: fixer => fixer.replaceText(body, `{${sourceCode.getText(body)}}`) + }); + } else { + context.report({ + node, + loc: body.loc, + messageId: opts && opts.condition ? "unexpectedCurlyAfterCondition" : "unexpectedCurlyAfter", + data: { + name + }, + fix(fixer) { + + /* + * `do while` expressions sometimes need a space to be inserted after `do`. + * e.g. `do{foo()} while (bar)` should be corrected to `do foo() while (bar)` + */ + const needsPrecedingSpace = node.type === "DoWhileStatement" && + sourceCode.getTokenBefore(body).range[1] === body.range[0] && + !astUtils.canTokensBeAdjacent("do", sourceCode.getFirstToken(body, { skip: 1 })); + + const openingBracket = sourceCode.getFirstToken(body); + const closingBracket = sourceCode.getLastToken(body); + const lastTokenInBlock = sourceCode.getTokenBefore(closingBracket); + + if (needsSemicolon(closingBracket)) { + + /* + * If removing braces would cause a SyntaxError due to multiple statements on the same line (or + * change the semantics of the code due to ASI), don't perform a fix. + */ + return null; + } + + const resultingBodyText = sourceCode.getText().slice(openingBracket.range[1], lastTokenInBlock.range[0]) + + sourceCode.getText(lastTokenInBlock) + + sourceCode.getText().slice(lastTokenInBlock.range[1], closingBracket.range[0]); + + return fixer.replaceText(body, (needsPrecedingSpace ? " " : "") + resultingBodyText); + } + }); + } + } + } + }; + } + + /** + * Prepares to check the bodies of a "if", "else if" and "else" chain. + * @param {ASTNode} node The first IfStatement node of the chain. + * @returns {Object[]} prepared checks for each body of the chain. See `prepareCheck` for more + * information. + */ + function prepareIfChecks(node) { + const preparedChecks = []; + + for (let currentNode = node; currentNode; currentNode = currentNode.alternate) { + preparedChecks.push(prepareCheck(currentNode, currentNode.consequent, "if", { condition: true })); + if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") { + preparedChecks.push(prepareCheck(currentNode, currentNode.alternate, "else")); + break; + } + } + + if (consistent) { + + /* + * If any node should have or already have braces, make sure they + * all have braces. + * If all nodes shouldn't have braces, make sure they don't. + */ + const expected = preparedChecks.some(preparedCheck => { + if (preparedCheck.expected !== null) { + return preparedCheck.expected; + } + return preparedCheck.actual; + }); + + preparedChecks.forEach(preparedCheck => { + preparedCheck.expected = expected; + }); + } + + return preparedChecks; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + IfStatement(node) { + const parent = node.parent; + const isElseIf = parent.type === "IfStatement" && parent.alternate === node; + + if (!isElseIf) { + + // This is a top `if`, check the whole `if-else-if` chain + prepareIfChecks(node).forEach(preparedCheck => { + preparedCheck.check(); + }); + } + + // Skip `else if`, it's already checked (when the top `if` was visited) + }, + + WhileStatement(node) { + prepareCheck(node, node.body, "while", { condition: true }).check(); + }, + + DoWhileStatement(node) { + prepareCheck(node, node.body, "do").check(); + }, + + ForStatement(node) { + prepareCheck(node, node.body, "for", { condition: true }).check(); + }, + + ForInStatement(node) { + prepareCheck(node, node.body, "for-in").check(); + }, + + ForOfStatement(node) { + prepareCheck(node, node.body, "for-of").check(); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/default-case-last.js b/node_modules/eslint/lib/rules/default-case-last.js new file mode 100644 index 0000000..34be289 --- /dev/null +++ b/node_modules/eslint/lib/rules/default-case-last.js @@ -0,0 +1,44 @@ +/** + * @fileoverview Rule to enforce default clauses in switch statements to be last + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce default clauses in switch statements to be last", + recommended: false, + url: "https://eslint.org/docs/rules/default-case-last" + }, + + schema: [], + + messages: { + notLast: "Default clause should be the last clause." + } + }, + + create(context) { + return { + SwitchStatement(node) { + const cases = node.cases, + indexOfDefault = cases.findIndex(c => c.test === null); + + if (indexOfDefault !== -1 && indexOfDefault !== cases.length - 1) { + const defaultClause = cases[indexOfDefault]; + + context.report({ node: defaultClause, messageId: "notLast" }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/default-case.js b/node_modules/eslint/lib/rules/default-case.js new file mode 100644 index 0000000..6ce2385 --- /dev/null +++ b/node_modules/eslint/lib/rules/default-case.js @@ -0,0 +1,97 @@ +/** + * @fileoverview require default case in switch statements + * @author Aliaksei Shytkin + */ +"use strict"; + +const DEFAULT_COMMENT_PATTERN = /^no default$/iu; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `default` cases in `switch` statements", + recommended: false, + url: "https://eslint.org/docs/rules/default-case" + }, + + schema: [{ + type: "object", + properties: { + commentPattern: { + type: "string" + } + }, + additionalProperties: false + }], + + messages: { + missingDefaultCase: "Expected a default case." + } + }, + + create(context) { + const options = context.options[0] || {}; + const commentPattern = options.commentPattern + ? new RegExp(options.commentPattern, "u") + : DEFAULT_COMMENT_PATTERN; + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Shortcut to get last element of array + * @param {*[]} collection Array + * @returns {any} Last element + */ + function last(collection) { + return collection[collection.length - 1]; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + SwitchStatement(node) { + + if (!node.cases.length) { + + /* + * skip check of empty switch because there is no easy way + * to extract comments inside it now + */ + return; + } + + const hasDefault = node.cases.some(v => v.test === null); + + if (!hasDefault) { + + let comment; + + const lastCase = last(node.cases); + const comments = sourceCode.getCommentsAfter(lastCase); + + if (comments.length) { + comment = last(comments); + } + + if (!comment || !commentPattern.test(comment.value.trim())) { + context.report({ node, messageId: "missingDefaultCase" }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/default-param-last.js b/node_modules/eslint/lib/rules/default-param-last.js new file mode 100644 index 0000000..ea12a2a --- /dev/null +++ b/node_modules/eslint/lib/rules/default-param-last.js @@ -0,0 +1,62 @@ +/** + * @fileoverview enforce default parameters to be last + * @author Chiawen Chen + */ + +"use strict"; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce default parameters to be last", + recommended: false, + url: "https://eslint.org/docs/rules/default-param-last" + }, + + schema: [], + + messages: { + shouldBeLast: "Default parameters should be last." + } + }, + + create(context) { + + /** + * Handler for function contexts. + * @param {ASTNode} node function node + * @returns {void} + */ + function handleFunction(node) { + let hasSeenPlainParam = false; + + for (let i = node.params.length - 1; i >= 0; i -= 1) { + const param = node.params[i]; + + if ( + param.type !== "AssignmentPattern" && + param.type !== "RestElement" + ) { + hasSeenPlainParam = true; + continue; + } + + if (hasSeenPlainParam && param.type === "AssignmentPattern") { + context.report({ + node: param, + messageId: "shouldBeLast" + }); + } + } + } + + return { + FunctionDeclaration: handleFunction, + FunctionExpression: handleFunction, + ArrowFunctionExpression: handleFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/dot-location.js b/node_modules/eslint/lib/rules/dot-location.js new file mode 100644 index 0000000..9dea4f2 --- /dev/null +++ b/node_modules/eslint/lib/rules/dot-location.js @@ -0,0 +1,105 @@ +/** + * @fileoverview Validates newlines before and after dots + * @author Greg Cochard + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent newlines before and after dots", + recommended: false, + url: "https://eslint.org/docs/rules/dot-location" + }, + + schema: [ + { + enum: ["object", "property"] + } + ], + + fixable: "code", + + messages: { + expectedDotAfterObject: "Expected dot to be on same line as object.", + expectedDotBeforeProperty: "Expected dot to be on same line as property." + } + }, + + create(context) { + + const config = context.options[0]; + + // default to onObject if no preference is passed + const onObject = config === "object" || !config; + + const sourceCode = context.getSourceCode(); + + /** + * Reports if the dot between object and property is on the correct location. + * @param {ASTNode} node The `MemberExpression` node. + * @returns {void} + */ + function checkDotLocation(node) { + const property = node.property; + const dotToken = sourceCode.getTokenBefore(property); + + if (onObject) { + + // `obj` expression can be parenthesized, but those paren tokens are not a part of the `obj` node. + const tokenBeforeDot = sourceCode.getTokenBefore(dotToken); + + if (!astUtils.isTokenOnSameLine(tokenBeforeDot, dotToken)) { + context.report({ + node, + loc: dotToken.loc, + messageId: "expectedDotAfterObject", + *fix(fixer) { + if (dotToken.value.startsWith(".") && astUtils.isDecimalIntegerNumericToken(tokenBeforeDot)) { + yield fixer.insertTextAfter(tokenBeforeDot, ` ${dotToken.value}`); + } else { + yield fixer.insertTextAfter(tokenBeforeDot, dotToken.value); + } + yield fixer.remove(dotToken); + } + }); + } + } else if (!astUtils.isTokenOnSameLine(dotToken, property)) { + context.report({ + node, + loc: dotToken.loc, + messageId: "expectedDotBeforeProperty", + *fix(fixer) { + yield fixer.remove(dotToken); + yield fixer.insertTextBefore(property, dotToken.value); + } + }); + } + } + + /** + * Checks the spacing of the dot within a member expression. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNode(node) { + if (!node.computed) { + checkDotLocation(node); + } + } + + return { + MemberExpression: checkNode + }; + } +}; diff --git a/node_modules/eslint/lib/rules/dot-notation.js b/node_modules/eslint/lib/rules/dot-notation.js new file mode 100644 index 0000000..90ba6d8 --- /dev/null +++ b/node_modules/eslint/lib/rules/dot-notation.js @@ -0,0 +1,177 @@ +/** + * @fileoverview Rule to warn about using dot notation instead of square bracket notation when possible. + * @author Josh Perez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const keywords = require("./utils/keywords"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/u; + +// `null` literal must be handled separately. +const literalTypesToCheck = new Set(["string", "boolean"]); + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce dot notation whenever possible", + recommended: false, + url: "https://eslint.org/docs/rules/dot-notation" + }, + + schema: [ + { + type: "object", + properties: { + allowKeywords: { + type: "boolean", + default: true + }, + allowPattern: { + type: "string", + default: "" + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + useDot: "[{{key}}] is better written in dot notation.", + useBrackets: ".{{key}} is a syntax error." + } + }, + + create(context) { + const options = context.options[0] || {}; + const allowKeywords = options.allowKeywords === void 0 || options.allowKeywords; + const sourceCode = context.getSourceCode(); + + let allowPattern; + + if (options.allowPattern) { + allowPattern = new RegExp(options.allowPattern, "u"); + } + + /** + * Check if the property is valid dot notation + * @param {ASTNode} node The dot notation node + * @param {string} value Value which is to be checked + * @returns {void} + */ + function checkComputedProperty(node, value) { + if ( + validIdentifier.test(value) && + (allowKeywords || !keywords.includes(String(value))) && + !(allowPattern && allowPattern.test(value)) + ) { + const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : `\`${value}\``; + + context.report({ + node: node.property, + messageId: "useDot", + data: { + key: formattedValue + }, + *fix(fixer) { + const leftBracket = sourceCode.getTokenAfter(node.object, astUtils.isOpeningBracketToken); + const rightBracket = sourceCode.getLastToken(node); + const nextToken = sourceCode.getTokenAfter(node); + + // Don't perform any fixes if there are comments inside the brackets. + if (sourceCode.commentsExistBetween(leftBracket, rightBracket)) { + return; + } + + // Replace the brackets by an identifier. + if (!node.optional) { + yield fixer.insertTextBefore( + leftBracket, + astUtils.isDecimalInteger(node.object) ? " ." : "." + ); + } + yield fixer.replaceTextRange( + [leftBracket.range[0], rightBracket.range[1]], + value + ); + + // Insert a space after the property if it will be connected to the next token. + if ( + nextToken && + rightBracket.range[1] === nextToken.range[0] && + !astUtils.canTokensBeAdjacent(String(value), nextToken) + ) { + yield fixer.insertTextAfter(node, " "); + } + } + }); + } + } + + return { + MemberExpression(node) { + if ( + node.computed && + node.property.type === "Literal" && + (literalTypesToCheck.has(typeof node.property.value) || astUtils.isNullLiteral(node.property)) + ) { + checkComputedProperty(node, node.property.value); + } + if ( + node.computed && + node.property.type === "TemplateLiteral" && + node.property.expressions.length === 0 + ) { + checkComputedProperty(node, node.property.quasis[0].value.cooked); + } + if ( + !allowKeywords && + !node.computed && + node.property.type === "Identifier" && + keywords.includes(String(node.property.name)) + ) { + context.report({ + node: node.property, + messageId: "useBrackets", + data: { + key: node.property.name + }, + *fix(fixer) { + const dotToken = sourceCode.getTokenBefore(node.property); + + // A statement that starts with `let[` is parsed as a destructuring variable declaration, not a MemberExpression. + if (node.object.type === "Identifier" && node.object.name === "let" && !node.optional) { + return; + } + + // Don't perform any fixes if there are comments between the dot and the property name. + if (sourceCode.commentsExistBetween(dotToken, node.property)) { + return; + } + + // Replace the identifier to brackets. + if (!node.optional) { + yield fixer.remove(dotToken); + } + yield fixer.replaceText(node.property, `["${node.property.name}"]`); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/eol-last.js b/node_modules/eslint/lib/rules/eol-last.js new file mode 100644 index 0000000..393b934 --- /dev/null +++ b/node_modules/eslint/lib/rules/eol-last.js @@ -0,0 +1,112 @@ +/** + * @fileoverview Require or disallow newline at the end of files + * @author Nodeca Team + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow newline at the end of files", + recommended: false, + url: "https://eslint.org/docs/rules/eol-last" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never", "unix", "windows"] + } + ], + + messages: { + missing: "Newline required at end of file but not found.", + unexpected: "Newline not allowed at end of file." + } + }, + create(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program: function checkBadEOF(node) { + const sourceCode = context.getSourceCode(), + src = sourceCode.getText(), + lastLine = sourceCode.lines[sourceCode.lines.length - 1], + location = { + column: lastLine.length, + line: sourceCode.lines.length + }, + LF = "\n", + CRLF = `\r${LF}`, + endsWithNewline = src.endsWith(LF); + + /* + * Empty source is always valid: No content in file so we don't + * need to lint for a newline on the last line of content. + */ + if (!src.length) { + return; + } + + let mode = context.options[0] || "always", + appendCRLF = false; + + if (mode === "unix") { + + // `"unix"` should behave exactly as `"always"` + mode = "always"; + } + if (mode === "windows") { + + // `"windows"` should behave exactly as `"always"`, but append CRLF in the fixer for backwards compatibility + mode = "always"; + appendCRLF = true; + } + if (mode === "always" && !endsWithNewline) { + + // File is not newline-terminated, but should be + context.report({ + node, + loc: location, + messageId: "missing", + fix(fixer) { + return fixer.insertTextAfterRange([0, src.length], appendCRLF ? CRLF : LF); + } + }); + } else if (mode === "never" && endsWithNewline) { + + const secondLastLine = sourceCode.lines[sourceCode.lines.length - 2]; + + // File is newline-terminated, but shouldn't be + context.report({ + node, + loc: { + start: { line: sourceCode.lines.length - 1, column: secondLastLine.length }, + end: { line: sourceCode.lines.length, column: 0 } + }, + messageId: "unexpected", + fix(fixer) { + const finalEOLs = /(?:\r?\n)+$/u, + match = finalEOLs.exec(sourceCode.text), + start = match.index, + end = sourceCode.text.length; + + return fixer.replaceTextRange([start, end], ""); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/eqeqeq.js b/node_modules/eslint/lib/rules/eqeqeq.js new file mode 100644 index 0000000..b5d784d --- /dev/null +++ b/node_modules/eslint/lib/rules/eqeqeq.js @@ -0,0 +1,174 @@ +/** + * @fileoverview Rule to flag statements that use != and == instead of !== and === + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require the use of `===` and `!==`", + recommended: false, + url: "https://eslint.org/docs/rules/eqeqeq" + }, + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always"] + }, + { + type: "object", + properties: { + null: { + enum: ["always", "never", "ignore"] + } + }, + additionalProperties: false + } + ], + additionalItems: false + }, + { + type: "array", + items: [ + { + enum: ["smart", "allow-null"] + } + ], + additionalItems: false + } + ] + }, + + fixable: "code", + + messages: { + unexpected: "Expected '{{expectedOperator}}' and instead saw '{{actualOperator}}'." + } + }, + + create(context) { + const config = context.options[0] || "always"; + const options = context.options[1] || {}; + const sourceCode = context.getSourceCode(); + + const nullOption = (config === "always") + ? options.null || "always" + : "ignore"; + const enforceRuleForNull = (nullOption === "always"); + const enforceInverseRuleForNull = (nullOption === "never"); + + /** + * Checks if an expression is a typeof expression + * @param {ASTNode} node The node to check + * @returns {boolean} if the node is a typeof expression + */ + function isTypeOf(node) { + return node.type === "UnaryExpression" && node.operator === "typeof"; + } + + /** + * Checks if either operand of a binary expression is a typeof operation + * @param {ASTNode} node The node to check + * @returns {boolean} if one of the operands is typeof + * @private + */ + function isTypeOfBinary(node) { + return isTypeOf(node.left) || isTypeOf(node.right); + } + + /** + * Checks if operands are literals of the same type (via typeof) + * @param {ASTNode} node The node to check + * @returns {boolean} if operands are of same type + * @private + */ + function areLiteralsAndSameType(node) { + return node.left.type === "Literal" && node.right.type === "Literal" && + typeof node.left.value === typeof node.right.value; + } + + /** + * Checks if one of the operands is a literal null + * @param {ASTNode} node The node to check + * @returns {boolean} if operands are null + * @private + */ + function isNullCheck(node) { + return astUtils.isNullLiteral(node.right) || astUtils.isNullLiteral(node.left); + } + + /** + * Reports a message for this rule. + * @param {ASTNode} node The binary expression node that was checked + * @param {string} expectedOperator The operator that was expected (either '==', '!=', '===', or '!==') + * @returns {void} + * @private + */ + function report(node, expectedOperator) { + const operatorToken = sourceCode.getFirstTokenBetween( + node.left, + node.right, + token => token.value === node.operator + ); + + context.report({ + node, + loc: operatorToken.loc, + messageId: "unexpected", + data: { expectedOperator, actualOperator: node.operator }, + fix(fixer) { + + // If the comparison is a `typeof` comparison or both sides are literals with the same type, then it's safe to fix. + if (isTypeOfBinary(node) || areLiteralsAndSameType(node)) { + return fixer.replaceText(operatorToken, expectedOperator); + } + return null; + } + }); + } + + return { + BinaryExpression(node) { + const isNull = isNullCheck(node); + + if (node.operator !== "==" && node.operator !== "!=") { + if (enforceInverseRuleForNull && isNull) { + report(node, node.operator.slice(0, -1)); + } + return; + } + + if (config === "smart" && (isTypeOfBinary(node) || + areLiteralsAndSameType(node) || isNull)) { + return; + } + + if (!enforceRuleForNull && isNull) { + return; + } + + report(node, `${node.operator}=`); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/for-direction.js b/node_modules/eslint/lib/rules/for-direction.js new file mode 100644 index 0000000..d3d825a --- /dev/null +++ b/node_modules/eslint/lib/rules/for-direction.js @@ -0,0 +1,126 @@ +/** + * @fileoverview enforce "for" loop update clause moving the counter in the right direction.(for-direction) + * @author Aladdin-ADD + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "enforce \"for\" loop update clause moving the counter in the right direction.", + recommended: true, + url: "https://eslint.org/docs/rules/for-direction" + }, + + fixable: null, + schema: [], + + messages: { + incorrectDirection: "The update clause in this loop moves the variable in the wrong direction." + } + }, + + create(context) { + + /** + * report an error. + * @param {ASTNode} node the node to report. + * @returns {void} + */ + function report(node) { + context.report({ + node, + messageId: "incorrectDirection" + }); + } + + /** + * check the right side of the assignment + * @param {ASTNode} update UpdateExpression to check + * @param {int} dir expected direction that could either be turned around or invalidated + * @returns {int} return dir, the negated dir or zero if it's not clear for identifiers + */ + function getRightDirection(update, dir) { + if (update.right.type === "UnaryExpression") { + if (update.right.operator === "-") { + return -dir; + } + } else if (update.right.type === "Identifier") { + return 0; + } + return dir; + } + + /** + * check UpdateExpression add/sub the counter + * @param {ASTNode} update UpdateExpression to check + * @param {string} counter variable name to check + * @returns {int} if add return 1, if sub return -1, if nochange, return 0 + */ + function getUpdateDirection(update, counter) { + if (update.argument.type === "Identifier" && update.argument.name === counter) { + if (update.operator === "++") { + return 1; + } + if (update.operator === "--") { + return -1; + } + } + return 0; + } + + /** + * check AssignmentExpression add/sub the counter + * @param {ASTNode} update AssignmentExpression to check + * @param {string} counter variable name to check + * @returns {int} if add return 1, if sub return -1, if nochange, return 0 + */ + function getAssignmentDirection(update, counter) { + if (update.left.name === counter) { + if (update.operator === "+=") { + return getRightDirection(update, 1); + } + if (update.operator === "-=") { + return getRightDirection(update, -1); + } + } + return 0; + } + return { + ForStatement(node) { + + if (node.test && node.test.type === "BinaryExpression" && node.test.left.type === "Identifier" && node.update) { + const counter = node.test.left.name; + const operator = node.test.operator; + const update = node.update; + + let wrongDirection; + + if (operator === "<" || operator === "<=") { + wrongDirection = -1; + } else if (operator === ">" || operator === ">=") { + wrongDirection = 1; + } else { + return; + } + + if (update.type === "UpdateExpression") { + if (getUpdateDirection(update, counter) === wrongDirection) { + report(node); + } + } else if (update.type === "AssignmentExpression" && getAssignmentDirection(update, counter) === wrongDirection) { + report(node); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/func-call-spacing.js b/node_modules/eslint/lib/rules/func-call-spacing.js new file mode 100644 index 0000000..0391d99 --- /dev/null +++ b/node_modules/eslint/lib/rules/func-call-spacing.js @@ -0,0 +1,230 @@ +/** + * @fileoverview Rule to control spacing within function calls + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow spacing between function identifiers and their invocations", + recommended: false, + url: "https://eslint.org/docs/rules/func-call-spacing" + }, + + fixable: "whitespace", + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["never"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["always"] + }, + { + type: "object", + properties: { + allowNewlines: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + messages: { + unexpectedWhitespace: "Unexpected whitespace between function name and paren.", + unexpectedNewline: "Unexpected newline between function name and paren.", + missing: "Missing space between function name and paren." + } + }, + + create(context) { + + const never = context.options[0] !== "always"; + const allowNewlines = !never && context.options[1] && context.options[1].allowNewlines; + const sourceCode = context.getSourceCode(); + const text = sourceCode.getText(); + + /** + * Check if open space is present in a function name + * @param {ASTNode} node node to evaluate + * @param {Token} leftToken The last token of the callee. This may be the closing parenthesis that encloses the callee. + * @param {Token} rightToken Tha first token of the arguments. this is the opening parenthesis that encloses the arguments. + * @returns {void} + * @private + */ + function checkSpacing(node, leftToken, rightToken) { + const textBetweenTokens = text.slice(leftToken.range[1], rightToken.range[0]).replace(/\/\*.*?\*\//gu, ""); + const hasWhitespace = /\s/u.test(textBetweenTokens); + const hasNewline = hasWhitespace && astUtils.LINEBREAK_MATCHER.test(textBetweenTokens); + + /* + * never allowNewlines hasWhitespace hasNewline message + * F F F F Missing space between function name and paren. + * F F F T (Invalid `!hasWhitespace && hasNewline`) + * F F T T Unexpected newline between function name and paren. + * F F T F (OK) + * F T T F (OK) + * F T T T (OK) + * F T F T (Invalid `!hasWhitespace && hasNewline`) + * F T F F Missing space between function name and paren. + * T T F F (Invalid `never && allowNewlines`) + * T T F T (Invalid `!hasWhitespace && hasNewline`) + * T T T T (Invalid `never && allowNewlines`) + * T T T F (Invalid `never && allowNewlines`) + * T F T F Unexpected space between function name and paren. + * T F T T Unexpected space between function name and paren. + * T F F T (Invalid `!hasWhitespace && hasNewline`) + * T F F F (OK) + * + * T T Unexpected space between function name and paren. + * F F Missing space between function name and paren. + * F F T Unexpected newline between function name and paren. + */ + + if (never && hasWhitespace) { + context.report({ + node, + loc: { + start: leftToken.loc.end, + end: { + line: rightToken.loc.start.line, + column: rightToken.loc.start.column - 1 + } + }, + messageId: "unexpectedWhitespace", + fix(fixer) { + + // Don't remove comments. + if (sourceCode.commentsExistBetween(leftToken, rightToken)) { + return null; + } + + // If `?.` exists, it doesn't hide no-unexpected-multiline errors + if (node.optional) { + return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], "?."); + } + + /* + * Only autofix if there is no newline + * https://github.com/eslint/eslint/issues/7787 + */ + if (hasNewline) { + return null; + } + return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); + } + }); + } else if (!never && !hasWhitespace) { + context.report({ + node, + loc: { + start: { + line: leftToken.loc.end.line, + column: leftToken.loc.end.column - 1 + }, + end: rightToken.loc.start + }, + messageId: "missing", + fix(fixer) { + if (node.optional) { + return null; // Not sure if inserting a space to either before/after `?.` token. + } + return fixer.insertTextBefore(rightToken, " "); + } + }); + } else if (!never && !allowNewlines && hasNewline) { + context.report({ + node, + loc: { + start: leftToken.loc.end, + end: rightToken.loc.start + }, + messageId: "unexpectedNewline", + fix(fixer) { + + /* + * Only autofix if there is no newline + * https://github.com/eslint/eslint/issues/7787 + * But if `?.` exists, it doesn't hide no-unexpected-multiline errors + */ + if (!node.optional) { + return null; + } + + // Don't remove comments. + if (sourceCode.commentsExistBetween(leftToken, rightToken)) { + return null; + } + + const range = [leftToken.range[1], rightToken.range[0]]; + const qdToken = sourceCode.getTokenAfter(leftToken); + + if (qdToken.range[0] === leftToken.range[1]) { + return fixer.replaceTextRange(range, "?. "); + } + if (qdToken.range[1] === rightToken.range[0]) { + return fixer.replaceTextRange(range, " ?."); + } + return fixer.replaceTextRange(range, " ?. "); + } + }); + } + } + + return { + "CallExpression, NewExpression"(node) { + const lastToken = sourceCode.getLastToken(node); + const lastCalleeToken = sourceCode.getLastToken(node.callee); + const parenToken = sourceCode.getFirstTokenBetween(lastCalleeToken, lastToken, astUtils.isOpeningParenToken); + const prevToken = parenToken && sourceCode.getTokenBefore(parenToken, astUtils.isNotQuestionDotToken); + + // Parens in NewExpression are optional + if (!(parenToken && parenToken.range[1] < node.range[1])) { + return; + } + + checkSpacing(node, prevToken, parenToken); + }, + + ImportExpression(node) { + const leftToken = sourceCode.getFirstToken(node); + const rightToken = sourceCode.getTokenAfter(leftToken); + + checkSpacing(node, leftToken, rightToken); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/func-name-matching.js b/node_modules/eslint/lib/rules/func-name-matching.js new file mode 100644 index 0000000..9cee5fe --- /dev/null +++ b/node_modules/eslint/lib/rules/func-name-matching.js @@ -0,0 +1,253 @@ +/** + * @fileoverview Rule to require function names to match the name of the variable or property to which they are assigned. + * @author Annie Zhang, Pavel Strashkin + */ + +"use strict"; + +//-------------------------------------------------------------------------- +// Requirements +//-------------------------------------------------------------------------- + +const astUtils = require("./utils/ast-utils"); +const esutils = require("esutils"); + +//-------------------------------------------------------------------------- +// Helpers +//-------------------------------------------------------------------------- + +/** + * Determines if a pattern is `module.exports` or `module["exports"]` + * @param {ASTNode} pattern The left side of the AssignmentExpression + * @returns {boolean} True if the pattern is `module.exports` or `module["exports"]` + */ +function isModuleExports(pattern) { + if (pattern.type === "MemberExpression" && pattern.object.type === "Identifier" && pattern.object.name === "module") { + + // module.exports + if (pattern.property.type === "Identifier" && pattern.property.name === "exports") { + return true; + } + + // module["exports"] + if (pattern.property.type === "Literal" && pattern.property.value === "exports") { + return true; + } + } + return false; +} + +/** + * Determines if a string name is a valid identifier + * @param {string} name The string to be checked + * @param {int} ecmaVersion The ECMAScript version if specified in the parserOptions config + * @returns {boolean} True if the string is a valid identifier + */ +function isIdentifier(name, ecmaVersion) { + if (ecmaVersion >= 6) { + return esutils.keyword.isIdentifierES6(name); + } + return esutils.keyword.isIdentifierES5(name); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const alwaysOrNever = { enum: ["always", "never"] }; +const optionsObject = { + type: "object", + properties: { + considerPropertyDescriptor: { + type: "boolean" + }, + includeCommonJSModuleExports: { + type: "boolean" + } + }, + additionalProperties: false +}; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require function names to match the name of the variable or property to which they are assigned", + recommended: false, + url: "https://eslint.org/docs/rules/func-name-matching" + }, + + schema: { + anyOf: [{ + type: "array", + additionalItems: false, + items: [alwaysOrNever, optionsObject] + }, { + type: "array", + additionalItems: false, + items: [optionsObject] + }] + }, + + messages: { + matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`.", + matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`.", + notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`.", + notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`." + } + }, + + create(context) { + const options = (typeof context.options[0] === "object" ? context.options[0] : context.options[1]) || {}; + const nameMatches = typeof context.options[0] === "string" ? context.options[0] : "always"; + const considerPropertyDescriptor = options.considerPropertyDescriptor; + const includeModuleExports = options.includeCommonJSModuleExports; + const ecmaVersion = context.parserOptions && context.parserOptions.ecmaVersion ? context.parserOptions.ecmaVersion : 5; + + /** + * Check whether node is a certain CallExpression. + * @param {string} objName object name + * @param {string} funcName function name + * @param {ASTNode} node The node to check + * @returns {boolean} `true` if node matches CallExpression + */ + function isPropertyCall(objName, funcName, node) { + if (!node) { + return false; + } + return node.type === "CallExpression" && astUtils.isSpecificMemberAccess(node.callee, objName, funcName); + } + + /** + * Compares identifiers based on the nameMatches option + * @param {string} x the first identifier + * @param {string} y the second identifier + * @returns {boolean} whether the two identifiers should warn. + */ + function shouldWarn(x, y) { + return (nameMatches === "always" && x !== y) || (nameMatches === "never" && x === y); + } + + /** + * Reports + * @param {ASTNode} node The node to report + * @param {string} name The variable or property name + * @param {string} funcName The function name + * @param {boolean} isProp True if the reported node is a property assignment + * @returns {void} + */ + function report(node, name, funcName, isProp) { + let messageId; + + if (nameMatches === "always" && isProp) { + messageId = "matchProperty"; + } else if (nameMatches === "always") { + messageId = "matchVariable"; + } else if (isProp) { + messageId = "notMatchProperty"; + } else { + messageId = "notMatchVariable"; + } + context.report({ + node, + messageId, + data: { + name, + funcName + } + }); + } + + /** + * Determines whether a given node is a string literal + * @param {ASTNode} node The node to check + * @returns {boolean} `true` if the node is a string literal + */ + function isStringLiteral(node) { + return node.type === "Literal" && typeof node.value === "string"; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + VariableDeclarator(node) { + if (!node.init || node.init.type !== "FunctionExpression" || node.id.type !== "Identifier") { + return; + } + if (node.init.id && shouldWarn(node.id.name, node.init.id.name)) { + report(node, node.id.name, node.init.id.name, false); + } + }, + + AssignmentExpression(node) { + if ( + node.right.type !== "FunctionExpression" || + (node.left.computed && node.left.property.type !== "Literal") || + (!includeModuleExports && isModuleExports(node.left)) || + (node.left.type !== "Identifier" && node.left.type !== "MemberExpression") + ) { + return; + } + + const isProp = node.left.type === "MemberExpression"; + const name = isProp ? astUtils.getStaticPropertyName(node.left) : node.left.name; + + if (node.right.id && name && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { + report(node, name, node.right.id.name, isProp); + } + }, + + "Property, PropertyDefinition[value]"(node) { + if (!(node.value.type === "FunctionExpression" && node.value.id)) { + return; + } + + if (node.key.type === "Identifier" && !node.computed) { + const functionName = node.value.id.name; + let propertyName = node.key.name; + + if ( + considerPropertyDescriptor && + propertyName === "value" && + node.parent.type === "ObjectExpression" + ) { + if (isPropertyCall("Object", "defineProperty", node.parent.parent) || isPropertyCall("Reflect", "defineProperty", node.parent.parent)) { + const property = node.parent.parent.arguments[1]; + + if (isStringLiteral(property) && shouldWarn(property.value, functionName)) { + report(node, property.value, functionName, true); + } + } else if (isPropertyCall("Object", "defineProperties", node.parent.parent.parent.parent)) { + propertyName = node.parent.parent.key.name; + if (!node.parent.parent.computed && shouldWarn(propertyName, functionName)) { + report(node, propertyName, functionName, true); + } + } else if (isPropertyCall("Object", "create", node.parent.parent.parent.parent)) { + propertyName = node.parent.parent.key.name; + if (!node.parent.parent.computed && shouldWarn(propertyName, functionName)) { + report(node, propertyName, functionName, true); + } + } else if (shouldWarn(propertyName, functionName)) { + report(node, propertyName, functionName, true); + } + } else if (shouldWarn(propertyName, functionName)) { + report(node, propertyName, functionName, true); + } + return; + } + + if ( + isStringLiteral(node.key) && + isIdentifier(node.key.value, ecmaVersion) && + shouldWarn(node.key.value, node.value.id.name) + ) { + report(node, node.key.value, node.value.id.name, true); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/func-names.js b/node_modules/eslint/lib/rules/func-names.js new file mode 100644 index 0000000..c7b2072 --- /dev/null +++ b/node_modules/eslint/lib/rules/func-names.js @@ -0,0 +1,191 @@ +/** + * @fileoverview Rule to warn when a function expression does not have a name. + * @author Kyle T. Nunery + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +/** + * Checks whether or not a given variable is a function name. + * @param {eslint-scope.Variable} variable A variable to check. + * @returns {boolean} `true` if the variable is a function name. + */ +function isFunctionName(variable) { + return variable && variable.defs[0].type === "FunctionName"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow named `function` expressions", + recommended: false, + url: "https://eslint.org/docs/rules/func-names" + }, + + schema: { + definitions: { + value: { + enum: [ + "always", + "as-needed", + "never" + ] + } + }, + items: [ + { + $ref: "#/definitions/value" + }, + { + type: "object", + properties: { + generators: { + $ref: "#/definitions/value" + } + }, + additionalProperties: false + } + ] + }, + + messages: { + unnamed: "Unexpected unnamed {{name}}.", + named: "Unexpected named {{name}}." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + + /** + * Returns the config option for the given node. + * @param {ASTNode} node A node to get the config for. + * @returns {string} The config option. + */ + function getConfigForNode(node) { + if ( + node.generator && + context.options.length > 1 && + context.options[1].generators + ) { + return context.options[1].generators; + } + + return context.options[0] || "always"; + } + + /** + * Determines whether the current FunctionExpression node is a get, set, or + * shorthand method in an object literal or a class. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node is a get, set, or shorthand method. + */ + function isObjectOrClassMethod(node) { + const parent = node.parent; + + return (parent.type === "MethodDefinition" || ( + parent.type === "Property" && ( + parent.method || + parent.kind === "get" || + parent.kind === "set" + ) + )); + } + + /** + * Determines whether the current FunctionExpression node has a name that would be + * inferred from context in a conforming ES6 environment. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node would have a name assigned automatically. + */ + function hasInferredName(node) { + const parent = node.parent; + + return isObjectOrClassMethod(node) || + (parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node) || + (parent.type === "Property" && parent.value === node) || + (parent.type === "PropertyDefinition" && parent.value === node) || + (parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node) || + (parent.type === "AssignmentPattern" && parent.left.type === "Identifier" && parent.right === node); + } + + /** + * Reports that an unnamed function should be named + * @param {ASTNode} node The node to report in the event of an error. + * @returns {void} + */ + function reportUnexpectedUnnamedFunction(node) { + context.report({ + node, + messageId: "unnamed", + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + data: { name: astUtils.getFunctionNameWithKind(node) } + }); + } + + /** + * Reports that a named function should be unnamed + * @param {ASTNode} node The node to report in the event of an error. + * @returns {void} + */ + function reportUnexpectedNamedFunction(node) { + context.report({ + node, + messageId: "named", + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + data: { name: astUtils.getFunctionNameWithKind(node) } + }); + } + + /** + * The listener for function nodes. + * @param {ASTNode} node function node + * @returns {void} + */ + function handleFunction(node) { + + // Skip recursive functions. + const nameVar = context.getDeclaredVariables(node)[0]; + + if (isFunctionName(nameVar) && nameVar.references.length > 0) { + return; + } + + const hasName = Boolean(node.id && node.id.name); + const config = getConfigForNode(node); + + if (config === "never") { + if (hasName && node.type !== "FunctionDeclaration") { + reportUnexpectedNamedFunction(node); + } + } else if (config === "as-needed") { + if (!hasName && !hasInferredName(node)) { + reportUnexpectedUnnamedFunction(node); + } + } else { + if (!hasName && !isObjectOrClassMethod(node)) { + reportUnexpectedUnnamedFunction(node); + } + } + } + + return { + "FunctionExpression:exit": handleFunction, + "ExportDefaultDeclaration > FunctionDeclaration": handleFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/func-style.js b/node_modules/eslint/lib/rules/func-style.js new file mode 100644 index 0000000..f715748 --- /dev/null +++ b/node_modules/eslint/lib/rules/func-style.js @@ -0,0 +1,98 @@ +/** + * @fileoverview Rule to enforce a particular function style + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce the consistent use of either `function` declarations or expressions", + recommended: false, + url: "https://eslint.org/docs/rules/func-style" + }, + + schema: [ + { + enum: ["declaration", "expression"] + }, + { + type: "object", + properties: { + allowArrowFunctions: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + expression: "Expected a function expression.", + declaration: "Expected a function declaration." + } + }, + + create(context) { + + const style = context.options[0], + allowArrowFunctions = context.options[1] && context.options[1].allowArrowFunctions, + enforceDeclarations = (style === "declaration"), + stack = []; + + const nodesToCheck = { + FunctionDeclaration(node) { + stack.push(false); + + if (!enforceDeclarations && node.parent.type !== "ExportDefaultDeclaration") { + context.report({ node, messageId: "expression" }); + } + }, + "FunctionDeclaration:exit"() { + stack.pop(); + }, + + FunctionExpression(node) { + stack.push(false); + + if (enforceDeclarations && node.parent.type === "VariableDeclarator") { + context.report({ node: node.parent, messageId: "declaration" }); + } + }, + "FunctionExpression:exit"() { + stack.pop(); + }, + + ThisExpression() { + if (stack.length > 0) { + stack[stack.length - 1] = true; + } + } + }; + + if (!allowArrowFunctions) { + nodesToCheck.ArrowFunctionExpression = function() { + stack.push(false); + }; + + nodesToCheck["ArrowFunctionExpression:exit"] = function(node) { + const hasThisExpr = stack.pop(); + + if (enforceDeclarations && !hasThisExpr && node.parent.type === "VariableDeclarator") { + context.report({ node: node.parent, messageId: "declaration" }); + } + }; + } + + return nodesToCheck; + + } +}; diff --git a/node_modules/eslint/lib/rules/function-call-argument-newline.js b/node_modules/eslint/lib/rules/function-call-argument-newline.js new file mode 100644 index 0000000..f3cfeee --- /dev/null +++ b/node_modules/eslint/lib/rules/function-call-argument-newline.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Rule to enforce line breaks between arguments of a function call + * @author Alexey Gonchar + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce line breaks between arguments of a function call", + recommended: false, + url: "https://eslint.org/docs/rules/function-call-argument-newline" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never", "consistent"] + } + ], + + messages: { + unexpectedLineBreak: "There should be no line break here.", + missingLineBreak: "There should be a line break after this argument." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const checkers = { + unexpected: { + messageId: "unexpectedLineBreak", + check: (prevToken, currentToken) => prevToken.loc.end.line !== currentToken.loc.start.line, + createFix: (token, tokenBefore) => fixer => + fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ") + }, + missing: { + messageId: "missingLineBreak", + check: (prevToken, currentToken) => prevToken.loc.end.line === currentToken.loc.start.line, + createFix: (token, tokenBefore) => fixer => + fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n") + } + }; + + /** + * Check all arguments for line breaks in the CallExpression + * @param {CallExpression} node node to evaluate + * @param {{ messageId: string, check: Function }} checker selected checker + * @returns {void} + * @private + */ + function checkArguments(node, checker) { + for (let i = 1; i < node.arguments.length; i++) { + const prevArgToken = sourceCode.getLastToken(node.arguments[i - 1]); + const currentArgToken = sourceCode.getFirstToken(node.arguments[i]); + + if (checker.check(prevArgToken, currentArgToken)) { + const tokenBefore = sourceCode.getTokenBefore( + currentArgToken, + { includeComments: true } + ); + + const hasLineCommentBefore = tokenBefore.type === "Line"; + + context.report({ + node, + loc: { + start: tokenBefore.loc.end, + end: currentArgToken.loc.start + }, + messageId: checker.messageId, + fix: hasLineCommentBefore ? null : checker.createFix(currentArgToken, tokenBefore) + }); + } + } + } + + /** + * Check if open space is present in a function name + * @param {CallExpression} node node to evaluate + * @returns {void} + * @private + */ + function check(node) { + if (node.arguments.length < 2) { + return; + } + + const option = context.options[0] || "always"; + + if (option === "never") { + checkArguments(node, checkers.unexpected); + } else if (option === "always") { + checkArguments(node, checkers.missing); + } else if (option === "consistent") { + const firstArgToken = sourceCode.getLastToken(node.arguments[0]); + const secondArgToken = sourceCode.getFirstToken(node.arguments[1]); + + if (firstArgToken.loc.end.line === secondArgToken.loc.start.line) { + checkArguments(node, checkers.unexpected); + } else { + checkArguments(node, checkers.missing); + } + } + } + + return { + CallExpression: check, + NewExpression: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/function-paren-newline.js b/node_modules/eslint/lib/rules/function-paren-newline.js new file mode 100644 index 0000000..cad27b9 --- /dev/null +++ b/node_modules/eslint/lib/rules/function-paren-newline.js @@ -0,0 +1,289 @@ +/** + * @fileoverview enforce consistent line breaks inside function parentheses + * @author Teddy Katz + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent line breaks inside function parentheses", + recommended: false, + url: "https://eslint.org/docs/rules/function-paren-newline" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never", "consistent", "multiline", "multiline-arguments"] + }, + { + type: "object", + properties: { + minItems: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + expectedBefore: "Expected newline before ')'.", + expectedAfter: "Expected newline after '('.", + expectedBetween: "Expected newline between arguments/params.", + unexpectedBefore: "Unexpected newline before ')'.", + unexpectedAfter: "Unexpected newline after '('." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const rawOption = context.options[0] || "multiline"; + const multilineOption = rawOption === "multiline"; + const multilineArgumentsOption = rawOption === "multiline-arguments"; + const consistentOption = rawOption === "consistent"; + let minItems; + + if (typeof rawOption === "object") { + minItems = rawOption.minItems; + } else if (rawOption === "always") { + minItems = 0; + } else if (rawOption === "never") { + minItems = Infinity; + } else { + minItems = null; + } + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Determines whether there should be newlines inside function parens + * @param {ASTNode[]} elements The arguments or parameters in the list + * @param {boolean} hasLeftNewline `true` if the left paren has a newline in the current code. + * @returns {boolean} `true` if there should be newlines inside the function parens + */ + function shouldHaveNewlines(elements, hasLeftNewline) { + if (multilineArgumentsOption && elements.length === 1) { + return hasLeftNewline; + } + if (multilineOption || multilineArgumentsOption) { + return elements.some((element, index) => index !== elements.length - 1 && element.loc.end.line !== elements[index + 1].loc.start.line); + } + if (consistentOption) { + return hasLeftNewline; + } + return elements.length >= minItems; + } + + /** + * Validates parens + * @param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token + * @param {ASTNode[]} elements The arguments or parameters in the list + * @returns {void} + */ + function validateParens(parens, elements) { + const leftParen = parens.leftParen; + const rightParen = parens.rightParen; + const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); + const tokenBeforeRightParen = sourceCode.getTokenBefore(rightParen); + const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); + const hasRightNewline = !astUtils.isTokenOnSameLine(tokenBeforeRightParen, rightParen); + const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); + + if (hasLeftNewline && !needsNewlines) { + context.report({ + node: leftParen, + messageId: "unexpectedAfter", + fix(fixer) { + return sourceCode.getText().slice(leftParen.range[1], tokenAfterLeftParen.range[0]).trim() + + // If there is a comment between the ( and the first element, don't do a fix. + ? null + : fixer.removeRange([leftParen.range[1], tokenAfterLeftParen.range[0]]); + } + }); + } else if (!hasLeftNewline && needsNewlines) { + context.report({ + node: leftParen, + messageId: "expectedAfter", + fix: fixer => fixer.insertTextAfter(leftParen, "\n") + }); + } + + if (hasRightNewline && !needsNewlines) { + context.report({ + node: rightParen, + messageId: "unexpectedBefore", + fix(fixer) { + return sourceCode.getText().slice(tokenBeforeRightParen.range[1], rightParen.range[0]).trim() + + // If there is a comment between the last element and the ), don't do a fix. + ? null + : fixer.removeRange([tokenBeforeRightParen.range[1], rightParen.range[0]]); + } + }); + } else if (!hasRightNewline && needsNewlines) { + context.report({ + node: rightParen, + messageId: "expectedBefore", + fix: fixer => fixer.insertTextBefore(rightParen, "\n") + }); + } + } + + /** + * Validates a list of arguments or parameters + * @param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token + * @param {ASTNode[]} elements The arguments or parameters in the list + * @returns {void} + */ + function validateArguments(parens, elements) { + const leftParen = parens.leftParen; + const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); + const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); + const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); + + for (let i = 0; i <= elements.length - 2; i++) { + const currentElement = elements[i]; + const nextElement = elements[i + 1]; + const hasNewLine = currentElement.loc.end.line !== nextElement.loc.start.line; + + if (!hasNewLine && needsNewlines) { + context.report({ + node: currentElement, + messageId: "expectedBetween", + fix: fixer => fixer.insertTextBefore(nextElement, "\n") + }); + } + } + } + + /** + * Gets the left paren and right paren tokens of a node. + * @param {ASTNode} node The node with parens + * @throws {TypeError} Unexpected node type. + * @returns {Object} An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token. + * Can also return `null` if an expression has no parens (e.g. a NewExpression with no arguments, or an ArrowFunctionExpression + * with a single parameter) + */ + function getParenTokens(node) { + switch (node.type) { + case "NewExpression": + if (!node.arguments.length && + !( + astUtils.isOpeningParenToken(sourceCode.getLastToken(node, { skip: 1 })) && + astUtils.isClosingParenToken(sourceCode.getLastToken(node)) && + node.callee.range[1] < node.range[1] + ) + ) { + + // If the NewExpression does not have parens (e.g. `new Foo`), return null. + return null; + } + + // falls through + + case "CallExpression": + return { + leftParen: sourceCode.getTokenAfter(node.callee, astUtils.isOpeningParenToken), + rightParen: sourceCode.getLastToken(node) + }; + + case "FunctionDeclaration": + case "FunctionExpression": { + const leftParen = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); + const rightParen = node.params.length + ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) + : sourceCode.getTokenAfter(leftParen); + + return { leftParen, rightParen }; + } + + case "ArrowFunctionExpression": { + const firstToken = sourceCode.getFirstToken(node, { skip: (node.async ? 1 : 0) }); + + if (!astUtils.isOpeningParenToken(firstToken)) { + + // If the ArrowFunctionExpression has a single param without parens, return null. + return null; + } + + const rightParen = node.params.length + ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) + : sourceCode.getTokenAfter(firstToken); + + return { + leftParen: firstToken, + rightParen + }; + } + + case "ImportExpression": { + const leftParen = sourceCode.getFirstToken(node, 1); + const rightParen = sourceCode.getLastToken(node); + + return { leftParen, rightParen }; + } + + default: + throw new TypeError(`unexpected node with type ${node.type}`); + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + [[ + "ArrowFunctionExpression", + "CallExpression", + "FunctionDeclaration", + "FunctionExpression", + "ImportExpression", + "NewExpression" + ]](node) { + const parens = getParenTokens(node); + let params; + + if (node.type === "ImportExpression") { + params = [node.source]; + } else if (astUtils.isFunction(node)) { + params = node.params; + } else { + params = node.arguments; + } + + if (parens) { + validateParens(parens, params); + + if (multilineArgumentsOption) { + validateArguments(parens, params); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/generator-star-spacing.js b/node_modules/eslint/lib/rules/generator-star-spacing.js new file mode 100644 index 0000000..28e8101 --- /dev/null +++ b/node_modules/eslint/lib/rules/generator-star-spacing.js @@ -0,0 +1,206 @@ +/** + * @fileoverview Rule to check the spacing around the * in generator functions. + * @author Jamund Ferguson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const OVERRIDE_SCHEMA = { + oneOf: [ + { + enum: ["before", "after", "both", "neither"] + }, + { + type: "object", + properties: { + before: { type: "boolean" }, + after: { type: "boolean" } + }, + additionalProperties: false + } + ] +}; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing around `*` operators in generator functions", + recommended: false, + url: "https://eslint.org/docs/rules/generator-star-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["before", "after", "both", "neither"] + }, + { + type: "object", + properties: { + before: { type: "boolean" }, + after: { type: "boolean" }, + named: OVERRIDE_SCHEMA, + anonymous: OVERRIDE_SCHEMA, + method: OVERRIDE_SCHEMA + }, + additionalProperties: false + } + ] + } + ], + + messages: { + missingBefore: "Missing space before *.", + missingAfter: "Missing space after *.", + unexpectedBefore: "Unexpected space before *.", + unexpectedAfter: "Unexpected space after *." + } + }, + + create(context) { + + const optionDefinitions = { + before: { before: true, after: false }, + after: { before: false, after: true }, + both: { before: true, after: true }, + neither: { before: false, after: false } + }; + + /** + * Returns resolved option definitions based on an option and defaults + * @param {any} option The option object or string value + * @param {Object} defaults The defaults to use if options are not present + * @returns {Object} the resolved object definition + */ + function optionToDefinition(option, defaults) { + if (!option) { + return defaults; + } + + return typeof option === "string" + ? optionDefinitions[option] + : Object.assign({}, defaults, option); + } + + const modes = (function(option) { + const defaults = optionToDefinition(option, optionDefinitions.before); + + return { + named: optionToDefinition(option.named, defaults), + anonymous: optionToDefinition(option.anonymous, defaults), + method: optionToDefinition(option.method, defaults) + }; + }(context.options[0] || {})); + + const sourceCode = context.getSourceCode(); + + /** + * Checks if the given token is a star token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a star token. + */ + function isStarToken(token) { + return token.value === "*" && token.type === "Punctuator"; + } + + /** + * Gets the generator star token of the given function node. + * @param {ASTNode} node The function node to get. + * @returns {Token} Found star token. + */ + function getStarToken(node) { + return sourceCode.getFirstToken( + (node.parent.method || node.parent.type === "MethodDefinition") ? node.parent : node, + isStarToken + ); + } + + /** + * capitalize a given string. + * @param {string} str the given string. + * @returns {string} the capitalized string. + */ + function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); + } + + /** + * Checks the spacing between two tokens before or after the star token. + * @param {string} kind Either "named", "anonymous", or "method" + * @param {string} side Either "before" or "after". + * @param {Token} leftToken `function` keyword token if side is "before", or + * star token if side is "after". + * @param {Token} rightToken Star token if side is "before", or identifier + * token if side is "after". + * @returns {void} + */ + function checkSpacing(kind, side, leftToken, rightToken) { + if (!!(rightToken.range[0] - leftToken.range[1]) !== modes[kind][side]) { + const after = leftToken.value === "*"; + const spaceRequired = modes[kind][side]; + const node = after ? leftToken : rightToken; + const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`; + + context.report({ + node, + messageId, + fix(fixer) { + if (spaceRequired) { + if (after) { + return fixer.insertTextAfter(node, " "); + } + return fixer.insertTextBefore(node, " "); + } + return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); + } + }); + } + } + + /** + * Enforces the spacing around the star if node is a generator function. + * @param {ASTNode} node A function expression or declaration node. + * @returns {void} + */ + function checkFunction(node) { + if (!node.generator) { + return; + } + + const starToken = getStarToken(node); + const prevToken = sourceCode.getTokenBefore(starToken); + const nextToken = sourceCode.getTokenAfter(starToken); + + let kind = "named"; + + if (node.parent.type === "MethodDefinition" || (node.parent.type === "Property" && node.parent.method)) { + kind = "method"; + } else if (!node.id) { + kind = "anonymous"; + } + + // Only check before when preceded by `function`|`static` keyword + if (!(kind === "method" && starToken === sourceCode.getFirstToken(node.parent))) { + checkSpacing(kind, "before", prevToken, starToken); + } + + checkSpacing(kind, "after", starToken, nextToken); + } + + return { + FunctionDeclaration: checkFunction, + FunctionExpression: checkFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/getter-return.js b/node_modules/eslint/lib/rules/getter-return.js new file mode 100644 index 0000000..03cfce2 --- /dev/null +++ b/node_modules/eslint/lib/rules/getter-return.js @@ -0,0 +1,173 @@ +/** + * @fileoverview Enforces that a return statement is present in property getters. + * @author Aladdin-ADD(hh_2013@foxmail.com) + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ +const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; + +/** + * Checks a given code path segment is reachable. + * @param {CodePathSegment} segment A segment to check. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "enforce `return` statements in getters", + recommended: true, + url: "https://eslint.org/docs/rules/getter-return" + }, + + fixable: null, + + schema: [ + { + type: "object", + properties: { + allowImplicit: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + expected: "Expected to return a value in {{name}}.", + expectedAlways: "Expected {{name}} to always return a value." + } + }, + + create(context) { + + const options = context.options[0] || { allowImplicit: false }; + const sourceCode = context.getSourceCode(); + + let funcInfo = { + upper: null, + codePath: null, + hasReturn: false, + shouldCheck: false, + node: null + }; + + /** + * Checks whether or not the last code path segment is reachable. + * Then reports this function if the segment is reachable. + * + * If the last code path segment is reachable, there are paths which are not + * returned or thrown. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function checkLastSegment(node) { + if (funcInfo.shouldCheck && + funcInfo.codePath.currentSegments.some(isReachable) + ) { + context.report({ + node, + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + messageId: funcInfo.hasReturn ? "expectedAlways" : "expected", + data: { + name: astUtils.getFunctionNameWithKind(funcInfo.node) + } + }); + } + } + + /** + * Checks whether a node means a getter function. + * @param {ASTNode} node a node to check. + * @returns {boolean} if node means a getter, return true; else return false. + */ + function isGetter(node) { + const parent = node.parent; + + if (TARGET_NODE_TYPE.test(node.type) && node.body.type === "BlockStatement") { + if (parent.kind === "get") { + return true; + } + if (parent.type === "Property" && astUtils.getStaticPropertyName(parent) === "get" && parent.parent.type === "ObjectExpression") { + + // Object.defineProperty() + if (parent.parent.parent.type === "CallExpression" && + astUtils.getStaticPropertyName(parent.parent.parent.callee) === "defineProperty") { + return true; + } + + // Object.defineProperties() + if (parent.parent.parent.type === "Property" && + parent.parent.parent.parent.type === "ObjectExpression" && + parent.parent.parent.parent.parent.type === "CallExpression" && + astUtils.getStaticPropertyName(parent.parent.parent.parent.parent.callee) === "defineProperties") { + return true; + } + } + } + return false; + } + return { + + // Stacks this function's information. + onCodePathStart(codePath, node) { + funcInfo = { + upper: funcInfo, + codePath, + hasReturn: false, + shouldCheck: isGetter(node), + node + }; + }, + + // Pops this function's information. + onCodePathEnd() { + funcInfo = funcInfo.upper; + }, + + // Checks the return statement is valid. + ReturnStatement(node) { + if (funcInfo.shouldCheck) { + funcInfo.hasReturn = true; + + // if allowImplicit: false, should also check node.argument + if (!options.allowImplicit && !node.argument) { + context.report({ + node, + messageId: "expected", + data: { + name: astUtils.getFunctionNameWithKind(funcInfo.node) + } + }); + } + } + }, + + // Reports a given function if the last path is reachable. + "FunctionExpression:exit": checkLastSegment, + "ArrowFunctionExpression:exit": checkLastSegment + }; + } +}; diff --git a/node_modules/eslint/lib/rules/global-require.js b/node_modules/eslint/lib/rules/global-require.js new file mode 100644 index 0000000..71a2bf1 --- /dev/null +++ b/node_modules/eslint/lib/rules/global-require.js @@ -0,0 +1,87 @@ +/** + * @fileoverview Rule for disallowing require() outside of the top-level module context + * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 + */ + +"use strict"; + +const ACCEPTABLE_PARENTS = new Set([ + "AssignmentExpression", + "VariableDeclarator", + "MemberExpression", + "ExpressionStatement", + "CallExpression", + "ConditionalExpression", + "Program", + "VariableDeclaration", + "ChainExpression" +]); + +/** + * Finds the eslint-scope reference in the given scope. + * @param {Object} scope The scope to search. + * @param {ASTNode} node The identifier node. + * @returns {Reference|null} Returns the found reference or null if none were found. + */ +function findReference(scope, node) { + const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && + reference.identifier.range[1] === node.range[1]); + + /* istanbul ignore else: correctly returns null */ + if (references.length === 1) { + return references[0]; + } + return null; + +} + +/** + * Checks if the given identifier node is shadowed in the given scope. + * @param {Object} scope The current scope. + * @param {ASTNode} node The identifier node to check. + * @returns {boolean} Whether or not the name is shadowed. + */ +function isShadowed(scope, node) { + const reference = findReference(scope, node); + + return reference && reference.resolved && reference.resolved.defs.length > 0; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "require `require()` calls to be placed at top-level module scope", + recommended: false, + url: "https://eslint.org/docs/rules/global-require" + }, + + schema: [], + messages: { + unexpected: "Unexpected require()." + } + }, + + create(context) { + return { + CallExpression(node) { + const currentScope = context.getScope(); + + if (node.callee.name === "require" && !isShadowed(currentScope, node.callee)) { + const isGoodRequire = context.getAncestors().every(parent => ACCEPTABLE_PARENTS.has(parent.type)); + + if (!isGoodRequire) { + context.report({ node, messageId: "unexpected" }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/grouped-accessor-pairs.js b/node_modules/eslint/lib/rules/grouped-accessor-pairs.js new file mode 100644 index 0000000..0fe6f91 --- /dev/null +++ b/node_modules/eslint/lib/rules/grouped-accessor-pairs.js @@ -0,0 +1,224 @@ +/** + * @fileoverview Rule to require grouped accessor pairs in object literals and classes + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * Property name if it can be computed statically, otherwise the list of the tokens of the key node. + * @typedef {string|Token[]} Key + */ + +/** + * Accessor nodes with the same key. + * @typedef {Object} AccessorData + * @property {Key} key Accessor's key + * @property {ASTNode[]} getters List of getter nodes. + * @property {ASTNode[]} setters List of setter nodes. + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not the given lists represent the equal tokens in the same order. + * Tokens are compared by their properties, not by instance. + * @param {Token[]} left First list of tokens. + * @param {Token[]} right Second list of tokens. + * @returns {boolean} `true` if the lists have same tokens. + */ +function areEqualTokenLists(left, right) { + if (left.length !== right.length) { + return false; + } + + for (let i = 0; i < left.length; i++) { + const leftToken = left[i], + rightToken = right[i]; + + if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) { + return false; + } + } + + return true; +} + +/** + * Checks whether or not the given keys are equal. + * @param {Key} left First key. + * @param {Key} right Second key. + * @returns {boolean} `true` if the keys are equal. + */ +function areEqualKeys(left, right) { + if (typeof left === "string" && typeof right === "string") { + + // Statically computed names. + return left === right; + } + if (Array.isArray(left) && Array.isArray(right)) { + + // Token lists. + return areEqualTokenLists(left, right); + } + + return false; +} + +/** + * Checks whether or not a given node is of an accessor kind ('get' or 'set'). + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is of an accessor kind. + */ +function isAccessorKind(node) { + return node.kind === "get" || node.kind === "set"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require grouped accessor pairs in object literals and classes", + recommended: false, + url: "https://eslint.org/docs/rules/grouped-accessor-pairs" + }, + + schema: [ + { + enum: ["anyOrder", "getBeforeSet", "setBeforeGet"] + } + ], + + messages: { + notGrouped: "Accessor pair {{ formerName }} and {{ latterName }} should be grouped.", + invalidOrder: "Expected {{ latterName }} to be before {{ formerName }}." + } + }, + + create(context) { + const order = context.options[0] || "anyOrder"; + const sourceCode = context.getSourceCode(); + + /** + * Reports the given accessor pair. + * @param {string} messageId messageId to report. + * @param {ASTNode} formerNode getter/setter node that is defined before `latterNode`. + * @param {ASTNode} latterNode getter/setter node that is defined after `formerNode`. + * @returns {void} + * @private + */ + function report(messageId, formerNode, latterNode) { + context.report({ + node: latterNode, + messageId, + loc: astUtils.getFunctionHeadLoc(latterNode.value, sourceCode), + data: { + formerName: astUtils.getFunctionNameWithKind(formerNode.value), + latterName: astUtils.getFunctionNameWithKind(latterNode.value) + } + }); + } + + /** + * Creates a new `AccessorData` object for the given getter or setter node. + * @param {ASTNode} node A getter or setter node. + * @returns {AccessorData} New `AccessorData` object that contains the given node. + * @private + */ + function createAccessorData(node) { + const name = astUtils.getStaticPropertyName(node); + const key = (name !== null) ? name : sourceCode.getTokens(node.key); + + return { + key, + getters: node.kind === "get" ? [node] : [], + setters: node.kind === "set" ? [node] : [] + }; + } + + /** + * Merges the given `AccessorData` object into the given accessors list. + * @param {AccessorData[]} accessors The list to merge into. + * @param {AccessorData} accessorData The object to merge. + * @returns {AccessorData[]} The same instance with the merged object. + * @private + */ + function mergeAccessorData(accessors, accessorData) { + const equalKeyElement = accessors.find(a => areEqualKeys(a.key, accessorData.key)); + + if (equalKeyElement) { + equalKeyElement.getters.push(...accessorData.getters); + equalKeyElement.setters.push(...accessorData.setters); + } else { + accessors.push(accessorData); + } + + return accessors; + } + + /** + * Checks accessor pairs in the given list of nodes. + * @param {ASTNode[]} nodes The list to check. + * @param {Function} shouldCheck – Predicate that returns `true` if the node should be checked. + * @returns {void} + * @private + */ + function checkList(nodes, shouldCheck) { + const accessors = nodes + .filter(shouldCheck) + .filter(isAccessorKind) + .map(createAccessorData) + .reduce(mergeAccessorData, []); + + for (const { getters, setters } of accessors) { + + // Don't report accessor properties that have duplicate getters or setters. + if (getters.length === 1 && setters.length === 1) { + const [getter] = getters, + [setter] = setters, + getterIndex = nodes.indexOf(getter), + setterIndex = nodes.indexOf(setter), + formerNode = getterIndex < setterIndex ? getter : setter, + latterNode = getterIndex < setterIndex ? setter : getter; + + if (Math.abs(getterIndex - setterIndex) > 1) { + report("notGrouped", formerNode, latterNode); + } else if ( + (order === "getBeforeSet" && getterIndex > setterIndex) || + (order === "setBeforeGet" && getterIndex < setterIndex) + ) { + report("invalidOrder", formerNode, latterNode); + } + } + } + } + + return { + ObjectExpression(node) { + checkList(node.properties, n => n.type === "Property"); + }, + ClassBody(node) { + checkList(node.body, n => n.type === "MethodDefinition" && !n.static); + checkList(node.body, n => n.type === "MethodDefinition" && n.static); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/guard-for-in.js b/node_modules/eslint/lib/rules/guard-for-in.js new file mode 100644 index 0000000..1c52af7 --- /dev/null +++ b/node_modules/eslint/lib/rules/guard-for-in.js @@ -0,0 +1,76 @@ +/** + * @fileoverview Rule to flag for-in loops without if statements inside + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `for-in` loops to include an `if` statement", + recommended: false, + url: "https://eslint.org/docs/rules/guard-for-in" + }, + + schema: [], + messages: { + wrap: "The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype." + } + }, + + create(context) { + + return { + + ForInStatement(node) { + const body = node.body; + + // empty statement + if (body.type === "EmptyStatement") { + return; + } + + // if statement + if (body.type === "IfStatement") { + return; + } + + // empty block + if (body.type === "BlockStatement" && body.body.length === 0) { + return; + } + + // block with just if statement + if (body.type === "BlockStatement" && body.body.length === 1 && body.body[0].type === "IfStatement") { + return; + } + + // block that starts with if statement + if (body.type === "BlockStatement" && body.body.length >= 1 && body.body[0].type === "IfStatement") { + const i = body.body[0]; + + // ... whose consequent is a continue + if (i.consequent.type === "ContinueStatement") { + return; + } + + // ... whose consequent is a block that contains only a continue + if (i.consequent.type === "BlockStatement" && i.consequent.body.length === 1 && i.consequent.body[0].type === "ContinueStatement") { + return; + } + } + + context.report({ node, messageId: "wrap" }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/handle-callback-err.js b/node_modules/eslint/lib/rules/handle-callback-err.js new file mode 100644 index 0000000..f370407 --- /dev/null +++ b/node_modules/eslint/lib/rules/handle-callback-err.js @@ -0,0 +1,100 @@ +/** + * @fileoverview Ensure handling of errors when we know they exist. + * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "require error handling in callbacks", + recommended: false, + url: "https://eslint.org/docs/rules/handle-callback-err" + }, + + schema: [ + { + type: "string" + } + ], + messages: { + expected: "Expected error to be handled." + } + }, + + create(context) { + + const errorArgument = context.options[0] || "err"; + + /** + * Checks if the given argument should be interpreted as a regexp pattern. + * @param {string} stringToCheck The string which should be checked. + * @returns {boolean} Whether or not the string should be interpreted as a pattern. + */ + function isPattern(stringToCheck) { + const firstChar = stringToCheck[0]; + + return firstChar === "^"; + } + + /** + * Checks if the given name matches the configured error argument. + * @param {string} name The name which should be compared. + * @returns {boolean} Whether or not the given name matches the configured error variable name. + */ + function matchesConfiguredErrorName(name) { + if (isPattern(errorArgument)) { + const regexp = new RegExp(errorArgument, "u"); + + return regexp.test(name); + } + return name === errorArgument; + } + + /** + * Get the parameters of a given function scope. + * @param {Object} scope The function scope. + * @returns {Array} All parameters of the given scope. + */ + function getParameters(scope) { + return scope.variables.filter(variable => variable.defs[0] && variable.defs[0].type === "Parameter"); + } + + /** + * Check to see if we're handling the error object properly. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function checkForError(node) { + const scope = context.getScope(), + parameters = getParameters(scope), + firstParameter = parameters[0]; + + if (firstParameter && matchesConfiguredErrorName(firstParameter.name)) { + if (firstParameter.references.length === 0) { + context.report({ node, messageId: "expected" }); + } + } + } + + return { + FunctionDeclaration: checkForError, + FunctionExpression: checkForError, + ArrowFunctionExpression: checkForError + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/id-blacklist.js b/node_modules/eslint/lib/rules/id-blacklist.js new file mode 100644 index 0000000..f7e04ae --- /dev/null +++ b/node_modules/eslint/lib/rules/id-blacklist.js @@ -0,0 +1,245 @@ +/** + * @fileoverview Rule that warns when identifier names that are + * specified in the configuration are used. + * @author Keith Cirkel (http://keithcirkel.co.uk) + * @deprecated in ESLint v7.5.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given node represents assignment target in a normal assignment or destructuring. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is assignment target. + */ +function isAssignmentTarget(node) { + const parent = node.parent; + + return ( + + // normal assignment + ( + parent.type === "AssignmentExpression" && + parent.left === node + ) || + + // destructuring + parent.type === "ArrayPattern" || + parent.type === "RestElement" || + ( + parent.type === "Property" && + parent.value === node && + parent.parent.type === "ObjectPattern" + ) || + ( + parent.type === "AssignmentPattern" && + parent.left === node + ) + ); +} + +/** + * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. + * + * Examples: + * import { a as b } from 'mod'; // node `a` is renamed import + * export { a as b } from 'mod'; // node `a` is renamed import + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a renamed import. + */ +function isRenamedImport(node) { + const parent = node.parent; + + return ( + ( + parent.type === "ImportSpecifier" && + parent.imported !== parent.local && + parent.imported === node + ) || + ( + parent.type === "ExportSpecifier" && + parent.parent.source && // re-export + parent.local !== parent.exported && + parent.local === node + ) + ); +} + +/** + * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. + * + * Examples: + * const { a : b } = foo; // node `a` is renamed node. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. + */ +function isRenamedInDestructuring(node) { + const parent = node.parent; + + return ( + ( + !parent.computed && + parent.type === "Property" && + parent.parent.type === "ObjectPattern" && + parent.value !== node && + parent.key === node + ) + ); +} + +/** + * Checks whether the given node represents shorthand definition of a property in an object literal. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a shorthand property definition. + */ +function isShorthandPropertyDefinition(node) { + const parent = node.parent; + + return ( + parent.type === "Property" && + parent.parent.type === "ObjectExpression" && + parent.shorthand + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + replacedBy: ["id-denylist"], + + type: "suggestion", + + docs: { + description: "disallow specified identifiers", + recommended: false, + url: "https://eslint.org/docs/rules/id-blacklist" + }, + + schema: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + }, + messages: { + restricted: "Identifier '{{name}}' is restricted." + } + }, + + create(context) { + + const denyList = new Set(context.options); + const reportedNodes = new Set(); + + let globalScope; + + /** + * Checks whether the given name is restricted. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is restricted. + * @private + */ + function isRestricted(name) { + return denyList.has(name); + } + + /** + * Checks whether the given node represents a reference to a global variable that is not declared in the source code. + * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a reference to a global variable. + */ + function isReferenceToGlobalVariable(node) { + const variable = globalScope.set.get(node.name); + + return variable && variable.defs.length === 0 && + variable.references.some(ref => ref.identifier === node); + } + + /** + * Determines whether the given node should be checked. + * @param {ASTNode} node `Identifier` node. + * @returns {boolean} `true` if the node should be checked. + */ + function shouldCheck(node) { + const parent = node.parent; + + /* + * Member access has special rules for checking property names. + * Read access to a property with a restricted name is allowed, because it can be on an object that user has no control over. + * Write access isn't allowed, because it potentially creates a new property with a restricted name. + */ + if ( + parent.type === "MemberExpression" && + parent.property === node && + !parent.computed + ) { + return isAssignmentTarget(parent); + } + + return ( + parent.type !== "CallExpression" && + parent.type !== "NewExpression" && + !isRenamedImport(node) && + !isRenamedInDestructuring(node) && + !( + isReferenceToGlobalVariable(node) && + !isShorthandPropertyDefinition(node) + ) + ); + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + context.report({ + node, + messageId: "restricted", + data: { + name: node.name + } + }); + reportedNodes.add(node.range.toString()); + } + + } + + return { + + Program() { + globalScope = context.getScope(); + }, + + Identifier(node) { + if (isRestricted(node.name) && shouldCheck(node)) { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/id-denylist.js b/node_modules/eslint/lib/rules/id-denylist.js new file mode 100644 index 0000000..a0b1f41 --- /dev/null +++ b/node_modules/eslint/lib/rules/id-denylist.js @@ -0,0 +1,227 @@ +/** + * @fileoverview Rule that warns when identifier names that are + * specified in the configuration are used. + * @author Keith Cirkel (http://keithcirkel.co.uk) + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given node represents assignment target in a normal assignment or destructuring. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is assignment target. + */ +function isAssignmentTarget(node) { + const parent = node.parent; + + return ( + + // normal assignment + ( + parent.type === "AssignmentExpression" && + parent.left === node + ) || + + // destructuring + parent.type === "ArrayPattern" || + parent.type === "RestElement" || + ( + parent.type === "Property" && + parent.value === node && + parent.parent.type === "ObjectPattern" + ) || + ( + parent.type === "AssignmentPattern" && + parent.left === node + ) + ); +} + +/** + * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. + * + * Examples: + * import { a as b } from 'mod'; // node `a` is renamed import + * export { a as b } from 'mod'; // node `a` is renamed import + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a renamed import. + */ +function isRenamedImport(node) { + const parent = node.parent; + + return ( + ( + parent.type === "ImportSpecifier" && + parent.imported !== parent.local && + parent.imported === node + ) || + ( + parent.type === "ExportSpecifier" && + parent.parent.source && // re-export + parent.local !== parent.exported && + parent.local === node + ) + ); +} + +/** + * Checks whether the given node is an ObjectPattern destructuring. + * + * Examples: + * const { a : b } = foo; + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is in an ObjectPattern destructuring. + */ +function isPropertyNameInDestructuring(node) { + const parent = node.parent; + + return ( + ( + !parent.computed && + parent.type === "Property" && + parent.parent.type === "ObjectPattern" && + parent.key === node + ) + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified identifiers", + recommended: false, + url: "https://eslint.org/docs/rules/id-denylist" + }, + + schema: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + }, + messages: { + restricted: "Identifier '{{name}}' is restricted.", + restrictedPrivate: "Identifier '#{{name}}' is restricted." + } + }, + + create(context) { + + const denyList = new Set(context.options); + const reportedNodes = new Set(); + + let globalScope; + + /** + * Checks whether the given name is restricted. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is restricted. + * @private + */ + function isRestricted(name) { + return denyList.has(name); + } + + /** + * Checks whether the given node represents a reference to a global variable that is not declared in the source code. + * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a reference to a global variable. + */ + function isReferenceToGlobalVariable(node) { + const variable = globalScope.set.get(node.name); + + return variable && variable.defs.length === 0 && + variable.references.some(ref => ref.identifier === node); + } + + /** + * Determines whether the given node should be checked. + * @param {ASTNode} node `Identifier` node. + * @returns {boolean} `true` if the node should be checked. + */ + function shouldCheck(node) { + const parent = node.parent; + + /* + * Member access has special rules for checking property names. + * Read access to a property with a restricted name is allowed, because it can be on an object that user has no control over. + * Write access isn't allowed, because it potentially creates a new property with a restricted name. + */ + if ( + parent.type === "MemberExpression" && + parent.property === node && + !parent.computed + ) { + return isAssignmentTarget(parent); + } + + return ( + parent.type !== "CallExpression" && + parent.type !== "NewExpression" && + !isRenamedImport(node) && + !isPropertyNameInDestructuring(node) && + !isReferenceToGlobalVariable(node) + ); + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + const isPrivate = node.type === "PrivateIdentifier"; + + context.report({ + node, + messageId: isPrivate ? "restrictedPrivate" : "restricted", + data: { + name: node.name + } + }); + reportedNodes.add(node.range.toString()); + } + } + + return { + + Program() { + globalScope = context.getScope(); + }, + + [[ + "Identifier", + "PrivateIdentifier" + ]](node) { + if (isRestricted(node.name) && shouldCheck(node)) { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/id-length.js b/node_modules/eslint/lib/rules/id-length.js new file mode 100644 index 0000000..3701c66 --- /dev/null +++ b/node_modules/eslint/lib/rules/id-length.js @@ -0,0 +1,169 @@ +/** + * @fileoverview Rule that warns when identifier names are shorter or longer + * than the values provided in configuration. + * @author Burak Yigit Kaya aka BYK + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce minimum and maximum identifier lengths", + recommended: false, + url: "https://eslint.org/docs/rules/id-length" + }, + + schema: [ + { + type: "object", + properties: { + min: { + type: "integer", + default: 2 + }, + max: { + type: "integer" + }, + exceptions: { + type: "array", + uniqueItems: true, + items: { + type: "string" + } + }, + exceptionPatterns: { + type: "array", + uniqueItems: true, + items: { + type: "string" + } + }, + properties: { + enum: ["always", "never"] + } + }, + additionalProperties: false + } + ], + messages: { + tooShort: "Identifier name '{{name}}' is too short (< {{min}}).", + tooShortPrivate: "Identifier name '#{{name}}' is too short (< {{min}}).", + tooLong: "Identifier name '{{name}}' is too long (> {{max}}).", + tooLongPrivate: "Identifier name #'{{name}}' is too long (> {{max}})." + } + }, + + create(context) { + const options = context.options[0] || {}; + const minLength = typeof options.min !== "undefined" ? options.min : 2; + const maxLength = typeof options.max !== "undefined" ? options.max : Infinity; + const properties = options.properties !== "never"; + const exceptions = new Set(options.exceptions); + const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); + const reportedNodes = new Set(); + + /** + * Checks if a string matches the provided exception patterns + * @param {string} name The string to check. + * @returns {boolean} if the string is a match + * @private + */ + function matchesExceptionPattern(name) { + return exceptionPatterns.some(pattern => pattern.test(name)); + } + + const SUPPORTED_EXPRESSIONS = { + MemberExpression: properties && function(parent) { + return !parent.computed && ( + + // regular property assignment + (parent.parent.left === parent && parent.parent.type === "AssignmentExpression" || + + // or the last identifier in an ObjectPattern destructuring + parent.parent.type === "Property" && parent.parent.value === parent && + parent.parent.parent.type === "ObjectPattern" && parent.parent.parent.parent.left === parent.parent.parent) + ); + }, + AssignmentPattern(parent, node) { + return parent.left === node; + }, + VariableDeclarator(parent, node) { + return parent.id === node; + }, + Property(parent, node) { + + if (parent.parent.type === "ObjectPattern") { + const isKeyAndValueSame = parent.value.name === parent.key.name; + + return ( + !isKeyAndValueSame && parent.value === node || + isKeyAndValueSame && parent.key === node && properties + ); + } + return properties && !parent.computed && parent.key.name === node.name; + }, + ImportDefaultSpecifier: true, + RestElement: true, + FunctionExpression: true, + ArrowFunctionExpression: true, + ClassDeclaration: true, + FunctionDeclaration: true, + MethodDefinition: true, + PropertyDefinition: true, + CatchClause: true, + ArrayPattern: true + }; + + return { + [[ + "Identifier", + "PrivateIdentifier" + ]](node) { + const name = node.name; + const parent = node.parent; + + const isShort = name.length < minLength; + const isLong = name.length > maxLength; + + if (!(isShort || isLong) || exceptions.has(name) || matchesExceptionPattern(name)) { + return; // Nothing to report + } + + const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type]; + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (isValidExpression && !reportedNodes.has(node.range.toString()) && (isValidExpression === true || isValidExpression(parent, node))) { + reportedNodes.add(node.range.toString()); + + let messageId = isShort ? "tooShort" : "tooLong"; + + if (node.type === "PrivateIdentifier") { + messageId += "Private"; + } + + context.report({ + node, + messageId, + data: { name, min: minLength, max: maxLength } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/id-match.js b/node_modules/eslint/lib/rules/id-match.js new file mode 100644 index 0000000..8713a5f --- /dev/null +++ b/node_modules/eslint/lib/rules/id-match.js @@ -0,0 +1,298 @@ +/** + * @fileoverview Rule to flag non-matching identifiers + * @author Matthieu Larcher + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require identifiers to match a specified regular expression", + recommended: false, + url: "https://eslint.org/docs/rules/id-match" + }, + + schema: [ + { + type: "string" + }, + { + type: "object", + properties: { + properties: { + type: "boolean", + default: false + }, + classFields: { + type: "boolean", + default: false + }, + onlyDeclarations: { + type: "boolean", + default: false + }, + ignoreDestructuring: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { + notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'.", + notMatchPrivate: "Identifier '#{{name}}' does not match the pattern '{{pattern}}'." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Options + //-------------------------------------------------------------------------- + const pattern = context.options[0] || "^.+$", + regexp = new RegExp(pattern, "u"); + + const options = context.options[1] || {}, + checkProperties = !!options.properties, + checkClassFields = !!options.classFields, + onlyDeclarations = !!options.onlyDeclarations, + ignoreDestructuring = !!options.ignoreDestructuring; + + let globalScope; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // contains reported nodes to avoid reporting twice on destructuring with shorthand notation + const reportedNodes = new Set(); + const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); + const DECLARATION_TYPES = new Set(["FunctionDeclaration", "VariableDeclarator"]); + const IMPORT_TYPES = new Set(["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"]); + + /** + * Checks whether the given node represents a reference to a global variable that is not declared in the source code. + * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a reference to a global variable. + */ + function isReferenceToGlobalVariable(node) { + const variable = globalScope.set.get(node.name); + + return variable && variable.defs.length === 0 && + variable.references.some(ref => ref.identifier === node); + } + + /** + * Checks if a string matches the provided pattern + * @param {string} name The string to check. + * @returns {boolean} if the string is a match + * @private + */ + function isInvalid(name) { + return !regexp.test(name); + } + + /** + * Checks if a parent of a node is an ObjectPattern. + * @param {ASTNode} node The node to check. + * @returns {boolean} if the node is inside an ObjectPattern + * @private + */ + function isInsideObjectPattern(node) { + let { parent } = node; + + while (parent) { + if (parent.type === "ObjectPattern") { + return true; + } + + parent = parent.parent; + } + + return false; + } + + /** + * Verifies if we should report an error or not based on the effective + * parent node and the identifier name. + * @param {ASTNode} effectiveParent The effective parent node of the node to be reported + * @param {string} name The identifier name of the identifier node + * @returns {boolean} whether an error should be reported or not + */ + function shouldReport(effectiveParent, name) { + return (!onlyDeclarations || DECLARATION_TYPES.has(effectiveParent.type)) && + !ALLOWED_PARENT_TYPES.has(effectiveParent.type) && isInvalid(name); + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + + const messageId = (node.type === "PrivateIdentifier") + ? "notMatchPrivate" : "notMatch"; + + context.report({ + node, + messageId, + data: { + name: node.name, + pattern + } + }); + reportedNodes.add(node.range.toString()); + } + } + + return { + + Program() { + globalScope = context.getScope(); + }, + + Identifier(node) { + const name = node.name, + parent = node.parent, + effectiveParent = (parent.type === "MemberExpression") ? parent.parent : parent; + + if (isReferenceToGlobalVariable(node)) { + return; + } + + if (parent.type === "MemberExpression") { + + if (!checkProperties) { + return; + } + + // Always check object names + if (parent.object.type === "Identifier" && + parent.object.name === name) { + if (isInvalid(name)) { + report(node); + } + + // Report AssignmentExpressions left side's assigned variable id + } else if (effectiveParent.type === "AssignmentExpression" && + effectiveParent.left.type === "MemberExpression" && + effectiveParent.left.property.name === node.name) { + if (isInvalid(name)) { + report(node); + } + + // Report AssignmentExpressions only if they are the left side of the assignment + } else if (effectiveParent.type === "AssignmentExpression" && effectiveParent.right.type !== "MemberExpression") { + if (isInvalid(name)) { + report(node); + } + } + + // For https://github.com/eslint/eslint/issues/15123 + } else if ( + parent.type === "Property" && + parent.parent.type === "ObjectExpression" && + parent.key === node && + !parent.computed + ) { + if (checkProperties && isInvalid(name)) { + report(node); + } + + /* + * Properties have their own rules, and + * AssignmentPattern nodes can be treated like Properties: + * e.g.: const { no_camelcased = false } = bar; + */ + } else if (parent.type === "Property" || parent.type === "AssignmentPattern") { + + if (parent.parent && parent.parent.type === "ObjectPattern") { + if (!ignoreDestructuring && parent.shorthand && parent.value.left && isInvalid(name)) { + report(node); + } + + const assignmentKeyEqualsValue = parent.key.name === parent.value.name; + + // prevent checking righthand side of destructured object + if (!assignmentKeyEqualsValue && parent.key === node) { + return; + } + + const valueIsInvalid = parent.value.name && isInvalid(name); + + // ignore destructuring if the option is set, unless a new identifier is created + if (valueIsInvalid && !(assignmentKeyEqualsValue && ignoreDestructuring)) { + report(node); + } + } + + // never check properties or always ignore destructuring + if ((!checkProperties && !parent.computed) || (ignoreDestructuring && isInsideObjectPattern(node))) { + return; + } + + // don't check right hand side of AssignmentExpression to prevent duplicate warnings + if (parent.right !== node && shouldReport(effectiveParent, name)) { + report(node); + } + + // Check if it's an import specifier + } else if (IMPORT_TYPES.has(parent.type)) { + + // Report only if the local imported identifier is invalid + if (parent.local && parent.local.name === node.name && isInvalid(name)) { + report(node); + } + + } else if (parent.type === "PropertyDefinition") { + + if (checkClassFields && isInvalid(name)) { + report(node); + } + + // Report anything that is invalid that isn't a CallExpression + } else if (shouldReport(effectiveParent, name)) { + report(node); + } + }, + + "PrivateIdentifier"(node) { + + const isClassField = node.parent.type === "PropertyDefinition"; + + if (isClassField && !checkClassFields) { + return; + } + + if (isInvalid(node.name)) { + report(node); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js b/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js new file mode 100644 index 0000000..71b2437 --- /dev/null +++ b/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js @@ -0,0 +1,81 @@ +/** + * @fileoverview enforce the location of arrow function bodies + * @author Sharmila Jesupaul + */ +"use strict"; + +const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce the location of arrow function bodies", + recommended: false, + url: "https://eslint.org/docs/rules/implicit-arrow-linebreak" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["beside", "below"] + } + ], + messages: { + expected: "Expected a linebreak before this expression.", + unexpected: "Expected no linebreak before this expression." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const option = context.options[0] || "beside"; + + /** + * Validates the location of an arrow function body + * @param {ASTNode} node The arrow function body + * @returns {void} + */ + function validateExpression(node) { + if (node.body.type === "BlockStatement") { + return; + } + + const arrowToken = sourceCode.getTokenBefore(node.body, isNotOpeningParenToken); + const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken); + + if (arrowToken.loc.end.line === firstTokenOfBody.loc.start.line && option === "below") { + context.report({ + node: firstTokenOfBody, + messageId: "expected", + fix: fixer => fixer.insertTextBefore(firstTokenOfBody, "\n") + }); + } else if (arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line && option === "beside") { + context.report({ + node: firstTokenOfBody, + messageId: "unexpected", + fix(fixer) { + if (sourceCode.getFirstTokenBetween(arrowToken, firstTokenOfBody, { includeComments: true, filter: isCommentToken })) { + return null; + } + + return fixer.replaceTextRange([arrowToken.range[1], firstTokenOfBody.range[0]], " "); + } + }); + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + return { + ArrowFunctionExpression: node => validateExpression(node) + }; + } +}; diff --git a/node_modules/eslint/lib/rules/indent-legacy.js b/node_modules/eslint/lib/rules/indent-legacy.js new file mode 100644 index 0000000..c5be4a5 --- /dev/null +++ b/node_modules/eslint/lib/rules/indent-legacy.js @@ -0,0 +1,1126 @@ +/** + * @fileoverview This option sets a specific tab width for your code + * + * This rule has been ported and modified from nodeca. + * @author Vitaly Puzrin + * @author Gyandeep Singh + * @deprecated in ESLint v4.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/* istanbul ignore next: this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. */ +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent indentation", + recommended: false, + url: "https://eslint.org/docs/rules/indent-legacy" + }, + + deprecated: true, + + replacedBy: ["indent"], + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["tab"] + }, + { + type: "integer", + minimum: 0 + } + ] + }, + { + type: "object", + properties: { + SwitchCase: { + type: "integer", + minimum: 0 + }, + VariableDeclarator: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + var: { + type: "integer", + minimum: 0 + }, + let: { + type: "integer", + minimum: 0 + }, + const: { + type: "integer", + minimum: 0 + } + } + } + ] + }, + outerIIFEBody: { + type: "integer", + minimum: 0 + }, + MemberExpression: { + type: "integer", + minimum: 0 + }, + FunctionDeclaration: { + type: "object", + properties: { + parameters: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first"] + } + ] + }, + body: { + type: "integer", + minimum: 0 + } + } + }, + FunctionExpression: { + type: "object", + properties: { + parameters: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first"] + } + ] + }, + body: { + type: "integer", + minimum: 0 + } + } + }, + CallExpression: { + type: "object", + properties: { + parameters: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first"] + } + ] + } + } + }, + ArrayExpression: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first"] + } + ] + }, + ObjectExpression: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first"] + } + ] + } + }, + additionalProperties: false + } + ], + messages: { + expected: "Expected indentation of {{expected}} but found {{actual}}." + } + }, + + create(context) { + const DEFAULT_VARIABLE_INDENT = 1; + const DEFAULT_PARAMETER_INDENT = null; // For backwards compatibility, don't check parameter indentation unless specified in the config + const DEFAULT_FUNCTION_BODY_INDENT = 1; + + let indentType = "space"; + let indentSize = 4; + const options = { + SwitchCase: 0, + VariableDeclarator: { + var: DEFAULT_VARIABLE_INDENT, + let: DEFAULT_VARIABLE_INDENT, + const: DEFAULT_VARIABLE_INDENT + }, + outerIIFEBody: null, + FunctionDeclaration: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + FunctionExpression: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + CallExpression: { + arguments: DEFAULT_PARAMETER_INDENT + }, + ArrayExpression: 1, + ObjectExpression: 1 + }; + + const sourceCode = context.getSourceCode(); + + if (context.options.length) { + if (context.options[0] === "tab") { + indentSize = 1; + indentType = "tab"; + } else /* istanbul ignore else : this will be caught by options validation */ if (typeof context.options[0] === "number") { + indentSize = context.options[0]; + indentType = "space"; + } + + if (context.options[1]) { + const opts = context.options[1]; + + options.SwitchCase = opts.SwitchCase || 0; + const variableDeclaratorRules = opts.VariableDeclarator; + + if (typeof variableDeclaratorRules === "number") { + options.VariableDeclarator = { + var: variableDeclaratorRules, + let: variableDeclaratorRules, + const: variableDeclaratorRules + }; + } else if (typeof variableDeclaratorRules === "object") { + Object.assign(options.VariableDeclarator, variableDeclaratorRules); + } + + if (typeof opts.outerIIFEBody === "number") { + options.outerIIFEBody = opts.outerIIFEBody; + } + + if (typeof opts.MemberExpression === "number") { + options.MemberExpression = opts.MemberExpression; + } + + if (typeof opts.FunctionDeclaration === "object") { + Object.assign(options.FunctionDeclaration, opts.FunctionDeclaration); + } + + if (typeof opts.FunctionExpression === "object") { + Object.assign(options.FunctionExpression, opts.FunctionExpression); + } + + if (typeof opts.CallExpression === "object") { + Object.assign(options.CallExpression, opts.CallExpression); + } + + if (typeof opts.ArrayExpression === "number" || typeof opts.ArrayExpression === "string") { + options.ArrayExpression = opts.ArrayExpression; + } + + if (typeof opts.ObjectExpression === "number" || typeof opts.ObjectExpression === "string") { + options.ObjectExpression = opts.ObjectExpression; + } + } + } + + const caseIndentStore = {}; + + /** + * Creates an error message for a line, given the expected/actual indentation. + * @param {int} expectedAmount The expected amount of indentation characters for this line + * @param {int} actualSpaces The actual number of indentation spaces that were found on this line + * @param {int} actualTabs The actual number of indentation tabs that were found on this line + * @returns {string} An error message for this line + */ + function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { + const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" + const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" + const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" + let foundStatement; + + if (actualSpaces > 0 && actualTabs > 0) { + foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs" + } else if (actualSpaces > 0) { + + /* + * Abbreviate the message if the expected indentation is also spaces. + * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + */ + foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; + } else if (actualTabs > 0) { + foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; + } else { + foundStatement = "0"; + } + return { + expected: expectedStatement, + actual: foundStatement + }; + } + + /** + * Reports a given indent violation + * @param {ASTNode} node Node violating the indent rule + * @param {int} needed Expected indentation character count + * @param {int} gottenSpaces Indentation space count in the actual node/code + * @param {int} gottenTabs Indentation tab count in the actual node/code + * @param {Object} [loc] Error line and column location + * @param {boolean} isLastNodeCheck Is the error for last node check + * @returns {void} + */ + function report(node, needed, gottenSpaces, gottenTabs, loc, isLastNodeCheck) { + if (gottenSpaces && gottenTabs) { + + // To avoid conflicts with `no-mixed-spaces-and-tabs`, don't report lines that have both spaces and tabs. + return; + } + + const desiredIndent = (indentType === "space" ? " " : "\t").repeat(needed); + + const textRange = isLastNodeCheck + ? [node.range[1] - node.loc.end.column, node.range[1] - node.loc.end.column + gottenSpaces + gottenTabs] + : [node.range[0] - node.loc.start.column, node.range[0] - node.loc.start.column + gottenSpaces + gottenTabs]; + + context.report({ + node, + loc, + messageId: "expected", + data: createErrorMessageData(needed, gottenSpaces, gottenTabs), + fix: fixer => fixer.replaceTextRange(textRange, desiredIndent) + }); + } + + /** + * Get the actual indent of node + * @param {ASTNode|Token} node Node to examine + * @param {boolean} [byLastLine=false] get indent of node's last line + * @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also + * contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and + * `badChar` is the amount of the other indentation character. + */ + function getNodeIndent(node, byLastLine) { + const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node); + const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split(""); + const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t")); + const spaces = indentChars.filter(char => char === " ").length; + const tabs = indentChars.filter(char => char === "\t").length; + + return { + space: spaces, + tab: tabs, + goodChar: indentType === "space" ? spaces : tabs, + badChar: indentType === "space" ? tabs : spaces + }; + } + + /** + * Checks node is the first in its own start line. By default it looks by start line. + * @param {ASTNode} node The node to check + * @param {boolean} [byEndLocation=false] Lookup based on start position or end + * @returns {boolean} true if its the first in the its start line + */ + function isNodeFirstInLine(node, byEndLocation) { + const firstToken = byEndLocation === true ? sourceCode.getLastToken(node, 1) : sourceCode.getTokenBefore(node), + startLine = byEndLocation === true ? node.loc.end.line : node.loc.start.line, + endLine = firstToken ? firstToken.loc.end.line : -1; + + return startLine !== endLine; + } + + /** + * Check indent for node + * @param {ASTNode} node Node to check + * @param {int} neededIndent needed indent + * @returns {void} + */ + function checkNodeIndent(node, neededIndent) { + const actualIndent = getNodeIndent(node, false); + + if ( + node.type !== "ArrayExpression" && + node.type !== "ObjectExpression" && + (actualIndent.goodChar !== neededIndent || actualIndent.badChar !== 0) && + isNodeFirstInLine(node) + ) { + report(node, neededIndent, actualIndent.space, actualIndent.tab); + } + + if (node.type === "IfStatement" && node.alternate) { + const elseToken = sourceCode.getTokenBefore(node.alternate); + + checkNodeIndent(elseToken, neededIndent); + + if (!isNodeFirstInLine(node.alternate)) { + checkNodeIndent(node.alternate, neededIndent); + } + } + + if (node.type === "TryStatement" && node.handler) { + const catchToken = sourceCode.getFirstToken(node.handler); + + checkNodeIndent(catchToken, neededIndent); + } + + if (node.type === "TryStatement" && node.finalizer) { + const finallyToken = sourceCode.getTokenBefore(node.finalizer); + + checkNodeIndent(finallyToken, neededIndent); + } + + if (node.type === "DoWhileStatement") { + const whileToken = sourceCode.getTokenAfter(node.body); + + checkNodeIndent(whileToken, neededIndent); + } + } + + /** + * Check indent for nodes list + * @param {ASTNode[]} nodes list of node objects + * @param {int} indent needed indent + * @returns {void} + */ + function checkNodesIndent(nodes, indent) { + nodes.forEach(node => checkNodeIndent(node, indent)); + } + + /** + * Check last node line indent this detects, that block closed correctly + * @param {ASTNode} node Node to examine + * @param {int} lastLineIndent needed indent + * @returns {void} + */ + function checkLastNodeLineIndent(node, lastLineIndent) { + const lastToken = sourceCode.getLastToken(node); + const endIndent = getNodeIndent(lastToken, true); + + if ((endIndent.goodChar !== lastLineIndent || endIndent.badChar !== 0) && isNodeFirstInLine(node, true)) { + report( + node, + lastLineIndent, + endIndent.space, + endIndent.tab, + { line: lastToken.loc.start.line, column: lastToken.loc.start.column }, + true + ); + } + } + + /** + * Check last node line indent this detects, that block closed correctly + * This function for more complicated return statement case, where closing parenthesis may be followed by ';' + * @param {ASTNode} node Node to examine + * @param {int} firstLineIndent first line needed indent + * @returns {void} + */ + function checkLastReturnStatementLineIndent(node, firstLineIndent) { + + /* + * in case if return statement ends with ');' we have traverse back to ')' + * otherwise we'll measure indent for ';' and replace ')' + */ + const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken); + const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1); + + if (textBeforeClosingParenthesis.trim()) { + + // There are tokens before the closing paren, don't report this case + return; + } + + const endIndent = getNodeIndent(lastToken, true); + + if (endIndent.goodChar !== firstLineIndent) { + report( + node, + firstLineIndent, + endIndent.space, + endIndent.tab, + { line: lastToken.loc.start.line, column: lastToken.loc.start.column }, + true + ); + } + } + + /** + * Check first node line indent is correct + * @param {ASTNode} node Node to examine + * @param {int} firstLineIndent needed indent + * @returns {void} + */ + function checkFirstNodeLineIndent(node, firstLineIndent) { + const startIndent = getNodeIndent(node, false); + + if ((startIndent.goodChar !== firstLineIndent || startIndent.badChar !== 0) && isNodeFirstInLine(node)) { + report( + node, + firstLineIndent, + startIndent.space, + startIndent.tab, + { line: node.loc.start.line, column: node.loc.start.column } + ); + } + } + + /** + * Returns a parent node of given node based on a specified type + * if not present then return null + * @param {ASTNode} node node to examine + * @param {string} type type that is being looked for + * @param {string} stopAtList end points for the evaluating code + * @returns {ASTNode|void} if found then node otherwise null + */ + function getParentNodeByType(node, type, stopAtList) { + let parent = node.parent; + const stopAtSet = new Set(stopAtList || ["Program"]); + + while (parent.type !== type && !stopAtSet.has(parent.type) && parent.type !== "Program") { + parent = parent.parent; + } + + return parent.type === type ? parent : null; + } + + /** + * Returns the VariableDeclarator based on the current node + * if not present then return null + * @param {ASTNode} node node to examine + * @returns {ASTNode|void} if found then node otherwise null + */ + function getVariableDeclaratorNode(node) { + return getParentNodeByType(node, "VariableDeclarator"); + } + + /** + * Check to see if the node is part of the multi-line variable declaration. + * Also if its on the same line as the varNode + * @param {ASTNode} node node to check + * @param {ASTNode} varNode variable declaration node to check against + * @returns {boolean} True if all the above condition satisfy + */ + function isNodeInVarOnTop(node, varNode) { + return varNode && + varNode.parent.loc.start.line === node.loc.start.line && + varNode.parent.declarations.length > 1; + } + + /** + * Check to see if the argument before the callee node is multi-line and + * there should only be 1 argument before the callee node + * @param {ASTNode} node node to check + * @returns {boolean} True if arguments are multi-line + */ + function isArgBeforeCalleeNodeMultiline(node) { + const parent = node.parent; + + if (parent.arguments.length >= 2 && parent.arguments[1] === node) { + return parent.arguments[0].loc.end.line > parent.arguments[0].loc.start.line; + } + + return false; + } + + /** + * Check to see if the node is a file level IIFE + * @param {ASTNode} node The function node to check. + * @returns {boolean} True if the node is the outer IIFE + */ + function isOuterIIFE(node) { + const parent = node.parent; + let stmt = parent.parent; + + /* + * Verify that the node is an IIEF + */ + if ( + parent.type !== "CallExpression" || + parent.callee !== node) { + + return false; + } + + /* + * Navigate legal ancestors to determine whether this IIEF is outer + */ + while ( + stmt.type === "UnaryExpression" && ( + stmt.operator === "!" || + stmt.operator === "~" || + stmt.operator === "+" || + stmt.operator === "-") || + stmt.type === "AssignmentExpression" || + stmt.type === "LogicalExpression" || + stmt.type === "SequenceExpression" || + stmt.type === "VariableDeclarator") { + + stmt = stmt.parent; + } + + return (( + stmt.type === "ExpressionStatement" || + stmt.type === "VariableDeclaration") && + stmt.parent && stmt.parent.type === "Program" + ); + } + + /** + * Check indent for function block content + * @param {ASTNode} node A BlockStatement node that is inside of a function. + * @returns {void} + */ + function checkIndentInFunctionBlock(node) { + + /* + * Search first caller in chain. + * Ex.: + * + * Models <- Identifier + * .User + * .find() + * .exec(function() { + * // function body + * }); + * + * Looks for 'Models' + */ + const calleeNode = node.parent; // FunctionExpression + let indent; + + if (calleeNode.parent && + (calleeNode.parent.type === "Property" || + calleeNode.parent.type === "ArrayExpression")) { + + // If function is part of array or object, comma can be put at left + indent = getNodeIndent(calleeNode, false).goodChar; + } else { + + // If function is standalone, simple calculate indent + indent = getNodeIndent(calleeNode).goodChar; + } + + if (calleeNode.parent.type === "CallExpression") { + const calleeParent = calleeNode.parent; + + if (calleeNode.type !== "FunctionExpression" && calleeNode.type !== "ArrowFunctionExpression") { + if (calleeParent && calleeParent.loc.start.line < node.loc.start.line) { + indent = getNodeIndent(calleeParent).goodChar; + } + } else { + if (isArgBeforeCalleeNodeMultiline(calleeNode) && + calleeParent.callee.loc.start.line === calleeParent.callee.loc.end.line && + !isNodeFirstInLine(calleeNode)) { + indent = getNodeIndent(calleeParent).goodChar; + } + } + } + + /* + * function body indent should be indent + indent size, unless this + * is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled. + */ + let functionOffset = indentSize; + + if (options.outerIIFEBody !== null && isOuterIIFE(calleeNode)) { + functionOffset = options.outerIIFEBody * indentSize; + } else if (calleeNode.type === "FunctionExpression") { + functionOffset = options.FunctionExpression.body * indentSize; + } else if (calleeNode.type === "FunctionDeclaration") { + functionOffset = options.FunctionDeclaration.body * indentSize; + } + indent += functionOffset; + + // check if the node is inside a variable + const parentVarNode = getVariableDeclaratorNode(node); + + if (parentVarNode && isNodeInVarOnTop(node, parentVarNode)) { + indent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind]; + } + + if (node.body.length > 0) { + checkNodesIndent(node.body, indent); + } + + checkLastNodeLineIndent(node, indent - functionOffset); + } + + + /** + * Checks if the given node starts and ends on the same line + * @param {ASTNode} node The node to check + * @returns {boolean} Whether or not the block starts and ends on the same line. + */ + function isSingleLineNode(node) { + const lastToken = sourceCode.getLastToken(node), + startLine = node.loc.start.line, + endLine = lastToken.loc.end.line; + + return startLine === endLine; + } + + /** + * Check indent for array block content or object block content + * @param {ASTNode} node node to examine + * @returns {void} + */ + function checkIndentInArrayOrObjectBlock(node) { + + // Skip inline + if (isSingleLineNode(node)) { + return; + } + + let elements = (node.type === "ArrayExpression") ? node.elements : node.properties; + + // filter out empty elements example would be [ , 2] so remove first element as espree considers it as null + elements = elements.filter(elem => elem !== null); + + let nodeIndent; + let elementsIndent; + const parentVarNode = getVariableDeclaratorNode(node); + + // TODO - come up with a better strategy in future + if (isNodeFirstInLine(node)) { + const parent = node.parent; + + nodeIndent = getNodeIndent(parent).goodChar; + if (!parentVarNode || parentVarNode.loc.start.line !== node.loc.start.line) { + if (parent.type !== "VariableDeclarator" || parentVarNode === parentVarNode.parent.declarations[0]) { + if (parent.type === "VariableDeclarator" && parentVarNode.loc.start.line === parent.loc.start.line) { + nodeIndent += (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]); + } else if (parent.type === "ObjectExpression" || parent.type === "ArrayExpression") { + const parentElements = node.parent.type === "ObjectExpression" ? node.parent.properties : node.parent.elements; + + if (parentElements[0] && + parentElements[0].loc.start.line === parent.loc.start.line && + parentElements[0].loc.end.line !== parent.loc.start.line) { + + /* + * If the first element of the array spans multiple lines, don't increase the expected indentation of the rest. + * e.g. [{ + * foo: 1 + * }, + * { + * bar: 1 + * }] + * the second object is not indented. + */ + } else if (typeof options[parent.type] === "number") { + nodeIndent += options[parent.type] * indentSize; + } else { + nodeIndent = parentElements[0].loc.start.column; + } + } else if (parent.type === "CallExpression" || parent.type === "NewExpression") { + if (typeof options.CallExpression.arguments === "number") { + nodeIndent += options.CallExpression.arguments * indentSize; + } else if (options.CallExpression.arguments === "first") { + if (parent.arguments.includes(node)) { + nodeIndent = parent.arguments[0].loc.start.column; + } + } else { + nodeIndent += indentSize; + } + } else if (parent.type === "LogicalExpression" || parent.type === "ArrowFunctionExpression") { + nodeIndent += indentSize; + } + } + } + + checkFirstNodeLineIndent(node, nodeIndent); + } else { + nodeIndent = getNodeIndent(node).goodChar; + } + + if (options[node.type] === "first") { + elementsIndent = elements.length ? elements[0].loc.start.column : 0; // If there are no elements, elementsIndent doesn't matter. + } else { + elementsIndent = nodeIndent + indentSize * options[node.type]; + } + + /* + * Check if the node is a multiple variable declaration; if so, then + * make sure indentation takes that into account. + */ + if (isNodeInVarOnTop(node, parentVarNode)) { + elementsIndent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind]; + } + + checkNodesIndent(elements, elementsIndent); + + if (elements.length > 0) { + + // Skip last block line check if last item in same line + if (elements[elements.length - 1].loc.end.line === node.loc.end.line) { + return; + } + } + + checkLastNodeLineIndent(node, nodeIndent + + (isNodeInVarOnTop(node, parentVarNode) ? options.VariableDeclarator[parentVarNode.parent.kind] * indentSize : 0)); + } + + /** + * Check if the node or node body is a BlockStatement or not + * @param {ASTNode} node node to test + * @returns {boolean} True if it or its body is a block statement + */ + function isNodeBodyBlock(node) { + return node.type === "BlockStatement" || node.type === "ClassBody" || (node.body && node.body.type === "BlockStatement") || + (node.consequent && node.consequent.type === "BlockStatement"); + } + + /** + * Check indentation for blocks + * @param {ASTNode} node node to check + * @returns {void} + */ + function blockIndentationCheck(node) { + + // Skip inline blocks + if (isSingleLineNode(node)) { + return; + } + + if (node.parent && ( + node.parent.type === "FunctionExpression" || + node.parent.type === "FunctionDeclaration" || + node.parent.type === "ArrowFunctionExpression") + ) { + checkIndentInFunctionBlock(node); + return; + } + + let indent; + let nodesToCheck = []; + + /* + * For this statements we should check indent from statement beginning, + * not from the beginning of the block. + */ + const statementsWithProperties = [ + "IfStatement", "WhileStatement", "ForStatement", "ForInStatement", "ForOfStatement", "DoWhileStatement", "ClassDeclaration", "TryStatement" + ]; + + if (node.parent && statementsWithProperties.includes(node.parent.type) && isNodeBodyBlock(node)) { + indent = getNodeIndent(node.parent).goodChar; + } else if (node.parent && node.parent.type === "CatchClause") { + indent = getNodeIndent(node.parent.parent).goodChar; + } else { + indent = getNodeIndent(node).goodChar; + } + + if (node.type === "IfStatement" && node.consequent.type !== "BlockStatement") { + nodesToCheck = [node.consequent]; + } else if (Array.isArray(node.body)) { + nodesToCheck = node.body; + } else { + nodesToCheck = [node.body]; + } + + if (nodesToCheck.length > 0) { + checkNodesIndent(nodesToCheck, indent + indentSize); + } + + if (node.type === "BlockStatement") { + checkLastNodeLineIndent(node, indent); + } + } + + /** + * Filter out the elements which are on the same line of each other or the node. + * basically have only 1 elements from each line except the variable declaration line. + * @param {ASTNode} node Variable declaration node + * @returns {ASTNode[]} Filtered elements + */ + function filterOutSameLineVars(node) { + return node.declarations.reduce((finalCollection, elem) => { + const lastElem = finalCollection[finalCollection.length - 1]; + + if ((elem.loc.start.line !== node.loc.start.line && !lastElem) || + (lastElem && lastElem.loc.start.line !== elem.loc.start.line)) { + finalCollection.push(elem); + } + + return finalCollection; + }, []); + } + + /** + * Check indentation for variable declarations + * @param {ASTNode} node node to examine + * @returns {void} + */ + function checkIndentInVariableDeclarations(node) { + const elements = filterOutSameLineVars(node); + const nodeIndent = getNodeIndent(node).goodChar; + const lastElement = elements[elements.length - 1]; + + const elementsIndent = nodeIndent + indentSize * options.VariableDeclarator[node.kind]; + + checkNodesIndent(elements, elementsIndent); + + // Only check the last line if there is any token after the last item + if (sourceCode.getLastToken(node).loc.end.line <= lastElement.loc.end.line) { + return; + } + + const tokenBeforeLastElement = sourceCode.getTokenBefore(lastElement); + + if (tokenBeforeLastElement.value === ",") { + + // Special case for comma-first syntax where the semicolon is indented + checkLastNodeLineIndent(node, getNodeIndent(tokenBeforeLastElement).goodChar); + } else { + checkLastNodeLineIndent(node, elementsIndent - indentSize); + } + } + + /** + * Check and decide whether to check for indentation for blockless nodes + * Scenarios are for or while statements without braces around them + * @param {ASTNode} node node to examine + * @returns {void} + */ + function blockLessNodes(node) { + if (node.body.type !== "BlockStatement") { + blockIndentationCheck(node); + } + } + + /** + * Returns the expected indentation for the case statement + * @param {ASTNode} node node to examine + * @param {int} [providedSwitchIndent] indent for switch statement + * @returns {int} indent size + */ + function expectedCaseIndent(node, providedSwitchIndent) { + const switchNode = (node.type === "SwitchStatement") ? node : node.parent; + const switchIndent = typeof providedSwitchIndent === "undefined" + ? getNodeIndent(switchNode).goodChar + : providedSwitchIndent; + let caseIndent; + + if (caseIndentStore[switchNode.loc.start.line]) { + return caseIndentStore[switchNode.loc.start.line]; + } + + if (switchNode.cases.length > 0 && options.SwitchCase === 0) { + caseIndent = switchIndent; + } else { + caseIndent = switchIndent + (indentSize * options.SwitchCase); + } + + caseIndentStore[switchNode.loc.start.line] = caseIndent; + return caseIndent; + + } + + /** + * Checks whether a return statement is wrapped in () + * @param {ASTNode} node node to examine + * @returns {boolean} the result + */ + function isWrappedInParenthesis(node) { + const regex = /^return\s*?\(\s*?\);*?/u; + + const statementWithoutArgument = sourceCode.getText(node).replace( + sourceCode.getText(node.argument), "" + ); + + return regex.test(statementWithoutArgument); + } + + return { + Program(node) { + if (node.body.length > 0) { + + // Root nodes should have no indent + checkNodesIndent(node.body, getNodeIndent(node).goodChar); + } + }, + + ClassBody: blockIndentationCheck, + + BlockStatement: blockIndentationCheck, + + WhileStatement: blockLessNodes, + + ForStatement: blockLessNodes, + + ForInStatement: blockLessNodes, + + ForOfStatement: blockLessNodes, + + DoWhileStatement: blockLessNodes, + + IfStatement(node) { + if (node.consequent.type !== "BlockStatement" && node.consequent.loc.start.line > node.loc.start.line) { + blockIndentationCheck(node); + } + }, + + VariableDeclaration(node) { + if (node.declarations[node.declarations.length - 1].loc.start.line > node.declarations[0].loc.start.line) { + checkIndentInVariableDeclarations(node); + } + }, + + ObjectExpression(node) { + checkIndentInArrayOrObjectBlock(node); + }, + + ArrayExpression(node) { + checkIndentInArrayOrObjectBlock(node); + }, + + MemberExpression(node) { + + if (typeof options.MemberExpression === "undefined") { + return; + } + + if (isSingleLineNode(node)) { + return; + } + + /* + * The typical layout of variable declarations and assignments + * alter the expectation of correct indentation. Skip them. + * TODO: Add appropriate configuration options for variable + * declarations and assignments. + */ + if (getParentNodeByType(node, "VariableDeclarator", ["FunctionExpression", "ArrowFunctionExpression"])) { + return; + } + + if (getParentNodeByType(node, "AssignmentExpression", ["FunctionExpression"])) { + return; + } + + const propertyIndent = getNodeIndent(node).goodChar + indentSize * options.MemberExpression; + + const checkNodes = [node.property]; + + const dot = sourceCode.getTokenBefore(node.property); + + if (dot.type === "Punctuator" && dot.value === ".") { + checkNodes.push(dot); + } + + checkNodesIndent(checkNodes, propertyIndent); + }, + + SwitchStatement(node) { + + // Switch is not a 'BlockStatement' + const switchIndent = getNodeIndent(node).goodChar; + const caseIndent = expectedCaseIndent(node, switchIndent); + + checkNodesIndent(node.cases, caseIndent); + + + checkLastNodeLineIndent(node, switchIndent); + }, + + SwitchCase(node) { + + // Skip inline cases + if (isSingleLineNode(node)) { + return; + } + const caseIndent = expectedCaseIndent(node); + + checkNodesIndent(node.consequent, caseIndent + indentSize); + }, + + FunctionDeclaration(node) { + if (isSingleLineNode(node)) { + return; + } + if (options.FunctionDeclaration.parameters === "first" && node.params.length) { + checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column); + } else if (options.FunctionDeclaration.parameters !== null) { + checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionDeclaration.parameters); + } + }, + + FunctionExpression(node) { + if (isSingleLineNode(node)) { + return; + } + if (options.FunctionExpression.parameters === "first" && node.params.length) { + checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column); + } else if (options.FunctionExpression.parameters !== null) { + checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionExpression.parameters); + } + }, + + ReturnStatement(node) { + if (isSingleLineNode(node)) { + return; + } + + const firstLineIndent = getNodeIndent(node).goodChar; + + // in case if return statement is wrapped in parenthesis + if (isWrappedInParenthesis(node)) { + checkLastReturnStatementLineIndent(node, firstLineIndent); + } else { + checkNodeIndent(node, firstLineIndent); + } + }, + + CallExpression(node) { + if (isSingleLineNode(node)) { + return; + } + if (options.CallExpression.arguments === "first" && node.arguments.length) { + checkNodesIndent(node.arguments.slice(1), node.arguments[0].loc.start.column); + } else if (options.CallExpression.arguments !== null) { + checkNodesIndent(node.arguments, getNodeIndent(node).goodChar + indentSize * options.CallExpression.arguments); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/indent.js b/node_modules/eslint/lib/rules/indent.js new file mode 100644 index 0000000..bc6aa9e --- /dev/null +++ b/node_modules/eslint/lib/rules/indent.js @@ -0,0 +1,1796 @@ +/** + * @fileoverview This rule sets a specific indentation style and width for your code + * + * @author Teddy Katz + * @author Vitaly Puzrin + * @author Gyandeep Singh + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const createTree = require("functional-red-black-tree"); + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const KNOWN_NODES = new Set([ + "AssignmentExpression", + "AssignmentPattern", + "ArrayExpression", + "ArrayPattern", + "ArrowFunctionExpression", + "AwaitExpression", + "BlockStatement", + "BinaryExpression", + "BreakStatement", + "CallExpression", + "CatchClause", + "ChainExpression", + "ClassBody", + "ClassDeclaration", + "ClassExpression", + "ConditionalExpression", + "ContinueStatement", + "DoWhileStatement", + "DebuggerStatement", + "EmptyStatement", + "ExperimentalRestProperty", + "ExperimentalSpreadProperty", + "ExpressionStatement", + "ForStatement", + "ForInStatement", + "ForOfStatement", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "IfStatement", + "Literal", + "LabeledStatement", + "LogicalExpression", + "MemberExpression", + "MetaProperty", + "MethodDefinition", + "NewExpression", + "ObjectExpression", + "ObjectPattern", + "PrivateIdentifier", + "Program", + "Property", + "PropertyDefinition", + "RestElement", + "ReturnStatement", + "SequenceExpression", + "SpreadElement", + "StaticBlock", + "Super", + "SwitchCase", + "SwitchStatement", + "TaggedTemplateExpression", + "TemplateElement", + "TemplateLiteral", + "ThisExpression", + "ThrowStatement", + "TryStatement", + "UnaryExpression", + "UpdateExpression", + "VariableDeclaration", + "VariableDeclarator", + "WhileStatement", + "WithStatement", + "YieldExpression", + "JSXFragment", + "JSXOpeningFragment", + "JSXClosingFragment", + "JSXIdentifier", + "JSXNamespacedName", + "JSXMemberExpression", + "JSXEmptyExpression", + "JSXExpressionContainer", + "JSXElement", + "JSXClosingElement", + "JSXOpeningElement", + "JSXAttribute", + "JSXSpreadAttribute", + "JSXText", + "ExportDefaultDeclaration", + "ExportNamedDeclaration", + "ExportAllDeclaration", + "ExportSpecifier", + "ImportDeclaration", + "ImportSpecifier", + "ImportDefaultSpecifier", + "ImportNamespaceSpecifier", + "ImportExpression" +]); + +/* + * General rule strategy: + * 1. An OffsetStorage instance stores a map of desired offsets, where each token has a specified offset from another + * specified token or to the first column. + * 2. As the AST is traversed, modify the desired offsets of tokens accordingly. For example, when entering a + * BlockStatement, offset all of the tokens in the BlockStatement by 1 indent level from the opening curly + * brace of the BlockStatement. + * 3. After traversing the AST, calculate the expected indentation levels of every token according to the + * OffsetStorage container. + * 4. For each line, compare the expected indentation of the first token to the actual indentation in the file, + * and report the token if the two values are not equal. + */ + + +/** + * A mutable balanced binary search tree that stores (key, value) pairs. The keys are numeric, and must be unique. + * This is intended to be a generic wrapper around a balanced binary search tree library, so that the underlying implementation + * can easily be swapped out. + */ +class BinarySearchTree { + + /** + * Creates an empty tree + */ + constructor() { + this._rbTree = createTree(); + } + + /** + * Inserts an entry into the tree. + * @param {number} key The entry's key + * @param {any} value The entry's value + * @returns {void} + */ + insert(key, value) { + const iterator = this._rbTree.find(key); + + if (iterator.valid) { + this._rbTree = iterator.update(value); + } else { + this._rbTree = this._rbTree.insert(key, value); + } + } + + /** + * Finds the entry with the largest key less than or equal to the provided key + * @param {number} key The provided key + * @returns {{key: number, value: *}|null} The found entry, or null if no such entry exists. + */ + findLe(key) { + const iterator = this._rbTree.le(key); + + return iterator && { key: iterator.key, value: iterator.value }; + } + + /** + * Deletes all of the keys in the interval [start, end) + * @param {number} start The start of the range + * @param {number} end The end of the range + * @returns {void} + */ + deleteRange(start, end) { + + // Exit without traversing the tree if the range has zero size. + if (start === end) { + return; + } + const iterator = this._rbTree.ge(start); + + while (iterator.valid && iterator.key < end) { + this._rbTree = this._rbTree.remove(iterator.key); + iterator.next(); + } + } +} + +/** + * A helper class to get token-based info related to indentation + */ +class TokenInfo { + + /** + * @param {SourceCode} sourceCode A SourceCode object + */ + constructor(sourceCode) { + this.sourceCode = sourceCode; + this.firstTokensByLineNumber = sourceCode.tokensAndComments.reduce((map, token) => { + if (!map.has(token.loc.start.line)) { + map.set(token.loc.start.line, token); + } + if (!map.has(token.loc.end.line) && sourceCode.text.slice(token.range[1] - token.loc.end.column, token.range[1]).trim()) { + map.set(token.loc.end.line, token); + } + return map; + }, new Map()); + } + + /** + * Gets the first token on a given token's line + * @param {Token|ASTNode} token a node or token + * @returns {Token} The first token on the given line + */ + getFirstTokenOfLine(token) { + return this.firstTokensByLineNumber.get(token.loc.start.line); + } + + /** + * Determines whether a token is the first token in its line + * @param {Token} token The token + * @returns {boolean} `true` if the token is the first on its line + */ + isFirstTokenOfLine(token) { + return this.getFirstTokenOfLine(token) === token; + } + + /** + * Get the actual indent of a token + * @param {Token} token Token to examine. This should be the first token on its line. + * @returns {string} The indentation characters that precede the token + */ + getTokenIndent(token) { + return this.sourceCode.text.slice(token.range[0] - token.loc.start.column, token.range[0]); + } +} + +/** + * A class to store information on desired offsets of tokens from each other + */ +class OffsetStorage { + + /** + * @param {TokenInfo} tokenInfo a TokenInfo instance + * @param {number} indentSize The desired size of each indentation level + * @param {string} indentType The indentation character + */ + constructor(tokenInfo, indentSize, indentType) { + this._tokenInfo = tokenInfo; + this._indentSize = indentSize; + this._indentType = indentType; + + this._tree = new BinarySearchTree(); + this._tree.insert(0, { offset: 0, from: null, force: false }); + + this._lockedFirstTokens = new WeakMap(); + this._desiredIndentCache = new WeakMap(); + this._ignoredTokens = new WeakSet(); + } + + _getOffsetDescriptor(token) { + return this._tree.findLe(token.range[0]).value; + } + + /** + * Sets the offset column of token B to match the offset column of token A. + * - **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In + * most cases, `setDesiredOffset` should be used instead. + * @param {Token} baseToken The first token + * @param {Token} offsetToken The second token, whose offset should be matched to the first token + * @returns {void} + */ + matchOffsetOf(baseToken, offsetToken) { + + /* + * lockedFirstTokens is a map from a token whose indentation is controlled by the "first" option to + * the token that it depends on. For example, with the `ArrayExpression: first` option, the first + * token of each element in the array after the first will be mapped to the first token of the first + * element. The desired indentation of each of these tokens is computed based on the desired indentation + * of the "first" element, rather than through the normal offset mechanism. + */ + this._lockedFirstTokens.set(offsetToken, baseToken); + } + + /** + * Sets the desired offset of a token. + * + * This uses a line-based offset collapsing behavior to handle tokens on the same line. + * For example, consider the following two cases: + * + * ( + * [ + * bar + * ] + * ) + * + * ([ + * bar + * ]) + * + * Based on the first case, it's clear that the `bar` token needs to have an offset of 1 indent level (4 spaces) from + * the `[` token, and the `[` token has to have an offset of 1 indent level from the `(` token. Since the `(` token is + * the first on its line (with an indent of 0 spaces), the `bar` token needs to be offset by 2 indent levels (8 spaces) + * from the start of its line. + * + * However, in the second case `bar` should only be indented by 4 spaces. This is because the offset of 1 indent level + * between the `(` and the `[` tokens gets "collapsed" because the two tokens are on the same line. As a result, the + * `(` token is mapped to the `[` token with an offset of 0, and the rule correctly decides that `bar` should be indented + * by 1 indent level from the start of the line. + * + * This is useful because rule listeners can usually just call `setDesiredOffset` for all the tokens in the node, + * without needing to check which lines those tokens are on. + * + * Note that since collapsing only occurs when two tokens are on the same line, there are a few cases where non-intuitive + * behavior can occur. For example, consider the following cases: + * + * foo( + * ). + * bar( + * baz + * ) + * + * foo( + * ).bar( + * baz + * ) + * + * Based on the first example, it would seem that `bar` should be offset by 1 indent level from `foo`, and `baz` + * should be offset by 1 indent level from `bar`. However, this is not correct, because it would result in `baz` + * being indented by 2 indent levels in the second case (since `foo`, `bar`, and `baz` are all on separate lines, no + * collapsing would occur). + * + * Instead, the correct way would be to offset `baz` by 1 level from `bar`, offset `bar` by 1 level from the `)`, and + * offset the `)` by 0 levels from `foo`. This ensures that the offset between `bar` and the `)` are correctly collapsed + * in the second case. + * @param {Token} token The token + * @param {Token} fromToken The token that `token` should be offset from + * @param {number} offset The desired indent level + * @returns {void} + */ + setDesiredOffset(token, fromToken, offset) { + return this.setDesiredOffsets(token.range, fromToken, offset); + } + + /** + * Sets the desired offset of all tokens in a range + * It's common for node listeners in this file to need to apply the same offset to a large, contiguous range of tokens. + * Moreover, the offset of any given token is usually updated multiple times (roughly once for each node that contains + * it). This means that the offset of each token is updated O(AST depth) times. + * It would not be performant to store and update the offsets for each token independently, because the rule would end + * up having a time complexity of O(number of tokens * AST depth), which is quite slow for large files. + * + * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following + * list could represent the state of the offset tree at a given point: + * + * - Tokens starting in the interval [0, 15) are aligned with the beginning of the file + * - Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token + * - Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token + * - Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token + * - Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token + * + * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: + * `setDesiredOffsets([30, 43], fooToken, 1);` + * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. + * @param {Token} fromToken The token that this is offset from + * @param {number} offset The desired indent level + * @param {boolean} force `true` if this offset should not use the normal collapsing behavior. This should almost always be false. + * @returns {void} + */ + setDesiredOffsets(range, fromToken, offset, force) { + + /* + * Offset ranges are stored as a collection of nodes, where each node maps a numeric key to an offset + * descriptor. The tree for the example above would have the following nodes: + * + * * key: 0, value: { offset: 0, from: null } + * * key: 15, value: { offset: 1, from: barToken } + * * key: 30, value: { offset: 1, from: fooToken } + * * key: 43, value: { offset: 2, from: barToken } + * * key: 820, value: { offset: 1, from: bazToken } + * + * To find the offset descriptor for any given token, one needs to find the node with the largest key + * which is <= token.start. To make this operation fast, the nodes are stored in a balanced binary + * search tree indexed by key. + */ + + const descriptorToInsert = { offset, from: fromToken, force }; + + const descriptorAfterRange = this._tree.findLe(range[1]).value; + + const fromTokenIsInRange = fromToken && fromToken.range[0] >= range[0] && fromToken.range[1] <= range[1]; + const fromTokenDescriptor = fromTokenIsInRange && this._getOffsetDescriptor(fromToken); + + // First, remove any existing nodes in the range from the tree. + this._tree.deleteRange(range[0] + 1, range[1]); + + // Insert a new node into the tree for this range + this._tree.insert(range[0], descriptorToInsert); + + /* + * To avoid circular offset dependencies, keep the `fromToken` token mapped to whatever it was mapped to previously, + * even if it's in the current range. + */ + if (fromTokenIsInRange) { + this._tree.insert(fromToken.range[0], fromTokenDescriptor); + this._tree.insert(fromToken.range[1], descriptorToInsert); + } + + /* + * To avoid modifying the offset of tokens after the range, insert another node to keep the offset of the following + * tokens the same as it was before. + */ + this._tree.insert(range[1], descriptorAfterRange); + } + + /** + * Gets the desired indent of a token + * @param {Token} token The token + * @returns {string} The desired indent of the token + */ + getDesiredIndent(token) { + if (!this._desiredIndentCache.has(token)) { + + if (this._ignoredTokens.has(token)) { + + /* + * If the token is ignored, use the actual indent of the token as the desired indent. + * This ensures that no errors are reported for this token. + */ + this._desiredIndentCache.set( + token, + this._tokenInfo.getTokenIndent(token) + ); + } else if (this._lockedFirstTokens.has(token)) { + const firstToken = this._lockedFirstTokens.get(token); + + this._desiredIndentCache.set( + token, + + // (indentation for the first element's line) + this.getDesiredIndent(this._tokenInfo.getFirstTokenOfLine(firstToken)) + + + // (space between the start of the first element's line and the first element) + this._indentType.repeat(firstToken.loc.start.column - this._tokenInfo.getFirstTokenOfLine(firstToken).loc.start.column) + ); + } else { + const offsetInfo = this._getOffsetDescriptor(token); + const offset = ( + offsetInfo.from && + offsetInfo.from.loc.start.line === token.loc.start.line && + !/^\s*?\n/u.test(token.value) && + !offsetInfo.force + ) ? 0 : offsetInfo.offset * this._indentSize; + + this._desiredIndentCache.set( + token, + (offsetInfo.from ? this.getDesiredIndent(offsetInfo.from) : "") + this._indentType.repeat(offset) + ); + } + } + return this._desiredIndentCache.get(token); + } + + /** + * Ignores a token, preventing it from being reported. + * @param {Token} token The token + * @returns {void} + */ + ignoreToken(token) { + if (this._tokenInfo.isFirstTokenOfLine(token)) { + this._ignoredTokens.add(token); + } + } + + /** + * Gets the first token that the given token's indentation is dependent on + * @param {Token} token The token + * @returns {Token} The token that the given token depends on, or `null` if the given token is at the top level + */ + getFirstDependency(token) { + return this._getOffsetDescriptor(token).from; + } +} + +const ELEMENT_LIST_SCHEMA = { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["first", "off"] + } + ] +}; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent indentation", + recommended: false, + url: "https://eslint.org/docs/rules/indent" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["tab"] + }, + { + type: "integer", + minimum: 0 + } + ] + }, + { + type: "object", + properties: { + SwitchCase: { + type: "integer", + minimum: 0, + default: 0 + }, + VariableDeclarator: { + oneOf: [ + ELEMENT_LIST_SCHEMA, + { + type: "object", + properties: { + var: ELEMENT_LIST_SCHEMA, + let: ELEMENT_LIST_SCHEMA, + const: ELEMENT_LIST_SCHEMA + }, + additionalProperties: false + } + ] + }, + outerIIFEBody: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["off"] + } + ] + }, + MemberExpression: { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + enum: ["off"] + } + ] + }, + FunctionDeclaration: { + type: "object", + properties: { + parameters: ELEMENT_LIST_SCHEMA, + body: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + }, + FunctionExpression: { + type: "object", + properties: { + parameters: ELEMENT_LIST_SCHEMA, + body: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + }, + StaticBlock: { + type: "object", + properties: { + body: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + }, + CallExpression: { + type: "object", + properties: { + arguments: ELEMENT_LIST_SCHEMA + }, + additionalProperties: false + }, + ArrayExpression: ELEMENT_LIST_SCHEMA, + ObjectExpression: ELEMENT_LIST_SCHEMA, + ImportDeclaration: ELEMENT_LIST_SCHEMA, + flatTernaryExpressions: { + type: "boolean", + default: false + }, + offsetTernaryExpressions: { + type: "boolean", + default: false + }, + ignoredNodes: { + type: "array", + items: { + type: "string", + not: { + pattern: ":exit$" + } + } + }, + ignoreComments: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { + wrongIndentation: "Expected indentation of {{expected}} but found {{actual}}." + } + }, + + create(context) { + const DEFAULT_VARIABLE_INDENT = 1; + const DEFAULT_PARAMETER_INDENT = 1; + const DEFAULT_FUNCTION_BODY_INDENT = 1; + + let indentType = "space"; + let indentSize = 4; + const options = { + SwitchCase: 0, + VariableDeclarator: { + var: DEFAULT_VARIABLE_INDENT, + let: DEFAULT_VARIABLE_INDENT, + const: DEFAULT_VARIABLE_INDENT + }, + outerIIFEBody: 1, + FunctionDeclaration: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + FunctionExpression: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + StaticBlock: { + body: DEFAULT_FUNCTION_BODY_INDENT + }, + CallExpression: { + arguments: DEFAULT_PARAMETER_INDENT + }, + MemberExpression: 1, + ArrayExpression: 1, + ObjectExpression: 1, + ImportDeclaration: 1, + flatTernaryExpressions: false, + ignoredNodes: [], + ignoreComments: false + }; + + if (context.options.length) { + if (context.options[0] === "tab") { + indentSize = 1; + indentType = "tab"; + } else { + indentSize = context.options[0]; + indentType = "space"; + } + + if (context.options[1]) { + Object.assign(options, context.options[1]); + + if (typeof options.VariableDeclarator === "number" || options.VariableDeclarator === "first") { + options.VariableDeclarator = { + var: options.VariableDeclarator, + let: options.VariableDeclarator, + const: options.VariableDeclarator + }; + } + } + } + + const sourceCode = context.getSourceCode(); + const tokenInfo = new TokenInfo(sourceCode); + const offsets = new OffsetStorage(tokenInfo, indentSize, indentType === "space" ? " " : "\t"); + const parameterParens = new WeakSet(); + + /** + * Creates an error message for a line, given the expected/actual indentation. + * @param {int} expectedAmount The expected amount of indentation characters for this line + * @param {int} actualSpaces The actual number of indentation spaces that were found on this line + * @param {int} actualTabs The actual number of indentation tabs that were found on this line + * @returns {string} An error message for this line + */ + function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { + const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" + const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" + const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" + let foundStatement; + + if (actualSpaces > 0) { + + /* + * Abbreviate the message if the expected indentation is also spaces. + * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + */ + foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; + } else if (actualTabs > 0) { + foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; + } else { + foundStatement = "0"; + } + return { + expected: expectedStatement, + actual: foundStatement + }; + } + + /** + * Reports a given indent violation + * @param {Token} token Token violating the indent rule + * @param {string} neededIndent Expected indentation string + * @returns {void} + */ + function report(token, neededIndent) { + const actualIndent = Array.from(tokenInfo.getTokenIndent(token)); + const numSpaces = actualIndent.filter(char => char === " ").length; + const numTabs = actualIndent.filter(char => char === "\t").length; + + context.report({ + node: token, + messageId: "wrongIndentation", + data: createErrorMessageData(neededIndent.length, numSpaces, numTabs), + loc: { + start: { line: token.loc.start.line, column: 0 }, + end: { line: token.loc.start.line, column: token.loc.start.column } + }, + fix(fixer) { + const range = [token.range[0] - token.loc.start.column, token.range[0]]; + const newText = neededIndent; + + return fixer.replaceTextRange(range, newText); + } + }); + } + + /** + * Checks if a token's indentation is correct + * @param {Token} token Token to examine + * @param {string} desiredIndent Desired indentation of the string + * @returns {boolean} `true` if the token's indentation is correct + */ + function validateTokenIndent(token, desiredIndent) { + const indentation = tokenInfo.getTokenIndent(token); + + return indentation === desiredIndent || + + // To avoid conflicts with no-mixed-spaces-and-tabs, don't report mixed spaces and tabs. + indentation.includes(" ") && indentation.includes("\t"); + } + + /** + * Check to see if the node is a file level IIFE + * @param {ASTNode} node The function node to check. + * @returns {boolean} True if the node is the outer IIFE + */ + function isOuterIIFE(node) { + + /* + * Verify that the node is an IIFE + */ + if (!node.parent || node.parent.type !== "CallExpression" || node.parent.callee !== node) { + return false; + } + + /* + * Navigate legal ancestors to determine whether this IIFE is outer. + * A "legal ancestor" is an expression or statement that causes the function to get executed immediately. + * For example, `!(function(){})()` is an outer IIFE even though it is preceded by a ! operator. + */ + let statement = node.parent && node.parent.parent; + + while ( + statement.type === "UnaryExpression" && ["!", "~", "+", "-"].includes(statement.operator) || + statement.type === "AssignmentExpression" || + statement.type === "LogicalExpression" || + statement.type === "SequenceExpression" || + statement.type === "VariableDeclarator" + ) { + statement = statement.parent; + } + + return (statement.type === "ExpressionStatement" || statement.type === "VariableDeclaration") && statement.parent.type === "Program"; + } + + /** + * Counts the number of linebreaks that follow the last non-whitespace character in a string + * @param {string} string The string to check + * @returns {number} The number of JavaScript linebreaks that follow the last non-whitespace character, + * or the total number of linebreaks if the string is all whitespace. + */ + function countTrailingLinebreaks(string) { + const trailingWhitespace = string.match(/\s*$/u)[0]; + const linebreakMatches = trailingWhitespace.match(astUtils.createGlobalLinebreakMatcher()); + + return linebreakMatches === null ? 0 : linebreakMatches.length; + } + + /** + * Check indentation for lists of elements (arrays, objects, function params) + * @param {ASTNode[]} elements List of elements that should be offset + * @param {Token} startToken The start token of the list that element should be aligned against, e.g. '[' + * @param {Token} endToken The end token of the list, e.g. ']' + * @param {number|string} offset The amount that the elements should be offset + * @returns {void} + */ + function addElementListIndent(elements, startToken, endToken, offset) { + + /** + * Gets the first token of a given element, including surrounding parentheses. + * @param {ASTNode} element A node in the `elements` list + * @returns {Token} The first token of this element + */ + function getFirstToken(element) { + let token = sourceCode.getTokenBefore(element); + + while (astUtils.isOpeningParenToken(token) && token !== startToken) { + token = sourceCode.getTokenBefore(token); + } + return sourceCode.getTokenAfter(token); + } + + // Run through all the tokens in the list, and offset them by one indent level (mainly for comments, other things will end up overridden) + offsets.setDesiredOffsets( + [startToken.range[1], endToken.range[0]], + startToken, + typeof offset === "number" ? offset : 1 + ); + offsets.setDesiredOffset(endToken, startToken, 0); + + // If the preference is "first" but there is no first element (e.g. sparse arrays w/ empty first slot), fall back to 1 level. + if (offset === "first" && elements.length && !elements[0]) { + return; + } + elements.forEach((element, index) => { + if (!element) { + + // Skip holes in arrays + return; + } + if (offset === "off") { + + // Ignore the first token of every element if the "off" option is used + offsets.ignoreToken(getFirstToken(element)); + } + + // Offset the following elements correctly relative to the first element + if (index === 0) { + return; + } + if (offset === "first" && tokenInfo.isFirstTokenOfLine(getFirstToken(element))) { + offsets.matchOffsetOf(getFirstToken(elements[0]), getFirstToken(element)); + } else { + const previousElement = elements[index - 1]; + const firstTokenOfPreviousElement = previousElement && getFirstToken(previousElement); + const previousElementLastToken = previousElement && sourceCode.getLastToken(previousElement); + + if ( + previousElement && + previousElementLastToken.loc.end.line - countTrailingLinebreaks(previousElementLastToken.value) > startToken.loc.end.line + ) { + offsets.setDesiredOffsets( + [previousElement.range[1], element.range[1]], + firstTokenOfPreviousElement, + 0 + ); + } + } + }); + } + + /** + * Check and decide whether to check for indentation for blockless nodes + * Scenarios are for or while statements without braces around them + * @param {ASTNode} node node to examine + * @returns {void} + */ + function addBlocklessNodeIndent(node) { + if (node.type !== "BlockStatement") { + const lastParentToken = sourceCode.getTokenBefore(node, astUtils.isNotOpeningParenToken); + + let firstBodyToken = sourceCode.getFirstToken(node); + let lastBodyToken = sourceCode.getLastToken(node); + + while ( + astUtils.isOpeningParenToken(sourceCode.getTokenBefore(firstBodyToken)) && + astUtils.isClosingParenToken(sourceCode.getTokenAfter(lastBodyToken)) + ) { + firstBodyToken = sourceCode.getTokenBefore(firstBodyToken); + lastBodyToken = sourceCode.getTokenAfter(lastBodyToken); + } + + offsets.setDesiredOffsets([firstBodyToken.range[0], lastBodyToken.range[1]], lastParentToken, 1); + } + } + + /** + * Checks the indentation for nodes that are like function calls (`CallExpression` and `NewExpression`) + * @param {ASTNode} node A CallExpression or NewExpression node + * @returns {void} + */ + function addFunctionCallIndent(node) { + let openingParen; + + if (node.arguments.length) { + openingParen = sourceCode.getFirstTokenBetween(node.callee, node.arguments[0], astUtils.isOpeningParenToken); + } else { + openingParen = sourceCode.getLastToken(node, 1); + } + const closingParen = sourceCode.getLastToken(node); + + parameterParens.add(openingParen); + parameterParens.add(closingParen); + + /* + * If `?.` token exists, set desired offset for that. + * This logic is copied from `MemberExpression`'s. + */ + if (node.optional) { + const dotToken = sourceCode.getTokenAfter(node.callee, astUtils.isQuestionDotToken); + const calleeParenCount = sourceCode.getTokensBetween(node.callee, dotToken, { filter: astUtils.isClosingParenToken }).length; + const firstTokenOfCallee = calleeParenCount + ? sourceCode.getTokenBefore(node.callee, { skip: calleeParenCount - 1 }) + : sourceCode.getFirstToken(node.callee); + const lastTokenOfCallee = sourceCode.getTokenBefore(dotToken); + const offsetBase = lastTokenOfCallee.loc.end.line === openingParen.loc.start.line + ? lastTokenOfCallee + : firstTokenOfCallee; + + offsets.setDesiredOffset(dotToken, offsetBase, 1); + } + + const offsetAfterToken = node.callee.type === "TaggedTemplateExpression" ? sourceCode.getFirstToken(node.callee.quasi) : openingParen; + const offsetToken = sourceCode.getTokenBefore(offsetAfterToken); + + offsets.setDesiredOffset(openingParen, offsetToken, 0); + + addElementListIndent(node.arguments, openingParen, closingParen, options.CallExpression.arguments); + } + + /** + * Checks the indentation of parenthesized values, given a list of tokens in a program + * @param {Token[]} tokens A list of tokens + * @returns {void} + */ + function addParensIndent(tokens) { + const parenStack = []; + const parenPairs = []; + + tokens.forEach(nextToken => { + + // Accumulate a list of parenthesis pairs + if (astUtils.isOpeningParenToken(nextToken)) { + parenStack.push(nextToken); + } else if (astUtils.isClosingParenToken(nextToken)) { + parenPairs.unshift({ left: parenStack.pop(), right: nextToken }); + } + }); + + parenPairs.forEach(pair => { + const leftParen = pair.left; + const rightParen = pair.right; + + // We only want to handle parens around expressions, so exclude parentheses that are in function parameters and function call arguments. + if (!parameterParens.has(leftParen) && !parameterParens.has(rightParen)) { + const parenthesizedTokens = new Set(sourceCode.getTokensBetween(leftParen, rightParen)); + + parenthesizedTokens.forEach(token => { + if (!parenthesizedTokens.has(offsets.getFirstDependency(token))) { + offsets.setDesiredOffset(token, leftParen, 1); + } + }); + } + + offsets.setDesiredOffset(rightParen, leftParen, 0); + }); + } + + /** + * Ignore all tokens within an unknown node whose offset do not depend + * on another token's offset within the unknown node + * @param {ASTNode} node Unknown Node + * @returns {void} + */ + function ignoreNode(node) { + const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true })); + + unknownNodeTokens.forEach(token => { + if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) { + const firstTokenOfLine = tokenInfo.getFirstTokenOfLine(token); + + if (token === firstTokenOfLine) { + offsets.ignoreToken(token); + } else { + offsets.setDesiredOffset(token, firstTokenOfLine, 0); + } + } + }); + } + + /** + * Check whether the given token is on the first line of a statement. + * @param {Token} token The token to check. + * @param {ASTNode} leafNode The expression node that the token belongs directly. + * @returns {boolean} `true` if the token is on the first line of a statement. + */ + function isOnFirstLineOfStatement(token, leafNode) { + let node = leafNode; + + while (node.parent && !node.parent.type.endsWith("Statement") && !node.parent.type.endsWith("Declaration")) { + node = node.parent; + } + node = node.parent; + + return !node || node.loc.start.line === token.loc.start.line; + } + + /** + * Check whether there are any blank (whitespace-only) lines between + * two tokens on separate lines. + * @param {Token} firstToken The first token. + * @param {Token} secondToken The second token. + * @returns {boolean} `true` if the tokens are on separate lines and + * there exists a blank line between them, `false` otherwise. + */ + function hasBlankLinesBetween(firstToken, secondToken) { + const firstTokenLine = firstToken.loc.end.line; + const secondTokenLine = secondToken.loc.start.line; + + if (firstTokenLine === secondTokenLine || firstTokenLine === secondTokenLine - 1) { + return false; + } + + for (let line = firstTokenLine + 1; line < secondTokenLine; ++line) { + if (!tokenInfo.firstTokensByLineNumber.has(line)) { + return true; + } + } + + return false; + } + + const ignoredNodeFirstTokens = new Set(); + + const baseOffsetListeners = { + "ArrayExpression, ArrayPattern"(node) { + const openingBracket = sourceCode.getFirstToken(node); + const closingBracket = sourceCode.getTokenAfter([...node.elements].reverse().find(_ => _) || openingBracket, astUtils.isClosingBracketToken); + + addElementListIndent(node.elements, openingBracket, closingBracket, options.ArrayExpression); + }, + + "ObjectExpression, ObjectPattern"(node) { + const openingCurly = sourceCode.getFirstToken(node); + const closingCurly = sourceCode.getTokenAfter( + node.properties.length ? node.properties[node.properties.length - 1] : openingCurly, + astUtils.isClosingBraceToken + ); + + addElementListIndent(node.properties, openingCurly, closingCurly, options.ObjectExpression); + }, + + ArrowFunctionExpression(node) { + const maybeOpeningParen = sourceCode.getFirstToken(node, { skip: node.async ? 1 : 0 }); + + if (astUtils.isOpeningParenToken(maybeOpeningParen)) { + const openingParen = maybeOpeningParen; + const closingParen = sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken); + + parameterParens.add(openingParen); + parameterParens.add(closingParen); + addElementListIndent(node.params, openingParen, closingParen, options.FunctionExpression.parameters); + } + + addBlocklessNodeIndent(node.body); + }, + + AssignmentExpression(node) { + const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); + + offsets.setDesiredOffsets([operator.range[0], node.range[1]], sourceCode.getLastToken(node.left), 1); + offsets.ignoreToken(operator); + offsets.ignoreToken(sourceCode.getTokenAfter(operator)); + }, + + "BinaryExpression, LogicalExpression"(node) { + const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); + + /* + * For backwards compatibility, don't check BinaryExpression indents, e.g. + * var foo = bar && + * baz; + */ + + const tokenAfterOperator = sourceCode.getTokenAfter(operator); + + offsets.ignoreToken(operator); + offsets.ignoreToken(tokenAfterOperator); + offsets.setDesiredOffset(tokenAfterOperator, operator, 0); + }, + + "BlockStatement, ClassBody"(node) { + let blockIndentLevel; + + if (node.parent && isOuterIIFE(node.parent)) { + blockIndentLevel = options.outerIIFEBody; + } else if (node.parent && (node.parent.type === "FunctionExpression" || node.parent.type === "ArrowFunctionExpression")) { + blockIndentLevel = options.FunctionExpression.body; + } else if (node.parent && node.parent.type === "FunctionDeclaration") { + blockIndentLevel = options.FunctionDeclaration.body; + } else { + blockIndentLevel = 1; + } + + /* + * For blocks that aren't lone statements, ensure that the opening curly brace + * is aligned with the parent. + */ + if (!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)) { + offsets.setDesiredOffset(sourceCode.getFirstToken(node), sourceCode.getFirstToken(node.parent), 0); + } + + addElementListIndent(node.body, sourceCode.getFirstToken(node), sourceCode.getLastToken(node), blockIndentLevel); + }, + + CallExpression: addFunctionCallIndent, + + "ClassDeclaration[superClass], ClassExpression[superClass]"(node) { + const classToken = sourceCode.getFirstToken(node); + const extendsToken = sourceCode.getTokenBefore(node.superClass, astUtils.isNotOpeningParenToken); + + offsets.setDesiredOffsets([extendsToken.range[0], node.body.range[0]], classToken, 1); + }, + + ConditionalExpression(node) { + const firstToken = sourceCode.getFirstToken(node); + + // `flatTernaryExpressions` option is for the following style: + // var a = + // foo > 0 ? bar : + // foo < 0 ? baz : + // /*else*/ qiz ; + if (!options.flatTernaryExpressions || + !astUtils.isTokenOnSameLine(node.test, node.consequent) || + isOnFirstLineOfStatement(firstToken, node) + ) { + const questionMarkToken = sourceCode.getFirstTokenBetween(node.test, node.consequent, token => token.type === "Punctuator" && token.value === "?"); + const colonToken = sourceCode.getFirstTokenBetween(node.consequent, node.alternate, token => token.type === "Punctuator" && token.value === ":"); + + const firstConsequentToken = sourceCode.getTokenAfter(questionMarkToken); + const lastConsequentToken = sourceCode.getTokenBefore(colonToken); + const firstAlternateToken = sourceCode.getTokenAfter(colonToken); + + offsets.setDesiredOffset(questionMarkToken, firstToken, 1); + offsets.setDesiredOffset(colonToken, firstToken, 1); + + offsets.setDesiredOffset(firstConsequentToken, firstToken, firstConsequentToken.type === "Punctuator" && + options.offsetTernaryExpressions ? 2 : 1); + + /* + * The alternate and the consequent should usually have the same indentation. + * If they share part of a line, align the alternate against the first token of the consequent. + * This allows the alternate to be indented correctly in cases like this: + * foo ? ( + * bar + * ) : ( // this '(' is aligned with the '(' above, so it's considered to be aligned with `foo` + * baz // as a result, `baz` is offset by 1 rather than 2 + * ) + */ + if (lastConsequentToken.loc.end.line === firstAlternateToken.loc.start.line) { + offsets.setDesiredOffset(firstAlternateToken, firstConsequentToken, 0); + } else { + + /** + * If the alternate and consequent do not share part of a line, offset the alternate from the first + * token of the conditional expression. For example: + * foo ? bar + * : baz + * + * If `baz` were aligned with `bar` rather than being offset by 1 from `foo`, `baz` would end up + * having no expected indentation. + */ + offsets.setDesiredOffset(firstAlternateToken, firstToken, firstAlternateToken.type === "Punctuator" && + options.offsetTernaryExpressions ? 2 : 1); + } + } + }, + + "DoWhileStatement, WhileStatement, ForInStatement, ForOfStatement": node => addBlocklessNodeIndent(node.body), + + ExportNamedDeclaration(node) { + if (node.declaration === null) { + const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken); + + // Indent the specifiers in `export {foo, bar, baz}` + addElementListIndent(node.specifiers, sourceCode.getFirstToken(node, { skip: 1 }), closingCurly, 1); + + if (node.source) { + + // Indent everything after and including the `from` token in `export {foo, bar, baz} from 'qux'` + offsets.setDesiredOffsets([closingCurly.range[1], node.range[1]], sourceCode.getFirstToken(node), 1); + } + } + }, + + ForStatement(node) { + const forOpeningParen = sourceCode.getFirstToken(node, 1); + + if (node.init) { + offsets.setDesiredOffsets(node.init.range, forOpeningParen, 1); + } + if (node.test) { + offsets.setDesiredOffsets(node.test.range, forOpeningParen, 1); + } + if (node.update) { + offsets.setDesiredOffsets(node.update.range, forOpeningParen, 1); + } + addBlocklessNodeIndent(node.body); + }, + + "FunctionDeclaration, FunctionExpression"(node) { + const closingParen = sourceCode.getTokenBefore(node.body); + const openingParen = sourceCode.getTokenBefore(node.params.length ? node.params[0] : closingParen); + + parameterParens.add(openingParen); + parameterParens.add(closingParen); + addElementListIndent(node.params, openingParen, closingParen, options[node.type].parameters); + }, + + IfStatement(node) { + addBlocklessNodeIndent(node.consequent); + if (node.alternate && node.alternate.type !== "IfStatement") { + addBlocklessNodeIndent(node.alternate); + } + }, + + /* + * For blockless nodes with semicolon-first style, don't indent the semicolon. + * e.g. + * if (foo) + * bar() + * ; [1, 2, 3].map(foo) + * + * Traversal into the node sets indentation of the semicolon, so we need to override it on exit. + */ + ":matches(DoWhileStatement, ForStatement, ForInStatement, ForOfStatement, IfStatement, WhileStatement):exit"(node) { + let nodesToCheck; + + if (node.type === "IfStatement") { + nodesToCheck = [node.consequent]; + if (node.alternate) { + nodesToCheck.push(node.alternate); + } + } else { + nodesToCheck = [node.body]; + } + + for (const nodeToCheck of nodesToCheck) { + const lastToken = sourceCode.getLastToken(nodeToCheck); + + if (astUtils.isSemicolonToken(lastToken)) { + const tokenBeforeLast = sourceCode.getTokenBefore(lastToken); + const tokenAfterLast = sourceCode.getTokenAfter(lastToken); + + // override indentation of `;` only if its line looks like a semicolon-first style line + if ( + !astUtils.isTokenOnSameLine(tokenBeforeLast, lastToken) && + tokenAfterLast && + astUtils.isTokenOnSameLine(lastToken, tokenAfterLast) + ) { + offsets.setDesiredOffset( + lastToken, + sourceCode.getFirstToken(node), + 0 + ); + } + } + } + }, + + ImportDeclaration(node) { + if (node.specifiers.some(specifier => specifier.type === "ImportSpecifier")) { + const openingCurly = sourceCode.getFirstToken(node, astUtils.isOpeningBraceToken); + const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken); + + addElementListIndent(node.specifiers.filter(specifier => specifier.type === "ImportSpecifier"), openingCurly, closingCurly, options.ImportDeclaration); + } + + const fromToken = sourceCode.getLastToken(node, token => token.type === "Identifier" && token.value === "from"); + const sourceToken = sourceCode.getLastToken(node, token => token.type === "String"); + const semiToken = sourceCode.getLastToken(node, token => token.type === "Punctuator" && token.value === ";"); + + if (fromToken) { + const end = semiToken && semiToken.range[1] === sourceToken.range[1] ? node.range[1] : sourceToken.range[1]; + + offsets.setDesiredOffsets([fromToken.range[0], end], sourceCode.getFirstToken(node), 1); + } + }, + + ImportExpression(node) { + const openingParen = sourceCode.getFirstToken(node, 1); + const closingParen = sourceCode.getLastToken(node); + + parameterParens.add(openingParen); + parameterParens.add(closingParen); + offsets.setDesiredOffset(openingParen, sourceCode.getTokenBefore(openingParen), 0); + + addElementListIndent([node.source], openingParen, closingParen, options.CallExpression.arguments); + }, + + "MemberExpression, JSXMemberExpression, MetaProperty"(node) { + const object = node.type === "MetaProperty" ? node.meta : node.object; + const firstNonObjectToken = sourceCode.getFirstTokenBetween(object, node.property, astUtils.isNotClosingParenToken); + const secondNonObjectToken = sourceCode.getTokenAfter(firstNonObjectToken); + + const objectParenCount = sourceCode.getTokensBetween(object, node.property, { filter: astUtils.isClosingParenToken }).length; + const firstObjectToken = objectParenCount + ? sourceCode.getTokenBefore(object, { skip: objectParenCount - 1 }) + : sourceCode.getFirstToken(object); + const lastObjectToken = sourceCode.getTokenBefore(firstNonObjectToken); + const firstPropertyToken = node.computed ? firstNonObjectToken : secondNonObjectToken; + + if (node.computed) { + + // For computed MemberExpressions, match the closing bracket with the opening bracket. + offsets.setDesiredOffset(sourceCode.getLastToken(node), firstNonObjectToken, 0); + offsets.setDesiredOffsets(node.property.range, firstNonObjectToken, 1); + } + + /* + * If the object ends on the same line that the property starts, match against the last token + * of the object, to ensure that the MemberExpression is not indented. + * + * Otherwise, match against the first token of the object, e.g. + * foo + * .bar + * .baz // <-- offset by 1 from `foo` + */ + const offsetBase = lastObjectToken.loc.end.line === firstPropertyToken.loc.start.line + ? lastObjectToken + : firstObjectToken; + + if (typeof options.MemberExpression === "number") { + + // Match the dot (for non-computed properties) or the opening bracket (for computed properties) against the object. + offsets.setDesiredOffset(firstNonObjectToken, offsetBase, options.MemberExpression); + + /* + * For computed MemberExpressions, match the first token of the property against the opening bracket. + * Otherwise, match the first token of the property against the object. + */ + offsets.setDesiredOffset(secondNonObjectToken, node.computed ? firstNonObjectToken : offsetBase, options.MemberExpression); + } else { + + // If the MemberExpression option is off, ignore the dot and the first token of the property. + offsets.ignoreToken(firstNonObjectToken); + offsets.ignoreToken(secondNonObjectToken); + + // To ignore the property indentation, ensure that the property tokens depend on the ignored tokens. + offsets.setDesiredOffset(firstNonObjectToken, offsetBase, 0); + offsets.setDesiredOffset(secondNonObjectToken, firstNonObjectToken, 0); + } + }, + + NewExpression(node) { + + // Only indent the arguments if the NewExpression has parens (e.g. `new Foo(bar)` or `new Foo()`, but not `new Foo` + if (node.arguments.length > 0 || + astUtils.isClosingParenToken(sourceCode.getLastToken(node)) && + astUtils.isOpeningParenToken(sourceCode.getLastToken(node, 1))) { + addFunctionCallIndent(node); + } + }, + + Property(node) { + if (!node.shorthand && !node.method && node.kind === "init") { + const colon = sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isColonToken); + + offsets.ignoreToken(sourceCode.getTokenAfter(colon)); + } + }, + + PropertyDefinition(node) { + const firstToken = sourceCode.getFirstToken(node); + const maybeSemicolonToken = sourceCode.getLastToken(node); + let keyLastToken = null; + + // Indent key. + if (node.computed) { + const bracketTokenL = sourceCode.getTokenBefore(node.key, astUtils.isOpeningBracketToken); + const bracketTokenR = keyLastToken = sourceCode.getTokenAfter(node.key, astUtils.isClosingBracketToken); + const keyRange = [bracketTokenL.range[1], bracketTokenR.range[0]]; + + if (bracketTokenL !== firstToken) { + offsets.setDesiredOffset(bracketTokenL, firstToken, 0); + } + offsets.setDesiredOffsets(keyRange, bracketTokenL, 1); + offsets.setDesiredOffset(bracketTokenR, bracketTokenL, 0); + } else { + const idToken = keyLastToken = sourceCode.getFirstToken(node.key); + + if (idToken !== firstToken) { + offsets.setDesiredOffset(idToken, firstToken, 1); + } + } + + // Indent initializer. + if (node.value) { + const eqToken = sourceCode.getTokenBefore(node.value, astUtils.isEqToken); + const valueToken = sourceCode.getTokenAfter(eqToken); + + offsets.setDesiredOffset(eqToken, keyLastToken, 1); + offsets.setDesiredOffset(valueToken, eqToken, 1); + if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, eqToken, 1); + } + } else if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, keyLastToken, 1); + } + }, + + StaticBlock(node) { + const openingCurly = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token + const closingCurly = sourceCode.getLastToken(node); + + addElementListIndent(node.body, openingCurly, closingCurly, options.StaticBlock.body); + }, + + SwitchStatement(node) { + const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken); + const closingCurly = sourceCode.getLastToken(node); + + offsets.setDesiredOffsets([openingCurly.range[1], closingCurly.range[0]], openingCurly, options.SwitchCase); + + if (node.cases.length) { + sourceCode.getTokensBetween( + node.cases[node.cases.length - 1], + closingCurly, + { includeComments: true, filter: astUtils.isCommentToken } + ).forEach(token => offsets.ignoreToken(token)); + } + }, + + SwitchCase(node) { + if (!(node.consequent.length === 1 && node.consequent[0].type === "BlockStatement")) { + const caseKeyword = sourceCode.getFirstToken(node); + const tokenAfterCurrentCase = sourceCode.getTokenAfter(node); + + offsets.setDesiredOffsets([caseKeyword.range[1], tokenAfterCurrentCase.range[0]], caseKeyword, 1); + } + }, + + TemplateLiteral(node) { + node.expressions.forEach((expression, index) => { + const previousQuasi = node.quasis[index]; + const nextQuasi = node.quasis[index + 1]; + const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line + ? sourceCode.getFirstToken(previousQuasi) + : null; + + offsets.setDesiredOffsets([previousQuasi.range[1], nextQuasi.range[0]], tokenToAlignFrom, 1); + offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, 0); + }); + }, + + VariableDeclaration(node) { + let variableIndent = Object.prototype.hasOwnProperty.call(options.VariableDeclarator, node.kind) + ? options.VariableDeclarator[node.kind] + : DEFAULT_VARIABLE_INDENT; + + const firstToken = sourceCode.getFirstToken(node), + lastToken = sourceCode.getLastToken(node); + + if (options.VariableDeclarator[node.kind] === "first") { + if (node.declarations.length > 1) { + addElementListIndent( + node.declarations, + firstToken, + lastToken, + "first" + ); + return; + } + + variableIndent = DEFAULT_VARIABLE_INDENT; + } + + if (node.declarations[node.declarations.length - 1].loc.start.line > node.loc.start.line) { + + /* + * VariableDeclarator indentation is a bit different from other forms of indentation, in that the + * indentation of an opening bracket sometimes won't match that of a closing bracket. For example, + * the following indentations are correct: + * + * var foo = { + * ok: true + * }; + * + * var foo = { + * ok: true, + * }, + * bar = 1; + * + * Account for when exiting the AST (after indentations have already been set for the nodes in + * the declaration) by manually increasing the indentation level of the tokens in this declarator + * on the same line as the start of the declaration, provided that there are declarators that + * follow this one. + */ + offsets.setDesiredOffsets(node.range, firstToken, variableIndent, true); + } else { + offsets.setDesiredOffsets(node.range, firstToken, variableIndent); + } + + if (astUtils.isSemicolonToken(lastToken)) { + offsets.ignoreToken(lastToken); + } + }, + + VariableDeclarator(node) { + if (node.init) { + const equalOperator = sourceCode.getTokenBefore(node.init, astUtils.isNotOpeningParenToken); + const tokenAfterOperator = sourceCode.getTokenAfter(equalOperator); + + offsets.ignoreToken(equalOperator); + offsets.ignoreToken(tokenAfterOperator); + offsets.setDesiredOffsets([tokenAfterOperator.range[0], node.range[1]], equalOperator, 1); + offsets.setDesiredOffset(equalOperator, sourceCode.getLastToken(node.id), 0); + } + }, + + "JSXAttribute[value]"(node) { + const equalsToken = sourceCode.getFirstTokenBetween(node.name, node.value, token => token.type === "Punctuator" && token.value === "="); + + offsets.setDesiredOffsets([equalsToken.range[0], node.value.range[1]], sourceCode.getFirstToken(node.name), 1); + }, + + JSXElement(node) { + if (node.closingElement) { + addElementListIndent(node.children, sourceCode.getFirstToken(node.openingElement), sourceCode.getFirstToken(node.closingElement), 1); + } + }, + + JSXOpeningElement(node) { + const firstToken = sourceCode.getFirstToken(node); + let closingToken; + + if (node.selfClosing) { + closingToken = sourceCode.getLastToken(node, { skip: 1 }); + offsets.setDesiredOffset(sourceCode.getLastToken(node), closingToken, 0); + } else { + closingToken = sourceCode.getLastToken(node); + } + offsets.setDesiredOffsets(node.name.range, sourceCode.getFirstToken(node)); + addElementListIndent(node.attributes, firstToken, closingToken, 1); + }, + + JSXClosingElement(node) { + const firstToken = sourceCode.getFirstToken(node); + + offsets.setDesiredOffsets(node.name.range, firstToken, 1); + }, + + JSXFragment(node) { + const firstOpeningToken = sourceCode.getFirstToken(node.openingFragment); + const firstClosingToken = sourceCode.getFirstToken(node.closingFragment); + + addElementListIndent(node.children, firstOpeningToken, firstClosingToken, 1); + }, + + JSXOpeningFragment(node) { + const firstToken = sourceCode.getFirstToken(node); + const closingToken = sourceCode.getLastToken(node); + + offsets.setDesiredOffsets(node.range, firstToken, 1); + offsets.matchOffsetOf(firstToken, closingToken); + }, + + JSXClosingFragment(node) { + const firstToken = sourceCode.getFirstToken(node); + const slashToken = sourceCode.getLastToken(node, { skip: 1 }); + const closingToken = sourceCode.getLastToken(node); + const tokenToMatch = astUtils.isTokenOnSameLine(slashToken, closingToken) ? slashToken : closingToken; + + offsets.setDesiredOffsets(node.range, firstToken, 1); + offsets.matchOffsetOf(firstToken, tokenToMatch); + }, + + JSXExpressionContainer(node) { + const openingCurly = sourceCode.getFirstToken(node); + const closingCurly = sourceCode.getLastToken(node); + + offsets.setDesiredOffsets( + [openingCurly.range[1], closingCurly.range[0]], + openingCurly, + 1 + ); + }, + + JSXSpreadAttribute(node) { + const openingCurly = sourceCode.getFirstToken(node); + const closingCurly = sourceCode.getLastToken(node); + + offsets.setDesiredOffsets( + [openingCurly.range[1], closingCurly.range[0]], + openingCurly, + 1 + ); + }, + + "*"(node) { + const firstToken = sourceCode.getFirstToken(node); + + // Ensure that the children of every node are indented at least as much as the first token. + if (firstToken && !ignoredNodeFirstTokens.has(firstToken)) { + offsets.setDesiredOffsets(node.range, firstToken, 0); + } + } + }; + + const listenerCallQueue = []; + + /* + * To ignore the indentation of a node: + * 1. Don't call the node's listener when entering it (if it has a listener) + * 2. Don't set any offsets against the first token of the node. + * 3. Call `ignoreNode` on the node sometime after exiting it and before validating offsets. + */ + const offsetListeners = {}; + + for (const [selector, listener] of Object.entries(baseOffsetListeners)) { + + /* + * Offset listener calls are deferred until traversal is finished, and are called as + * part of the final `Program:exit` listener. This is necessary because a node might + * be matched by multiple selectors. + * + * Example: Suppose there is an offset listener for `Identifier`, and the user has + * specified in configuration that `MemberExpression > Identifier` should be ignored. + * Due to selector specificity rules, the `Identifier` listener will get called first. However, + * if a given Identifier node is supposed to be ignored, then the `Identifier` offset listener + * should not have been called at all. Without doing extra selector matching, we don't know + * whether the Identifier matches the `MemberExpression > Identifier` selector until the + * `MemberExpression > Identifier` listener is called. + * + * To avoid this, the `Identifier` listener isn't called until traversal finishes and all + * ignored nodes are known. + */ + offsetListeners[selector] = node => listenerCallQueue.push({ listener, node }); + } + + // For each ignored node selector, set up a listener to collect it into the `ignoredNodes` set. + const ignoredNodes = new Set(); + + /** + * Ignores a node + * @param {ASTNode} node The node to ignore + * @returns {void} + */ + function addToIgnoredNodes(node) { + ignoredNodes.add(node); + ignoredNodeFirstTokens.add(sourceCode.getFirstToken(node)); + } + + const ignoredNodeListeners = options.ignoredNodes.reduce( + (listeners, ignoredSelector) => Object.assign(listeners, { [ignoredSelector]: addToIgnoredNodes }), + {} + ); + + /* + * Join the listeners, and add a listener to verify that all tokens actually have the correct indentation + * at the end. + * + * Using Object.assign will cause some offset listeners to be overwritten if the same selector also appears + * in `ignoredNodeListeners`. This isn't a problem because all of the matching nodes will be ignored, + * so those listeners wouldn't be called anyway. + */ + return Object.assign( + offsetListeners, + ignoredNodeListeners, + { + "*:exit"(node) { + + // If a node's type is nonstandard, we can't tell how its children should be offset, so ignore it. + if (!KNOWN_NODES.has(node.type)) { + addToIgnoredNodes(node); + } + }, + "Program:exit"() { + + // If ignoreComments option is enabled, ignore all comment tokens. + if (options.ignoreComments) { + sourceCode.getAllComments() + .forEach(comment => offsets.ignoreToken(comment)); + } + + // Invoke the queued offset listeners for the nodes that aren't ignored. + listenerCallQueue + .filter(nodeInfo => !ignoredNodes.has(nodeInfo.node)) + .forEach(nodeInfo => nodeInfo.listener(nodeInfo.node)); + + // Update the offsets for ignored nodes to prevent their child tokens from being reported. + ignoredNodes.forEach(ignoreNode); + + addParensIndent(sourceCode.ast.tokens); + + /* + * Create a Map from (tokenOrComment) => (precedingToken). + * This is necessary because sourceCode.getTokenBefore does not handle a comment as an argument correctly. + */ + const precedingTokens = sourceCode.ast.comments.reduce((commentMap, comment) => { + const tokenOrCommentBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); + + return commentMap.set(comment, commentMap.has(tokenOrCommentBefore) ? commentMap.get(tokenOrCommentBefore) : tokenOrCommentBefore); + }, new WeakMap()); + + sourceCode.lines.forEach((line, lineIndex) => { + const lineNumber = lineIndex + 1; + + if (!tokenInfo.firstTokensByLineNumber.has(lineNumber)) { + + // Don't check indentation on blank lines + return; + } + + const firstTokenOfLine = tokenInfo.firstTokensByLineNumber.get(lineNumber); + + if (firstTokenOfLine.loc.start.line !== lineNumber) { + + // Don't check the indentation of multi-line tokens (e.g. template literals or block comments) twice. + return; + } + + if (astUtils.isCommentToken(firstTokenOfLine)) { + const tokenBefore = precedingTokens.get(firstTokenOfLine); + const tokenAfter = tokenBefore ? sourceCode.getTokenAfter(tokenBefore) : sourceCode.ast.tokens[0]; + const mayAlignWithBefore = tokenBefore && !hasBlankLinesBetween(tokenBefore, firstTokenOfLine); + const mayAlignWithAfter = tokenAfter && !hasBlankLinesBetween(firstTokenOfLine, tokenAfter); + + /* + * If a comment precedes a line that begins with a semicolon token, align to that token, i.e. + * + * let foo + * // comment + * ;(async () => {})() + */ + if (tokenAfter && astUtils.isSemicolonToken(tokenAfter) && !astUtils.isTokenOnSameLine(firstTokenOfLine, tokenAfter)) { + offsets.setDesiredOffset(firstTokenOfLine, tokenAfter, 0); + } + + // If a comment matches the expected indentation of the token immediately before or after, don't report it. + if ( + mayAlignWithBefore && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenBefore)) || + mayAlignWithAfter && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenAfter)) + ) { + return; + } + } + + // If the token matches the expected indentation, don't report it. + if (validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine))) { + return; + } + + // Otherwise, report the token/comment. + report(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine)); + }); + } + } + ); + } +}; diff --git a/node_modules/eslint/lib/rules/index.js b/node_modules/eslint/lib/rules/index.js new file mode 100644 index 0000000..aef47f5 --- /dev/null +++ b/node_modules/eslint/lib/rules/index.js @@ -0,0 +1,302 @@ +/** + * @fileoverview Collects the built-in rules into a map structure so that they can be imported all at once and without + * using the file-system directly. + * @author Peter (Somogyvari) Metz + */ + +"use strict"; + +/* eslint sort-keys: ["error", "asc"] -- More readable for long list */ + +const { LazyLoadingRuleMap } = require("./utils/lazy-loading-rule-map"); + +/** @type {Map} */ +module.exports = new LazyLoadingRuleMap(Object.entries({ + "accessor-pairs": () => require("./accessor-pairs"), + "array-bracket-newline": () => require("./array-bracket-newline"), + "array-bracket-spacing": () => require("./array-bracket-spacing"), + "array-callback-return": () => require("./array-callback-return"), + "array-element-newline": () => require("./array-element-newline"), + "arrow-body-style": () => require("./arrow-body-style"), + "arrow-parens": () => require("./arrow-parens"), + "arrow-spacing": () => require("./arrow-spacing"), + "block-scoped-var": () => require("./block-scoped-var"), + "block-spacing": () => require("./block-spacing"), + "brace-style": () => require("./brace-style"), + "callback-return": () => require("./callback-return"), + camelcase: () => require("./camelcase"), + "capitalized-comments": () => require("./capitalized-comments"), + "class-methods-use-this": () => require("./class-methods-use-this"), + "comma-dangle": () => require("./comma-dangle"), + "comma-spacing": () => require("./comma-spacing"), + "comma-style": () => require("./comma-style"), + complexity: () => require("./complexity"), + "computed-property-spacing": () => require("./computed-property-spacing"), + "consistent-return": () => require("./consistent-return"), + "consistent-this": () => require("./consistent-this"), + "constructor-super": () => require("./constructor-super"), + curly: () => require("./curly"), + "default-case": () => require("./default-case"), + "default-case-last": () => require("./default-case-last"), + "default-param-last": () => require("./default-param-last"), + "dot-location": () => require("./dot-location"), + "dot-notation": () => require("./dot-notation"), + "eol-last": () => require("./eol-last"), + eqeqeq: () => require("./eqeqeq"), + "for-direction": () => require("./for-direction"), + "func-call-spacing": () => require("./func-call-spacing"), + "func-name-matching": () => require("./func-name-matching"), + "func-names": () => require("./func-names"), + "func-style": () => require("./func-style"), + "function-call-argument-newline": () => require("./function-call-argument-newline"), + "function-paren-newline": () => require("./function-paren-newline"), + "generator-star-spacing": () => require("./generator-star-spacing"), + "getter-return": () => require("./getter-return"), + "global-require": () => require("./global-require"), + "grouped-accessor-pairs": () => require("./grouped-accessor-pairs"), + "guard-for-in": () => require("./guard-for-in"), + "handle-callback-err": () => require("./handle-callback-err"), + "id-blacklist": () => require("./id-blacklist"), + "id-denylist": () => require("./id-denylist"), + "id-length": () => require("./id-length"), + "id-match": () => require("./id-match"), + "implicit-arrow-linebreak": () => require("./implicit-arrow-linebreak"), + indent: () => require("./indent"), + "indent-legacy": () => require("./indent-legacy"), + "init-declarations": () => require("./init-declarations"), + "jsx-quotes": () => require("./jsx-quotes"), + "key-spacing": () => require("./key-spacing"), + "keyword-spacing": () => require("./keyword-spacing"), + "line-comment-position": () => require("./line-comment-position"), + "linebreak-style": () => require("./linebreak-style"), + "lines-around-comment": () => require("./lines-around-comment"), + "lines-around-directive": () => require("./lines-around-directive"), + "lines-between-class-members": () => require("./lines-between-class-members"), + "max-classes-per-file": () => require("./max-classes-per-file"), + "max-depth": () => require("./max-depth"), + "max-len": () => require("./max-len"), + "max-lines": () => require("./max-lines"), + "max-lines-per-function": () => require("./max-lines-per-function"), + "max-nested-callbacks": () => require("./max-nested-callbacks"), + "max-params": () => require("./max-params"), + "max-statements": () => require("./max-statements"), + "max-statements-per-line": () => require("./max-statements-per-line"), + "multiline-comment-style": () => require("./multiline-comment-style"), + "multiline-ternary": () => require("./multiline-ternary"), + "new-cap": () => require("./new-cap"), + "new-parens": () => require("./new-parens"), + "newline-after-var": () => require("./newline-after-var"), + "newline-before-return": () => require("./newline-before-return"), + "newline-per-chained-call": () => require("./newline-per-chained-call"), + "no-alert": () => require("./no-alert"), + "no-array-constructor": () => require("./no-array-constructor"), + "no-async-promise-executor": () => require("./no-async-promise-executor"), + "no-await-in-loop": () => require("./no-await-in-loop"), + "no-bitwise": () => require("./no-bitwise"), + "no-buffer-constructor": () => require("./no-buffer-constructor"), + "no-caller": () => require("./no-caller"), + "no-case-declarations": () => require("./no-case-declarations"), + "no-catch-shadow": () => require("./no-catch-shadow"), + "no-class-assign": () => require("./no-class-assign"), + "no-compare-neg-zero": () => require("./no-compare-neg-zero"), + "no-cond-assign": () => require("./no-cond-assign"), + "no-confusing-arrow": () => require("./no-confusing-arrow"), + "no-console": () => require("./no-console"), + "no-const-assign": () => require("./no-const-assign"), + "no-constant-binary-expression": () => require("./no-constant-binary-expression"), + "no-constant-condition": () => require("./no-constant-condition"), + "no-constructor-return": () => require("./no-constructor-return"), + "no-continue": () => require("./no-continue"), + "no-control-regex": () => require("./no-control-regex"), + "no-debugger": () => require("./no-debugger"), + "no-delete-var": () => require("./no-delete-var"), + "no-div-regex": () => require("./no-div-regex"), + "no-dupe-args": () => require("./no-dupe-args"), + "no-dupe-class-members": () => require("./no-dupe-class-members"), + "no-dupe-else-if": () => require("./no-dupe-else-if"), + "no-dupe-keys": () => require("./no-dupe-keys"), + "no-duplicate-case": () => require("./no-duplicate-case"), + "no-duplicate-imports": () => require("./no-duplicate-imports"), + "no-else-return": () => require("./no-else-return"), + "no-empty": () => require("./no-empty"), + "no-empty-character-class": () => require("./no-empty-character-class"), + "no-empty-function": () => require("./no-empty-function"), + "no-empty-pattern": () => require("./no-empty-pattern"), + "no-eq-null": () => require("./no-eq-null"), + "no-eval": () => require("./no-eval"), + "no-ex-assign": () => require("./no-ex-assign"), + "no-extend-native": () => require("./no-extend-native"), + "no-extra-bind": () => require("./no-extra-bind"), + "no-extra-boolean-cast": () => require("./no-extra-boolean-cast"), + "no-extra-label": () => require("./no-extra-label"), + "no-extra-parens": () => require("./no-extra-parens"), + "no-extra-semi": () => require("./no-extra-semi"), + "no-fallthrough": () => require("./no-fallthrough"), + "no-floating-decimal": () => require("./no-floating-decimal"), + "no-func-assign": () => require("./no-func-assign"), + "no-global-assign": () => require("./no-global-assign"), + "no-implicit-coercion": () => require("./no-implicit-coercion"), + "no-implicit-globals": () => require("./no-implicit-globals"), + "no-implied-eval": () => require("./no-implied-eval"), + "no-import-assign": () => require("./no-import-assign"), + "no-inline-comments": () => require("./no-inline-comments"), + "no-inner-declarations": () => require("./no-inner-declarations"), + "no-invalid-regexp": () => require("./no-invalid-regexp"), + "no-invalid-this": () => require("./no-invalid-this"), + "no-irregular-whitespace": () => require("./no-irregular-whitespace"), + "no-iterator": () => require("./no-iterator"), + "no-label-var": () => require("./no-label-var"), + "no-labels": () => require("./no-labels"), + "no-lone-blocks": () => require("./no-lone-blocks"), + "no-lonely-if": () => require("./no-lonely-if"), + "no-loop-func": () => require("./no-loop-func"), + "no-loss-of-precision": () => require("./no-loss-of-precision"), + "no-magic-numbers": () => require("./no-magic-numbers"), + "no-misleading-character-class": () => require("./no-misleading-character-class"), + "no-mixed-operators": () => require("./no-mixed-operators"), + "no-mixed-requires": () => require("./no-mixed-requires"), + "no-mixed-spaces-and-tabs": () => require("./no-mixed-spaces-and-tabs"), + "no-multi-assign": () => require("./no-multi-assign"), + "no-multi-spaces": () => require("./no-multi-spaces"), + "no-multi-str": () => require("./no-multi-str"), + "no-multiple-empty-lines": () => require("./no-multiple-empty-lines"), + "no-native-reassign": () => require("./no-native-reassign"), + "no-negated-condition": () => require("./no-negated-condition"), + "no-negated-in-lhs": () => require("./no-negated-in-lhs"), + "no-nested-ternary": () => require("./no-nested-ternary"), + "no-new": () => require("./no-new"), + "no-new-func": () => require("./no-new-func"), + "no-new-object": () => require("./no-new-object"), + "no-new-require": () => require("./no-new-require"), + "no-new-symbol": () => require("./no-new-symbol"), + "no-new-wrappers": () => require("./no-new-wrappers"), + "no-nonoctal-decimal-escape": () => require("./no-nonoctal-decimal-escape"), + "no-obj-calls": () => require("./no-obj-calls"), + "no-octal": () => require("./no-octal"), + "no-octal-escape": () => require("./no-octal-escape"), + "no-param-reassign": () => require("./no-param-reassign"), + "no-path-concat": () => require("./no-path-concat"), + "no-plusplus": () => require("./no-plusplus"), + "no-process-env": () => require("./no-process-env"), + "no-process-exit": () => require("./no-process-exit"), + "no-promise-executor-return": () => require("./no-promise-executor-return"), + "no-proto": () => require("./no-proto"), + "no-prototype-builtins": () => require("./no-prototype-builtins"), + "no-redeclare": () => require("./no-redeclare"), + "no-regex-spaces": () => require("./no-regex-spaces"), + "no-restricted-exports": () => require("./no-restricted-exports"), + "no-restricted-globals": () => require("./no-restricted-globals"), + "no-restricted-imports": () => require("./no-restricted-imports"), + "no-restricted-modules": () => require("./no-restricted-modules"), + "no-restricted-properties": () => require("./no-restricted-properties"), + "no-restricted-syntax": () => require("./no-restricted-syntax"), + "no-return-assign": () => require("./no-return-assign"), + "no-return-await": () => require("./no-return-await"), + "no-script-url": () => require("./no-script-url"), + "no-self-assign": () => require("./no-self-assign"), + "no-self-compare": () => require("./no-self-compare"), + "no-sequences": () => require("./no-sequences"), + "no-setter-return": () => require("./no-setter-return"), + "no-shadow": () => require("./no-shadow"), + "no-shadow-restricted-names": () => require("./no-shadow-restricted-names"), + "no-spaced-func": () => require("./no-spaced-func"), + "no-sparse-arrays": () => require("./no-sparse-arrays"), + "no-sync": () => require("./no-sync"), + "no-tabs": () => require("./no-tabs"), + "no-template-curly-in-string": () => require("./no-template-curly-in-string"), + "no-ternary": () => require("./no-ternary"), + "no-this-before-super": () => require("./no-this-before-super"), + "no-throw-literal": () => require("./no-throw-literal"), + "no-trailing-spaces": () => require("./no-trailing-spaces"), + "no-undef": () => require("./no-undef"), + "no-undef-init": () => require("./no-undef-init"), + "no-undefined": () => require("./no-undefined"), + "no-underscore-dangle": () => require("./no-underscore-dangle"), + "no-unexpected-multiline": () => require("./no-unexpected-multiline"), + "no-unmodified-loop-condition": () => require("./no-unmodified-loop-condition"), + "no-unneeded-ternary": () => require("./no-unneeded-ternary"), + "no-unreachable": () => require("./no-unreachable"), + "no-unreachable-loop": () => require("./no-unreachable-loop"), + "no-unsafe-finally": () => require("./no-unsafe-finally"), + "no-unsafe-negation": () => require("./no-unsafe-negation"), + "no-unsafe-optional-chaining": () => require("./no-unsafe-optional-chaining"), + "no-unused-expressions": () => require("./no-unused-expressions"), + "no-unused-labels": () => require("./no-unused-labels"), + "no-unused-private-class-members": () => require("./no-unused-private-class-members"), + "no-unused-vars": () => require("./no-unused-vars"), + "no-use-before-define": () => require("./no-use-before-define"), + "no-useless-backreference": () => require("./no-useless-backreference"), + "no-useless-call": () => require("./no-useless-call"), + "no-useless-catch": () => require("./no-useless-catch"), + "no-useless-computed-key": () => require("./no-useless-computed-key"), + "no-useless-concat": () => require("./no-useless-concat"), + "no-useless-constructor": () => require("./no-useless-constructor"), + "no-useless-escape": () => require("./no-useless-escape"), + "no-useless-rename": () => require("./no-useless-rename"), + "no-useless-return": () => require("./no-useless-return"), + "no-var": () => require("./no-var"), + "no-void": () => require("./no-void"), + "no-warning-comments": () => require("./no-warning-comments"), + "no-whitespace-before-property": () => require("./no-whitespace-before-property"), + "no-with": () => require("./no-with"), + "nonblock-statement-body-position": () => require("./nonblock-statement-body-position"), + "object-curly-newline": () => require("./object-curly-newline"), + "object-curly-spacing": () => require("./object-curly-spacing"), + "object-property-newline": () => require("./object-property-newline"), + "object-shorthand": () => require("./object-shorthand"), + "one-var": () => require("./one-var"), + "one-var-declaration-per-line": () => require("./one-var-declaration-per-line"), + "operator-assignment": () => require("./operator-assignment"), + "operator-linebreak": () => require("./operator-linebreak"), + "padded-blocks": () => require("./padded-blocks"), + "padding-line-between-statements": () => require("./padding-line-between-statements"), + "prefer-arrow-callback": () => require("./prefer-arrow-callback"), + "prefer-const": () => require("./prefer-const"), + "prefer-destructuring": () => require("./prefer-destructuring"), + "prefer-exponentiation-operator": () => require("./prefer-exponentiation-operator"), + "prefer-named-capture-group": () => require("./prefer-named-capture-group"), + "prefer-numeric-literals": () => require("./prefer-numeric-literals"), + "prefer-object-has-own": () => require("./prefer-object-has-own"), + "prefer-object-spread": () => require("./prefer-object-spread"), + "prefer-promise-reject-errors": () => require("./prefer-promise-reject-errors"), + "prefer-reflect": () => require("./prefer-reflect"), + "prefer-regex-literals": () => require("./prefer-regex-literals"), + "prefer-rest-params": () => require("./prefer-rest-params"), + "prefer-spread": () => require("./prefer-spread"), + "prefer-template": () => require("./prefer-template"), + "quote-props": () => require("./quote-props"), + quotes: () => require("./quotes"), + radix: () => require("./radix"), + "require-atomic-updates": () => require("./require-atomic-updates"), + "require-await": () => require("./require-await"), + "require-jsdoc": () => require("./require-jsdoc"), + "require-unicode-regexp": () => require("./require-unicode-regexp"), + "require-yield": () => require("./require-yield"), + "rest-spread-spacing": () => require("./rest-spread-spacing"), + semi: () => require("./semi"), + "semi-spacing": () => require("./semi-spacing"), + "semi-style": () => require("./semi-style"), + "sort-imports": () => require("./sort-imports"), + "sort-keys": () => require("./sort-keys"), + "sort-vars": () => require("./sort-vars"), + "space-before-blocks": () => require("./space-before-blocks"), + "space-before-function-paren": () => require("./space-before-function-paren"), + "space-in-parens": () => require("./space-in-parens"), + "space-infix-ops": () => require("./space-infix-ops"), + "space-unary-ops": () => require("./space-unary-ops"), + "spaced-comment": () => require("./spaced-comment"), + strict: () => require("./strict"), + "switch-colon-spacing": () => require("./switch-colon-spacing"), + "symbol-description": () => require("./symbol-description"), + "template-curly-spacing": () => require("./template-curly-spacing"), + "template-tag-spacing": () => require("./template-tag-spacing"), + "unicode-bom": () => require("./unicode-bom"), + "use-isnan": () => require("./use-isnan"), + "valid-jsdoc": () => require("./valid-jsdoc"), + "valid-typeof": () => require("./valid-typeof"), + "vars-on-top": () => require("./vars-on-top"), + "wrap-iife": () => require("./wrap-iife"), + "wrap-regex": () => require("./wrap-regex"), + "yield-star-spacing": () => require("./yield-star-spacing"), + yoda: () => require("./yoda") +})); diff --git a/node_modules/eslint/lib/rules/init-declarations.js b/node_modules/eslint/lib/rules/init-declarations.js new file mode 100644 index 0000000..d952b89 --- /dev/null +++ b/node_modules/eslint/lib/rules/init-declarations.js @@ -0,0 +1,139 @@ +/** + * @fileoverview A rule to control the style of variable initializations. + * @author Colin Ihrig + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given node is a for loop. + * @param {ASTNode} block A node to check. + * @returns {boolean} `true` when the node is a for loop. + */ +function isForLoop(block) { + return block.type === "ForInStatement" || + block.type === "ForOfStatement" || + block.type === "ForStatement"; +} + +/** + * Checks whether or not a given declarator node has its initializer. + * @param {ASTNode} node A declarator node to check. + * @returns {boolean} `true` when the node has its initializer. + */ +function isInitialized(node) { + const declaration = node.parent; + const block = declaration.parent; + + if (isForLoop(block)) { + if (block.type === "ForStatement") { + return block.init === declaration; + } + return block.left === declaration; + } + return Boolean(node.init); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow initialization in variable declarations", + recommended: false, + url: "https://eslint.org/docs/rules/init-declarations" + }, + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["never"] + }, + { + type: "object", + properties: { + ignoreForLoopInit: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + messages: { + initialized: "Variable '{{idName}}' should be initialized on declaration.", + notInitialized: "Variable '{{idName}}' should not be initialized on declaration." + } + }, + + create(context) { + + const MODE_ALWAYS = "always", + MODE_NEVER = "never"; + + const mode = context.options[0] || MODE_ALWAYS; + const params = context.options[1] || {}; + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "VariableDeclaration:exit"(node) { + + const kind = node.kind, + declarations = node.declarations; + + for (let i = 0; i < declarations.length; ++i) { + const declaration = declarations[i], + id = declaration.id, + initialized = isInitialized(declaration), + isIgnoredForLoop = params.ignoreForLoopInit && isForLoop(node.parent); + let messageId = ""; + + if (mode === MODE_ALWAYS && !initialized) { + messageId = "initialized"; + } else if (mode === MODE_NEVER && kind !== "const" && initialized && !isIgnoredForLoop) { + messageId = "notInitialized"; + } + + if (id.type === "Identifier" && messageId) { + context.report({ + node: declaration, + messageId, + data: { + idName: id.name + } + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/jsx-quotes.js b/node_modules/eslint/lib/rules/jsx-quotes.js new file mode 100644 index 0000000..f63dfd6 --- /dev/null +++ b/node_modules/eslint/lib/rules/jsx-quotes.js @@ -0,0 +1,95 @@ +/** + * @fileoverview A rule to ensure consistent quotes used in jsx syntax. + * @author Mathias Schreck + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const QUOTE_SETTINGS = { + "prefer-double": { + quote: "\"", + description: "singlequote", + convert(str) { + return str.replace(/'/gu, "\""); + } + }, + "prefer-single": { + quote: "'", + description: "doublequote", + convert(str) { + return str.replace(/"/gu, "'"); + } + } +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce the consistent use of either double or single quotes in JSX attributes", + recommended: false, + url: "https://eslint.org/docs/rules/jsx-quotes" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["prefer-single", "prefer-double"] + } + ], + messages: { + unexpected: "Unexpected usage of {{description}}." + } + }, + + create(context) { + const quoteOption = context.options[0] || "prefer-double", + setting = QUOTE_SETTINGS[quoteOption]; + + /** + * Checks if the given string literal node uses the expected quotes + * @param {ASTNode} node A string literal node. + * @returns {boolean} Whether or not the string literal used the expected quotes. + * @public + */ + function usesExpectedQuotes(node) { + return node.value.includes(setting.quote) || astUtils.isSurroundedBy(node.raw, setting.quote); + } + + return { + JSXAttribute(node) { + const attributeValue = node.value; + + if (attributeValue && astUtils.isStringLiteral(attributeValue) && !usesExpectedQuotes(attributeValue)) { + context.report({ + node: attributeValue, + messageId: "unexpected", + data: { + description: setting.description + }, + fix(fixer) { + return fixer.replaceText(attributeValue, setting.convert(attributeValue.raw)); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/key-spacing.js b/node_modules/eslint/lib/rules/key-spacing.js new file mode 100644 index 0000000..ce8bad5 --- /dev/null +++ b/node_modules/eslint/lib/rules/key-spacing.js @@ -0,0 +1,675 @@ +/** + * @fileoverview Rule to specify spacing of object literal keys and values + * @author Brandon Mills + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether a string contains a line terminator as defined in + * http://www.ecma-international.org/ecma-262/5.1/#sec-7.3 + * @param {string} str String to test. + * @returns {boolean} True if str contains a line terminator. + */ +function containsLineTerminator(str) { + return astUtils.LINEBREAK_MATCHER.test(str); +} + +/** + * Gets the last element of an array. + * @param {Array} arr An array. + * @returns {any} Last element of arr. + */ +function last(arr) { + return arr[arr.length - 1]; +} + +/** + * Checks whether a node is contained on a single line. + * @param {ASTNode} node AST Node being evaluated. + * @returns {boolean} True if the node is a single line. + */ +function isSingleLine(node) { + return (node.loc.end.line === node.loc.start.line); +} + +/** + * Checks whether the properties on a single line. + * @param {ASTNode[]} properties List of Property AST nodes. + * @returns {boolean} True if all properties is on a single line. + */ +function isSingleLineProperties(properties) { + const [firstProp] = properties, + lastProp = last(properties); + + return firstProp.loc.start.line === lastProp.loc.end.line; +} + +/** + * Initializes a single option property from the configuration with defaults for undefined values + * @param {Object} toOptions Object to be initialized + * @param {Object} fromOptions Object to be initialized from + * @returns {Object} The object with correctly initialized options and values + */ +function initOptionProperty(toOptions, fromOptions) { + toOptions.mode = fromOptions.mode || "strict"; + + // Set value of beforeColon + if (typeof fromOptions.beforeColon !== "undefined") { + toOptions.beforeColon = +fromOptions.beforeColon; + } else { + toOptions.beforeColon = 0; + } + + // Set value of afterColon + if (typeof fromOptions.afterColon !== "undefined") { + toOptions.afterColon = +fromOptions.afterColon; + } else { + toOptions.afterColon = 1; + } + + // Set align if exists + if (typeof fromOptions.align !== "undefined") { + if (typeof fromOptions.align === "object") { + toOptions.align = fromOptions.align; + } else { // "string" + toOptions.align = { + on: fromOptions.align, + mode: toOptions.mode, + beforeColon: toOptions.beforeColon, + afterColon: toOptions.afterColon + }; + } + } + + return toOptions; +} + +/** + * Initializes all the option values (singleLine, multiLine and align) from the configuration with defaults for undefined values + * @param {Object} toOptions Object to be initialized + * @param {Object} fromOptions Object to be initialized from + * @returns {Object} The object with correctly initialized options and values + */ +function initOptions(toOptions, fromOptions) { + if (typeof fromOptions.align === "object") { + + // Initialize the alignment configuration + toOptions.align = initOptionProperty({}, fromOptions.align); + toOptions.align.on = fromOptions.align.on || "colon"; + toOptions.align.mode = fromOptions.align.mode || "strict"; + + toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); + toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); + + } else { // string or undefined + toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); + toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); + + // If alignment options are defined in multiLine, pull them out into the general align configuration + if (toOptions.multiLine.align) { + toOptions.align = { + on: toOptions.multiLine.align.on, + mode: toOptions.multiLine.align.mode || toOptions.multiLine.mode, + beforeColon: toOptions.multiLine.align.beforeColon, + afterColon: toOptions.multiLine.align.afterColon + }; + } + } + + return toOptions; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing between keys and values in object literal properties", + recommended: false, + url: "https://eslint.org/docs/rules/key-spacing" + }, + + fixable: "whitespace", + + schema: [{ + anyOf: [ + { + type: "object", + properties: { + align: { + anyOf: [ + { + enum: ["colon", "value"] + }, + { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + on: { + enum: ["colon", "value"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + }, + mode: { + enum: ["strict", "minimum"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + }, + { + type: "object", + properties: { + singleLine: { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + }, + multiLine: { + type: "object", + properties: { + align: { + anyOf: [ + { + enum: ["colon", "value"] + }, + { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + on: { + enum: ["colon", "value"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + }, + mode: { + enum: ["strict", "minimum"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + } + }, + additionalProperties: false + }, + { + type: "object", + properties: { + singleLine: { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + }, + multiLine: { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + }, + align: { + type: "object", + properties: { + mode: { + enum: ["strict", "minimum"] + }, + on: { + enum: ["colon", "value"] + }, + beforeColon: { + type: "boolean" + }, + afterColon: { + type: "boolean" + } + }, + additionalProperties: false + } + }, + additionalProperties: false + } + ] + }], + messages: { + extraKey: "Extra space after {{computed}}key '{{key}}'.", + extraValue: "Extra space before value for {{computed}}key '{{key}}'.", + missingKey: "Missing space after {{computed}}key '{{key}}'.", + missingValue: "Missing space before value for {{computed}}key '{{key}}'." + } + }, + + create(context) { + + /** + * OPTIONS + * "key-spacing": [2, { + * beforeColon: false, + * afterColon: true, + * align: "colon" // Optional, or "value" + * } + */ + const options = context.options[0] || {}, + ruleOptions = initOptions({}, options), + multiLineOptions = ruleOptions.multiLine, + singleLineOptions = ruleOptions.singleLine, + alignmentOptions = ruleOptions.align || null; + + const sourceCode = context.getSourceCode(); + + /** + * Checks whether a property is a member of the property group it follows. + * @param {ASTNode} lastMember The last Property known to be in the group. + * @param {ASTNode} candidate The next Property that might be in the group. + * @returns {boolean} True if the candidate property is part of the group. + */ + function continuesPropertyGroup(lastMember, candidate) { + const groupEndLine = lastMember.loc.start.line, + candidateStartLine = candidate.loc.start.line; + + if (candidateStartLine - groupEndLine <= 1) { + return true; + } + + /* + * Check that the first comment is adjacent to the end of the group, the + * last comment is adjacent to the candidate property, and that successive + * comments are adjacent to each other. + */ + const leadingComments = sourceCode.getCommentsBefore(candidate); + + if ( + leadingComments.length && + leadingComments[0].loc.start.line - groupEndLine <= 1 && + candidateStartLine - last(leadingComments).loc.end.line <= 1 + ) { + for (let i = 1; i < leadingComments.length; i++) { + if (leadingComments[i].loc.start.line - leadingComments[i - 1].loc.end.line > 1) { + return false; + } + } + return true; + } + + return false; + } + + /** + * Determines if the given property is key-value property. + * @param {ASTNode} property Property node to check. + * @returns {boolean} Whether the property is a key-value property. + */ + function isKeyValueProperty(property) { + return !( + (property.method || + property.shorthand || + property.kind !== "init" || property.type !== "Property") // Could be "ExperimentalSpreadProperty" or "SpreadElement" + ); + } + + /** + * Starting from the given a node (a property.key node here) looks forward + * until it finds the last token before a colon punctuator and returns it. + * @param {ASTNode} node The node to start looking from. + * @returns {ASTNode} The last token before a colon punctuator. + */ + function getLastTokenBeforeColon(node) { + const colonToken = sourceCode.getTokenAfter(node, astUtils.isColonToken); + + return sourceCode.getTokenBefore(colonToken); + } + + /** + * Starting from the given a node (a property.key node here) looks forward + * until it finds the colon punctuator and returns it. + * @param {ASTNode} node The node to start looking from. + * @returns {ASTNode} The colon punctuator. + */ + function getNextColon(node) { + return sourceCode.getTokenAfter(node, astUtils.isColonToken); + } + + /** + * Gets an object literal property's key as the identifier name or string value. + * @param {ASTNode} property Property node whose key to retrieve. + * @returns {string} The property's key. + */ + function getKey(property) { + const key = property.key; + + if (property.computed) { + return sourceCode.getText().slice(key.range[0], key.range[1]); + } + return astUtils.getStaticPropertyName(property); + } + + /** + * Reports an appropriately-formatted error if spacing is incorrect on one + * side of the colon. + * @param {ASTNode} property Key-value pair in an object literal. + * @param {string} side Side being verified - either "key" or "value". + * @param {string} whitespace Actual whitespace string. + * @param {int} expected Expected whitespace length. + * @param {string} mode Value of the mode as "strict" or "minimum" + * @returns {void} + */ + function report(property, side, whitespace, expected, mode) { + const diff = whitespace.length - expected; + + if (( + diff && mode === "strict" || + diff < 0 && mode === "minimum" || + diff > 0 && !expected && mode === "minimum") && + !(expected && containsLineTerminator(whitespace)) + ) { + const nextColon = getNextColon(property.key), + tokenBeforeColon = sourceCode.getTokenBefore(nextColon, { includeComments: true }), + tokenAfterColon = sourceCode.getTokenAfter(nextColon, { includeComments: true }), + isKeySide = side === "key", + isExtra = diff > 0, + diffAbs = Math.abs(diff), + spaces = Array(diffAbs + 1).join(" "); + + const locStart = isKeySide ? tokenBeforeColon.loc.end : nextColon.loc.start; + const locEnd = isKeySide ? nextColon.loc.start : tokenAfterColon.loc.start; + const missingLoc = isKeySide ? tokenBeforeColon.loc : tokenAfterColon.loc; + const loc = isExtra ? { start: locStart, end: locEnd } : missingLoc; + + let fix; + + if (isExtra) { + let range; + + // Remove whitespace + if (isKeySide) { + range = [tokenBeforeColon.range[1], tokenBeforeColon.range[1] + diffAbs]; + } else { + range = [tokenAfterColon.range[0] - diffAbs, tokenAfterColon.range[0]]; + } + fix = function(fixer) { + return fixer.removeRange(range); + }; + } else { + + // Add whitespace + if (isKeySide) { + fix = function(fixer) { + return fixer.insertTextAfter(tokenBeforeColon, spaces); + }; + } else { + fix = function(fixer) { + return fixer.insertTextBefore(tokenAfterColon, spaces); + }; + } + } + + let messageId = ""; + + if (isExtra) { + messageId = side === "key" ? "extraKey" : "extraValue"; + } else { + messageId = side === "key" ? "missingKey" : "missingValue"; + } + + context.report({ + node: property[side], + loc, + messageId, + data: { + computed: property.computed ? "computed " : "", + key: getKey(property) + }, + fix + }); + } + } + + /** + * Gets the number of characters in a key, including quotes around string + * keys and braces around computed property keys. + * @param {ASTNode} property Property of on object literal. + * @returns {int} Width of the key. + */ + function getKeyWidth(property) { + const startToken = sourceCode.getFirstToken(property); + const endToken = getLastTokenBeforeColon(property.key); + + return endToken.range[1] - startToken.range[0]; + } + + /** + * Gets the whitespace around the colon in an object literal property. + * @param {ASTNode} property Property node from an object literal. + * @returns {Object} Whitespace before and after the property's colon. + */ + function getPropertyWhitespace(property) { + const whitespace = /(\s*):(\s*)/u.exec(sourceCode.getText().slice( + property.key.range[1], property.value.range[0] + )); + + if (whitespace) { + return { + beforeColon: whitespace[1], + afterColon: whitespace[2] + }; + } + return null; + } + + /** + * Creates groups of properties. + * @param {ASTNode} node ObjectExpression node being evaluated. + * @returns {Array} Groups of property AST node lists. + */ + function createGroups(node) { + if (node.properties.length === 1) { + return [node.properties]; + } + + return node.properties.reduce((groups, property) => { + const currentGroup = last(groups), + prev = last(currentGroup); + + if (!prev || continuesPropertyGroup(prev, property)) { + currentGroup.push(property); + } else { + groups.push([property]); + } + + return groups; + }, [ + [] + ]); + } + + /** + * Verifies correct vertical alignment of a group of properties. + * @param {ASTNode[]} properties List of Property AST nodes. + * @returns {void} + */ + function verifyGroupAlignment(properties) { + const length = properties.length, + widths = properties.map(getKeyWidth), // Width of keys, including quotes + align = alignmentOptions.on; // "value" or "colon" + let targetWidth = Math.max(...widths), + beforeColon, afterColon, mode; + + if (alignmentOptions && length > 1) { // When aligning values within a group, use the alignment configuration. + beforeColon = alignmentOptions.beforeColon; + afterColon = alignmentOptions.afterColon; + mode = alignmentOptions.mode; + } else { + beforeColon = multiLineOptions.beforeColon; + afterColon = multiLineOptions.afterColon; + mode = alignmentOptions.mode; + } + + // Conditionally include one space before or after colon + targetWidth += (align === "colon" ? beforeColon : afterColon); + + for (let i = 0; i < length; i++) { + const property = properties[i]; + const whitespace = getPropertyWhitespace(property); + + if (whitespace) { // Object literal getters/setters lack a colon + const width = widths[i]; + + if (align === "value") { + report(property, "key", whitespace.beforeColon, beforeColon, mode); + report(property, "value", whitespace.afterColon, targetWidth - width, mode); + } else { // align = "colon" + report(property, "key", whitespace.beforeColon, targetWidth - width, mode); + report(property, "value", whitespace.afterColon, afterColon, mode); + } + } + } + } + + /** + * Verifies spacing of property conforms to specified options. + * @param {ASTNode} node Property node being evaluated. + * @param {Object} lineOptions Configured singleLine or multiLine options + * @returns {void} + */ + function verifySpacing(node, lineOptions) { + const actual = getPropertyWhitespace(node); + + if (actual) { // Object literal getters/setters lack colons + report(node, "key", actual.beforeColon, lineOptions.beforeColon, lineOptions.mode); + report(node, "value", actual.afterColon, lineOptions.afterColon, lineOptions.mode); + } + } + + /** + * Verifies spacing of each property in a list. + * @param {ASTNode[]} properties List of Property AST nodes. + * @param {Object} lineOptions Configured singleLine or multiLine options + * @returns {void} + */ + function verifyListSpacing(properties, lineOptions) { + const length = properties.length; + + for (let i = 0; i < length; i++) { + verifySpacing(properties[i], lineOptions); + } + } + + /** + * Verifies vertical alignment, taking into account groups of properties. + * @param {ASTNode} node ObjectExpression node being evaluated. + * @returns {void} + */ + function verifyAlignment(node) { + createGroups(node).forEach(group => { + const properties = group.filter(isKeyValueProperty); + + if (properties.length > 0 && isSingleLineProperties(properties)) { + verifyListSpacing(properties, multiLineOptions); + } else { + verifyGroupAlignment(properties); + } + }); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + if (alignmentOptions) { // Verify vertical alignment + + return { + ObjectExpression(node) { + if (isSingleLine(node)) { + verifyListSpacing(node.properties.filter(isKeyValueProperty), singleLineOptions); + } else { + verifyAlignment(node); + } + } + }; + + } + + // Obey beforeColon and afterColon in each property as configured + return { + Property(node) { + verifySpacing(node, isSingleLine(node.parent) ? singleLineOptions : multiLineOptions); + } + }; + + + } +}; diff --git a/node_modules/eslint/lib/rules/keyword-spacing.js b/node_modules/eslint/lib/rules/keyword-spacing.js new file mode 100644 index 0000000..16a65d7 --- /dev/null +++ b/node_modules/eslint/lib/rules/keyword-spacing.js @@ -0,0 +1,637 @@ +/** + * @fileoverview Rule to enforce spacing before and after keywords. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"), + keywords = require("./utils/keywords"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const PREV_TOKEN = /^[)\]}>]$/u; +const NEXT_TOKEN = /^(?:[([{<~!]|\+\+?|--?)$/u; +const PREV_TOKEN_M = /^[)\]}>*]$/u; +const NEXT_TOKEN_M = /^[{*]$/u; +const TEMPLATE_OPEN_PAREN = /\$\{$/u; +const TEMPLATE_CLOSE_PAREN = /^\}/u; +const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template|PrivateIdentifier)$/u; +const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of", "set", "yield"]); + +// check duplications. +(function() { + KEYS.sort(); + for (let i = 1; i < KEYS.length; ++i) { + if (KEYS[i] === KEYS[i - 1]) { + throw new Error(`Duplication was found in the keyword list: ${KEYS[i]}`); + } + } +}()); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given token is a "Template" token ends with "${". + * @param {Token} token A token to check. + * @returns {boolean} `true` if the token is a "Template" token ends with "${". + */ +function isOpenParenOfTemplate(token) { + return token.type === "Template" && TEMPLATE_OPEN_PAREN.test(token.value); +} + +/** + * Checks whether or not a given token is a "Template" token starts with "}". + * @param {Token} token A token to check. + * @returns {boolean} `true` if the token is a "Template" token starts with "}". + */ +function isCloseParenOfTemplate(token) { + return token.type === "Template" && TEMPLATE_CLOSE_PAREN.test(token.value); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before and after keywords", + recommended: false, + url: "https://eslint.org/docs/rules/keyword-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + before: { type: "boolean", default: true }, + after: { type: "boolean", default: true }, + overrides: { + type: "object", + properties: KEYS.reduce((retv, key) => { + retv[key] = { + type: "object", + properties: { + before: { type: "boolean" }, + after: { type: "boolean" } + }, + additionalProperties: false + }; + return retv; + }, {}), + additionalProperties: false + } + }, + additionalProperties: false + } + ], + messages: { + expectedBefore: "Expected space(s) before \"{{value}}\".", + expectedAfter: "Expected space(s) after \"{{value}}\".", + unexpectedBefore: "Unexpected space(s) before \"{{value}}\".", + unexpectedAfter: "Unexpected space(s) after \"{{value}}\"." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const tokensToIgnore = new WeakSet(); + + /** + * Reports a given token if there are not space(s) before the token. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. + * @returns {void} + */ + function expectSpaceBefore(token, pattern) { + const prevToken = sourceCode.getTokenBefore(token); + + if (prevToken && + (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && + !isOpenParenOfTemplate(prevToken) && + !tokensToIgnore.has(prevToken) && + astUtils.isTokenOnSameLine(prevToken, token) && + !sourceCode.isSpaceBetweenTokens(prevToken, token) + ) { + context.report({ + loc: token.loc, + messageId: "expectedBefore", + data: token, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + } + + /** + * Reports a given token if there are space(s) before the token. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. + * @returns {void} + */ + function unexpectSpaceBefore(token, pattern) { + const prevToken = sourceCode.getTokenBefore(token); + + if (prevToken && + (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && + !isOpenParenOfTemplate(prevToken) && + !tokensToIgnore.has(prevToken) && + astUtils.isTokenOnSameLine(prevToken, token) && + sourceCode.isSpaceBetweenTokens(prevToken, token) + ) { + context.report({ + loc: { start: prevToken.loc.end, end: token.loc.start }, + messageId: "unexpectedBefore", + data: token, + fix(fixer) { + return fixer.removeRange([prevToken.range[1], token.range[0]]); + } + }); + } + } + + /** + * Reports a given token if there are not space(s) after the token. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. + * @returns {void} + */ + function expectSpaceAfter(token, pattern) { + const nextToken = sourceCode.getTokenAfter(token); + + if (nextToken && + (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && + !isCloseParenOfTemplate(nextToken) && + !tokensToIgnore.has(nextToken) && + astUtils.isTokenOnSameLine(token, nextToken) && + !sourceCode.isSpaceBetweenTokens(token, nextToken) + ) { + context.report({ + loc: token.loc, + messageId: "expectedAfter", + data: token, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + } + + /** + * Reports a given token if there are space(s) after the token. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. + * @returns {void} + */ + function unexpectSpaceAfter(token, pattern) { + const nextToken = sourceCode.getTokenAfter(token); + + if (nextToken && + (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && + !isCloseParenOfTemplate(nextToken) && + !tokensToIgnore.has(nextToken) && + astUtils.isTokenOnSameLine(token, nextToken) && + sourceCode.isSpaceBetweenTokens(token, nextToken) + ) { + + context.report({ + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "unexpectedAfter", + data: token, + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + } + + /** + * Parses the option object and determines check methods for each keyword. + * @param {Object|undefined} options The option object to parse. + * @returns {Object} - Normalized option object. + * Keys are keywords (there are for every keyword). + * Values are instances of `{"before": function, "after": function}`. + */ + function parseOptions(options = {}) { + const before = options.before !== false; + const after = options.after !== false; + const defaultValue = { + before: before ? expectSpaceBefore : unexpectSpaceBefore, + after: after ? expectSpaceAfter : unexpectSpaceAfter + }; + const overrides = (options && options.overrides) || {}; + const retv = Object.create(null); + + for (let i = 0; i < KEYS.length; ++i) { + const key = KEYS[i]; + const override = overrides[key]; + + if (override) { + const thisBefore = ("before" in override) ? override.before : before; + const thisAfter = ("after" in override) ? override.after : after; + + retv[key] = { + before: thisBefore ? expectSpaceBefore : unexpectSpaceBefore, + after: thisAfter ? expectSpaceAfter : unexpectSpaceAfter + }; + } else { + retv[key] = defaultValue; + } + } + + return retv; + } + + const checkMethodMap = parseOptions(context.options[0]); + + /** + * Reports a given token if usage of spacing followed by the token is + * invalid. + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the previous + * token to check. + * @returns {void} + */ + function checkSpacingBefore(token, pattern) { + checkMethodMap[token.value].before(token, pattern || PREV_TOKEN); + } + + /** + * Reports a given token if usage of spacing preceded by the token is + * invalid. + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the next + * token to check. + * @returns {void} + */ + function checkSpacingAfter(token, pattern) { + checkMethodMap[token.value].after(token, pattern || NEXT_TOKEN); + } + + /** + * Reports a given token if usage of spacing around the token is invalid. + * @param {Token} token A token to report. + * @returns {void} + */ + function checkSpacingAround(token) { + checkSpacingBefore(token); + checkSpacingAfter(token); + } + + /** + * Reports the first token of a given node if the first token is a keyword + * and usage of spacing around the token is invalid. + * @param {ASTNode|null} node A node to report. + * @returns {void} + */ + function checkSpacingAroundFirstToken(node) { + const firstToken = node && sourceCode.getFirstToken(node); + + if (firstToken && firstToken.type === "Keyword") { + checkSpacingAround(firstToken); + } + } + + /** + * Reports the first token of a given node if the first token is a keyword + * and usage of spacing followed by the token is invalid. + * + * This is used for unary operators (e.g. `typeof`), `function`, and `super`. + * Other rules are handling usage of spacing preceded by those keywords. + * @param {ASTNode|null} node A node to report. + * @returns {void} + */ + function checkSpacingBeforeFirstToken(node) { + const firstToken = node && sourceCode.getFirstToken(node); + + if (firstToken && firstToken.type === "Keyword") { + checkSpacingBefore(firstToken); + } + } + + /** + * Reports the previous token of a given node if the token is a keyword and + * usage of spacing around the token is invalid. + * @param {ASTNode|null} node A node to report. + * @returns {void} + */ + function checkSpacingAroundTokenBefore(node) { + if (node) { + const token = sourceCode.getTokenBefore(node, astUtils.isKeywordToken); + + checkSpacingAround(token); + } + } + + /** + * Reports `async` or `function` keywords of a given node if usage of + * spacing around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForFunction(node) { + const firstToken = node && sourceCode.getFirstToken(node); + + if (firstToken && + ((firstToken.type === "Keyword" && firstToken.value === "function") || + firstToken.value === "async") + ) { + checkSpacingBefore(firstToken); + } + } + + /** + * Reports `class` and `extends` keywords of a given node if usage of + * spacing around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForClass(node) { + checkSpacingAroundFirstToken(node); + checkSpacingAroundTokenBefore(node.superClass); + } + + /** + * Reports `if` and `else` keywords of a given node if usage of spacing + * around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForIfStatement(node) { + checkSpacingAroundFirstToken(node); + checkSpacingAroundTokenBefore(node.alternate); + } + + /** + * Reports `try`, `catch`, and `finally` keywords of a given node if usage + * of spacing around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForTryStatement(node) { + checkSpacingAroundFirstToken(node); + checkSpacingAroundFirstToken(node.handler); + checkSpacingAroundTokenBefore(node.finalizer); + } + + /** + * Reports `do` and `while` keywords of a given node if usage of spacing + * around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForDoWhileStatement(node) { + checkSpacingAroundFirstToken(node); + checkSpacingAroundTokenBefore(node.test); + } + + /** + * Reports `for` and `in` keywords of a given node if usage of spacing + * around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForForInStatement(node) { + checkSpacingAroundFirstToken(node); + + const inToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(inToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(inToken); + } + + checkSpacingAfter(inToken); + } + + /** + * Reports `for` and `of` keywords of a given node if usage of spacing + * around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForForOfStatement(node) { + if (node.await) { + checkSpacingBefore(sourceCode.getFirstToken(node, 0)); + checkSpacingAfter(sourceCode.getFirstToken(node, 1)); + } else { + checkSpacingAroundFirstToken(node); + } + + const ofToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(ofToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(ofToken); + } + + checkSpacingAfter(ofToken); + } + + /** + * Reports `import`, `export`, `as`, and `from` keywords of a given node if + * usage of spacing around those keywords is invalid. + * + * This rule handles the `*` token in module declarations. + * + * import*as A from "./a"; /*error Expected space(s) after "import". + * error Expected space(s) before "as". + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForModuleDeclaration(node) { + const firstToken = sourceCode.getFirstToken(node); + + checkSpacingBefore(firstToken, PREV_TOKEN_M); + checkSpacingAfter(firstToken, NEXT_TOKEN_M); + + if (node.type === "ExportDefaultDeclaration") { + checkSpacingAround(sourceCode.getTokenAfter(firstToken)); + } + + if (node.type === "ExportAllDeclaration" && node.exported) { + const asToken = sourceCode.getTokenBefore(node.exported); + + checkSpacingBefore(asToken, PREV_TOKEN_M); + checkSpacingAfter(asToken, NEXT_TOKEN_M); + } + + if (node.source) { + const fromToken = sourceCode.getTokenBefore(node.source); + + checkSpacingBefore(fromToken, PREV_TOKEN_M); + checkSpacingAfter(fromToken, NEXT_TOKEN_M); + } + } + + /** + * Reports `as` keyword of a given node if usage of spacing around this + * keyword is invalid. + * @param {ASTNode} node An `ImportSpecifier` node to check. + * @returns {void} + */ + function checkSpacingForImportSpecifier(node) { + if (node.imported.range[0] !== node.local.range[0]) { + const asToken = sourceCode.getTokenBefore(node.local); + + checkSpacingBefore(asToken, PREV_TOKEN_M); + } + } + + /** + * Reports `as` keyword of a given node if usage of spacing around this + * keyword is invalid. + * @param {ASTNode} node An `ExportSpecifier` node to check. + * @returns {void} + */ + function checkSpacingForExportSpecifier(node) { + if (node.local.range[0] !== node.exported.range[0]) { + const asToken = sourceCode.getTokenBefore(node.exported); + + checkSpacingBefore(asToken, PREV_TOKEN_M); + checkSpacingAfter(asToken, NEXT_TOKEN_M); + } + } + + /** + * Reports `as` keyword of a given node if usage of spacing around this + * keyword is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForImportNamespaceSpecifier(node) { + const asToken = sourceCode.getFirstToken(node, 1); + + checkSpacingBefore(asToken, PREV_TOKEN_M); + } + + /** + * Reports `static`, `get`, and `set` keywords of a given node if usage of + * spacing around those keywords is invalid. + * @param {ASTNode} node A node to report. + * @throws {Error} If unable to find token get, set, or async beside method name. + * @returns {void} + */ + function checkSpacingForProperty(node) { + if (node.static) { + checkSpacingAroundFirstToken(node); + } + if (node.kind === "get" || + node.kind === "set" || + ( + (node.method || node.type === "MethodDefinition") && + node.value.async + ) + ) { + const token = sourceCode.getTokenBefore( + node.key, + tok => { + switch (tok.value) { + case "get": + case "set": + case "async": + return true; + default: + return false; + } + } + ); + + if (!token) { + throw new Error("Failed to find token get, set, or async beside method name"); + } + + + checkSpacingAround(token); + } + } + + /** + * Reports `await` keyword of a given node if usage of spacing before + * this keyword is invalid. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function checkSpacingForAwaitExpression(node) { + checkSpacingBefore(sourceCode.getFirstToken(node)); + } + + return { + + // Statements + DebuggerStatement: checkSpacingAroundFirstToken, + WithStatement: checkSpacingAroundFirstToken, + + // Statements - Control flow + BreakStatement: checkSpacingAroundFirstToken, + ContinueStatement: checkSpacingAroundFirstToken, + ReturnStatement: checkSpacingAroundFirstToken, + ThrowStatement: checkSpacingAroundFirstToken, + TryStatement: checkSpacingForTryStatement, + + // Statements - Choice + IfStatement: checkSpacingForIfStatement, + SwitchStatement: checkSpacingAroundFirstToken, + SwitchCase: checkSpacingAroundFirstToken, + + // Statements - Loops + DoWhileStatement: checkSpacingForDoWhileStatement, + ForInStatement: checkSpacingForForInStatement, + ForOfStatement: checkSpacingForForOfStatement, + ForStatement: checkSpacingAroundFirstToken, + WhileStatement: checkSpacingAroundFirstToken, + + // Statements - Declarations + ClassDeclaration: checkSpacingForClass, + ExportNamedDeclaration: checkSpacingForModuleDeclaration, + ExportDefaultDeclaration: checkSpacingForModuleDeclaration, + ExportAllDeclaration: checkSpacingForModuleDeclaration, + FunctionDeclaration: checkSpacingForFunction, + ImportDeclaration: checkSpacingForModuleDeclaration, + VariableDeclaration: checkSpacingAroundFirstToken, + + // Expressions + ArrowFunctionExpression: checkSpacingForFunction, + AwaitExpression: checkSpacingForAwaitExpression, + ClassExpression: checkSpacingForClass, + FunctionExpression: checkSpacingForFunction, + NewExpression: checkSpacingBeforeFirstToken, + Super: checkSpacingBeforeFirstToken, + ThisExpression: checkSpacingBeforeFirstToken, + UnaryExpression: checkSpacingBeforeFirstToken, + YieldExpression: checkSpacingBeforeFirstToken, + + // Others + ImportSpecifier: checkSpacingForImportSpecifier, + ExportSpecifier: checkSpacingForExportSpecifier, + ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier, + MethodDefinition: checkSpacingForProperty, + PropertyDefinition: checkSpacingForProperty, + StaticBlock: checkSpacingAroundFirstToken, + Property: checkSpacingForProperty, + + // To avoid conflicts with `space-infix-ops`, e.g. `a > this.b` + "BinaryExpression[operator='>']"(node) { + const operatorToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + + tokensToIgnore.add(operatorToken); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/line-comment-position.js b/node_modules/eslint/lib/rules/line-comment-position.js new file mode 100644 index 0000000..9ce2831 --- /dev/null +++ b/node_modules/eslint/lib/rules/line-comment-position.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Rule to enforce the position of line comments + * @author Alberto Rodríguez + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce position of line comments", + recommended: false, + url: "https://eslint.org/docs/rules/line-comment-position" + }, + + schema: [ + { + oneOf: [ + { + enum: ["above", "beside"] + }, + { + type: "object", + properties: { + position: { + enum: ["above", "beside"] + }, + ignorePattern: { + type: "string" + }, + applyDefaultPatterns: { + type: "boolean" + }, + applyDefaultIgnorePatterns: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + } + ], + messages: { + above: "Expected comment to be above code.", + beside: "Expected comment to be beside code." + } + }, + + create(context) { + const options = context.options[0]; + + let above, + ignorePattern, + applyDefaultIgnorePatterns = true; + + if (!options || typeof options === "string") { + above = !options || options === "above"; + + } else { + above = !options.position || options.position === "above"; + ignorePattern = options.ignorePattern; + + if (Object.prototype.hasOwnProperty.call(options, "applyDefaultIgnorePatterns")) { + applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns; + } else { + applyDefaultIgnorePatterns = options.applyDefaultPatterns !== false; + } + } + + const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN; + const fallThroughRegExp = /^\s*falls?\s?through/u; + const customIgnoreRegExp = new RegExp(ignorePattern, "u"); + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program() { + const comments = sourceCode.getAllComments(); + + comments.filter(token => token.type === "Line").forEach(node => { + if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) { + return; + } + + if (ignorePattern && customIgnoreRegExp.test(node.value)) { + return; + } + + const previous = sourceCode.getTokenBefore(node, { includeComments: true }); + const isOnSameLine = previous && previous.loc.end.line === node.loc.start.line; + + if (above) { + if (isOnSameLine) { + context.report({ + node, + messageId: "above" + }); + } + } else { + if (!isOnSameLine) { + context.report({ + node, + messageId: "beside" + }); + } + } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/linebreak-style.js b/node_modules/eslint/lib/rules/linebreak-style.js new file mode 100644 index 0000000..483788a --- /dev/null +++ b/node_modules/eslint/lib/rules/linebreak-style.js @@ -0,0 +1,105 @@ +/** + * @fileoverview Rule to enforce a single linebreak style. + * @author Erik Mueller + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent linebreak style", + recommended: false, + url: "https://eslint.org/docs/rules/linebreak-style" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["unix", "windows"] + } + ], + messages: { + expectedLF: "Expected linebreaks to be 'LF' but found 'CRLF'.", + expectedCRLF: "Expected linebreaks to be 'CRLF' but found 'LF'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Builds a fix function that replaces text at the specified range in the source text. + * @param {int[]} range The range to replace + * @param {string} text The text to insert. + * @returns {Function} Fixer function + * @private + */ + function createFix(range, text) { + return function(fixer) { + return fixer.replaceTextRange(range, text); + }; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program: function checkForLinebreakStyle(node) { + const linebreakStyle = context.options[0] || "unix", + expectedLF = linebreakStyle === "unix", + expectedLFChars = expectedLF ? "\n" : "\r\n", + source = sourceCode.getText(), + pattern = astUtils.createGlobalLinebreakMatcher(); + let match; + + let i = 0; + + while ((match = pattern.exec(source)) !== null) { + i++; + if (match[0] === expectedLFChars) { + continue; + } + + const index = match.index; + const range = [index, index + match[0].length]; + + context.report({ + node, + loc: { + start: { + line: i, + column: sourceCode.lines[i - 1].length + }, + end: { + line: i + 1, + column: 0 + } + }, + messageId: expectedLF ? "expectedLF" : "expectedCRLF", + fix: createFix(range, expectedLFChars) + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/lines-around-comment.js b/node_modules/eslint/lib/rules/lines-around-comment.js new file mode 100644 index 0000000..6b1cd5f --- /dev/null +++ b/node_modules/eslint/lib/rules/lines-around-comment.js @@ -0,0 +1,450 @@ +/** + * @fileoverview Enforces empty lines around comments. + * @author Jamund Ferguson + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Return an array with with any line numbers that are empty. + * @param {Array} lines An array of each line of the file. + * @returns {Array} An array of line numbers. + */ +function getEmptyLineNums(lines) { + const emptyLines = lines.map((line, i) => ({ + code: line.trim(), + num: i + 1 + })).filter(line => !line.code).map(line => line.num); + + return emptyLines; +} + +/** + * Return an array with with any line numbers that contain comments. + * @param {Array} comments An array of comment tokens. + * @returns {Array} An array of line numbers. + */ +function getCommentLineNums(comments) { + const lines = []; + + comments.forEach(token => { + const start = token.loc.start.line; + const end = token.loc.end.line; + + lines.push(start, end); + }); + return lines; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require empty lines around comments", + recommended: false, + url: "https://eslint.org/docs/rules/lines-around-comment" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + beforeBlockComment: { + type: "boolean", + default: true + }, + afterBlockComment: { + type: "boolean", + default: false + }, + beforeLineComment: { + type: "boolean", + default: false + }, + afterLineComment: { + type: "boolean", + default: false + }, + allowBlockStart: { + type: "boolean", + default: false + }, + allowBlockEnd: { + type: "boolean", + default: false + }, + allowClassStart: { + type: "boolean" + }, + allowClassEnd: { + type: "boolean" + }, + allowObjectStart: { + type: "boolean" + }, + allowObjectEnd: { + type: "boolean" + }, + allowArrayStart: { + type: "boolean" + }, + allowArrayEnd: { + type: "boolean" + }, + ignorePattern: { + type: "string" + }, + applyDefaultIgnorePatterns: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + messages: { + after: "Expected line after comment.", + before: "Expected line before comment." + } + }, + + create(context) { + + const options = Object.assign({}, context.options[0]); + const ignorePattern = options.ignorePattern; + const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN; + const customIgnoreRegExp = new RegExp(ignorePattern, "u"); + const applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns !== false; + + options.beforeBlockComment = typeof options.beforeBlockComment !== "undefined" ? options.beforeBlockComment : true; + + const sourceCode = context.getSourceCode(); + + const lines = sourceCode.lines, + numLines = lines.length + 1, + comments = sourceCode.getAllComments(), + commentLines = getCommentLineNums(comments), + emptyLines = getEmptyLineNums(lines), + commentAndEmptyLines = new Set(commentLines.concat(emptyLines)); + + /** + * Returns whether or not comments are on lines starting with or ending with code + * @param {token} token The comment token to check. + * @returns {boolean} True if the comment is not alone. + */ + function codeAroundComment(token) { + let currentToken = token; + + do { + currentToken = sourceCode.getTokenBefore(currentToken, { includeComments: true }); + } while (currentToken && astUtils.isCommentToken(currentToken)); + + if (currentToken && astUtils.isTokenOnSameLine(currentToken, token)) { + return true; + } + + currentToken = token; + do { + currentToken = sourceCode.getTokenAfter(currentToken, { includeComments: true }); + } while (currentToken && astUtils.isCommentToken(currentToken)); + + if (currentToken && astUtils.isTokenOnSameLine(token, currentToken)) { + return true; + } + + return false; + } + + /** + * Returns whether or not comments are inside a node type or not. + * @param {ASTNode} parent The Comment parent node. + * @param {string} nodeType The parent type to check against. + * @returns {boolean} True if the comment is inside nodeType. + */ + function isParentNodeType(parent, nodeType) { + return parent.type === nodeType || + (parent.body && parent.body.type === nodeType) || + (parent.consequent && parent.consequent.type === nodeType); + } + + /** + * Returns the parent node that contains the given token. + * @param {token} token The token to check. + * @returns {ASTNode|null} The parent node that contains the given token. + */ + function getParentNodeOfToken(token) { + const node = sourceCode.getNodeByRangeIndex(token.range[0]); + + /* + * For the purpose of this rule, the comment token is in a `StaticBlock` node only + * if it's inside the braces of that `StaticBlock` node. + * + * Example where this function returns `null`: + * + * static + * // comment + * { + * } + * + * Example where this function returns `StaticBlock` node: + * + * static + * { + * // comment + * } + * + */ + if (node && node.type === "StaticBlock") { + const openingBrace = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token + + return token.range[0] >= openingBrace.range[0] + ? node + : null; + } + + return node; + } + + /** + * Returns whether or not comments are at the parent start or not. + * @param {token} token The Comment token. + * @param {string} nodeType The parent type to check against. + * @returns {boolean} True if the comment is at parent start. + */ + function isCommentAtParentStart(token, nodeType) { + const parent = getParentNodeOfToken(token); + + if (parent && isParentNodeType(parent, nodeType)) { + const parentStartNodeOrToken = parent.type === "StaticBlock" + ? sourceCode.getFirstToken(parent, { skip: 1 }) // opening brace of the static block + : parent; + + return token.loc.start.line - parentStartNodeOrToken.loc.start.line === 1; + } + + return false; + } + + /** + * Returns whether or not comments are at the parent end or not. + * @param {token} token The Comment token. + * @param {string} nodeType The parent type to check against. + * @returns {boolean} True if the comment is at parent end. + */ + function isCommentAtParentEnd(token, nodeType) { + const parent = getParentNodeOfToken(token); + + return !!parent && isParentNodeType(parent, nodeType) && + parent.loc.end.line - token.loc.end.line === 1; + } + + /** + * Returns whether or not comments are at the block start or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at block start. + */ + function isCommentAtBlockStart(token) { + return ( + isCommentAtParentStart(token, "ClassBody") || + isCommentAtParentStart(token, "BlockStatement") || + isCommentAtParentStart(token, "StaticBlock") || + isCommentAtParentStart(token, "SwitchCase") + ); + } + + /** + * Returns whether or not comments are at the block end or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at block end. + */ + function isCommentAtBlockEnd(token) { + return ( + isCommentAtParentEnd(token, "ClassBody") || + isCommentAtParentEnd(token, "BlockStatement") || + isCommentAtParentEnd(token, "StaticBlock") || + isCommentAtParentEnd(token, "SwitchCase") || + isCommentAtParentEnd(token, "SwitchStatement") + ); + } + + /** + * Returns whether or not comments are at the class start or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at class start. + */ + function isCommentAtClassStart(token) { + return isCommentAtParentStart(token, "ClassBody"); + } + + /** + * Returns whether or not comments are at the class end or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at class end. + */ + function isCommentAtClassEnd(token) { + return isCommentAtParentEnd(token, "ClassBody"); + } + + /** + * Returns whether or not comments are at the object start or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at object start. + */ + function isCommentAtObjectStart(token) { + return isCommentAtParentStart(token, "ObjectExpression") || isCommentAtParentStart(token, "ObjectPattern"); + } + + /** + * Returns whether or not comments are at the object end or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at object end. + */ + function isCommentAtObjectEnd(token) { + return isCommentAtParentEnd(token, "ObjectExpression") || isCommentAtParentEnd(token, "ObjectPattern"); + } + + /** + * Returns whether or not comments are at the array start or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at array start. + */ + function isCommentAtArrayStart(token) { + return isCommentAtParentStart(token, "ArrayExpression") || isCommentAtParentStart(token, "ArrayPattern"); + } + + /** + * Returns whether or not comments are at the array end or not. + * @param {token} token The Comment token. + * @returns {boolean} True if the comment is at array end. + */ + function isCommentAtArrayEnd(token) { + return isCommentAtParentEnd(token, "ArrayExpression") || isCommentAtParentEnd(token, "ArrayPattern"); + } + + /** + * Checks if a comment token has lines around it (ignores inline comments) + * @param {token} token The Comment token. + * @param {Object} opts Options to determine the newline. + * @param {boolean} opts.after Should have a newline after this line. + * @param {boolean} opts.before Should have a newline before this line. + * @returns {void} + */ + function checkForEmptyLine(token, opts) { + if (applyDefaultIgnorePatterns && defaultIgnoreRegExp.test(token.value)) { + return; + } + + if (ignorePattern && customIgnoreRegExp.test(token.value)) { + return; + } + + let after = opts.after, + before = opts.before; + + const prevLineNum = token.loc.start.line - 1, + nextLineNum = token.loc.end.line + 1, + commentIsNotAlone = codeAroundComment(token); + + const blockStartAllowed = options.allowBlockStart && + isCommentAtBlockStart(token) && + !(options.allowClassStart === false && + isCommentAtClassStart(token)), + blockEndAllowed = options.allowBlockEnd && isCommentAtBlockEnd(token) && !(options.allowClassEnd === false && isCommentAtClassEnd(token)), + classStartAllowed = options.allowClassStart && isCommentAtClassStart(token), + classEndAllowed = options.allowClassEnd && isCommentAtClassEnd(token), + objectStartAllowed = options.allowObjectStart && isCommentAtObjectStart(token), + objectEndAllowed = options.allowObjectEnd && isCommentAtObjectEnd(token), + arrayStartAllowed = options.allowArrayStart && isCommentAtArrayStart(token), + arrayEndAllowed = options.allowArrayEnd && isCommentAtArrayEnd(token); + + const exceptionStartAllowed = blockStartAllowed || classStartAllowed || objectStartAllowed || arrayStartAllowed; + const exceptionEndAllowed = blockEndAllowed || classEndAllowed || objectEndAllowed || arrayEndAllowed; + + // ignore top of the file and bottom of the file + if (prevLineNum < 1) { + before = false; + } + if (nextLineNum >= numLines) { + after = false; + } + + // we ignore all inline comments + if (commentIsNotAlone) { + return; + } + + const previousTokenOrComment = sourceCode.getTokenBefore(token, { includeComments: true }); + const nextTokenOrComment = sourceCode.getTokenAfter(token, { includeComments: true }); + + // check for newline before + if (!exceptionStartAllowed && before && !commentAndEmptyLines.has(prevLineNum) && + !(astUtils.isCommentToken(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, token))) { + const lineStart = token.range[0] - token.loc.start.column; + const range = [lineStart, lineStart]; + + context.report({ + node: token, + messageId: "before", + fix(fixer) { + return fixer.insertTextBeforeRange(range, "\n"); + } + }); + } + + // check for newline after + if (!exceptionEndAllowed && after && !commentAndEmptyLines.has(nextLineNum) && + !(astUtils.isCommentToken(nextTokenOrComment) && astUtils.isTokenOnSameLine(token, nextTokenOrComment))) { + context.report({ + node: token, + messageId: "after", + fix(fixer) { + return fixer.insertTextAfter(token, "\n"); + } + }); + } + + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program() { + comments.forEach(token => { + if (token.type === "Line") { + if (options.beforeLineComment || options.afterLineComment) { + checkForEmptyLine(token, { + after: options.afterLineComment, + before: options.beforeLineComment + }); + } + } else if (token.type === "Block") { + if (options.beforeBlockComment || options.afterBlockComment) { + checkForEmptyLine(token, { + after: options.afterBlockComment, + before: options.beforeBlockComment + }); + } + } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/lines-around-directive.js b/node_modules/eslint/lib/rules/lines-around-directive.js new file mode 100644 index 0000000..21884f1 --- /dev/null +++ b/node_modules/eslint/lib/rules/lines-around-directive.js @@ -0,0 +1,201 @@ +/** + * @fileoverview Require or disallow newlines around directives. + * @author Kai Cataldo + * @deprecated in ESLint v4.0.0 + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow newlines around directives", + recommended: false, + url: "https://eslint.org/docs/rules/lines-around-directive" + }, + + schema: [{ + oneOf: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + before: { + enum: ["always", "never"] + }, + after: { + enum: ["always", "never"] + } + }, + additionalProperties: false, + minProperties: 2 + } + ] + }], + + fixable: "whitespace", + messages: { + expected: "Expected newline {{location}} \"{{value}}\" directive.", + unexpected: "Unexpected newline {{location}} \"{{value}}\" directive." + }, + deprecated: true, + replacedBy: ["padding-line-between-statements"] + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const config = context.options[0] || "always"; + const expectLineBefore = typeof config === "string" ? config : config.before; + const expectLineAfter = typeof config === "string" ? config : config.after; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if node is preceded by a blank newline. + * @param {ASTNode} node Node to check. + * @returns {boolean} Whether or not the passed in node is preceded by a blank newline. + */ + function hasNewlineBefore(node) { + const tokenBefore = sourceCode.getTokenBefore(node, { includeComments: true }); + const tokenLineBefore = tokenBefore ? tokenBefore.loc.end.line : 0; + + return node.loc.start.line - tokenLineBefore >= 2; + } + + /** + * Gets the last token of a node that is on the same line as the rest of the node. + * This will usually be the last token of the node, but it will be the second-to-last token if the node has a trailing + * semicolon on a different line. + * @param {ASTNode} node A directive node + * @returns {Token} The last token of the node on the line + */ + function getLastTokenOnLine(node) { + const lastToken = sourceCode.getLastToken(node); + const secondToLastToken = sourceCode.getTokenBefore(lastToken); + + return astUtils.isSemicolonToken(lastToken) && lastToken.loc.start.line > secondToLastToken.loc.end.line + ? secondToLastToken + : lastToken; + } + + /** + * Check if node is followed by a blank newline. + * @param {ASTNode} node Node to check. + * @returns {boolean} Whether or not the passed in node is followed by a blank newline. + */ + function hasNewlineAfter(node) { + const lastToken = getLastTokenOnLine(node); + const tokenAfter = sourceCode.getTokenAfter(lastToken, { includeComments: true }); + + return tokenAfter.loc.start.line - lastToken.loc.end.line >= 2; + } + + /** + * Report errors for newlines around directives. + * @param {ASTNode} node Node to check. + * @param {string} location Whether the error was found before or after the directive. + * @param {boolean} expected Whether or not a newline was expected or unexpected. + * @returns {void} + */ + function reportError(node, location, expected) { + context.report({ + node, + messageId: expected ? "expected" : "unexpected", + data: { + value: node.expression.value, + location + }, + fix(fixer) { + const lastToken = getLastTokenOnLine(node); + + if (expected) { + return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n"); + } + return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]); + } + }); + } + + /** + * Check lines around directives in node + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkDirectives(node) { + const directives = astUtils.getDirectivePrologue(node); + + if (!directives.length) { + return; + } + + const firstDirective = directives[0]; + const leadingComments = sourceCode.getCommentsBefore(firstDirective); + + /* + * Only check before the first directive if it is preceded by a comment or if it is at the top of + * the file and expectLineBefore is set to "never". This is to not force a newline at the top of + * the file if there are no comments as well as for compatibility with padded-blocks. + */ + if (leadingComments.length) { + if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) { + reportError(firstDirective, "before", true); + } + + if (expectLineBefore === "never" && hasNewlineBefore(firstDirective)) { + reportError(firstDirective, "before", false); + } + } else if ( + node.type === "Program" && + expectLineBefore === "never" && + !leadingComments.length && + hasNewlineBefore(firstDirective) + ) { + reportError(firstDirective, "before", false); + } + + const lastDirective = directives[directives.length - 1]; + const statements = node.type === "Program" ? node.body : node.body.body; + + /* + * Do not check after the last directive if the body only + * contains a directive prologue and isn't followed by a comment to ensure + * this rule behaves well with padded-blocks. + */ + if (lastDirective === statements[statements.length - 1] && !lastDirective.trailingComments) { + return; + } + + if (expectLineAfter === "always" && !hasNewlineAfter(lastDirective)) { + reportError(lastDirective, "after", true); + } + + if (expectLineAfter === "never" && hasNewlineAfter(lastDirective)) { + reportError(lastDirective, "after", false); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program: checkDirectives, + FunctionDeclaration: checkDirectives, + FunctionExpression: checkDirectives, + ArrowFunctionExpression: checkDirectives + }; + } +}; diff --git a/node_modules/eslint/lib/rules/lines-between-class-members.js b/node_modules/eslint/lib/rules/lines-between-class-members.js new file mode 100644 index 0000000..1d6b7e7 --- /dev/null +++ b/node_modules/eslint/lib/rules/lines-between-class-members.js @@ -0,0 +1,181 @@ +/** + * @fileoverview Rule to check empty newline between class members + * @author 薛定谔的猫 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow an empty line between class members", + recommended: false, + url: "https://eslint.org/docs/rules/lines-between-class-members" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + exceptAfterSingleLine: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { + never: "Unexpected blank line between class members.", + always: "Expected blank line between class members." + } + }, + + create(context) { + + const options = []; + + options[0] = context.options[0] || "always"; + options[1] = context.options[1] || { exceptAfterSingleLine: false }; + + const sourceCode = context.getSourceCode(); + + /** + * Gets a pair of tokens that should be used to check lines between two class member nodes. + * + * In most cases, this returns the very last token of the current node and + * the very first token of the next node. + * For example: + * + * class C { + * x = 1; // curLast: `;` nextFirst: `in` + * in = 2 + * } + * + * There is only one exception. If the given node ends with a semicolon, and it looks like + * a semicolon-less style's semicolon - one that is not on the same line as the preceding + * token, but is on the line where the next class member starts - this returns the preceding + * token and the semicolon as boundary tokens. + * For example: + * + * class C { + * x = 1 // curLast: `1` nextFirst: `;` + * ;in = 2 + * } + * When determining the desired layout of the code, we should treat this semicolon as + * a part of the next class member node instead of the one it technically belongs to. + * @param {ASTNode} curNode Current class member node. + * @param {ASTNode} nextNode Next class member node. + * @returns {Token} The actual last token of `node`. + * @private + */ + function getBoundaryTokens(curNode, nextNode) { + const lastToken = sourceCode.getLastToken(curNode); + const prevToken = sourceCode.getTokenBefore(lastToken); + const nextToken = sourceCode.getFirstToken(nextNode); // skip possible lone `;` between nodes + + const isSemicolonLessStyle = ( + astUtils.isSemicolonToken(lastToken) && + !astUtils.isTokenOnSameLine(prevToken, lastToken) && + astUtils.isTokenOnSameLine(lastToken, nextToken) + ); + + return isSemicolonLessStyle + ? { curLast: prevToken, nextFirst: lastToken } + : { curLast: lastToken, nextFirst: nextToken }; + } + + /** + * Return the last token among the consecutive tokens that have no exceed max line difference in between, before the first token in the next member. + * @param {Token} prevLastToken The last token in the previous member node. + * @param {Token} nextFirstToken The first token in the next member node. + * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. + * @returns {Token} The last token among the consecutive tokens. + */ + function findLastConsecutiveTokenAfter(prevLastToken, nextFirstToken, maxLine) { + const after = sourceCode.getTokenAfter(prevLastToken, { includeComments: true }); + + if (after !== nextFirstToken && after.loc.start.line - prevLastToken.loc.end.line <= maxLine) { + return findLastConsecutiveTokenAfter(after, nextFirstToken, maxLine); + } + return prevLastToken; + } + + /** + * Return the first token among the consecutive tokens that have no exceed max line difference in between, after the last token in the previous member. + * @param {Token} nextFirstToken The first token in the next member node. + * @param {Token} prevLastToken The last token in the previous member node. + * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. + * @returns {Token} The first token among the consecutive tokens. + */ + function findFirstConsecutiveTokenBefore(nextFirstToken, prevLastToken, maxLine) { + const before = sourceCode.getTokenBefore(nextFirstToken, { includeComments: true }); + + if (before !== prevLastToken && nextFirstToken.loc.start.line - before.loc.end.line <= maxLine) { + return findFirstConsecutiveTokenBefore(before, prevLastToken, maxLine); + } + return nextFirstToken; + } + + /** + * Checks if there is a token or comment between two tokens. + * @param {Token} before The token before. + * @param {Token} after The token after. + * @returns {boolean} True if there is a token or comment between two tokens. + */ + function hasTokenOrCommentBetween(before, after) { + return sourceCode.getTokensBetween(before, after, { includeComments: true }).length !== 0; + } + + return { + ClassBody(node) { + const body = node.body; + + for (let i = 0; i < body.length - 1; i++) { + const curFirst = sourceCode.getFirstToken(body[i]); + const { curLast, nextFirst } = getBoundaryTokens(body[i], body[i + 1]); + const isMulti = !astUtils.isTokenOnSameLine(curFirst, curLast); + const skip = !isMulti && options[1].exceptAfterSingleLine; + const beforePadding = findLastConsecutiveTokenAfter(curLast, nextFirst, 1); + const afterPadding = findFirstConsecutiveTokenBefore(nextFirst, curLast, 1); + const isPadded = afterPadding.loc.start.line - beforePadding.loc.end.line > 1; + const hasTokenInPadding = hasTokenOrCommentBetween(beforePadding, afterPadding); + const curLineLastToken = findLastConsecutiveTokenAfter(curLast, nextFirst, 0); + + if ((options[0] === "always" && !skip && !isPadded) || + (options[0] === "never" && isPadded)) { + context.report({ + node: body[i + 1], + messageId: isPadded ? "never" : "always", + fix(fixer) { + if (hasTokenInPadding) { + return null; + } + return isPadded + ? fixer.replaceTextRange([beforePadding.range[1], afterPadding.range[0]], "\n") + : fixer.insertTextAfter(curLineLastToken, "\n"); + } + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/max-classes-per-file.js b/node_modules/eslint/lib/rules/max-classes-per-file.js new file mode 100644 index 0000000..2157beb --- /dev/null +++ b/node_modules/eslint/lib/rules/max-classes-per-file.js @@ -0,0 +1,89 @@ +/** + * @fileoverview Enforce a maximum number of classes per file + * @author James Garbutt + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum number of classes per file", + recommended: false, + url: "https://eslint.org/docs/rules/max-classes-per-file" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 1 + }, + { + type: "object", + properties: { + ignoreExpressions: { + type: "boolean" + }, + max: { + type: "integer", + minimum: 1 + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + maximumExceeded: "File has too many classes ({{ classCount }}). Maximum allowed is {{ max }}." + } + }, + create(context) { + const [option = {}] = context.options; + const [ignoreExpressions, max] = typeof option === "number" + ? [false, option || 1] + : [option.ignoreExpressions, option.max || 1]; + + let classCount = 0; + + return { + Program() { + classCount = 0; + }, + "Program:exit"(node) { + if (classCount > max) { + context.report({ + node, + messageId: "maximumExceeded", + data: { + classCount, + max + } + }); + } + }, + "ClassDeclaration"() { + classCount++; + }, + "ClassExpression"() { + if (!ignoreExpressions) { + classCount++; + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/max-depth.js b/node_modules/eslint/lib/rules/max-depth.js new file mode 100644 index 0000000..8006ffd --- /dev/null +++ b/node_modules/eslint/lib/rules/max-depth.js @@ -0,0 +1,156 @@ +/** + * @fileoverview A rule to set the maximum depth block can be nested in a function. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum depth that blocks can be nested", + recommended: false, + url: "https://eslint.org/docs/rules/max-depth" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + maximum: { + type: "integer", + minimum: 0 + }, + max: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + messages: { + tooDeeply: "Blocks are nested too deeply ({{depth}}). Maximum allowed is {{maxDepth}}." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const functionStack = [], + option = context.options[0]; + let maxDepth = 4; + + if ( + typeof option === "object" && + (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) + ) { + maxDepth = option.maximum || option.max; + } + if (typeof option === "number") { + maxDepth = option; + } + + /** + * When parsing a new function, store it in our function stack + * @returns {void} + * @private + */ + function startFunction() { + functionStack.push(0); + } + + /** + * When parsing is done then pop out the reference + * @returns {void} + * @private + */ + function endFunction() { + functionStack.pop(); + } + + /** + * Save the block and Evaluate the node + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function pushBlock(node) { + const len = ++functionStack[functionStack.length - 1]; + + if (len > maxDepth) { + context.report({ node, messageId: "tooDeeply", data: { depth: len, maxDepth } }); + } + } + + /** + * Pop the saved block + * @returns {void} + * @private + */ + function popBlock() { + functionStack[functionStack.length - 1]--; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + Program: startFunction, + FunctionDeclaration: startFunction, + FunctionExpression: startFunction, + ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, + + IfStatement(node) { + if (node.parent.type !== "IfStatement") { + pushBlock(node); + } + }, + SwitchStatement: pushBlock, + TryStatement: pushBlock, + DoWhileStatement: pushBlock, + WhileStatement: pushBlock, + WithStatement: pushBlock, + ForStatement: pushBlock, + ForInStatement: pushBlock, + ForOfStatement: pushBlock, + + "IfStatement:exit": popBlock, + "SwitchStatement:exit": popBlock, + "TryStatement:exit": popBlock, + "DoWhileStatement:exit": popBlock, + "WhileStatement:exit": popBlock, + "WithStatement:exit": popBlock, + "ForStatement:exit": popBlock, + "ForInStatement:exit": popBlock, + "ForOfStatement:exit": popBlock, + + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction, + "Program:exit": endFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/max-len.js b/node_modules/eslint/lib/rules/max-len.js new file mode 100644 index 0000000..d05559e --- /dev/null +++ b/node_modules/eslint/lib/rules/max-len.js @@ -0,0 +1,433 @@ +/** + * @fileoverview Rule to check for max length on a line. + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const OPTIONS_SCHEMA = { + type: "object", + properties: { + code: { + type: "integer", + minimum: 0 + }, + comments: { + type: "integer", + minimum: 0 + }, + tabWidth: { + type: "integer", + minimum: 0 + }, + ignorePattern: { + type: "string" + }, + ignoreComments: { + type: "boolean" + }, + ignoreStrings: { + type: "boolean" + }, + ignoreUrls: { + type: "boolean" + }, + ignoreTemplateLiterals: { + type: "boolean" + }, + ignoreRegExpLiterals: { + type: "boolean" + }, + ignoreTrailingComments: { + type: "boolean" + } + }, + additionalProperties: false +}; + +const OPTIONS_OR_INTEGER_SCHEMA = { + anyOf: [ + OPTIONS_SCHEMA, + { + type: "integer", + minimum: 0 + } + ] +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce a maximum line length", + recommended: false, + url: "https://eslint.org/docs/rules/max-len" + }, + + schema: [ + OPTIONS_OR_INTEGER_SCHEMA, + OPTIONS_OR_INTEGER_SCHEMA, + OPTIONS_SCHEMA + ], + messages: { + max: "This line has a length of {{lineLength}}. Maximum allowed is {{maxLength}}.", + maxComment: "This line has a comment length of {{lineLength}}. Maximum allowed is {{maxCommentLength}}." + } + }, + + create(context) { + + /* + * Inspired by http://tools.ietf.org/html/rfc3986#appendix-B, however: + * - They're matching an entire string that we know is a URI + * - We're matching part of a string where we think there *might* be a URL + * - We're only concerned about URLs, as picking out any URI would cause + * too many false positives + * - We don't care about matching the entire URL, any small segment is fine + */ + const URL_REGEXP = /[^:/?#]:\/\/[^?#]/u; + + const sourceCode = context.getSourceCode(); + + /** + * Computes the length of a line that may contain tabs. The width of each + * tab will be the number of spaces to the next tab stop. + * @param {string} line The line. + * @param {int} tabWidth The width of each tab stop in spaces. + * @returns {int} The computed line length. + * @private + */ + function computeLineLength(line, tabWidth) { + let extraCharacterCount = 0; + + line.replace(/\t/gu, (match, offset) => { + const totalOffset = offset + extraCharacterCount, + previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0, + spaceCount = tabWidth - previousTabStopOffset; + + extraCharacterCount += spaceCount - 1; // -1 for the replaced tab + }); + return Array.from(line).length + extraCharacterCount; + } + + // The options object must be the last option specified… + const options = Object.assign({}, context.options[context.options.length - 1]); + + // …but max code length… + if (typeof context.options[0] === "number") { + options.code = context.options[0]; + } + + // …and tabWidth can be optionally specified directly as integers. + if (typeof context.options[1] === "number") { + options.tabWidth = context.options[1]; + } + + const maxLength = typeof options.code === "number" ? options.code : 80, + tabWidth = typeof options.tabWidth === "number" ? options.tabWidth : 4, + ignoreComments = !!options.ignoreComments, + ignoreStrings = !!options.ignoreStrings, + ignoreTemplateLiterals = !!options.ignoreTemplateLiterals, + ignoreRegExpLiterals = !!options.ignoreRegExpLiterals, + ignoreTrailingComments = !!options.ignoreTrailingComments || !!options.ignoreComments, + ignoreUrls = !!options.ignoreUrls, + maxCommentLength = options.comments; + let ignorePattern = options.ignorePattern || null; + + if (ignorePattern) { + ignorePattern = new RegExp(ignorePattern, "u"); + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Tells if a given comment is trailing: it starts on the current line and + * extends to or past the end of the current line. + * @param {string} line The source line we want to check for a trailing comment on + * @param {number} lineNumber The one-indexed line number for line + * @param {ASTNode} comment The comment to inspect + * @returns {boolean} If the comment is trailing on the given line + */ + function isTrailingComment(line, lineNumber, comment) { + return comment && + (comment.loc.start.line === lineNumber && lineNumber <= comment.loc.end.line) && + (comment.loc.end.line > lineNumber || comment.loc.end.column === line.length); + } + + /** + * Tells if a comment encompasses the entire line. + * @param {string} line The source line with a trailing comment + * @param {number} lineNumber The one-indexed line number this is on + * @param {ASTNode} comment The comment to remove + * @returns {boolean} If the comment covers the entire line + */ + function isFullLineComment(line, lineNumber, comment) { + const start = comment.loc.start, + end = comment.loc.end, + isFirstTokenOnLine = !line.slice(0, comment.loc.start.column).trim(); + + return comment && + (start.line < lineNumber || (start.line === lineNumber && isFirstTokenOnLine)) && + (end.line > lineNumber || (end.line === lineNumber && end.column === line.length)); + } + + /** + * Check if a node is a JSXEmptyExpression contained in a single line JSXExpressionContainer. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node is a JSXEmptyExpression contained in a single line JSXExpressionContainer. + */ + function isJSXEmptyExpressionInSingleLineContainer(node) { + if (!node || !node.parent || node.type !== "JSXEmptyExpression" || node.parent.type !== "JSXExpressionContainer") { + return false; + } + + const parent = node.parent; + + return parent.loc.start.line === parent.loc.end.line; + } + + /** + * Gets the line after the comment and any remaining trailing whitespace is + * stripped. + * @param {string} line The source line with a trailing comment + * @param {ASTNode} comment The comment to remove + * @returns {string} Line without comment and trailing whitespace + */ + function stripTrailingComment(line, comment) { + + // loc.column is zero-indexed + return line.slice(0, comment.loc.start.column).replace(/\s+$/u, ""); + } + + /** + * Ensure that an array exists at [key] on `object`, and add `value` to it. + * @param {Object} object the object to mutate + * @param {string} key the object's key + * @param {any} value the value to add + * @returns {void} + * @private + */ + function ensureArrayAndPush(object, key, value) { + if (!Array.isArray(object[key])) { + object[key] = []; + } + object[key].push(value); + } + + /** + * Retrieves an array containing all strings (" or ') in the source code. + * @returns {ASTNode[]} An array of string nodes. + */ + function getAllStrings() { + return sourceCode.ast.tokens.filter(token => (token.type === "String" || + (token.type === "JSXText" && sourceCode.getNodeByRangeIndex(token.range[0] - 1).type === "JSXAttribute"))); + } + + /** + * Retrieves an array containing all template literals in the source code. + * @returns {ASTNode[]} An array of template literal nodes. + */ + function getAllTemplateLiterals() { + return sourceCode.ast.tokens.filter(token => token.type === "Template"); + } + + + /** + * Retrieves an array containing all RegExp literals in the source code. + * @returns {ASTNode[]} An array of RegExp literal nodes. + */ + function getAllRegExpLiterals() { + return sourceCode.ast.tokens.filter(token => token.type === "RegularExpression"); + } + + + /** + * A reducer to group an AST node by line number, both start and end. + * @param {Object} acc the accumulator + * @param {ASTNode} node the AST node in question + * @returns {Object} the modified accumulator + * @private + */ + function groupByLineNumber(acc, node) { + for (let i = node.loc.start.line; i <= node.loc.end.line; ++i) { + ensureArrayAndPush(acc, i, node); + } + return acc; + } + + /** + * Returns an array of all comments in the source code. + * If the element in the array is a JSXEmptyExpression contained with a single line JSXExpressionContainer, + * the element is changed with JSXExpressionContainer node. + * @returns {ASTNode[]} An array of comment nodes + */ + function getAllComments() { + const comments = []; + + sourceCode.getAllComments() + .forEach(commentNode => { + const containingNode = sourceCode.getNodeByRangeIndex(commentNode.range[0]); + + if (isJSXEmptyExpressionInSingleLineContainer(containingNode)) { + + // push a unique node only + if (comments[comments.length - 1] !== containingNode.parent) { + comments.push(containingNode.parent); + } + } else { + comments.push(commentNode); + } + }); + + return comments; + } + + /** + * Check the program for max length + * @param {ASTNode} node Node to examine + * @returns {void} + * @private + */ + function checkProgramForMaxLength(node) { + + // split (honors line-ending) + const lines = sourceCode.lines, + + // list of comments to ignore + comments = ignoreComments || maxCommentLength || ignoreTrailingComments ? getAllComments() : []; + + // we iterate over comments in parallel with the lines + let commentsIndex = 0; + + const strings = getAllStrings(); + const stringsByLine = strings.reduce(groupByLineNumber, {}); + + const templateLiterals = getAllTemplateLiterals(); + const templateLiteralsByLine = templateLiterals.reduce(groupByLineNumber, {}); + + const regExpLiterals = getAllRegExpLiterals(); + const regExpLiteralsByLine = regExpLiterals.reduce(groupByLineNumber, {}); + + lines.forEach((line, i) => { + + // i is zero-indexed, line numbers are one-indexed + const lineNumber = i + 1; + + /* + * if we're checking comment length; we need to know whether this + * line is a comment + */ + let lineIsComment = false; + let textToMeasure; + + /* + * We can short-circuit the comment checks if we're already out of + * comments to check. + */ + if (commentsIndex < comments.length) { + let comment = null; + + // iterate over comments until we find one past the current line + do { + comment = comments[++commentsIndex]; + } while (comment && comment.loc.start.line <= lineNumber); + + // and step back by one + comment = comments[--commentsIndex]; + + if (isFullLineComment(line, lineNumber, comment)) { + lineIsComment = true; + textToMeasure = line; + } else if (ignoreTrailingComments && isTrailingComment(line, lineNumber, comment)) { + textToMeasure = stripTrailingComment(line, comment); + + // ignore multiple trailing comments in the same line + let lastIndex = commentsIndex; + + while (isTrailingComment(textToMeasure, lineNumber, comments[--lastIndex])) { + textToMeasure = stripTrailingComment(textToMeasure, comments[lastIndex]); + } + } else { + textToMeasure = line; + } + } else { + textToMeasure = line; + } + if (ignorePattern && ignorePattern.test(textToMeasure) || + ignoreUrls && URL_REGEXP.test(textToMeasure) || + ignoreStrings && stringsByLine[lineNumber] || + ignoreTemplateLiterals && templateLiteralsByLine[lineNumber] || + ignoreRegExpLiterals && regExpLiteralsByLine[lineNumber] + ) { + + // ignore this line + return; + } + + const lineLength = computeLineLength(textToMeasure, tabWidth); + const commentLengthApplies = lineIsComment && maxCommentLength; + + if (lineIsComment && ignoreComments) { + return; + } + + const loc = { + start: { + line: lineNumber, + column: 0 + }, + end: { + line: lineNumber, + column: textToMeasure.length + } + }; + + if (commentLengthApplies) { + if (lineLength > maxCommentLength) { + context.report({ + node, + loc, + messageId: "maxComment", + data: { + lineLength, + maxCommentLength + } + }); + } + } else if (lineLength > maxLength) { + context.report({ + node, + loc, + messageId: "max", + data: { + lineLength, + maxLength + } + }); + } + }); + } + + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + Program: checkProgramForMaxLength + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/max-lines-per-function.js b/node_modules/eslint/lib/rules/max-lines-per-function.js new file mode 100644 index 0000000..5985a73 --- /dev/null +++ b/node_modules/eslint/lib/rules/max-lines-per-function.js @@ -0,0 +1,213 @@ +/** + * @fileoverview A rule to set the maximum number of line of code in a function. + * @author Pete Ward + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { upperCaseFirst } = require("../shared/string-utils"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const OPTIONS_SCHEMA = { + type: "object", + properties: { + max: { + type: "integer", + minimum: 0 + }, + skipComments: { + type: "boolean" + }, + skipBlankLines: { + type: "boolean" + }, + IIFEs: { + type: "boolean" + } + }, + additionalProperties: false +}; + +const OPTIONS_OR_INTEGER_SCHEMA = { + oneOf: [ + OPTIONS_SCHEMA, + { + type: "integer", + minimum: 1 + } + ] +}; + +/** + * Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values. + * @param {Array} comments An array of comment nodes. + * @returns {Map} A map with numeric keys (source code line numbers) and comment token values. + */ +function getCommentLineNumbers(comments) { + const map = new Map(); + + comments.forEach(comment => { + for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) { + map.set(i, comment); + } + }); + return map; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum number of lines of code in a function", + recommended: false, + url: "https://eslint.org/docs/rules/max-lines-per-function" + }, + + schema: [ + OPTIONS_OR_INTEGER_SCHEMA + ], + messages: { + exceed: "{{name}} has too many lines ({{lineCount}}). Maximum allowed is {{maxLines}}." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const lines = sourceCode.lines; + + const option = context.options[0]; + let maxLines = 50; + let skipComments = false; + let skipBlankLines = false; + let IIFEs = false; + + if (typeof option === "object") { + maxLines = typeof option.max === "number" ? option.max : 50; + skipComments = !!option.skipComments; + skipBlankLines = !!option.skipBlankLines; + IIFEs = !!option.IIFEs; + } else if (typeof option === "number") { + maxLines = option; + } + + const commentLineNumbers = getCommentLineNumbers(sourceCode.getAllComments()); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Tells if a comment encompasses the entire line. + * @param {string} line The source line with a trailing comment + * @param {number} lineNumber The one-indexed line number this is on + * @param {ASTNode} comment The comment to remove + * @returns {boolean} If the comment covers the entire line + */ + function isFullLineComment(line, lineNumber, comment) { + const start = comment.loc.start, + end = comment.loc.end, + isFirstTokenOnLine = start.line === lineNumber && !line.slice(0, start.column).trim(), + isLastTokenOnLine = end.line === lineNumber && !line.slice(end.column).trim(); + + return comment && + (start.line < lineNumber || isFirstTokenOnLine) && + (end.line > lineNumber || isLastTokenOnLine); + } + + /** + * Identifies is a node is a FunctionExpression which is part of an IIFE + * @param {ASTNode} node Node to test + * @returns {boolean} True if it's an IIFE + */ + function isIIFE(node) { + return (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") && node.parent && node.parent.type === "CallExpression" && node.parent.callee === node; + } + + /** + * Identifies is a node is a FunctionExpression which is embedded within a MethodDefinition or Property + * @param {ASTNode} node Node to test + * @returns {boolean} True if it's a FunctionExpression embedded within a MethodDefinition or Property + */ + function isEmbedded(node) { + if (!node.parent) { + return false; + } + if (node !== node.parent.value) { + return false; + } + if (node.parent.type === "MethodDefinition") { + return true; + } + if (node.parent.type === "Property") { + return node.parent.method === true || node.parent.kind === "get" || node.parent.kind === "set"; + } + return false; + } + + /** + * Count the lines in the function + * @param {ASTNode} funcNode Function AST node + * @returns {void} + * @private + */ + function processFunction(funcNode) { + const node = isEmbedded(funcNode) ? funcNode.parent : funcNode; + + if (!IIFEs && isIIFE(node)) { + return; + } + let lineCount = 0; + + for (let i = node.loc.start.line - 1; i < node.loc.end.line; ++i) { + const line = lines[i]; + + if (skipComments) { + if (commentLineNumbers.has(i + 1) && isFullLineComment(line, i + 1, commentLineNumbers.get(i + 1))) { + continue; + } + } + + if (skipBlankLines) { + if (line.match(/^\s*$/u)) { + continue; + } + } + + lineCount++; + } + + if (lineCount > maxLines) { + const name = upperCaseFirst(astUtils.getFunctionNameWithKind(funcNode)); + + context.report({ + node, + messageId: "exceed", + data: { name, lineCount, maxLines } + }); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + FunctionDeclaration: processFunction, + FunctionExpression: processFunction, + ArrowFunctionExpression: processFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/max-lines.js b/node_modules/eslint/lib/rules/max-lines.js new file mode 100644 index 0000000..772f02a --- /dev/null +++ b/node_modules/eslint/lib/rules/max-lines.js @@ -0,0 +1,193 @@ +/** + * @fileoverview enforce a maximum file length + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Creates an array of numbers from `start` up to, but not including, `end` + * @param {number} start The start of the range + * @param {number} end The end of the range + * @returns {number[]} The range of numbers + */ +function range(start, end) { + return [...Array(end - start).keys()].map(x => x + start); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum number of lines per file", + recommended: false, + url: "https://eslint.org/docs/rules/max-lines" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + max: { + type: "integer", + minimum: 0 + }, + skipComments: { + type: "boolean" + }, + skipBlankLines: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + } + ], + messages: { + exceed: + "File has too many lines ({{actual}}). Maximum allowed is {{max}}." + } + }, + + create(context) { + const option = context.options[0]; + let max = 300; + + if ( + typeof option === "object" && + Object.prototype.hasOwnProperty.call(option, "max") + ) { + max = option.max; + } else if (typeof option === "number") { + max = option; + } + + const skipComments = option && option.skipComments; + const skipBlankLines = option && option.skipBlankLines; + + const sourceCode = context.getSourceCode(); + + /** + * Returns whether or not a token is a comment node type + * @param {Token} token The token to check + * @returns {boolean} True if the token is a comment node + */ + function isCommentNodeType(token) { + return token && (token.type === "Block" || token.type === "Line"); + } + + /** + * Returns the line numbers of a comment that don't have any code on the same line + * @param {Node} comment The comment node to check + * @returns {number[]} The line numbers + */ + function getLinesWithoutCode(comment) { + let start = comment.loc.start.line; + let end = comment.loc.end.line; + + let token; + + token = comment; + do { + token = sourceCode.getTokenBefore(token, { + includeComments: true + }); + } while (isCommentNodeType(token)); + + if (token && astUtils.isTokenOnSameLine(token, comment)) { + start += 1; + } + + token = comment; + do { + token = sourceCode.getTokenAfter(token, { + includeComments: true + }); + } while (isCommentNodeType(token)); + + if (token && astUtils.isTokenOnSameLine(comment, token)) { + end -= 1; + } + + if (start <= end) { + return range(start, end + 1); + } + return []; + } + + return { + "Program:exit"() { + let lines = sourceCode.lines.map((text, i) => ({ + lineNumber: i + 1, + text + })); + + /* + * If file ends with a linebreak, `sourceCode.lines` will have one extra empty line at the end. + * That isn't a real line, so we shouldn't count it. + */ + if (lines.length > 1 && lines[lines.length - 1].text === "") { + lines.pop(); + } + + if (skipBlankLines) { + lines = lines.filter(l => l.text.trim() !== ""); + } + + if (skipComments) { + const comments = sourceCode.getAllComments(); + + const commentLines = new Set(comments.flatMap(getLinesWithoutCode)); + + lines = lines.filter( + l => !commentLines.has(l.lineNumber) + ); + } + + if (lines.length > max) { + const loc = { + start: { + line: lines[max].lineNumber, + column: 0 + }, + end: { + line: sourceCode.lines.length, + column: sourceCode.lines[sourceCode.lines.length - 1].length + } + }; + + context.report({ + loc, + messageId: "exceed", + data: { + max, + actual: lines.length + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/max-nested-callbacks.js b/node_modules/eslint/lib/rules/max-nested-callbacks.js new file mode 100644 index 0000000..0d43050 --- /dev/null +++ b/node_modules/eslint/lib/rules/max-nested-callbacks.js @@ -0,0 +1,117 @@ +/** + * @fileoverview Rule to enforce a maximum number of nested callbacks. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum depth that callbacks can be nested", + recommended: false, + url: "https://eslint.org/docs/rules/max-nested-callbacks" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + maximum: { + type: "integer", + minimum: 0 + }, + max: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + messages: { + exceed: "Too many nested callbacks ({{num}}). Maximum allowed is {{max}}." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Constants + //-------------------------------------------------------------------------- + const option = context.options[0]; + let THRESHOLD = 10; + + if ( + typeof option === "object" && + (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) + ) { + THRESHOLD = option.maximum || option.max; + } else if (typeof option === "number") { + THRESHOLD = option; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const callbackStack = []; + + /** + * Checks a given function node for too many callbacks. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkFunction(node) { + const parent = node.parent; + + if (parent.type === "CallExpression") { + callbackStack.push(node); + } + + if (callbackStack.length > THRESHOLD) { + const opts = { num: callbackStack.length, max: THRESHOLD }; + + context.report({ node, messageId: "exceed", data: opts }); + } + } + + /** + * Pops the call stack. + * @returns {void} + * @private + */ + function popStack() { + callbackStack.pop(); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + ArrowFunctionExpression: checkFunction, + "ArrowFunctionExpression:exit": popStack, + + FunctionExpression: checkFunction, + "FunctionExpression:exit": popStack + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/max-params.js b/node_modules/eslint/lib/rules/max-params.js new file mode 100644 index 0000000..72379d2 --- /dev/null +++ b/node_modules/eslint/lib/rules/max-params.js @@ -0,0 +1,102 @@ +/** + * @fileoverview Rule to flag when a function has too many parameters + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { upperCaseFirst } = require("../shared/string-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum number of parameters in function definitions", + recommended: false, + url: "https://eslint.org/docs/rules/max-params" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + maximum: { + type: "integer", + minimum: 0 + }, + max: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + } + ], + messages: { + exceed: "{{name}} has too many parameters ({{count}}). Maximum allowed is {{max}}." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const option = context.options[0]; + let numParams = 3; + + if ( + typeof option === "object" && + (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) + ) { + numParams = option.maximum || option.max; + } + if (typeof option === "number") { + numParams = option; + } + + /** + * Checks a function to see if it has too many parameters. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkFunction(node) { + if (node.params.length > numParams) { + context.report({ + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + node, + messageId: "exceed", + data: { + name: upperCaseFirst(astUtils.getFunctionNameWithKind(node)), + count: node.params.length, + max: numParams + } + }); + } + } + + return { + FunctionDeclaration: checkFunction, + ArrowFunctionExpression: checkFunction, + FunctionExpression: checkFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/max-statements-per-line.js b/node_modules/eslint/lib/rules/max-statements-per-line.js new file mode 100644 index 0000000..61b508c --- /dev/null +++ b/node_modules/eslint/lib/rules/max-statements-per-line.js @@ -0,0 +1,196 @@ +/** + * @fileoverview Specify the maximum number of statements allowed per line. + * @author Kenneth Williams + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce a maximum number of statements allowed per line", + recommended: false, + url: "https://eslint.org/docs/rules/max-statements-per-line" + }, + + schema: [ + { + type: "object", + properties: { + max: { + type: "integer", + minimum: 1, + default: 1 + } + }, + additionalProperties: false + } + ], + messages: { + exceed: "This line has {{numberOfStatementsOnThisLine}} {{statements}}. Maximum allowed is {{maxStatementsPerLine}}." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(), + options = context.options[0] || {}, + maxStatementsPerLine = typeof options.max !== "undefined" ? options.max : 1; + + let lastStatementLine = 0, + numberOfStatementsOnThisLine = 0, + firstExtraStatement; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const SINGLE_CHILD_ALLOWED = /^(?:(?:DoWhile|For|ForIn|ForOf|If|Labeled|While)Statement|Export(?:Default|Named)Declaration)$/u; + + /** + * Reports with the first extra statement, and clears it. + * @returns {void} + */ + function reportFirstExtraStatementAndClear() { + if (firstExtraStatement) { + context.report({ + node: firstExtraStatement, + messageId: "exceed", + data: { + numberOfStatementsOnThisLine, + maxStatementsPerLine, + statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements" + } + }); + } + firstExtraStatement = null; + } + + /** + * Gets the actual last token of a given node. + * @param {ASTNode} node A node to get. This is a node except EmptyStatement. + * @returns {Token} The actual last token. + */ + function getActualLastToken(node) { + return sourceCode.getLastToken(node, astUtils.isNotSemicolonToken); + } + + /** + * Addresses a given node. + * It updates the state of this rule, then reports the node if the node violated this rule. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function enterStatement(node) { + const line = node.loc.start.line; + + /* + * Skip to allow non-block statements if this is direct child of control statements. + * `if (a) foo();` is counted as 1. + * But `if (a) foo(); else foo();` should be counted as 2. + */ + if (SINGLE_CHILD_ALLOWED.test(node.parent.type) && + node.parent.alternate !== node + ) { + return; + } + + // Update state. + if (line === lastStatementLine) { + numberOfStatementsOnThisLine += 1; + } else { + reportFirstExtraStatementAndClear(); + numberOfStatementsOnThisLine = 1; + lastStatementLine = line; + } + + // Reports if the node violated this rule. + if (numberOfStatementsOnThisLine === maxStatementsPerLine + 1) { + firstExtraStatement = firstExtraStatement || node; + } + } + + /** + * Updates the state of this rule with the end line of leaving node to check with the next statement. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function leaveStatement(node) { + const line = getActualLastToken(node).loc.end.line; + + // Update state. + if (line !== lastStatementLine) { + reportFirstExtraStatementAndClear(); + numberOfStatementsOnThisLine = 1; + lastStatementLine = line; + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + BreakStatement: enterStatement, + ClassDeclaration: enterStatement, + ContinueStatement: enterStatement, + DebuggerStatement: enterStatement, + DoWhileStatement: enterStatement, + ExpressionStatement: enterStatement, + ForInStatement: enterStatement, + ForOfStatement: enterStatement, + ForStatement: enterStatement, + FunctionDeclaration: enterStatement, + IfStatement: enterStatement, + ImportDeclaration: enterStatement, + LabeledStatement: enterStatement, + ReturnStatement: enterStatement, + SwitchStatement: enterStatement, + ThrowStatement: enterStatement, + TryStatement: enterStatement, + VariableDeclaration: enterStatement, + WhileStatement: enterStatement, + WithStatement: enterStatement, + ExportNamedDeclaration: enterStatement, + ExportDefaultDeclaration: enterStatement, + ExportAllDeclaration: enterStatement, + + "BreakStatement:exit": leaveStatement, + "ClassDeclaration:exit": leaveStatement, + "ContinueStatement:exit": leaveStatement, + "DebuggerStatement:exit": leaveStatement, + "DoWhileStatement:exit": leaveStatement, + "ExpressionStatement:exit": leaveStatement, + "ForInStatement:exit": leaveStatement, + "ForOfStatement:exit": leaveStatement, + "ForStatement:exit": leaveStatement, + "FunctionDeclaration:exit": leaveStatement, + "IfStatement:exit": leaveStatement, + "ImportDeclaration:exit": leaveStatement, + "LabeledStatement:exit": leaveStatement, + "ReturnStatement:exit": leaveStatement, + "SwitchStatement:exit": leaveStatement, + "ThrowStatement:exit": leaveStatement, + "TryStatement:exit": leaveStatement, + "VariableDeclaration:exit": leaveStatement, + "WhileStatement:exit": leaveStatement, + "WithStatement:exit": leaveStatement, + "ExportNamedDeclaration:exit": leaveStatement, + "ExportDefaultDeclaration:exit": leaveStatement, + "ExportAllDeclaration:exit": leaveStatement, + "Program:exit": reportFirstExtraStatementAndClear + }; + } +}; diff --git a/node_modules/eslint/lib/rules/max-statements.js b/node_modules/eslint/lib/rules/max-statements.js new file mode 100644 index 0000000..1f627b6 --- /dev/null +++ b/node_modules/eslint/lib/rules/max-statements.js @@ -0,0 +1,184 @@ +/** + * @fileoverview A rule to set the maximum number of statements in a function. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { upperCaseFirst } = require("../shared/string-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a maximum number of statements allowed in function blocks", + recommended: false, + url: "https://eslint.org/docs/rules/max-statements" + }, + + schema: [ + { + oneOf: [ + { + type: "integer", + minimum: 0 + }, + { + type: "object", + properties: { + maximum: { + type: "integer", + minimum: 0 + }, + max: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + } + ] + }, + { + type: "object", + properties: { + ignoreTopLevelFunctions: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + messages: { + exceed: "{{name}} has too many statements ({{count}}). Maximum allowed is {{max}}." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const functionStack = [], + option = context.options[0], + ignoreTopLevelFunctions = context.options[1] && context.options[1].ignoreTopLevelFunctions || false, + topLevelFunctions = []; + let maxStatements = 10; + + if ( + typeof option === "object" && + (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) + ) { + maxStatements = option.maximum || option.max; + } else if (typeof option === "number") { + maxStatements = option; + } + + /** + * Reports a node if it has too many statements + * @param {ASTNode} node node to evaluate + * @param {int} count Number of statements in node + * @param {int} max Maximum number of statements allowed + * @returns {void} + * @private + */ + function reportIfTooManyStatements(node, count, max) { + if (count > max) { + const name = upperCaseFirst(astUtils.getFunctionNameWithKind(node)); + + context.report({ + node, + messageId: "exceed", + data: { name, count, max } + }); + } + } + + /** + * When parsing a new function, store it in our function stack + * @returns {void} + * @private + */ + function startFunction() { + functionStack.push(0); + } + + /** + * Evaluate the node at the end of function + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function endFunction(node) { + const count = functionStack.pop(); + + /* + * This rule does not apply to class static blocks, but we have to track them so + * that statements in them do not count as statements in the enclosing function. + */ + if (node.type === "StaticBlock") { + return; + } + + if (ignoreTopLevelFunctions && functionStack.length === 0) { + topLevelFunctions.push({ node, count }); + } else { + reportIfTooManyStatements(node, count, maxStatements); + } + } + + /** + * Increment the count of the functions + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function countStatements(node) { + functionStack[functionStack.length - 1] += node.body.length; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + FunctionDeclaration: startFunction, + FunctionExpression: startFunction, + ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, + + BlockStatement: countStatements, + + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction, + + "Program:exit"() { + if (topLevelFunctions.length === 1) { + return; + } + + topLevelFunctions.forEach(element => { + const count = element.count; + const node = element.node; + + reportIfTooManyStatements(node, count, maxStatements); + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/multiline-comment-style.js b/node_modules/eslint/lib/rules/multiline-comment-style.js new file mode 100644 index 0000000..7985bc8 --- /dev/null +++ b/node_modules/eslint/lib/rules/multiline-comment-style.js @@ -0,0 +1,435 @@ +/** + * @fileoverview enforce a particular style for multiline comments + * @author Teddy Katz + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce a particular style for multiline comments", + recommended: false, + url: "https://eslint.org/docs/rules/multiline-comment-style" + }, + + fixable: "whitespace", + schema: [{ enum: ["starred-block", "separate-lines", "bare-block"] }], + messages: { + expectedBlock: "Expected a block comment instead of consecutive line comments.", + expectedBareBlock: "Expected a block comment without padding stars.", + startNewline: "Expected a linebreak after '/*'.", + endNewline: "Expected a linebreak before '*/'.", + missingStar: "Expected a '*' at the start of this line.", + alignment: "Expected this line to be aligned with the start of the comment.", + expectedLines: "Expected multiple line comments instead of a block comment." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const option = context.options[0] || "starred-block"; + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Checks if a comment line is starred. + * @param {string} line A string representing a comment line. + * @returns {boolean} Whether or not the comment line is starred. + */ + function isStarredCommentLine(line) { + return /^\s*\*/u.test(line); + } + + /** + * Checks if a comment group is in starred-block form. + * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment. + * @returns {boolean} Whether or not the comment group is in starred block form. + */ + function isStarredBlockComment([firstComment]) { + if (firstComment.type !== "Block") { + return false; + } + + const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); + + // The first and last lines can only contain whitespace. + return lines.length > 0 && lines.every((line, i) => (i === 0 || i === lines.length - 1 ? /^\s*$/u : /^\s*\*/u).test(line)); + } + + /** + * Checks if a comment group is in JSDoc form. + * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment. + * @returns {boolean} Whether or not the comment group is in JSDoc form. + */ + function isJSDocComment([firstComment]) { + if (firstComment.type !== "Block") { + return false; + } + + const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); + + return /^\*\s*$/u.test(lines[0]) && + lines.slice(1, -1).every(line => /^\s* /u.test(line)) && + /^\s*$/u.test(lines[lines.length - 1]); + } + + /** + * Processes a comment group that is currently in separate-line form, calculating the offset for each line. + * @param {Token[]} commentGroup A group of comments containing multiple line comments. + * @returns {string[]} An array of the processed lines. + */ + function processSeparateLineComments(commentGroup) { + const allLinesHaveLeadingSpace = commentGroup + .map(({ value }) => value) + .filter(line => line.trim().length) + .every(line => line.startsWith(" ")); + + return commentGroup.map(({ value }) => (allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value)); + } + + /** + * Processes a comment group that is currently in starred-block form, calculating the offset for each line. + * @param {Token} comment A single block comment token in starred-block form. + * @returns {string[]} An array of the processed lines. + */ + function processStarredBlockComment(comment) { + const lines = comment.value.split(astUtils.LINEBREAK_MATCHER) + .filter((line, i, linesArr) => !(i === 0 || i === linesArr.length - 1)) + .map(line => line.replace(/^\s*$/u, "")); + const allLinesHaveLeadingSpace = lines + .map(line => line.replace(/\s*\*/u, "")) + .filter(line => line.trim().length) + .every(line => line.startsWith(" ")); + + return lines.map(line => line.replace(allLinesHaveLeadingSpace ? /\s*\* ?/u : /\s*\*/u, "")); + } + + /** + * Processes a comment group that is currently in bare-block form, calculating the offset for each line. + * @param {Token} comment A single block comment token in bare-block form. + * @returns {string[]} An array of the processed lines. + */ + function processBareBlockComment(comment) { + const lines = comment.value.split(astUtils.LINEBREAK_MATCHER).map(line => line.replace(/^\s*$/u, "")); + const leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `; + let offset = ""; + + /* + * Calculate the offset of the least indented line and use that as the basis for offsetting all the lines. + * The first line should not be checked because it is inline with the opening block comment delimiter. + */ + for (const [i, line] of lines.entries()) { + if (!line.trim().length || i === 0) { + continue; + } + + const [, lineOffset] = line.match(/^(\s*\*?\s*)/u); + + if (lineOffset.length < leadingWhitespace.length) { + const newOffset = leadingWhitespace.slice(lineOffset.length - leadingWhitespace.length); + + if (newOffset.length > offset.length) { + offset = newOffset; + } + } + } + + return lines.map(line => { + const match = line.match(/^(\s*\*?\s*)(.*)/u); + const [, lineOffset, lineContents] = match; + + if (lineOffset.length > leadingWhitespace.length) { + return `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}`; + } + + if (lineOffset.length < leadingWhitespace.length) { + return `${lineOffset.slice(leadingWhitespace.length)}${lineContents}`; + } + + return lineContents; + }); + } + + /** + * Gets a list of comment lines in a group, formatting leading whitespace as necessary. + * @param {Token[]} commentGroup A group of comments containing either multiple line comments or a single block comment. + * @returns {string[]} A list of comment lines. + */ + function getCommentLines(commentGroup) { + const [firstComment] = commentGroup; + + if (firstComment.type === "Line") { + return processSeparateLineComments(commentGroup); + } + + if (isStarredBlockComment(commentGroup)) { + return processStarredBlockComment(firstComment); + } + + return processBareBlockComment(firstComment); + } + + /** + * Gets the initial offset (whitespace) from the beginning of a line to a given comment token. + * @param {Token} comment The token to check. + * @returns {string} The offset from the beginning of a line to the token. + */ + function getInitialOffset(comment) { + return sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0]); + } + + /** + * Converts a comment into starred-block form + * @param {Token} firstComment The first comment of the group being converted + * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment + * @returns {string} A representation of the comment value in starred-block form, excluding start and end markers + */ + function convertToStarredBlock(firstComment, commentLinesList) { + const initialOffset = getInitialOffset(firstComment); + + return `/*\n${commentLinesList.map(line => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`; + } + + /** + * Converts a comment into separate-line form + * @param {Token} firstComment The first comment of the group being converted + * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment + * @returns {string} A representation of the comment value in separate-line form + */ + function convertToSeparateLines(firstComment, commentLinesList) { + return commentLinesList.map(line => `// ${line}`).join(`\n${getInitialOffset(firstComment)}`); + } + + /** + * Converts a comment into bare-block form + * @param {Token} firstComment The first comment of the group being converted + * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment + * @returns {string} A representation of the comment value in bare-block form + */ + function convertToBlock(firstComment, commentLinesList) { + return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`; + } + + /** + * Each method checks a group of comments to see if it's valid according to the given option. + * @param {Token[]} commentGroup A list of comments that appear together. This will either contain a single + * block comment or multiple line comments. + * @returns {void} + */ + const commentGroupCheckers = { + "starred-block"(commentGroup) { + const [firstComment] = commentGroup; + const commentLines = getCommentLines(commentGroup); + + if (commentLines.some(value => value.includes("*/"))) { + return; + } + + if (commentGroup.length > 1) { + context.report({ + loc: { + start: firstComment.loc.start, + end: commentGroup[commentGroup.length - 1].loc.end + }, + messageId: "expectedBlock", + fix(fixer) { + const range = [firstComment.range[0], commentGroup[commentGroup.length - 1].range[1]]; + + return commentLines.some(value => value.startsWith("/")) + ? null + : fixer.replaceTextRange(range, convertToStarredBlock(firstComment, commentLines)); + } + }); + } else { + const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); + const expectedLeadingWhitespace = getInitialOffset(firstComment); + const expectedLinePrefix = `${expectedLeadingWhitespace} *`; + + if (!/^\*?\s*$/u.test(lines[0])) { + const start = firstComment.value.startsWith("*") ? firstComment.range[0] + 1 : firstComment.range[0]; + + context.report({ + loc: { + start: firstComment.loc.start, + end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } + }, + messageId: "startNewline", + fix: fixer => fixer.insertTextAfterRange([start, start + 2], `\n${expectedLinePrefix}`) + }); + } + + if (!/^\s*$/u.test(lines[lines.length - 1])) { + context.report({ + loc: { + start: { line: firstComment.loc.end.line, column: firstComment.loc.end.column - 2 }, + end: firstComment.loc.end + }, + messageId: "endNewline", + fix: fixer => fixer.replaceTextRange([firstComment.range[1] - 2, firstComment.range[1]], `\n${expectedLinePrefix}/`) + }); + } + + for (let lineNumber = firstComment.loc.start.line + 1; lineNumber <= firstComment.loc.end.line; lineNumber++) { + const lineText = sourceCode.lines[lineNumber - 1]; + const errorType = isStarredCommentLine(lineText) + ? "alignment" + : "missingStar"; + + if (!lineText.startsWith(expectedLinePrefix)) { + context.report({ + loc: { + start: { line: lineNumber, column: 0 }, + end: { line: lineNumber, column: lineText.length } + }, + messageId: errorType, + fix(fixer) { + const lineStartIndex = sourceCode.getIndexFromLoc({ line: lineNumber, column: 0 }); + + if (errorType === "alignment") { + const [, commentTextPrefix = ""] = lineText.match(/^(\s*\*)/u) || []; + const commentTextStartIndex = lineStartIndex + commentTextPrefix.length; + + return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], expectedLinePrefix); + } + + const [, commentTextPrefix = ""] = lineText.match(/^(\s*)/u) || []; + const commentTextStartIndex = lineStartIndex + commentTextPrefix.length; + let offset; + + for (const [idx, line] of lines.entries()) { + if (!/\S+/u.test(line)) { + continue; + } + + const lineTextToAlignWith = sourceCode.lines[firstComment.loc.start.line - 1 + idx]; + const [, prefix = "", initialOffset = ""] = lineTextToAlignWith.match(/^(\s*(?:\/?\*)?(\s*))/u) || []; + + offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`; + + if (/^\s*\//u.test(lineText) && offset.length === 0) { + offset += " "; + } + break; + } + + return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`); + } + }); + } + } + } + }, + "separate-lines"(commentGroup) { + const [firstComment] = commentGroup; + + if (firstComment.type !== "Block" || isJSDocComment(commentGroup)) { + return; + } + + const commentLines = getCommentLines(commentGroup); + const tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: true }); + + if (tokenAfter && firstComment.loc.end.line === tokenAfter.loc.start.line) { + return; + } + + context.report({ + loc: { + start: firstComment.loc.start, + end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } + }, + messageId: "expectedLines", + fix(fixer) { + return fixer.replaceText(firstComment, convertToSeparateLines(firstComment, commentLines)); + } + }); + }, + "bare-block"(commentGroup) { + if (isJSDocComment(commentGroup)) { + return; + } + + const [firstComment] = commentGroup; + const commentLines = getCommentLines(commentGroup); + + // Disallows consecutive line comments in favor of using a block comment. + if (firstComment.type === "Line" && commentLines.length > 1 && + !commentLines.some(value => value.includes("*/"))) { + context.report({ + loc: { + start: firstComment.loc.start, + end: commentGroup[commentGroup.length - 1].loc.end + }, + messageId: "expectedBlock", + fix(fixer) { + return fixer.replaceTextRange( + [firstComment.range[0], commentGroup[commentGroup.length - 1].range[1]], + convertToBlock(firstComment, commentLines) + ); + } + }); + } + + // Prohibits block comments from having a * at the beginning of each line. + if (isStarredBlockComment(commentGroup)) { + context.report({ + loc: { + start: firstComment.loc.start, + end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } + }, + messageId: "expectedBareBlock", + fix(fixer) { + return fixer.replaceText(firstComment, convertToBlock(firstComment, commentLines)); + } + }); + } + } + }; + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + Program() { + return sourceCode.getAllComments() + .filter(comment => comment.type !== "Shebang") + .filter(comment => !astUtils.COMMENTS_IGNORE_PATTERN.test(comment.value)) + .filter(comment => { + const tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); + + return !tokenBefore || tokenBefore.loc.end.line < comment.loc.start.line; + }) + .reduce((commentGroups, comment, index, commentList) => { + const tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); + + if ( + comment.type === "Line" && + index && commentList[index - 1].type === "Line" && + tokenBefore && tokenBefore.loc.end.line === comment.loc.start.line - 1 && + tokenBefore === commentList[index - 1] + ) { + commentGroups[commentGroups.length - 1].push(comment); + } else { + commentGroups.push([comment]); + } + + return commentGroups; + }, []) + .filter(commentGroup => !(commentGroup.length === 1 && commentGroup[0].loc.start.line === commentGroup[0].loc.end.line)) + .forEach(commentGroupCheckers[option]); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/multiline-ternary.js b/node_modules/eslint/lib/rules/multiline-ternary.js new file mode 100644 index 0000000..91aa5a1 --- /dev/null +++ b/node_modules/eslint/lib/rules/multiline-ternary.js @@ -0,0 +1,171 @@ +/** + * @fileoverview Enforce newlines between operands of ternary expressions + * @author Kai Cataldo + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce newlines between operands of ternary expressions", + recommended: false, + url: "https://eslint.org/docs/rules/multiline-ternary" + }, + + schema: [ + { + enum: ["always", "always-multiline", "never"] + } + ], + + messages: { + expectedTestCons: "Expected newline between test and consequent of ternary expression.", + expectedConsAlt: "Expected newline between consequent and alternate of ternary expression.", + unexpectedTestCons: "Unexpected newline between test and consequent of ternary expression.", + unexpectedConsAlt: "Unexpected newline between consequent and alternate of ternary expression." + }, + + fixable: "whitespace" + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const option = context.options[0]; + const multiline = option !== "never"; + const allowSingleLine = option === "always-multiline"; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ConditionalExpression(node) { + const questionToken = sourceCode.getTokenAfter(node.test, astUtils.isNotClosingParenToken); + const colonToken = sourceCode.getTokenAfter(node.consequent, astUtils.isNotClosingParenToken); + + const firstTokenOfTest = sourceCode.getFirstToken(node); + const lastTokenOfTest = sourceCode.getTokenBefore(questionToken); + const firstTokenOfConsequent = sourceCode.getTokenAfter(questionToken); + const lastTokenOfConsequent = sourceCode.getTokenBefore(colonToken); + const firstTokenOfAlternate = sourceCode.getTokenAfter(colonToken); + + const areTestAndConsequentOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, firstTokenOfConsequent); + const areConsequentAndAlternateOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, firstTokenOfAlternate); + + const hasComments = !!sourceCode.getCommentsInside(node).length; + + if (!multiline) { + if (!areTestAndConsequentOnSameLine) { + context.report({ + node: node.test, + loc: { + start: firstTokenOfTest.loc.start, + end: lastTokenOfTest.loc.end + }, + messageId: "unexpectedTestCons", + fix: fixer => { + if (hasComments) { + return null; + } + const fixers = []; + const areTestAndQuestionOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, questionToken); + const areQuestionAndConsOnSameLine = astUtils.isTokenOnSameLine(questionToken, firstTokenOfConsequent); + + if (!areTestAndQuestionOnSameLine) { + fixers.push(fixer.removeRange([lastTokenOfTest.range[1], questionToken.range[0]])); + } + if (!areQuestionAndConsOnSameLine) { + fixers.push(fixer.removeRange([questionToken.range[1], firstTokenOfConsequent.range[0]])); + } + + return fixers; + } + }); + } + + if (!areConsequentAndAlternateOnSameLine) { + context.report({ + node: node.consequent, + loc: { + start: firstTokenOfConsequent.loc.start, + end: lastTokenOfConsequent.loc.end + }, + messageId: "unexpectedConsAlt", + fix: fixer => { + if (hasComments) { + return null; + } + const fixers = []; + const areConsAndColonOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, colonToken); + const areColonAndAltOnSameLine = astUtils.isTokenOnSameLine(colonToken, firstTokenOfAlternate); + + if (!areConsAndColonOnSameLine) { + fixers.push(fixer.removeRange([lastTokenOfConsequent.range[1], colonToken.range[0]])); + } + if (!areColonAndAltOnSameLine) { + fixers.push(fixer.removeRange([colonToken.range[1], firstTokenOfAlternate.range[0]])); + } + + return fixers; + } + }); + } + } else { + if (allowSingleLine && node.loc.start.line === node.loc.end.line) { + return; + } + + if (areTestAndConsequentOnSameLine) { + context.report({ + node: node.test, + loc: { + start: firstTokenOfTest.loc.start, + end: lastTokenOfTest.loc.end + }, + messageId: "expectedTestCons", + fix: fixer => (hasComments ? null : ( + fixer.replaceTextRange( + [ + lastTokenOfTest.range[1], + questionToken.range[0] + ], + "\n" + ) + )) + }); + } + + if (areConsequentAndAlternateOnSameLine) { + context.report({ + node: node.consequent, + loc: { + start: firstTokenOfConsequent.loc.start, + end: lastTokenOfConsequent.loc.end + }, + messageId: "expectedConsAlt", + fix: (fixer => (hasComments ? null : ( + fixer.replaceTextRange( + [ + lastTokenOfConsequent.range[1], + colonToken.range[0] + ], + "\n" + ) + ))) + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/new-cap.js b/node_modules/eslint/lib/rules/new-cap.js new file mode 100644 index 0000000..466cfd4 --- /dev/null +++ b/node_modules/eslint/lib/rules/new-cap.js @@ -0,0 +1,276 @@ +/** + * @fileoverview Rule to flag use of constructors without capital letters + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const CAPS_ALLOWED = [ + "Array", + "Boolean", + "Date", + "Error", + "Function", + "Number", + "Object", + "RegExp", + "String", + "Symbol", + "BigInt" +]; + +/** + * Ensure that if the key is provided, it must be an array. + * @param {Object} obj Object to check with `key`. + * @param {string} key Object key to check on `obj`. + * @param {any} fallback If obj[key] is not present, this will be returned. + * @throws {TypeError} If key is not an own array type property of `obj`. + * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` + */ +function checkArray(obj, key, fallback) { + + /* istanbul ignore if */ + if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { + throw new TypeError(`${key}, if provided, must be an Array`); + } + return obj[key] || fallback; +} + +/** + * A reducer function to invert an array to an Object mapping the string form of the key, to `true`. + * @param {Object} map Accumulator object for the reduce. + * @param {string} key Object key to set to `true`. + * @returns {Object} Returns the updated Object for further reduction. + */ +function invert(map, key) { + map[key] = true; + return map; +} + +/** + * Creates an object with the cap is new exceptions as its keys and true as their values. + * @param {Object} config Rule configuration + * @returns {Object} Object with cap is new exceptions. + */ +function calculateCapIsNewExceptions(config) { + let capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED); + + if (capIsNewExceptions !== CAPS_ALLOWED) { + capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED); + } + + return capIsNewExceptions.reduce(invert, {}); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require constructor names to begin with a capital letter", + recommended: false, + url: "https://eslint.org/docs/rules/new-cap" + }, + + schema: [ + { + type: "object", + properties: { + newIsCap: { + type: "boolean", + default: true + }, + capIsNew: { + type: "boolean", + default: true + }, + newIsCapExceptions: { + type: "array", + items: { + type: "string" + } + }, + newIsCapExceptionPattern: { + type: "string" + }, + capIsNewExceptions: { + type: "array", + items: { + type: "string" + } + }, + capIsNewExceptionPattern: { + type: "string" + }, + properties: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + messages: { + upper: "A function with a name starting with an uppercase letter should only be used as a constructor.", + lower: "A constructor name should not start with a lowercase letter." + } + }, + + create(context) { + + const config = Object.assign({}, context.options[0]); + + config.newIsCap = config.newIsCap !== false; + config.capIsNew = config.capIsNew !== false; + const skipProperties = config.properties === false; + + const newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); + const newIsCapExceptionPattern = config.newIsCapExceptionPattern ? new RegExp(config.newIsCapExceptionPattern, "u") : null; + + const capIsNewExceptions = calculateCapIsNewExceptions(config); + const capIsNewExceptionPattern = config.capIsNewExceptionPattern ? new RegExp(config.capIsNewExceptionPattern, "u") : null; + + const listeners = {}; + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Get exact callee name from expression + * @param {ASTNode} node CallExpression or NewExpression node + * @returns {string} name + */ + function extractNameFromExpression(node) { + return node.callee.type === "Identifier" + ? node.callee.name + : astUtils.getStaticPropertyName(node.callee) || ""; + } + + /** + * Returns the capitalization state of the string - + * Whether the first character is uppercase, lowercase, or non-alphabetic + * @param {string} str String + * @returns {string} capitalization state: "non-alpha", "lower", or "upper" + */ + function getCap(str) { + const firstChar = str.charAt(0); + + const firstCharLower = firstChar.toLowerCase(); + const firstCharUpper = firstChar.toUpperCase(); + + if (firstCharLower === firstCharUpper) { + + // char has no uppercase variant, so it's non-alphabetic + return "non-alpha"; + } + if (firstChar === firstCharLower) { + return "lower"; + } + return "upper"; + + } + + /** + * Check if capitalization is allowed for a CallExpression + * @param {Object} allowedMap Object mapping calleeName to a Boolean + * @param {ASTNode} node CallExpression node + * @param {string} calleeName Capitalized callee name from a CallExpression + * @param {Object} pattern RegExp object from options pattern + * @returns {boolean} Returns true if the callee may be capitalized + */ + function isCapAllowed(allowedMap, node, calleeName, pattern) { + const sourceText = sourceCode.getText(node.callee); + + if (allowedMap[calleeName] || allowedMap[sourceText]) { + return true; + } + + if (pattern && pattern.test(sourceText)) { + return true; + } + + const callee = astUtils.skipChainExpression(node.callee); + + if (calleeName === "UTC" && callee.type === "MemberExpression") { + + // allow if callee is Date.UTC + return callee.object.type === "Identifier" && + callee.object.name === "Date"; + } + + return skipProperties && callee.type === "MemberExpression"; + } + + /** + * Reports the given messageId for the given node. The location will be the start of the property or the callee. + * @param {ASTNode} node CallExpression or NewExpression node. + * @param {string} messageId The messageId to report. + * @returns {void} + */ + function report(node, messageId) { + let callee = astUtils.skipChainExpression(node.callee); + + if (callee.type === "MemberExpression") { + callee = callee.property; + } + + context.report({ node, loc: callee.loc, messageId }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + if (config.newIsCap) { + listeners.NewExpression = function(node) { + + const constructorName = extractNameFromExpression(node); + + if (constructorName) { + const capitalization = getCap(constructorName); + const isAllowed = capitalization !== "lower" || isCapAllowed(newIsCapExceptions, node, constructorName, newIsCapExceptionPattern); + + if (!isAllowed) { + report(node, "lower"); + } + } + }; + } + + if (config.capIsNew) { + listeners.CallExpression = function(node) { + + const calleeName = extractNameFromExpression(node); + + if (calleeName) { + const capitalization = getCap(calleeName); + const isAllowed = capitalization !== "upper" || isCapAllowed(capIsNewExceptions, node, calleeName, capIsNewExceptionPattern); + + if (!isAllowed) { + report(node, "upper"); + } + } + }; + } + + return listeners; + } +}; diff --git a/node_modules/eslint/lib/rules/new-parens.js b/node_modules/eslint/lib/rules/new-parens.js new file mode 100644 index 0000000..8ee4a2e --- /dev/null +++ b/node_modules/eslint/lib/rules/new-parens.js @@ -0,0 +1,99 @@ +/** + * @fileoverview Rule to flag when using constructor without parentheses + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce or disallow parentheses when invoking a constructor with no arguments", + recommended: false, + url: "https://eslint.org/docs/rules/new-parens" + }, + + fixable: "code", + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always", "never"] + } + ], + minItems: 0, + maxItems: 1 + } + ] + }, + messages: { + missing: "Missing '()' invoking a constructor.", + unnecessary: "Unnecessary '()' invoking a constructor with no arguments." + } + }, + + create(context) { + const options = context.options; + const always = options[0] !== "never"; // Default is always + + const sourceCode = context.getSourceCode(); + + return { + NewExpression(node) { + if (node.arguments.length !== 0) { + return; // if there are arguments, there have to be parens + } + + const lastToken = sourceCode.getLastToken(node); + const hasLastParen = lastToken && astUtils.isClosingParenToken(lastToken); + + // `hasParens` is true only if the new expression ends with its own parens, e.g., new new foo() does not end with its own parens + const hasParens = hasLastParen && + astUtils.isOpeningParenToken(sourceCode.getTokenBefore(lastToken)) && + node.callee.range[1] < node.range[1]; + + if (always) { + if (!hasParens) { + context.report({ + node, + messageId: "missing", + fix: fixer => fixer.insertTextAfter(node, "()") + }); + } + } else { + if (hasParens) { + context.report({ + node, + messageId: "unnecessary", + fix: fixer => [ + fixer.remove(sourceCode.getTokenBefore(lastToken)), + fixer.remove(lastToken), + fixer.insertTextBefore(node, "("), + fixer.insertTextAfter(node, ")") + ] + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/newline-after-var.js b/node_modules/eslint/lib/rules/newline-after-var.js new file mode 100644 index 0000000..e519a3a --- /dev/null +++ b/node_modules/eslint/lib/rules/newline-after-var.js @@ -0,0 +1,255 @@ +/** + * @fileoverview Rule to check empty newline after "var" statement + * @author Gopal Venkatesan + * @deprecated in ESLint v4.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow an empty line after variable declarations", + recommended: false, + url: "https://eslint.org/docs/rules/newline-after-var" + }, + schema: [ + { + enum: ["never", "always"] + } + ], + fixable: "whitespace", + messages: { + expected: "Expected blank line after variable declarations.", + unexpected: "Unexpected blank line after variable declarations." + }, + + deprecated: true, + + replacedBy: ["padding-line-between-statements"] + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + // Default `mode` to "always". + const mode = context.options[0] === "never" ? "never" : "always"; + + // Cache starting and ending line numbers of comments for faster lookup + const commentEndLine = sourceCode.getAllComments().reduce((result, token) => { + result[token.loc.start.line] = token.loc.end.line; + return result; + }, {}); + + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Gets a token from the given node to compare line to the next statement. + * + * In general, the token is the last token of the node. However, the token is the second last token if the following conditions satisfy. + * + * - The last token is semicolon. + * - The semicolon is on a different line from the previous token of the semicolon. + * + * This behavior would address semicolon-less style code. e.g.: + * + * var foo = 1 + * + * ;(a || b).doSomething() + * @param {ASTNode} node The node to get. + * @returns {Token} The token to compare line to the next statement. + */ + function getLastToken(node) { + const lastToken = sourceCode.getLastToken(node); + + if (lastToken.type === "Punctuator" && lastToken.value === ";") { + const prevToken = sourceCode.getTokenBefore(lastToken); + + if (prevToken.loc.end.line !== lastToken.loc.start.line) { + return prevToken; + } + } + + return lastToken; + } + + /** + * Determine if provided keyword is a variable declaration + * @private + * @param {string} keyword keyword to test + * @returns {boolean} True if `keyword` is a type of var + */ + function isVar(keyword) { + return keyword === "var" || keyword === "let" || keyword === "const"; + } + + /** + * Determine if provided keyword is a variant of for specifiers + * @private + * @param {string} keyword keyword to test + * @returns {boolean} True if `keyword` is a variant of for specifier + */ + function isForTypeSpecifier(keyword) { + return keyword === "ForStatement" || keyword === "ForInStatement" || keyword === "ForOfStatement"; + } + + /** + * Determine if provided keyword is an export specifiers + * @private + * @param {string} nodeType nodeType to test + * @returns {boolean} True if `nodeType` is an export specifier + */ + function isExportSpecifier(nodeType) { + return nodeType === "ExportNamedDeclaration" || nodeType === "ExportSpecifier" || + nodeType === "ExportDefaultDeclaration" || nodeType === "ExportAllDeclaration"; + } + + /** + * Determine if provided node is the last of their parent block. + * @private + * @param {ASTNode} node node to test + * @returns {boolean} True if `node` is last of their parent block. + */ + function isLastNode(node) { + const token = sourceCode.getTokenAfter(node); + + return !token || (token.type === "Punctuator" && token.value === "}"); + } + + /** + * Gets the last line of a group of consecutive comments + * @param {number} commentStartLine The starting line of the group + * @returns {number} The number of the last comment line of the group + */ + function getLastCommentLineOfBlock(commentStartLine) { + const currentCommentEnd = commentEndLine[commentStartLine]; + + return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd; + } + + /** + * Determine if a token starts more than one line after a comment ends + * @param {token} token The token being checked + * @param {integer} commentStartLine The line number on which the comment starts + * @returns {boolean} True if `token` does not start immediately after a comment + */ + function hasBlankLineAfterComment(token, commentStartLine) { + return token.loc.start.line > getLastCommentLineOfBlock(commentStartLine) + 1; + } + + /** + * Checks that a blank line exists after a variable declaration when mode is + * set to "always", or checks that there is no blank line when mode is set + * to "never" + * @private + * @param {ASTNode} node `VariableDeclaration` node to test + * @returns {void} + */ + function checkForBlankLine(node) { + + /* + * lastToken is the last token on the node's line. It will usually also be the last token of the node, but it will + * sometimes be second-last if there is a semicolon on a different line. + */ + const lastToken = getLastToken(node), + + /* + * If lastToken is the last token of the node, nextToken should be the token after the node. Otherwise, nextToken + * is the last token of the node. + */ + nextToken = lastToken === sourceCode.getLastToken(node) ? sourceCode.getTokenAfter(node) : sourceCode.getLastToken(node), + nextLineNum = lastToken.loc.end.line + 1; + + // Ignore if there is no following statement + if (!nextToken) { + return; + } + + // Ignore if parent of node is a for variant + if (isForTypeSpecifier(node.parent.type)) { + return; + } + + // Ignore if parent of node is an export specifier + if (isExportSpecifier(node.parent.type)) { + return; + } + + /* + * Some coding styles use multiple `var` statements, so do nothing if + * the next token is a `var` statement. + */ + if (nextToken.type === "Keyword" && isVar(nextToken.value)) { + return; + } + + // Ignore if it is last statement in a block + if (isLastNode(node)) { + return; + } + + // Next statement is not a `var`... + const noNextLineToken = nextToken.loc.start.line > nextLineNum; + const hasNextLineComment = (typeof commentEndLine[nextLineNum] !== "undefined"); + + if (mode === "never" && noNextLineToken && !hasNextLineComment) { + context.report({ + node, + messageId: "unexpected", + data: { identifier: node.name }, + fix(fixer) { + const linesBetween = sourceCode.getText().slice(lastToken.range[1], nextToken.range[0]).split(astUtils.LINEBREAK_MATCHER); + + return fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], `${linesBetween.slice(0, -1).join("")}\n${linesBetween[linesBetween.length - 1]}`); + } + }); + } + + // Token on the next line, or comment without blank line + if ( + mode === "always" && ( + !noNextLineToken || + hasNextLineComment && !hasBlankLineAfterComment(nextToken, nextLineNum) + ) + ) { + context.report({ + node, + messageId: "expected", + data: { identifier: node.name }, + fix(fixer) { + if ((noNextLineToken ? getLastCommentLineOfBlock(nextLineNum) : lastToken.loc.end.line) === nextToken.loc.start.line) { + return fixer.insertTextBefore(nextToken, "\n\n"); + } + + return fixer.insertTextBeforeRange([nextToken.range[0] - nextToken.loc.start.column, nextToken.range[1]], "\n"); + } + }); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + VariableDeclaration: checkForBlankLine + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/newline-before-return.js b/node_modules/eslint/lib/rules/newline-before-return.js new file mode 100644 index 0000000..d07c236 --- /dev/null +++ b/node_modules/eslint/lib/rules/newline-before-return.js @@ -0,0 +1,217 @@ +/** + * @fileoverview Rule to require newlines before `return` statement + * @author Kai Cataldo + * @deprecated in ESLint v4.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require an empty line before `return` statements", + recommended: false, + url: "https://eslint.org/docs/rules/newline-before-return" + }, + + fixable: "whitespace", + schema: [], + messages: { + expected: "Expected newline before return statement." + }, + + deprecated: true, + replacedBy: ["padding-line-between-statements"] + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Tests whether node is preceded by supplied tokens + * @param {ASTNode} node node to check + * @param {Array} testTokens array of tokens to test against + * @returns {boolean} Whether or not the node is preceded by one of the supplied tokens + * @private + */ + function isPrecededByTokens(node, testTokens) { + const tokenBefore = sourceCode.getTokenBefore(node); + + return testTokens.includes(tokenBefore.value); + } + + /** + * Checks whether node is the first node after statement or in block + * @param {ASTNode} node node to check + * @returns {boolean} Whether or not the node is the first node after statement or in block + * @private + */ + function isFirstNode(node) { + const parentType = node.parent.type; + + if (node.parent.body) { + return Array.isArray(node.parent.body) + ? node.parent.body[0] === node + : node.parent.body === node; + } + + if (parentType === "IfStatement") { + return isPrecededByTokens(node, ["else", ")"]); + } + if (parentType === "DoWhileStatement") { + return isPrecededByTokens(node, ["do"]); + } + if (parentType === "SwitchCase") { + return isPrecededByTokens(node, [":"]); + } + return isPrecededByTokens(node, [")"]); + + } + + /** + * Returns the number of lines of comments that precede the node + * @param {ASTNode} node node to check for overlapping comments + * @param {number} lineNumTokenBefore line number of previous token, to check for overlapping comments + * @returns {number} Number of lines of comments that precede the node + * @private + */ + function calcCommentLines(node, lineNumTokenBefore) { + const comments = sourceCode.getCommentsBefore(node); + let numLinesComments = 0; + + if (!comments.length) { + return numLinesComments; + } + + comments.forEach(comment => { + numLinesComments++; + + if (comment.type === "Block") { + numLinesComments += comment.loc.end.line - comment.loc.start.line; + } + + // avoid counting lines with inline comments twice + if (comment.loc.start.line === lineNumTokenBefore) { + numLinesComments--; + } + + if (comment.loc.end.line === node.loc.start.line) { + numLinesComments--; + } + }); + + return numLinesComments; + } + + /** + * Returns the line number of the token before the node that is passed in as an argument + * @param {ASTNode} node The node to use as the start of the calculation + * @returns {number} Line number of the token before `node` + * @private + */ + function getLineNumberOfTokenBefore(node) { + const tokenBefore = sourceCode.getTokenBefore(node); + let lineNumTokenBefore; + + /** + * Global return (at the beginning of a script) is a special case. + * If there is no token before `return`, then we expect no line + * break before the return. Comments are allowed to occupy lines + * before the global return, just no blank lines. + * Setting lineNumTokenBefore to zero in that case results in the + * desired behavior. + */ + if (tokenBefore) { + lineNumTokenBefore = tokenBefore.loc.end.line; + } else { + lineNumTokenBefore = 0; // global return at beginning of script + } + + return lineNumTokenBefore; + } + + /** + * Checks whether node is preceded by a newline + * @param {ASTNode} node node to check + * @returns {boolean} Whether or not the node is preceded by a newline + * @private + */ + function hasNewlineBefore(node) { + const lineNumNode = node.loc.start.line; + const lineNumTokenBefore = getLineNumberOfTokenBefore(node); + const commentLines = calcCommentLines(node, lineNumTokenBefore); + + return (lineNumNode - lineNumTokenBefore - commentLines) > 1; + } + + /** + * Checks whether it is safe to apply a fix to a given return statement. + * + * The fix is not considered safe if the given return statement has leading comments, + * as we cannot safely determine if the newline should be added before or after the comments. + * For more information, see: https://github.com/eslint/eslint/issues/5958#issuecomment-222767211 + * @param {ASTNode} node The return statement node to check. + * @returns {boolean} `true` if it can fix the node. + * @private + */ + function canFix(node) { + const leadingComments = sourceCode.getCommentsBefore(node); + const lastLeadingComment = leadingComments[leadingComments.length - 1]; + const tokenBefore = sourceCode.getTokenBefore(node); + + if (leadingComments.length === 0) { + return true; + } + + /* + * if the last leading comment ends in the same line as the previous token and + * does not share a line with the `return` node, we can consider it safe to fix. + * Example: + * function a() { + * var b; //comment + * return; + * } + */ + if (lastLeadingComment.loc.end.line === tokenBefore.loc.end.line && + lastLeadingComment.loc.end.line !== node.loc.start.line) { + return true; + } + + return false; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ReturnStatement(node) { + if (!isFirstNode(node) && !hasNewlineBefore(node)) { + context.report({ + node, + messageId: "expected", + fix(fixer) { + if (canFix(node)) { + const tokenBefore = sourceCode.getTokenBefore(node); + const newlines = node.loc.start.line === tokenBefore.loc.end.line ? "\n\n" : "\n"; + + return fixer.insertTextBefore(node, newlines); + } + return null; + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/newline-per-chained-call.js b/node_modules/eslint/lib/rules/newline-per-chained-call.js new file mode 100644 index 0000000..818bf70 --- /dev/null +++ b/node_modules/eslint/lib/rules/newline-per-chained-call.js @@ -0,0 +1,123 @@ +/** + * @fileoverview Rule to ensure newline per method call when chaining calls + * @author Rajendra Patil + * @author Burak Yigit Kaya + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require a newline after each call in a method chain", + recommended: false, + url: "https://eslint.org/docs/rules/newline-per-chained-call" + }, + + fixable: "whitespace", + + schema: [{ + type: "object", + properties: { + ignoreChainWithDepth: { + type: "integer", + minimum: 1, + maximum: 10, + default: 2 + } + }, + additionalProperties: false + }], + messages: { + expected: "Expected line break before `{{callee}}`." + } + }, + + create(context) { + + const options = context.options[0] || {}, + ignoreChainWithDepth = options.ignoreChainWithDepth || 2; + + const sourceCode = context.getSourceCode(); + + /** + * Get the prefix of a given MemberExpression node. + * If the MemberExpression node is a computed value it returns a + * left bracket. If not it returns a period. + * @param {ASTNode} node A MemberExpression node to get + * @returns {string} The prefix of the node. + */ + function getPrefix(node) { + if (node.computed) { + if (node.optional) { + return "?.["; + } + return "["; + } + if (node.optional) { + return "?."; + } + return "."; + } + + /** + * Gets the property text of a given MemberExpression node. + * If the text is multiline, this returns only the first line. + * @param {ASTNode} node A MemberExpression node to get. + * @returns {string} The property text of the node. + */ + function getPropertyText(node) { + const prefix = getPrefix(node); + const lines = sourceCode.getText(node.property).split(astUtils.LINEBREAK_MATCHER); + const suffix = node.computed && lines.length === 1 ? "]" : ""; + + return prefix + lines[0] + suffix; + } + + return { + "CallExpression:exit"(node) { + const callee = astUtils.skipChainExpression(node.callee); + + if (callee.type !== "MemberExpression") { + return; + } + + let parent = astUtils.skipChainExpression(callee.object); + let depth = 1; + + while (parent && parent.callee) { + depth += 1; + parent = astUtils.skipChainExpression(astUtils.skipChainExpression(parent.callee).object); + } + + if (depth > ignoreChainWithDepth && astUtils.isTokenOnSameLine(callee.object, callee.property)) { + const firstTokenAfterObject = sourceCode.getTokenAfter(callee.object, astUtils.isNotClosingParenToken); + + context.report({ + node: callee.property, + loc: { + start: firstTokenAfterObject.loc.start, + end: callee.loc.end + }, + messageId: "expected", + data: { + callee: getPropertyText(callee) + }, + fix(fixer) { + return fixer.insertTextBefore(firstTokenAfterObject, "\n"); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-alert.js b/node_modules/eslint/lib/rules/no-alert.js new file mode 100644 index 0000000..c6f7ddf --- /dev/null +++ b/node_modules/eslint/lib/rules/no-alert.js @@ -0,0 +1,136 @@ +/** + * @fileoverview Rule to flag use of alert, confirm, prompt + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { + getStaticPropertyName: getPropertyName, + getVariableByName, + skipChainExpression +} = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks if the given name is a prohibited identifier. + * @param {string} name The name to check + * @returns {boolean} Whether or not the name is prohibited. + */ +function isProhibitedIdentifier(name) { + return /^(alert|confirm|prompt)$/u.test(name); +} + +/** + * Finds the eslint-scope reference in the given scope. + * @param {Object} scope The scope to search. + * @param {ASTNode} node The identifier node. + * @returns {Reference|null} Returns the found reference or null if none were found. + */ +function findReference(scope, node) { + const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && + reference.identifier.range[1] === node.range[1]); + + if (references.length === 1) { + return references[0]; + } + return null; +} + +/** + * Checks if the given identifier node is shadowed in the given scope. + * @param {Object} scope The current scope. + * @param {string} node The identifier node to check + * @returns {boolean} Whether or not the name is shadowed. + */ +function isShadowed(scope, node) { + const reference = findReference(scope, node); + + return reference && reference.resolved && reference.resolved.defs.length > 0; +} + +/** + * Checks if the given identifier node is a ThisExpression in the global scope or the global window property. + * @param {Object} scope The current scope. + * @param {string} node The identifier node to check + * @returns {boolean} Whether or not the node is a reference to the global object. + */ +function isGlobalThisReferenceOrGlobalWindow(scope, node) { + if (scope.type === "global" && node.type === "ThisExpression") { + return true; + } + if ( + node.type === "Identifier" && + ( + node.name === "window" || + (node.name === "globalThis" && getVariableByName(scope, "globalThis")) + ) + ) { + return !isShadowed(scope, node); + } + + return false; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `alert`, `confirm`, and `prompt`", + recommended: false, + url: "https://eslint.org/docs/rules/no-alert" + }, + + schema: [], + + messages: { + unexpected: "Unexpected {{name}}." + } + }, + + create(context) { + return { + CallExpression(node) { + const callee = skipChainExpression(node.callee), + currentScope = context.getScope(); + + // without window. + if (callee.type === "Identifier") { + const name = callee.name; + + if (!isShadowed(currentScope, callee) && isProhibitedIdentifier(callee.name)) { + context.report({ + node, + messageId: "unexpected", + data: { name } + }); + } + + } else if (callee.type === "MemberExpression" && isGlobalThisReferenceOrGlobalWindow(currentScope, callee.object)) { + const name = getPropertyName(callee); + + if (isProhibitedIdentifier(name)) { + context.report({ + node, + messageId: "unexpected", + data: { name } + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-array-constructor.js b/node_modules/eslint/lib/rules/no-array-constructor.js new file mode 100644 index 0000000..02e6114 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-array-constructor.js @@ -0,0 +1,54 @@ +/** + * @fileoverview Disallow construction of dense arrays using the Array constructor + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `Array` constructors", + recommended: false, + url: "https://eslint.org/docs/rules/no-array-constructor" + }, + + schema: [], + + messages: { + preferLiteral: "The array literal notation [] is preferable." + } + }, + + create(context) { + + /** + * Disallow construction of dense arrays using the Array constructor + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function check(node) { + if ( + node.arguments.length !== 1 && + node.callee.type === "Identifier" && + node.callee.name === "Array" + ) { + context.report({ node, messageId: "preferLiteral" }); + } + } + + return { + CallExpression: check, + NewExpression: check + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-async-promise-executor.js b/node_modules/eslint/lib/rules/no-async-promise-executor.js new file mode 100644 index 0000000..f940f15 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-async-promise-executor.js @@ -0,0 +1,39 @@ +/** + * @fileoverview disallow using an async function as a Promise executor + * @author Teddy Katz + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow using an async function as a Promise executor", + recommended: true, + url: "https://eslint.org/docs/rules/no-async-promise-executor" + }, + + fixable: null, + schema: [], + messages: { + async: "Promise executor functions should not be async." + } + }, + + create(context) { + return { + "NewExpression[callee.name='Promise'][arguments.0.async=true]"(node) { + context.report({ + node: context.getSourceCode().getFirstToken(node.arguments[0], token => token.value === "async"), + messageId: "async" + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-await-in-loop.js b/node_modules/eslint/lib/rules/no-await-in-loop.js new file mode 100644 index 0000000..3aea39a --- /dev/null +++ b/node_modules/eslint/lib/rules/no-await-in-loop.js @@ -0,0 +1,106 @@ +/** + * @fileoverview Rule to disallow uses of await inside of loops. + * @author Nat Mote (nmote) + */ +"use strict"; + +/** + * Check whether it should stop traversing ancestors at the given node. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if it should stop traversing. + */ +function isBoundary(node) { + const t = node.type; + + return ( + t === "FunctionDeclaration" || + t === "FunctionExpression" || + t === "ArrowFunctionExpression" || + + /* + * Don't report the await expressions on for-await-of loop since it's + * asynchronous iteration intentionally. + */ + (t === "ForOfStatement" && node.await === true) + ); +} + +/** + * Check whether the given node is in loop. + * @param {ASTNode} node A node to check. + * @param {ASTNode} parent A parent node to check. + * @returns {boolean} `true` if the node is in loop. + */ +function isLooped(node, parent) { + switch (parent.type) { + case "ForStatement": + return ( + node === parent.test || + node === parent.update || + node === parent.body + ); + + case "ForOfStatement": + case "ForInStatement": + return node === parent.body; + + case "WhileStatement": + case "DoWhileStatement": + return node === parent.test || node === parent.body; + + default: + return false; + } +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow `await` inside of loops", + recommended: false, + url: "https://eslint.org/docs/rules/no-await-in-loop" + }, + + schema: [], + + messages: { + unexpectedAwait: "Unexpected `await` inside a loop." + } + }, + create(context) { + + /** + * Validate an await expression. + * @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate. + * @returns {void} + */ + function validate(awaitNode) { + if (awaitNode.type === "ForOfStatement" && !awaitNode.await) { + return; + } + + let node = awaitNode; + let parent = node.parent; + + while (parent && !isBoundary(parent)) { + if (isLooped(node, parent)) { + context.report({ + node: awaitNode, + messageId: "unexpectedAwait" + }); + return; + } + node = parent; + parent = parent.parent; + } + } + + return { + AwaitExpression: validate, + ForOfStatement: validate + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-bitwise.js b/node_modules/eslint/lib/rules/no-bitwise.js new file mode 100644 index 0000000..43a1e76 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-bitwise.js @@ -0,0 +1,119 @@ +/** + * @fileoverview Rule to flag bitwise identifiers + * @author Nicholas C. Zakas + */ + +"use strict"; + +/* + * + * Set of bitwise operators. + * + */ +const BITWISE_OPERATORS = [ + "^", "|", "&", "<<", ">>", ">>>", + "^=", "|=", "&=", "<<=", ">>=", ">>>=", + "~" +]; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow bitwise operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-bitwise" + }, + + schema: [ + { + type: "object", + properties: { + allow: { + type: "array", + items: { + enum: BITWISE_OPERATORS + }, + uniqueItems: true + }, + int32Hint: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "Unexpected use of '{{operator}}'." + } + }, + + create(context) { + const options = context.options[0] || {}; + const allowed = options.allow || []; + const int32Hint = options.int32Hint === true; + + /** + * Reports an unexpected use of a bitwise operator. + * @param {ASTNode} node Node which contains the bitwise operator. + * @returns {void} + */ + function report(node) { + context.report({ node, messageId: "unexpected", data: { operator: node.operator } }); + } + + /** + * Checks if the given node has a bitwise operator. + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the node has a bitwise operator. + */ + function hasBitwiseOperator(node) { + return BITWISE_OPERATORS.includes(node.operator); + } + + /** + * Checks if exceptions were provided, e.g. `{ allow: ['~', '|'] }`. + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the node has a bitwise operator. + */ + function allowedOperator(node) { + return allowed.includes(node.operator); + } + + /** + * Checks if the given bitwise operator is used for integer typecasting, i.e. "|0" + * @param {ASTNode} node The node to check. + * @returns {boolean} whether the node is used in integer typecasting. + */ + function isInt32Hint(node) { + return int32Hint && node.operator === "|" && node.right && + node.right.type === "Literal" && node.right.value === 0; + } + + /** + * Report if the given node contains a bitwise operator. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNodeForBitwiseOperator(node) { + if (hasBitwiseOperator(node) && !allowedOperator(node) && !isInt32Hint(node)) { + report(node); + } + } + + return { + AssignmentExpression: checkNodeForBitwiseOperator, + BinaryExpression: checkNodeForBitwiseOperator, + UnaryExpression: checkNodeForBitwiseOperator + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-buffer-constructor.js b/node_modules/eslint/lib/rules/no-buffer-constructor.js new file mode 100644 index 0000000..678d703 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-buffer-constructor.js @@ -0,0 +1,50 @@ +/** + * @fileoverview disallow use of the Buffer() constructor + * @author Teddy Katz + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "problem", + + docs: { + description: "disallow use of the `Buffer()` constructor", + recommended: false, + url: "https://eslint.org/docs/rules/no-buffer-constructor" + }, + + schema: [], + + messages: { + deprecated: "{{expr}} is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead." + } + }, + + create(context) { + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + "CallExpression[callee.name='Buffer'], NewExpression[callee.name='Buffer']"(node) { + context.report({ + node, + messageId: "deprecated", + data: { expr: node.type === "CallExpression" ? "Buffer()" : "new Buffer()" } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-caller.js b/node_modules/eslint/lib/rules/no-caller.js new file mode 100644 index 0000000..a6ad94f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-caller.js @@ -0,0 +1,46 @@ +/** + * @fileoverview Rule to flag use of arguments.callee and arguments.caller. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `arguments.caller` or `arguments.callee`", + recommended: false, + url: "https://eslint.org/docs/rules/no-caller" + }, + + schema: [], + + messages: { + unexpected: "Avoid arguments.{{prop}}." + } + }, + + create(context) { + + return { + + MemberExpression(node) { + const objectName = node.object.name, + propertyName = node.property.name; + + if (objectName === "arguments" && !node.computed && propertyName && propertyName.match(/^calle[er]$/u)) { + context.report({ node, messageId: "unexpected", data: { prop: propertyName } }); + } + + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-case-declarations.js b/node_modules/eslint/lib/rules/no-case-declarations.js new file mode 100644 index 0000000..d722f0c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-case-declarations.js @@ -0,0 +1,64 @@ +/** + * @fileoverview Rule to flag use of an lexical declarations inside a case clause + * @author Erik Arvidsson + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow lexical declarations in case clauses", + recommended: true, + url: "https://eslint.org/docs/rules/no-case-declarations" + }, + + schema: [], + + messages: { + unexpected: "Unexpected lexical declaration in case block." + } + }, + + create(context) { + + /** + * Checks whether or not a node is a lexical declaration. + * @param {ASTNode} node A direct child statement of a switch case. + * @returns {boolean} Whether or not the node is a lexical declaration. + */ + function isLexicalDeclaration(node) { + switch (node.type) { + case "FunctionDeclaration": + case "ClassDeclaration": + return true; + case "VariableDeclaration": + return node.kind !== "var"; + default: + return false; + } + } + + return { + SwitchCase(node) { + for (let i = 0; i < node.consequent.length; i++) { + const statement = node.consequent[i]; + + if (isLexicalDeclaration(statement)) { + context.report({ + node: statement, + messageId: "unexpected" + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-catch-shadow.js b/node_modules/eslint/lib/rules/no-catch-shadow.js new file mode 100644 index 0000000..d09c913 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-catch-shadow.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Rule to flag variable leak in CatchClauses in IE 8 and earlier + * @author Ian Christian Myers + * @deprecated in ESLint v5.1.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `catch` clause parameters from shadowing variables in the outer scope", + recommended: false, + url: "https://eslint.org/docs/rules/no-catch-shadow" + }, + + replacedBy: ["no-shadow"], + + deprecated: true, + schema: [], + + messages: { + mutable: "Value of '{{name}}' may be overwritten in IE 8 and earlier." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if the parameters are been shadowed + * @param {Object} scope current scope + * @param {string} name parameter name + * @returns {boolean} True is its been shadowed + */ + function paramIsShadowing(scope, name) { + return astUtils.getVariableByName(scope, name) !== null; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "CatchClause[param!=null]"(node) { + let scope = context.getScope(); + + /* + * When ecmaVersion >= 6, CatchClause creates its own scope + * so start from one upper scope to exclude the current node + */ + if (scope.block === node) { + scope = scope.upper; + } + + if (paramIsShadowing(scope, node.param.name)) { + context.report({ node, messageId: "mutable", data: { name: node.param.name } }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-class-assign.js b/node_modules/eslint/lib/rules/no-class-assign.js new file mode 100644 index 0000000..f679d42 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-class-assign.js @@ -0,0 +1,61 @@ +/** + * @fileoverview A rule to disallow modifying variables of class declarations + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow reassigning class members", + recommended: true, + url: "https://eslint.org/docs/rules/no-class-assign" + }, + + schema: [], + + messages: { + class: "'{{name}}' is a class." + } + }, + + create(context) { + + /** + * Finds and reports references that are non initializer and writable. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + astUtils.getModifyingReferences(variable.references).forEach(reference => { + context.report({ node: reference.identifier, messageId: "class", data: { name: reference.identifier.name } }); + + }); + } + + /** + * Finds and reports references that are non initializer and writable. + * @param {ASTNode} node A ClassDeclaration/ClassExpression node to check. + * @returns {void} + */ + function checkForClass(node) { + context.getDeclaredVariables(node).forEach(checkVariable); + } + + return { + ClassDeclaration: checkForClass, + ClassExpression: checkForClass + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-compare-neg-zero.js b/node_modules/eslint/lib/rules/no-compare-neg-zero.js new file mode 100644 index 0000000..fb56b99 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-compare-neg-zero.js @@ -0,0 +1,60 @@ +/** + * @fileoverview The rule should warn against code that tries to compare against -0. + * @author Aladdin-ADD + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow comparing against -0", + recommended: true, + url: "https://eslint.org/docs/rules/no-compare-neg-zero" + }, + + fixable: null, + schema: [], + + messages: { + unexpected: "Do not use the '{{operator}}' operator to compare against -0." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks a given node is -0 + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is -0. + */ + function isNegZero(node) { + return node.type === "UnaryExpression" && node.operator === "-" && node.argument.type === "Literal" && node.argument.value === 0; + } + const OPERATORS_TO_CHECK = new Set([">", ">=", "<", "<=", "==", "===", "!=", "!=="]); + + return { + BinaryExpression(node) { + if (OPERATORS_TO_CHECK.has(node.operator)) { + if (isNegZero(node.left) || isNegZero(node.right)) { + context.report({ + node, + messageId: "unexpected", + data: { operator: node.operator } + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-cond-assign.js b/node_modules/eslint/lib/rules/no-cond-assign.js new file mode 100644 index 0000000..30d5b3b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-cond-assign.js @@ -0,0 +1,159 @@ +/** + * @fileoverview Rule to flag assignment in a conditional statement's test expression + * @author Stephen Murray + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const TEST_CONDITION_PARENT_TYPES = new Set(["IfStatement", "WhileStatement", "DoWhileStatement", "ForStatement", "ConditionalExpression"]); + +const NODE_DESCRIPTIONS = { + DoWhileStatement: "a 'do...while' statement", + ForStatement: "a 'for' statement", + IfStatement: "an 'if' statement", + WhileStatement: "a 'while' statement" +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow assignment operators in conditional expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-cond-assign" + }, + + schema: [ + { + enum: ["except-parens", "always"] + } + ], + + messages: { + unexpected: "Unexpected assignment within {{type}}.", + + // must match JSHint's error message + missing: "Expected a conditional expression and instead saw an assignment." + } + }, + + create(context) { + + const prohibitAssign = (context.options[0] || "except-parens"); + + const sourceCode = context.getSourceCode(); + + /** + * Check whether an AST node is the test expression for a conditional statement. + * @param {!Object} node The node to test. + * @returns {boolean} `true` if the node is the text expression for a conditional statement; otherwise, `false`. + */ + function isConditionalTestExpression(node) { + return node.parent && + TEST_CONDITION_PARENT_TYPES.has(node.parent.type) && + node === node.parent.test; + } + + /** + * Given an AST node, perform a bottom-up search for the first ancestor that represents a conditional statement. + * @param {!Object} node The node to use at the start of the search. + * @returns {?Object} The closest ancestor node that represents a conditional statement. + */ + function findConditionalAncestor(node) { + let currentAncestor = node; + + do { + if (isConditionalTestExpression(currentAncestor)) { + return currentAncestor.parent; + } + } while ((currentAncestor = currentAncestor.parent) && !astUtils.isFunction(currentAncestor)); + + return null; + } + + /** + * Check whether the code represented by an AST node is enclosed in two sets of parentheses. + * @param {!Object} node The node to test. + * @returns {boolean} `true` if the code is enclosed in two sets of parentheses; otherwise, `false`. + */ + function isParenthesisedTwice(node) { + const previousToken = sourceCode.getTokenBefore(node, 1), + nextToken = sourceCode.getTokenAfter(node, 1); + + return astUtils.isParenthesised(sourceCode, node) && + previousToken && astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] && + astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1]; + } + + /** + * Check a conditional statement's test expression for top-level assignments that are not enclosed in parentheses. + * @param {!Object} node The node for the conditional statement. + * @returns {void} + */ + function testForAssign(node) { + if (node.test && + (node.test.type === "AssignmentExpression") && + (node.type === "ForStatement" + ? !astUtils.isParenthesised(sourceCode, node.test) + : !isParenthesisedTwice(node.test) + ) + ) { + + context.report({ + node: node.test, + messageId: "missing" + }); + } + } + + /** + * Check whether an assignment expression is descended from a conditional statement's test expression. + * @param {!Object} node The node for the assignment expression. + * @returns {void} + */ + function testForConditionalAncestor(node) { + const ancestor = findConditionalAncestor(node); + + if (ancestor) { + context.report({ + node, + messageId: "unexpected", + data: { + type: NODE_DESCRIPTIONS[ancestor.type] || ancestor.type + } + }); + } + } + + if (prohibitAssign === "always") { + return { + AssignmentExpression: testForConditionalAncestor + }; + } + + return { + DoWhileStatement: testForAssign, + ForStatement: testForAssign, + IfStatement: testForAssign, + WhileStatement: testForAssign, + ConditionalExpression: testForAssign + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-confusing-arrow.js b/node_modules/eslint/lib/rules/no-confusing-arrow.js new file mode 100644 index 0000000..9cdd0a8 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-confusing-arrow.js @@ -0,0 +1,89 @@ +/** + * @fileoverview A rule to warn against using arrow functions when they could be + * confused with comparisons + * @author Jxck + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils.js"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a node is a conditional expression. + * @param {ASTNode} node node to test + * @returns {boolean} `true` if the node is a conditional expression. + */ +function isConditional(node) { + return node && node.type === "ConditionalExpression"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow arrow functions where they could be confused with comparisons", + recommended: false, + url: "https://eslint.org/docs/rules/no-confusing-arrow" + }, + + fixable: "code", + + schema: [{ + type: "object", + properties: { + allowParens: { type: "boolean", default: true }, + onlyOneSimpleParam: { type: "boolean", default: false } + }, + additionalProperties: false + }], + + messages: { + confusing: "Arrow function used ambiguously with a conditional expression." + } + }, + + create(context) { + const config = context.options[0] || {}; + const allowParens = config.allowParens || (config.allowParens === void 0); + const onlyOneSimpleParam = config.onlyOneSimpleParam; + const sourceCode = context.getSourceCode(); + + + /** + * Reports if an arrow function contains an ambiguous conditional. + * @param {ASTNode} node A node to check and report. + * @returns {void} + */ + function checkArrowFunc(node) { + const body = node.body; + + if (isConditional(body) && + !(allowParens && astUtils.isParenthesised(sourceCode, body)) && + !(onlyOneSimpleParam && !(node.params.length === 1 && node.params[0].type === "Identifier"))) { + context.report({ + node, + messageId: "confusing", + fix(fixer) { + + // if `allowParens` is not set to true don't bother wrapping in parens + return allowParens && fixer.replaceText(node.body, `(${sourceCode.getText(node.body)})`); + } + }); + } + } + + return { + ArrowFunctionExpression: checkArrowFunc + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-console.js b/node_modules/eslint/lib/rules/no-console.js new file mode 100644 index 0000000..464d564 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-console.js @@ -0,0 +1,134 @@ +/** + * @fileoverview Rule to flag use of console object + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `console`", + recommended: false, + url: "https://eslint.org/docs/rules/no-console" + }, + + schema: [ + { + type: "object", + properties: { + allow: { + type: "array", + items: { + type: "string" + }, + minItems: 1, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "Unexpected console statement." + } + }, + + create(context) { + const options = context.options[0] || {}; + const allowed = options.allow || []; + + /** + * Checks whether the given reference is 'console' or not. + * @param {eslint-scope.Reference} reference The reference to check. + * @returns {boolean} `true` if the reference is 'console'. + */ + function isConsole(reference) { + const id = reference.identifier; + + return id && id.name === "console"; + } + + /** + * Checks whether the property name of the given MemberExpression node + * is allowed by options or not. + * @param {ASTNode} node The MemberExpression node to check. + * @returns {boolean} `true` if the property name of the node is allowed. + */ + function isAllowed(node) { + const propertyName = astUtils.getStaticPropertyName(node); + + return propertyName && allowed.includes(propertyName); + } + + /** + * Checks whether the given reference is a member access which is not + * allowed by options or not. + * @param {eslint-scope.Reference} reference The reference to check. + * @returns {boolean} `true` if the reference is a member access which + * is not allowed by options. + */ + function isMemberAccessExceptAllowed(reference) { + const node = reference.identifier; + const parent = node.parent; + + return ( + parent.type === "MemberExpression" && + parent.object === node && + !isAllowed(parent) + ); + } + + /** + * Reports the given reference as a violation. + * @param {eslint-scope.Reference} reference The reference to report. + * @returns {void} + */ + function report(reference) { + const node = reference.identifier.parent; + + context.report({ + node, + loc: node.loc, + messageId: "unexpected" + }); + } + + return { + "Program:exit"() { + const scope = context.getScope(); + const consoleVar = astUtils.getVariableByName(scope, "console"); + const shadowed = consoleVar && consoleVar.defs.length > 0; + + /* + * 'scope.through' includes all references to undefined + * variables. If the variable 'console' is not defined, it uses + * 'scope.through'. + */ + const references = consoleVar + ? consoleVar.references + : scope.through.filter(isConsole); + + if (!shadowed) { + references + .filter(isMemberAccessExceptAllowed) + .forEach(report); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-const-assign.js b/node_modules/eslint/lib/rules/no-const-assign.js new file mode 100644 index 0000000..b5f7c37 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-const-assign.js @@ -0,0 +1,54 @@ +/** + * @fileoverview A rule to disallow modifying variables that are declared using `const` + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow reassigning `const` variables", + recommended: true, + url: "https://eslint.org/docs/rules/no-const-assign" + }, + + schema: [], + + messages: { + const: "'{{name}}' is constant." + } + }, + + create(context) { + + /** + * Finds and reports references that are non initializer and writable. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + astUtils.getModifyingReferences(variable.references).forEach(reference => { + context.report({ node: reference.identifier, messageId: "const", data: { name: reference.identifier.name } }); + }); + } + + return { + VariableDeclaration(node) { + if (node.kind === "const") { + context.getDeclaredVariables(node).forEach(checkVariable); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-constant-binary-expression.js b/node_modules/eslint/lib/rules/no-constant-binary-expression.js new file mode 100644 index 0000000..6cad0ef --- /dev/null +++ b/node_modules/eslint/lib/rules/no-constant-binary-expression.js @@ -0,0 +1,500 @@ +/** + * @fileoverview Rule to flag constant comparisons and logical expressions that always/never short circuit + * @author Jordan Eldredge + */ + +"use strict"; + +const globals = require("globals"); +const { isNullLiteral, isConstant, isReferenceToGlobalVariable, isLogicalAssignmentOperator } = require("./utils/ast-utils"); + +const NUMERIC_OR_STRING_BINARY_OPERATORS = new Set(["+", "-", "*", "/", "%", "|", "^", "&", "**", "<<", ">>", ">>>"]); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Test if an AST node has a statically knowable constant nullishness. Meaning, + * it will always resolve to a constant value of either: `null`, `undefined` + * or not `null` _or_ `undefined`. An expression that can vary between those + * three states at runtime would return `false`. + * @param {Scope} scope The scope in which the node was found. + * @param {ASTNode} node The AST node being tested. + * @returns {boolean} Does `node` have constant nullishness? + */ +function hasConstantNullishness(scope, node) { + switch (node.type) { + case "ObjectExpression": // Objects are never nullish + case "ArrayExpression": // Arrays are never nullish + case "ArrowFunctionExpression": // Functions never nullish + case "FunctionExpression": // Functions are never nullish + case "ClassExpression": // Classes are never nullish + case "NewExpression": // Objects are never nullish + case "Literal": // Nullish, or non-nullish, literals never change + case "TemplateLiteral": // A string is never nullish + case "UpdateExpression": // Numbers are never nullish + case "BinaryExpression": // Numbers, strings, or booleans are never nullish + return true; + case "CallExpression": { + if (node.callee.type !== "Identifier") { + return false; + } + const functionName = node.callee.name; + + return (functionName === "Boolean" || functionName === "String" || functionName === "Number") && + isReferenceToGlobalVariable(scope, node.callee); + } + case "AssignmentExpression": + if (node.operator === "=") { + return hasConstantNullishness(scope, node.right); + } + + /* + * Handling short-circuiting assignment operators would require + * walking the scope. We won't attempt that (for now...) / + */ + if (isLogicalAssignmentOperator(node.operator)) { + return false; + } + + /* + * The remaining assignment expressions all result in a numeric or + * string (non-nullish) value: + * "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&=" + */ + + return true; + case "UnaryExpression": + + /* + * "void" Always returns `undefined` + * "typeof" All types are strings, and thus non-nullish + * "!" Boolean is never nullish + * "delete" Returns a boolean, which is never nullish + * Math operators always return numbers or strings, neither of which + * are non-nullish "+", "-", "~" + */ + + return true; + case "SequenceExpression": { + const last = node.expressions[node.expressions.length - 1]; + + return hasConstantNullishness(scope, last); + } + case "Identifier": + return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); + case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. + case "JSXFragment": + return false; + default: + return false; + } +} + +/** + * Test if an AST node is a boolean value that never changes. Specifically we + * test for: + * 1. Literal booleans (`true` or `false`) + * 2. Unary `!` expressions with a constant value + * 3. Constant booleans created via the `Boolean` global function + * @param {Scope} scope The scope in which the node was found. + * @param {ASTNode} node The node to test + * @returns {boolean} Is `node` guaranteed to be a boolean? + */ +function isStaticBoolean(scope, node) { + switch (node.type) { + case "Literal": + return typeof node.value === "boolean"; + case "CallExpression": + return node.callee.type === "Identifier" && node.callee.name === "Boolean" && + isReferenceToGlobalVariable(scope, node.callee) && + (node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)); + case "UnaryExpression": + return node.operator === "!" && isConstant(scope, node.argument, true); + default: + return false; + } +} + + +/** + * Test if an AST node will always give the same result when compared to a + * boolean value. Note that comparison to boolean values is different than + * truthiness. + * https://262.ecma-international.org/5.1/#sec-11.9.3 + * + * Javascript `==` operator works by converting the boolean to `1` (true) or + * `+0` (false) and then checks the values `==` equality to that number. + * @param {Scope} scope The scope in which node was found. + * @param {ASTNode} node The node to test. + * @returns {boolean} Will `node` always coerce to the same boolean value? + */ +function hasConstantLooseBooleanComparison(scope, node) { + switch (node.type) { + case "ObjectExpression": + case "ClassExpression": + + /** + * In theory objects like: + * + * `{toString: () => a}` + * `{valueOf: () => a}` + * + * Or a classes like: + * + * `class { static toString() { return a } }` + * `class { static valueOf() { return a } }` + * + * Are not constant verifiably when `inBooleanPosition` is + * false, but it's an edge case we've opted not to handle. + */ + return true; + case "ArrayExpression": { + const nonSpreadElements = node.elements.filter(e => + + // Elements can be `null` in sparse arrays: `[,,]`; + e !== null && e.type !== "SpreadElement"); + + + /* + * Possible future direction if needed: We could check if the + * single value would result in variable boolean comparison. + * For now we will err on the side of caution since `[x]` could + * evaluate to `[0]` or `[1]`. + */ + return node.elements.length === 0 || nonSpreadElements.length > 1; + } + case "ArrowFunctionExpression": + case "FunctionExpression": + return true; + case "UnaryExpression": + if (node.operator === "void" || // Always returns `undefined` + node.operator === "typeof" // All `typeof` strings, when coerced to number, are not 0 or 1. + ) { + return true; + } + if (node.operator === "!") { + return isConstant(scope, node.argument, true); + } + + /* + * We won't try to reason about +, -, ~, or delete + * In theory, for the mathematical operators, we could look at the + * argument and try to determine if it coerces to a constant numeric + * value. + */ + return false; + case "NewExpression": // Objects might have custom `.valueOf` or `.toString`. + return false; + case "CallExpression": { + if (node.callee.type === "Identifier" && + node.callee.name === "Boolean" && + isReferenceToGlobalVariable(scope, node.callee) + ) { + return node.arguments.length === 0 || isConstant(scope, node.arguments[0], true); + } + return false; + } + case "Literal": // True or false, literals never change + return true; + case "Identifier": + return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); + case "TemplateLiteral": + + /* + * In theory we could try to check if the quasi are sufficient to + * prove that the expression will always be true, but it would be + * tricky to get right. For example: `000.${foo}000` + */ + return node.expressions.length === 0; + case "AssignmentExpression": + if (node.operator === "=") { + return hasConstantLooseBooleanComparison(scope, node.right); + } + + /* + * Handling short-circuiting assignment operators would require + * walking the scope. We won't attempt that (for now...) + * + * The remaining assignment expressions all result in a numeric or + * string (non-nullish) values which could be truthy or falsy: + * "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&=" + */ + return false; + case "SequenceExpression": { + const last = node.expressions[node.expressions.length - 1]; + + return hasConstantLooseBooleanComparison(scope, last); + } + case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. + case "JSXFragment": + return false; + default: + return false; + } +} + + +/** + * Test if an AST node will always give the same result when _strictly_ compared + * to a boolean value. This can happen if the expression can never be boolean, or + * if it is always the same boolean value. + * @param {Scope} scope The scope in which the node was found. + * @param {ASTNode} node The node to test + * @returns {boolean} Will `node` always give the same result when compared to a + * static boolean value? + */ +function hasConstantStrictBooleanComparison(scope, node) { + switch (node.type) { + case "ObjectExpression": // Objects are not booleans + case "ArrayExpression": // Arrays are not booleans + case "ArrowFunctionExpression": // Functions are not booleans + case "FunctionExpression": + case "ClassExpression": // Classes are not booleans + case "NewExpression": // Objects are not booleans + case "TemplateLiteral": // Strings are not booleans + case "Literal": // True, false, or not boolean, literals never change. + case "UpdateExpression": // Numbers are not booleans + return true; + case "BinaryExpression": + return NUMERIC_OR_STRING_BINARY_OPERATORS.has(node.operator); + case "UnaryExpression": { + if (node.operator === "delete") { + return false; + } + if (node.operator === "!") { + return isConstant(scope, node.argument, true); + } + + /* + * The remaining operators return either strings or numbers, neither + * of which are boolean. + */ + return true; + } + case "SequenceExpression": { + const last = node.expressions[node.expressions.length - 1]; + + return hasConstantStrictBooleanComparison(scope, last); + } + case "Identifier": + return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); + case "AssignmentExpression": + if (node.operator === "=") { + return hasConstantStrictBooleanComparison(scope, node.right); + } + + /* + * Handling short-circuiting assignment operators would require + * walking the scope. We won't attempt that (for now...) + */ + if (isLogicalAssignmentOperator(node.operator)) { + return false; + } + + /* + * The remaining assignment expressions all result in either a number + * or a string, neither of which can ever be boolean. + */ + return true; + case "CallExpression": { + if (node.callee.type !== "Identifier") { + return false; + } + const functionName = node.callee.name; + + if ( + (functionName === "String" || functionName === "Number") && + isReferenceToGlobalVariable(scope, node.callee) + ) { + return true; + } + if (functionName === "Boolean" && isReferenceToGlobalVariable(scope, node.callee)) { + return ( + node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)); + } + return false; + } + case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. + case "JSXFragment": + return false; + default: + return false; + } +} + +/** + * Test if an AST node will always result in a newly constructed object + * @param {Scope} scope The scope in which the node was found. + * @param {ASTNode} node The node to test + * @returns {boolean} Will `node` always be new? + */ +function isAlwaysNew(scope, node) { + switch (node.type) { + case "ObjectExpression": + case "ArrayExpression": + case "ArrowFunctionExpression": + case "FunctionExpression": + case "ClassExpression": + return true; + case "NewExpression": { + if (node.callee.type !== "Identifier") { + return false; + } + + /* + * All the built-in constructors are always new, but + * user-defined constructors could return a sentinel + * object. + * + * Catching these is especially useful for primitive constructures + * which return boxed values, a surprising gotcha' in JavaScript. + */ + return Object.hasOwnProperty.call(globals.builtin, node.callee.name) && + isReferenceToGlobalVariable(scope, node.callee); + } + case "Literal": + + // Regular expressions are objects, and thus always new + return typeof node.regex === "object"; + case "SequenceExpression": { + const last = node.expressions[node.expressions.length - 1]; + + return isAlwaysNew(scope, last); + } + case "AssignmentExpression": + if (node.operator === "=") { + return isAlwaysNew(scope, node.right); + } + return false; + case "ConditionalExpression": + return isAlwaysNew(scope, node.consequent) && isAlwaysNew(scope, node.alternate); + case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. + case "JSXFragment": + return false; + default: + return false; + } +} + +/** + * Checks whether or not a node is `null` or `undefined`. Similar to the one + * found in ast-utils.js, but this one correctly handles the edge case that + * `undefined` has been redefined. + * @param {Scope} scope Scope in which the expression was found. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a `null` or `undefined`. + * @public + */ +function isNullOrUndefined(scope, node) { + return ( + isNullLiteral(node) || + (node.type === "Identifier" && node.name === "undefined" && isReferenceToGlobalVariable(scope, node)) || + (node.type === "UnaryExpression" && node.operator === "void") + ); +} + + +/** + * Checks if one operand will cause the result to be constant. + * @param {Scope} scope Scope in which the expression was found. + * @param {ASTNode} a One side of the expression + * @param {ASTNode} b The other side of the expression + * @param {string} operator The binary expression operator + * @returns {ASTNode | null} The node which will cause the expression to have a constant result. + */ +function findBinaryExpressionConstantOperand(scope, a, b, operator) { + if (operator === "==" || operator === "!=") { + if ( + (isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b)) || + (isStaticBoolean(scope, a) && hasConstantLooseBooleanComparison(scope, b)) + ) { + return b; + } + } else if (operator === "===" || operator === "!==") { + if ( + (isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b)) || + (isStaticBoolean(scope, a) && hasConstantStrictBooleanComparison(scope, b)) + ) { + return b; + } + } + return null; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + docs: { + description: "disallow expressions where the operation doesn't affect the value", + recommended: false, + url: "https://eslint.org/docs/rules/no-constant-binary-expression" + }, + schema: [], + messages: { + constantBinaryOperand: "Unexpected constant binary expression. Compares constantly with the {{otherSide}}-hand side of the `{{operator}}`.", + constantShortCircuit: "Unexpected constant {{property}} on the left-hand side of a `{{operator}}` expression.", + alwaysNew: "Unexpected comparison to newly constructed object. These two values can never be equal.", + bothAlwaysNew: "Unexpected comparison of two newly constructed objects. These two values can never be equal." + } + }, + + create(context) { + return { + LogicalExpression(node) { + const { operator, left } = node; + const scope = context.getScope(); + + if ((operator === "&&" || operator === "||") && isConstant(scope, left, true)) { + context.report({ node: left, messageId: "constantShortCircuit", data: { property: "truthiness", operator } }); + } else if (operator === "??" && hasConstantNullishness(scope, left)) { + context.report({ node: left, messageId: "constantShortCircuit", data: { property: "nullishness", operator } }); + } + }, + BinaryExpression(node) { + const scope = context.getScope(); + const { right, left, operator } = node; + const rightConstantOperand = findBinaryExpressionConstantOperand(scope, left, right, operator); + const leftConstantOperand = findBinaryExpressionConstantOperand(scope, right, left, operator); + + if (rightConstantOperand) { + context.report({ node: rightConstantOperand, messageId: "constantBinaryOperand", data: { operator, otherSide: "left" } }); + } else if (leftConstantOperand) { + context.report({ node: leftConstantOperand, messageId: "constantBinaryOperand", data: { operator, otherSide: "right" } }); + } else if (operator === "===" || operator === "!==") { + if (isAlwaysNew(scope, left)) { + context.report({ node: left, messageId: "alwaysNew" }); + } else if (isAlwaysNew(scope, right)) { + context.report({ node: right, messageId: "alwaysNew" }); + } + } else if (operator === "==" || operator === "!=") { + + /* + * If both sides are "new", then both sides are objects and + * therefore they will be compared by reference even with `==` + * equality. + */ + if (isAlwaysNew(scope, left) && isAlwaysNew(scope, right)) { + context.report({ node: left, messageId: "bothAlwaysNew" }); + } + } + + } + + /* + * In theory we could handle short-circuiting assignment operators, + * for some constant values, but that would require walking the + * scope to find the value of the variable being assigned. This is + * dependant on https://github.com/eslint/eslint/issues/13776 + * + * AssignmentExpression() {}, + */ + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-constant-condition.js b/node_modules/eslint/lib/rules/no-constant-condition.js new file mode 100644 index 0000000..a0871fe --- /dev/null +++ b/node_modules/eslint/lib/rules/no-constant-condition.js @@ -0,0 +1,149 @@ +/** + * @fileoverview Rule to flag use constant conditions + * @author Christian Schulz + */ + +"use strict"; + +const { isConstant } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow constant expressions in conditions", + recommended: true, + url: "https://eslint.org/docs/rules/no-constant-condition" + }, + + schema: [ + { + type: "object", + properties: { + checkLoops: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "Unexpected constant condition." + } + }, + + create(context) { + const options = context.options[0] || {}, + checkLoops = options.checkLoops !== false, + loopSetStack = []; + + let loopsInCurrentScope = new Set(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Tracks when the given node contains a constant condition. + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function trackConstantConditionLoop(node) { + if (node.test && isConstant(context.getScope(), node.test, true)) { + loopsInCurrentScope.add(node); + } + } + + /** + * Reports when the set contains the given constant condition node + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function checkConstantConditionLoopInSet(node) { + if (loopsInCurrentScope.has(node)) { + loopsInCurrentScope.delete(node); + context.report({ node: node.test, messageId: "unexpected" }); + } + } + + /** + * Reports when the given node contains a constant condition. + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function reportIfConstant(node) { + if (node.test && isConstant(context.getScope(), node.test, true)) { + context.report({ node: node.test, messageId: "unexpected" }); + } + } + + /** + * Stores current set of constant loops in loopSetStack temporarily + * and uses a new set to track constant loops + * @returns {void} + * @private + */ + function enterFunction() { + loopSetStack.push(loopsInCurrentScope); + loopsInCurrentScope = new Set(); + } + + /** + * Reports when the set still contains stored constant conditions + * @returns {void} + * @private + */ + function exitFunction() { + loopsInCurrentScope = loopSetStack.pop(); + } + + /** + * Checks node when checkLoops option is enabled + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function checkLoop(node) { + if (checkLoops) { + trackConstantConditionLoop(node); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ConditionalExpression: reportIfConstant, + IfStatement: reportIfConstant, + WhileStatement: checkLoop, + "WhileStatement:exit": checkConstantConditionLoopInSet, + DoWhileStatement: checkLoop, + "DoWhileStatement:exit": checkConstantConditionLoopInSet, + ForStatement: checkLoop, + "ForStatement > .test": node => checkLoop(node.parent), + "ForStatement:exit": checkConstantConditionLoopInSet, + FunctionDeclaration: enterFunction, + "FunctionDeclaration:exit": exitFunction, + FunctionExpression: enterFunction, + "FunctionExpression:exit": exitFunction, + YieldExpression: () => loopsInCurrentScope.clear() + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-constructor-return.js b/node_modules/eslint/lib/rules/no-constructor-return.js new file mode 100644 index 0000000..f8a717c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-constructor-return.js @@ -0,0 +1,62 @@ +/** + * @fileoverview Rule to disallow returning value from constructor. + * @author Pig Fang + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow returning value from constructor", + recommended: false, + url: "https://eslint.org/docs/rules/no-constructor-return" + }, + + schema: {}, + + fixable: null, + + messages: { + unexpected: "Unexpected return statement in constructor." + } + }, + + create(context) { + const stack = []; + + return { + onCodePathStart(_, node) { + stack.push(node); + }, + onCodePathEnd() { + stack.pop(); + }, + ReturnStatement(node) { + const last = stack[stack.length - 1]; + + if (!last.parent) { + return; + } + + if ( + last.parent.type === "MethodDefinition" && + last.parent.kind === "constructor" && + (node.parent.parent === last || node.argument) + ) { + context.report({ + node, + messageId: "unexpected" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-continue.js b/node_modules/eslint/lib/rules/no-continue.js new file mode 100644 index 0000000..8658a79 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-continue.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Rule to flag use of continue statement + * @author Borislav Zhivkov + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `continue` statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-continue" + }, + + schema: [], + + messages: { + unexpected: "Unexpected use of continue statement." + } + }, + + create(context) { + + return { + ContinueStatement(node) { + context.report({ node, messageId: "unexpected" }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-control-regex.js b/node_modules/eslint/lib/rules/no-control-regex.js new file mode 100644 index 0000000..00278f5 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-control-regex.js @@ -0,0 +1,125 @@ +/** + * @fileoverview Rule to forbid control characters from regular expressions. + * @author Nicholas C. Zakas + */ + +"use strict"; + +const RegExpValidator = require("regexpp").RegExpValidator; +const collector = new (class { + constructor() { + this._source = ""; + this._controlChars = []; + this._validator = new RegExpValidator(this); + } + + onPatternEnter() { + this._controlChars = []; + } + + onCharacter(start, end, cp) { + if (cp >= 0x00 && + cp <= 0x1F && + ( + this._source.codePointAt(start) === cp || + this._source.slice(start, end).startsWith("\\x") || + this._source.slice(start, end).startsWith("\\u") + ) + ) { + this._controlChars.push(`\\x${`0${cp.toString(16)}`.slice(-2)}`); + } + } + + collectControlChars(regexpStr, flags) { + const uFlag = typeof flags === "string" && flags.includes("u"); + + try { + this._source = regexpStr; + this._validator.validatePattern(regexpStr, void 0, void 0, uFlag); // Call onCharacter hook + } catch { + + // Ignore syntax errors in RegExp. + } + return this._controlChars; + } +})(); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow control characters in regular expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-control-regex" + }, + + schema: [], + + messages: { + unexpected: "Unexpected control character(s) in regular expression: {{controlChars}}." + } + }, + + create(context) { + + /** + * Get the regex expression + * @param {ASTNode} node `Literal` node to evaluate + * @returns {{ pattern: string, flags: string | null } | null} Regex if found (the given node is either a regex literal + * or a string literal that is the pattern argument of a RegExp constructor call). Otherwise `null`. If flags cannot be determined, + * the `flags` property will be `null`. + * @private + */ + function getRegExp(node) { + if (node.regex) { + return node.regex; + } + if (typeof node.value === "string" && + (node.parent.type === "NewExpression" || node.parent.type === "CallExpression") && + node.parent.callee.type === "Identifier" && + node.parent.callee.name === "RegExp" && + node.parent.arguments[0] === node + ) { + const pattern = node.value; + const flags = + node.parent.arguments.length > 1 && + node.parent.arguments[1].type === "Literal" && + typeof node.parent.arguments[1].value === "string" + ? node.parent.arguments[1].value + : null; + + return { pattern, flags }; + } + + return null; + } + + return { + Literal(node) { + const regExp = getRegExp(node); + + if (regExp) { + const { pattern, flags } = regExp; + const controlCharacters = collector.collectControlChars(pattern, flags); + + if (controlCharacters.length > 0) { + context.report({ + node, + messageId: "unexpected", + data: { + controlChars: controlCharacters.join(", ") + } + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-debugger.js b/node_modules/eslint/lib/rules/no-debugger.js new file mode 100644 index 0000000..e62db1b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-debugger.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to flag use of a debugger statement + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow the use of `debugger`", + recommended: true, + url: "https://eslint.org/docs/rules/no-debugger" + }, + + fixable: null, + schema: [], + + messages: { + unexpected: "Unexpected 'debugger' statement." + } + }, + + create(context) { + + return { + DebuggerStatement(node) { + context.report({ + node, + messageId: "unexpected" + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-delete-var.js b/node_modules/eslint/lib/rules/no-delete-var.js new file mode 100644 index 0000000..1d1c710 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-delete-var.js @@ -0,0 +1,42 @@ +/** + * @fileoverview Rule to flag when deleting variables + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow deleting variables", + recommended: true, + url: "https://eslint.org/docs/rules/no-delete-var" + }, + + schema: [], + + messages: { + unexpected: "Variables should not be deleted." + } + }, + + create(context) { + + return { + + UnaryExpression(node) { + if (node.operator === "delete" && node.argument.type === "Identifier") { + context.report({ node, messageId: "unexpected" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-div-regex.js b/node_modules/eslint/lib/rules/no-div-regex.js new file mode 100644 index 0000000..175f6c2 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-div-regex.js @@ -0,0 +1,53 @@ +/** + * @fileoverview Rule to check for ambiguous div operator in regexes + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow division operators explicitly at the beginning of regular expressions", + recommended: false, + url: "https://eslint.org/docs/rules/no-div-regex" + }, + + fixable: "code", + + schema: [], + + messages: { + unexpected: "A regular expression literal can be confused with '/='." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + + Literal(node) { + const token = sourceCode.getFirstToken(node); + + if (token.type === "RegularExpression" && token.value[1] === "=") { + context.report({ + node, + messageId: "unexpected", + fix(fixer) { + return fixer.replaceTextRange([token.range[0] + 1, token.range[0] + 2], "[=]"); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-dupe-args.js b/node_modules/eslint/lib/rules/no-dupe-args.js new file mode 100644 index 0000000..13090e1 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-dupe-args.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Rule to flag duplicate arguments + * @author Jamund Ferguson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate arguments in `function` definitions", + recommended: true, + url: "https://eslint.org/docs/rules/no-dupe-args" + }, + + schema: [], + + messages: { + unexpected: "Duplicate param '{{name}}'." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks whether or not a given definition is a parameter's. + * @param {eslint-scope.DefEntry} def A definition to check. + * @returns {boolean} `true` if the definition is a parameter's. + */ + function isParameter(def) { + return def.type === "Parameter"; + } + + /** + * Determines if a given node has duplicate parameters. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkParams(node) { + const variables = context.getDeclaredVariables(node); + + for (let i = 0; i < variables.length; ++i) { + const variable = variables[i]; + + // Checks and reports duplications. + const defs = variable.defs.filter(isParameter); + + if (defs.length >= 2) { + context.report({ + node, + messageId: "unexpected", + data: { name: variable.name } + }); + } + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + FunctionDeclaration: checkParams, + FunctionExpression: checkParams + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-dupe-class-members.js b/node_modules/eslint/lib/rules/no-dupe-class-members.js new file mode 100644 index 0000000..ae61f16 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-dupe-class-members.js @@ -0,0 +1,104 @@ +/** + * @fileoverview A rule to disallow duplicate name in class members. + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate class members", + recommended: true, + url: "https://eslint.org/docs/rules/no-dupe-class-members" + }, + + schema: [], + + messages: { + unexpected: "Duplicate name '{{name}}'." + } + }, + + create(context) { + let stack = []; + + /** + * Gets state of a given member name. + * @param {string} name A name of a member. + * @param {boolean} isStatic A flag which specifies that is a static member. + * @returns {Object} A state of a given member name. + * - retv.init {boolean} A flag which shows the name is declared as normal member. + * - retv.get {boolean} A flag which shows the name is declared as getter. + * - retv.set {boolean} A flag which shows the name is declared as setter. + */ + function getState(name, isStatic) { + const stateMap = stack[stack.length - 1]; + const key = `$${name}`; // to avoid "__proto__". + + if (!stateMap[key]) { + stateMap[key] = { + nonStatic: { init: false, get: false, set: false }, + static: { init: false, get: false, set: false } + }; + } + + return stateMap[key][isStatic ? "static" : "nonStatic"]; + } + + return { + + // Initializes the stack of state of member declarations. + Program() { + stack = []; + }, + + // Initializes state of member declarations for the class. + ClassBody() { + stack.push(Object.create(null)); + }, + + // Disposes the state for the class. + "ClassBody:exit"() { + stack.pop(); + }, + + // Reports the node if its name has been declared already. + "MethodDefinition, PropertyDefinition"(node) { + const name = astUtils.getStaticPropertyName(node); + const kind = node.type === "MethodDefinition" ? node.kind : "field"; + + if (name === null || kind === "constructor") { + return; + } + + const state = getState(name, node.static); + let isDuplicate = false; + + if (kind === "get") { + isDuplicate = (state.init || state.get); + state.get = true; + } else if (kind === "set") { + isDuplicate = (state.init || state.set); + state.set = true; + } else { + isDuplicate = (state.init || state.get || state.set); + state.init = true; + } + + if (isDuplicate) { + context.report({ node, messageId: "unexpected", data: { name } }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-dupe-else-if.js b/node_modules/eslint/lib/rules/no-dupe-else-if.js new file mode 100644 index 0000000..1e1d549 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-dupe-else-if.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Rule to disallow duplicate conditions in if-else-if chains + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the first given array is a subset of the second given array. + * @param {Function} comparator A function to compare two elements, should return `true` if they are equal. + * @param {Array} arrA The array to compare from. + * @param {Array} arrB The array to compare against. + * @returns {boolean} `true` if the array `arrA` is a subset of the array `arrB`. + */ +function isSubsetByComparator(comparator, arrA, arrB) { + return arrA.every(a => arrB.some(b => comparator(a, b))); +} + +/** + * Splits the given node by the given logical operator. + * @param {string} operator Logical operator `||` or `&&`. + * @param {ASTNode} node The node to split. + * @returns {ASTNode[]} Array of conditions that makes the node when joined by the operator. + */ +function splitByLogicalOperator(operator, node) { + if (node.type === "LogicalExpression" && node.operator === operator) { + return [...splitByLogicalOperator(operator, node.left), ...splitByLogicalOperator(operator, node.right)]; + } + return [node]; +} + +const splitByOr = splitByLogicalOperator.bind(null, "||"); +const splitByAnd = splitByLogicalOperator.bind(null, "&&"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate conditions in if-else-if chains", + recommended: true, + url: "https://eslint.org/docs/rules/no-dupe-else-if" + }, + + schema: [], + + messages: { + unexpected: "This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Determines whether the two given nodes are considered to be equal. In particular, given that the nodes + * represent expressions in a boolean context, `||` and `&&` can be considered as commutative operators. + * @param {ASTNode} a First node. + * @param {ASTNode} b Second node. + * @returns {boolean} `true` if the nodes are considered to be equal. + */ + function equal(a, b) { + if (a.type !== b.type) { + return false; + } + + if ( + a.type === "LogicalExpression" && + (a.operator === "||" || a.operator === "&&") && + a.operator === b.operator + ) { + return equal(a.left, b.left) && equal(a.right, b.right) || + equal(a.left, b.right) && equal(a.right, b.left); + } + + return astUtils.equalTokens(a, b, sourceCode); + } + + const isSubset = isSubsetByComparator.bind(null, equal); + + return { + IfStatement(node) { + const test = node.test, + conditionsToCheck = test.type === "LogicalExpression" && test.operator === "&&" + ? [test, ...splitByAnd(test)] + : [test]; + let current = node, + listToCheck = conditionsToCheck.map(c => splitByOr(c).map(splitByAnd)); + + while (current.parent && current.parent.type === "IfStatement" && current.parent.alternate === current) { + current = current.parent; + + const currentOrOperands = splitByOr(current.test).map(splitByAnd); + + listToCheck = listToCheck.map(orOperands => orOperands.filter( + orOperand => !currentOrOperands.some(currentOrOperand => isSubset(currentOrOperand, orOperand)) + )); + + if (listToCheck.some(orOperands => orOperands.length === 0)) { + context.report({ node: test, messageId: "unexpected" }); + break; + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-dupe-keys.js b/node_modules/eslint/lib/rules/no-dupe-keys.js new file mode 100644 index 0000000..dac13cf --- /dev/null +++ b/node_modules/eslint/lib/rules/no-dupe-keys.js @@ -0,0 +1,142 @@ +/** + * @fileoverview Rule to flag use of duplicate keys in an object. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const GET_KIND = /^(?:init|get)$/u; +const SET_KIND = /^(?:init|set)$/u; + +/** + * The class which stores properties' information of an object. + */ +class ObjectInfo { + + /** + * @param {ObjectInfo|null} upper The information of the outer object. + * @param {ASTNode} node The ObjectExpression node of this information. + */ + constructor(upper, node) { + this.upper = upper; + this.node = node; + this.properties = new Map(); + } + + /** + * Gets the information of the given Property node. + * @param {ASTNode} node The Property node to get. + * @returns {{get: boolean, set: boolean}} The information of the property. + */ + getPropertyInfo(node) { + const name = astUtils.getStaticPropertyName(node); + + if (!this.properties.has(name)) { + this.properties.set(name, { get: false, set: false }); + } + return this.properties.get(name); + } + + /** + * Checks whether the given property has been defined already or not. + * @param {ASTNode} node The Property node to check. + * @returns {boolean} `true` if the property has been defined. + */ + isPropertyDefined(node) { + const entry = this.getPropertyInfo(node); + + return ( + (GET_KIND.test(node.kind) && entry.get) || + (SET_KIND.test(node.kind) && entry.set) + ); + } + + /** + * Defines the given property. + * @param {ASTNode} node The Property node to define. + * @returns {void} + */ + defineProperty(node) { + const entry = this.getPropertyInfo(node); + + if (GET_KIND.test(node.kind)) { + entry.get = true; + } + if (SET_KIND.test(node.kind)) { + entry.set = true; + } + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate keys in object literals", + recommended: true, + url: "https://eslint.org/docs/rules/no-dupe-keys" + }, + + schema: [], + + messages: { + unexpected: "Duplicate key '{{name}}'." + } + }, + + create(context) { + let info = null; + + return { + ObjectExpression(node) { + info = new ObjectInfo(info, node); + }, + "ObjectExpression:exit"() { + info = info.upper; + }, + + Property(node) { + const name = astUtils.getStaticPropertyName(node); + + // Skip destructuring. + if (node.parent.type !== "ObjectExpression") { + return; + } + + // Skip if the name is not static. + if (name === null) { + return; + } + + // Reports if the name is defined already. + if (info.isPropertyDefined(node)) { + context.report({ + node: info.node, + loc: node.key.loc, + messageId: "unexpected", + data: { name } + }); + } + + // Update info. + info.defineProperty(node); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-duplicate-case.js b/node_modules/eslint/lib/rules/no-duplicate-case.js new file mode 100644 index 0000000..a0c0b31 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-duplicate-case.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Rule to disallow a duplicate case label. + * @author Dieter Oberkofler + * @author Burak Yigit Kaya + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate case labels", + recommended: true, + url: "https://eslint.org/docs/rules/no-duplicate-case" + }, + + schema: [], + + messages: { + unexpected: "Duplicate case label." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Determines whether the two given nodes are considered to be equal. + * @param {ASTNode} a First node. + * @param {ASTNode} b Second node. + * @returns {boolean} `true` if the nodes are considered to be equal. + */ + function equal(a, b) { + if (a.type !== b.type) { + return false; + } + + return astUtils.equalTokens(a, b, sourceCode); + } + return { + SwitchStatement(node) { + const previousTests = []; + + for (const switchCase of node.cases) { + if (switchCase.test) { + const test = switchCase.test; + + if (previousTests.some(previousTest => equal(previousTest, test))) { + context.report({ node: switchCase, messageId: "unexpected" }); + } else { + previousTests.push(test); + } + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-duplicate-imports.js b/node_modules/eslint/lib/rules/no-duplicate-imports.js new file mode 100644 index 0000000..947bb30 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-duplicate-imports.js @@ -0,0 +1,290 @@ +/** + * @fileoverview Restrict usage of duplicate imports. + * @author Simen Bekkhus + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const NAMED_TYPES = ["ImportSpecifier", "ExportSpecifier"]; +const NAMESPACE_TYPES = [ + "ImportNamespaceSpecifier", + "ExportNamespaceSpecifier" +]; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Check if an import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier). + * @param {string} importExportType An import/export type to check. + * @param {string} type Can be "named" or "namespace" + * @returns {boolean} True if import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier) and false if it doesn't. + */ +function isImportExportSpecifier(importExportType, type) { + const arrayToCheck = type === "named" ? NAMED_TYPES : NAMESPACE_TYPES; + + return arrayToCheck.includes(importExportType); +} + +/** + * Return the type of (import|export). + * @param {ASTNode} node A node to get. + * @returns {string} The type of the (import|export). + */ +function getImportExportType(node) { + if (node.specifiers && node.specifiers.length > 0) { + const nodeSpecifiers = node.specifiers; + const index = nodeSpecifiers.findIndex( + ({ type }) => + isImportExportSpecifier(type, "named") || + isImportExportSpecifier(type, "namespace") + ); + const i = index > -1 ? index : 0; + + return nodeSpecifiers[i].type; + } + if (node.type === "ExportAllDeclaration") { + if (node.exported) { + return "ExportNamespaceSpecifier"; + } + return "ExportAll"; + } + return "SideEffectImport"; +} + +/** + * Returns a boolean indicates if two (import|export) can be merged + * @param {ASTNode} node1 A node to check. + * @param {ASTNode} node2 A node to check. + * @returns {boolean} True if two (import|export) can be merged, false if they can't. + */ +function isImportExportCanBeMerged(node1, node2) { + const importExportType1 = getImportExportType(node1); + const importExportType2 = getImportExportType(node2); + + if ( + (importExportType1 === "ExportAll" && + importExportType2 !== "ExportAll" && + importExportType2 !== "SideEffectImport") || + (importExportType1 !== "ExportAll" && + importExportType1 !== "SideEffectImport" && + importExportType2 === "ExportAll") + ) { + return false; + } + if ( + (isImportExportSpecifier(importExportType1, "namespace") && + isImportExportSpecifier(importExportType2, "named")) || + (isImportExportSpecifier(importExportType2, "namespace") && + isImportExportSpecifier(importExportType1, "named")) + ) { + return false; + } + return true; +} + +/** + * Returns a boolean if we should report (import|export). + * @param {ASTNode} node A node to be reported or not. + * @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported. + * @returns {boolean} True if the (import|export) should be reported. + */ +function shouldReportImportExport(node, previousNodes) { + let i = 0; + + while (i < previousNodes.length) { + if (isImportExportCanBeMerged(node, previousNodes[i])) { + return true; + } + i++; + } + return false; +} + +/** + * Returns array contains only nodes with declarations types equal to type. + * @param {[{node: ASTNode, declarationType: string}]} nodes An array contains objects, each object contains a node and a declaration type. + * @param {string} type Declaration type. + * @returns {[ASTNode]} An array contains only nodes with declarations types equal to type. + */ +function getNodesByDeclarationType(nodes, type) { + return nodes + .filter(({ declarationType }) => declarationType === type) + .map(({ node }) => node); +} + +/** + * Returns the name of the module imported or re-exported. + * @param {ASTNode} node A node to get. + * @returns {string} The name of the module, or empty string if no name. + */ +function getModule(node) { + if (node && node.source && node.source.value) { + return node.source.value.trim(); + } + return ""; +} + +/** + * Checks if the (import|export) can be merged with at least one import or one export, and reports if so. + * @param {RuleContext} context The ESLint rule context object. + * @param {ASTNode} node A node to get. + * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. + * @param {string} declarationType A declaration type can be an import or export. + * @param {boolean} includeExports Whether or not to check for exports in addition to imports. + * @returns {void} No return value. + */ +function checkAndReport( + context, + node, + modules, + declarationType, + includeExports +) { + const module = getModule(node); + + if (modules.has(module)) { + const previousNodes = modules.get(module); + const messagesIds = []; + const importNodes = getNodesByDeclarationType(previousNodes, "import"); + let exportNodes; + + if (includeExports) { + exportNodes = getNodesByDeclarationType(previousNodes, "export"); + } + if (declarationType === "import") { + if (shouldReportImportExport(node, importNodes)) { + messagesIds.push("import"); + } + if (includeExports) { + if (shouldReportImportExport(node, exportNodes)) { + messagesIds.push("importAs"); + } + } + } else if (declarationType === "export") { + if (shouldReportImportExport(node, exportNodes)) { + messagesIds.push("export"); + } + if (shouldReportImportExport(node, importNodes)) { + messagesIds.push("exportAs"); + } + } + messagesIds.forEach(messageId => + context.report({ + node, + messageId, + data: { + module + } + })); + } +} + +/** + * @callback nodeCallback + * @param {ASTNode} node A node to handle. + */ + +/** + * Returns a function handling the (imports|exports) of a given file + * @param {RuleContext} context The ESLint rule context object. + * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. + * @param {string} declarationType A declaration type can be an import or export. + * @param {boolean} includeExports Whether or not to check for exports in addition to imports. + * @returns {nodeCallback} A function passed to ESLint to handle the statement. + */ +function handleImportsExports( + context, + modules, + declarationType, + includeExports +) { + return function(node) { + const module = getModule(node); + + if (module) { + checkAndReport( + context, + node, + modules, + declarationType, + includeExports + ); + const currentNode = { node, declarationType }; + let nodes = [currentNode]; + + if (modules.has(module)) { + const previousNodes = modules.get(module); + + nodes = [...previousNodes, currentNode]; + } + modules.set(module, nodes); + } + }; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow duplicate module imports", + recommended: false, + url: "https://eslint.org/docs/rules/no-duplicate-imports" + }, + + schema: [ + { + type: "object", + properties: { + includeExports: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + import: "'{{module}}' import is duplicated.", + importAs: "'{{module}}' import is duplicated as export.", + export: "'{{module}}' export is duplicated.", + exportAs: "'{{module}}' export is duplicated as import." + } + }, + + create(context) { + const includeExports = (context.options[0] || {}).includeExports, + modules = new Map(); + const handlers = { + ImportDeclaration: handleImportsExports( + context, + modules, + "import", + includeExports + ) + }; + + if (includeExports) { + handlers.ExportNamedDeclaration = handleImportsExports( + context, + modules, + "export", + includeExports + ); + handlers.ExportAllDeclaration = handleImportsExports( + context, + modules, + "export", + includeExports + ); + } + return handlers; + } +}; diff --git a/node_modules/eslint/lib/rules/no-else-return.js b/node_modules/eslint/lib/rules/no-else-return.js new file mode 100644 index 0000000..3662fc8 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-else-return.js @@ -0,0 +1,404 @@ +/** + * @fileoverview Rule to flag `else` after a `return` in `if` + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const FixTracker = require("./utils/fix-tracker"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `else` blocks after `return` statements in `if` statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-else-return" + }, + + schema: [{ + type: "object", + properties: { + allowElseIf: { + type: "boolean", + default: true + } + }, + additionalProperties: false + }], + + fixable: "code", + + messages: { + unexpected: "Unnecessary 'else' after 'return'." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks whether the given names can be safely used to declare block-scoped variables + * in the given scope. Name collisions can produce redeclaration syntax errors, + * or silently change references and modify behavior of the original code. + * + * This is not a generic function. In particular, it is assumed that the scope is a function scope or + * a function's inner scope, and that the names can be valid identifiers in the given scope. + * @param {string[]} names Array of variable names. + * @param {eslint-scope.Scope} scope Function scope or a function's inner scope. + * @returns {boolean} True if all names can be safely declared, false otherwise. + */ + function isSafeToDeclare(names, scope) { + + if (names.length === 0) { + return true; + } + + const functionScope = scope.variableScope; + + /* + * If this is a function scope, scope.variables will contain parameters, implicit variables such as "arguments", + * all function-scoped variables ('var'), and block-scoped variables defined in the scope. + * If this is an inner scope, scope.variables will contain block-scoped variables defined in the scope. + * + * Redeclaring any of these would cause a syntax error, except for the implicit variables. + */ + const declaredVariables = scope.variables.filter(({ defs }) => defs.length > 0); + + if (declaredVariables.some(({ name }) => names.includes(name))) { + return false; + } + + // Redeclaring a catch variable would also cause a syntax error. + if (scope !== functionScope && scope.upper.type === "catch") { + if (scope.upper.variables.some(({ name }) => names.includes(name))) { + return false; + } + } + + /* + * Redeclaring an implicit variable, such as "arguments", would not cause a syntax error. + * However, if the variable was used, declaring a new one with the same name would change references + * and modify behavior. + */ + const usedImplicitVariables = scope.variables.filter(({ defs, references }) => + defs.length === 0 && references.length > 0); + + if (usedImplicitVariables.some(({ name }) => names.includes(name))) { + return false; + } + + /* + * Declaring a variable with a name that was already used to reference a variable from an upper scope + * would change references and modify behavior. + */ + if (scope.through.some(t => names.includes(t.identifier.name))) { + return false; + } + + /* + * If the scope is an inner scope (not the function scope), an uninitialized `var` variable declared inside + * the scope node (directly or in one of its descendants) is neither declared nor 'through' in the scope. + * + * For example, this would be a syntax error "Identifier 'a' has already been declared": + * function foo() { if (bar) { let a; if (baz) { var a; } } } + */ + if (scope !== functionScope) { + const scopeNodeRange = scope.block.range; + const variablesToCheck = functionScope.variables.filter(({ name }) => names.includes(name)); + + if (variablesToCheck.some(v => v.defs.some(({ node: { range } }) => + scopeNodeRange[0] <= range[0] && range[1] <= scopeNodeRange[1]))) { + return false; + } + } + + return true; + } + + + /** + * Checks whether the removal of `else` and its braces is safe from variable name collisions. + * @param {Node} node The 'else' node. + * @param {eslint-scope.Scope} scope The scope in which the node and the whole 'if' statement is. + * @returns {boolean} True if it is safe, false otherwise. + */ + function isSafeFromNameCollisions(node, scope) { + + if (node.type === "FunctionDeclaration") { + + // Conditional function declaration. Scope and hoisting are unpredictable, different engines work differently. + return false; + } + + if (node.type !== "BlockStatement") { + return true; + } + + const elseBlockScope = scope.childScopes.find(({ block }) => block === node); + + if (!elseBlockScope) { + + // ecmaVersion < 6, `else` block statement cannot have its own scope, no possible collisions. + return true; + } + + /* + * elseBlockScope is supposed to merge into its upper scope. elseBlockScope.variables array contains + * only block-scoped variables (such as let and const variables or class and function declarations) + * defined directly in the elseBlockScope. These are exactly the only names that could cause collisions. + */ + const namesToCheck = elseBlockScope.variables.map(({ name }) => name); + + return isSafeToDeclare(namesToCheck, scope); + } + + /** + * Display the context report if rule is violated + * @param {Node} node The 'else' node + * @returns {void} + */ + function displayReport(node) { + const currentScope = context.getScope(); + + context.report({ + node, + messageId: "unexpected", + fix: fixer => { + + if (!isSafeFromNameCollisions(node, currentScope)) { + return null; + } + + const sourceCode = context.getSourceCode(); + const startToken = sourceCode.getFirstToken(node); + const elseToken = sourceCode.getTokenBefore(startToken); + const source = sourceCode.getText(node); + const lastIfToken = sourceCode.getTokenBefore(elseToken); + let fixedSource, firstTokenOfElseBlock; + + if (startToken.type === "Punctuator" && startToken.value === "{") { + firstTokenOfElseBlock = sourceCode.getTokenAfter(startToken); + } else { + firstTokenOfElseBlock = startToken; + } + + /* + * If the if block does not have curly braces and does not end in a semicolon + * and the else block starts with (, [, /, +, ` or -, then it is not + * safe to remove the else keyword, because ASI will not add a semicolon + * after the if block + */ + const ifBlockMaybeUnsafe = node.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";"; + const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value); + + if (ifBlockMaybeUnsafe && elseBlockUnsafe) { + return null; + } + + const endToken = sourceCode.getLastToken(node); + const lastTokenOfElseBlock = sourceCode.getTokenBefore(endToken); + + if (lastTokenOfElseBlock.value !== ";") { + const nextToken = sourceCode.getTokenAfter(endToken); + + const nextTokenUnsafe = nextToken && /^[([/+`-]/u.test(nextToken.value); + const nextTokenOnSameLine = nextToken && nextToken.loc.start.line === lastTokenOfElseBlock.loc.start.line; + + /* + * If the else block contents does not end in a semicolon, + * and the else block starts with (, [, /, +, ` or -, then it is not + * safe to remove the else block, because ASI will not add a semicolon + * after the remaining else block contents + */ + if (nextTokenUnsafe || (nextTokenOnSameLine && nextToken.value !== "}")) { + return null; + } + } + + if (startToken.type === "Punctuator" && startToken.value === "{") { + fixedSource = source.slice(1, -1); + } else { + fixedSource = source; + } + + /* + * Extend the replacement range to include the entire + * function to avoid conflicting with no-useless-return. + * https://github.com/eslint/eslint/issues/8026 + * + * Also, to avoid name collisions between two else blocks. + */ + return new FixTracker(fixer, sourceCode) + .retainEnclosingFunction(node) + .replaceTextRange([elseToken.range[0], node.range[1]], fixedSource); + } + }); + } + + /** + * Check to see if the node is a ReturnStatement + * @param {Node} node The node being evaluated + * @returns {boolean} True if node is a return + */ + function checkForReturn(node) { + return node.type === "ReturnStatement"; + } + + /** + * Naive return checking, does not iterate through the whole + * BlockStatement because we make the assumption that the ReturnStatement + * will be the last node in the body of the BlockStatement. + * @param {Node} node The consequent/alternate node + * @returns {boolean} True if it has a return + */ + function naiveHasReturn(node) { + if (node.type === "BlockStatement") { + const body = node.body, + lastChildNode = body[body.length - 1]; + + return lastChildNode && checkForReturn(lastChildNode); + } + return checkForReturn(node); + } + + /** + * Check to see if the node is valid for evaluation, + * meaning it has an else. + * @param {Node} node The node being evaluated + * @returns {boolean} True if the node is valid + */ + function hasElse(node) { + return node.alternate && node.consequent; + } + + /** + * If the consequent is an IfStatement, check to see if it has an else + * and both its consequent and alternate path return, meaning this is + * a nested case of rule violation. If-Else not considered currently. + * @param {Node} node The consequent node + * @returns {boolean} True if this is a nested rule violation + */ + function checkForIf(node) { + return node.type === "IfStatement" && hasElse(node) && + naiveHasReturn(node.alternate) && naiveHasReturn(node.consequent); + } + + /** + * Check the consequent/body node to make sure it is not + * a ReturnStatement or an IfStatement that returns on both + * code paths. + * @param {Node} node The consequent or body node + * @returns {boolean} `true` if it is a Return/If node that always returns. + */ + function checkForReturnOrIf(node) { + return checkForReturn(node) || checkForIf(node); + } + + + /** + * Check whether a node returns in every codepath. + * @param {Node} node The node to be checked + * @returns {boolean} `true` if it returns on every codepath. + */ + function alwaysReturns(node) { + if (node.type === "BlockStatement") { + + // If we have a BlockStatement, check each consequent body node. + return node.body.some(checkForReturnOrIf); + } + + /* + * If not a block statement, make sure the consequent isn't a + * ReturnStatement or an IfStatement with returns on both paths. + */ + return checkForReturnOrIf(node); + } + + + /** + * Check the if statement, but don't catch else-if blocks. + * @returns {void} + * @param {Node} node The node for the if statement to check + * @private + */ + function checkIfWithoutElse(node) { + const parent = node.parent; + + /* + * Fixing this would require splitting one statement into two, so no error should + * be reported if this node is in a position where only one statement is allowed. + */ + if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { + return; + } + + const consequents = []; + let alternate; + + for (let currentNode = node; currentNode.type === "IfStatement"; currentNode = currentNode.alternate) { + if (!currentNode.alternate) { + return; + } + consequents.push(currentNode.consequent); + alternate = currentNode.alternate; + } + + if (consequents.every(alwaysReturns)) { + displayReport(alternate); + } + } + + /** + * Check the if statement + * @returns {void} + * @param {Node} node The node for the if statement to check + * @private + */ + function checkIfWithElse(node) { + const parent = node.parent; + + + /* + * Fixing this would require splitting one statement into two, so no error should + * be reported if this node is in a position where only one statement is allowed. + */ + if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { + return; + } + + const alternate = node.alternate; + + if (alternate && alwaysReturns(node.consequent)) { + displayReport(alternate); + } + } + + const allowElseIf = !(context.options[0] && context.options[0].allowElseIf === false); + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "IfStatement:exit": allowElseIf ? checkIfWithoutElse : checkIfWithElse + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-empty-character-class.js b/node_modules/eslint/lib/rules/no-empty-character-class.js new file mode 100644 index 0000000..f75f591 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-empty-character-class.js @@ -0,0 +1,55 @@ +/** + * @fileoverview Rule to flag the use of empty character classes in regular expressions + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/* + * plain-English description of the following regexp: + * 0. `^` fix the match at the beginning of the string + * 1. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following + * 1.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) + * 1.1. `\\.`: an escape sequence + * 1.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty + * 2. `$`: fix the match at the end of the string + */ +const regex = /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow empty character classes in regular expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-empty-character-class" + }, + + schema: [], + + messages: { + unexpected: "Empty class." + } + }, + + create(context) { + return { + "Literal[regex]"(node) { + if (!regex.test(node.regex.pattern)) { + context.report({ node, messageId: "unexpected" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-empty-function.js b/node_modules/eslint/lib/rules/no-empty-function.js new file mode 100644 index 0000000..e23b69e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-empty-function.js @@ -0,0 +1,167 @@ +/** + * @fileoverview Rule to disallow empty functions. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const ALLOW_OPTIONS = Object.freeze([ + "functions", + "arrowFunctions", + "generatorFunctions", + "methods", + "generatorMethods", + "getters", + "setters", + "constructors", + "asyncFunctions", + "asyncMethods" +]); + +/** + * Gets the kind of a given function node. + * @param {ASTNode} node A function node to get. This is one of + * an ArrowFunctionExpression, a FunctionDeclaration, or a + * FunctionExpression. + * @returns {string} The kind of the function. This is one of "functions", + * "arrowFunctions", "generatorFunctions", "asyncFunctions", "methods", + * "generatorMethods", "asyncMethods", "getters", "setters", and + * "constructors". + */ +function getKind(node) { + const parent = node.parent; + let kind = ""; + + if (node.type === "ArrowFunctionExpression") { + return "arrowFunctions"; + } + + // Detects main kind. + if (parent.type === "Property") { + if (parent.kind === "get") { + return "getters"; + } + if (parent.kind === "set") { + return "setters"; + } + kind = parent.method ? "methods" : "functions"; + + } else if (parent.type === "MethodDefinition") { + if (parent.kind === "get") { + return "getters"; + } + if (parent.kind === "set") { + return "setters"; + } + if (parent.kind === "constructor") { + return "constructors"; + } + kind = "methods"; + + } else { + kind = "functions"; + } + + // Detects prefix. + let prefix = ""; + + if (node.generator) { + prefix = "generator"; + } else if (node.async) { + prefix = "async"; + } else { + return kind; + } + return prefix + kind[0].toUpperCase() + kind.slice(1); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow empty functions", + recommended: false, + url: "https://eslint.org/docs/rules/no-empty-function" + }, + + schema: [ + { + type: "object", + properties: { + allow: { + type: "array", + items: { enum: ALLOW_OPTIONS }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "Unexpected empty {{name}}." + } + }, + + create(context) { + const options = context.options[0] || {}; + const allowed = options.allow || []; + + const sourceCode = context.getSourceCode(); + + /** + * Reports a given function node if the node matches the following patterns. + * + * - Not allowed by options. + * - The body is empty. + * - The body doesn't have any comments. + * @param {ASTNode} node A function node to report. This is one of + * an ArrowFunctionExpression, a FunctionDeclaration, or a + * FunctionExpression. + * @returns {void} + */ + function reportIfEmpty(node) { + const kind = getKind(node); + const name = astUtils.getFunctionNameWithKind(node); + const innerComments = sourceCode.getTokens(node.body, { + includeComments: true, + filter: astUtils.isCommentToken + }); + + if (!allowed.includes(kind) && + node.body.type === "BlockStatement" && + node.body.body.length === 0 && + innerComments.length === 0 + ) { + context.report({ + node, + loc: node.body.loc, + messageId: "unexpected", + data: { name } + }); + } + } + + return { + ArrowFunctionExpression: reportIfEmpty, + FunctionDeclaration: reportIfEmpty, + FunctionExpression: reportIfEmpty + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-empty-pattern.js b/node_modules/eslint/lib/rules/no-empty-pattern.js new file mode 100644 index 0000000..2de575f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-empty-pattern.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to disallow an empty pattern + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow empty destructuring patterns", + recommended: true, + url: "https://eslint.org/docs/rules/no-empty-pattern" + }, + + schema: [], + + messages: { + unexpected: "Unexpected empty {{type}} pattern." + } + }, + + create(context) { + return { + ObjectPattern(node) { + if (node.properties.length === 0) { + context.report({ node, messageId: "unexpected", data: { type: "object" } }); + } + }, + ArrayPattern(node) { + if (node.elements.length === 0) { + context.report({ node, messageId: "unexpected", data: { type: "array" } }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-empty.js b/node_modules/eslint/lib/rules/no-empty.js new file mode 100644 index 0000000..f04ee2c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-empty.js @@ -0,0 +1,86 @@ +/** + * @fileoverview Rule to flag use of an empty block statement + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow empty block statements", + recommended: true, + url: "https://eslint.org/docs/rules/no-empty" + }, + + schema: [ + { + type: "object", + properties: { + allowEmptyCatch: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "Empty {{type}} statement." + } + }, + + create(context) { + const options = context.options[0] || {}, + allowEmptyCatch = options.allowEmptyCatch || false; + + const sourceCode = context.getSourceCode(); + + return { + BlockStatement(node) { + + // if the body is not empty, we can just return immediately + if (node.body.length !== 0) { + return; + } + + // a function is generally allowed to be empty + if (astUtils.isFunction(node.parent)) { + return; + } + + if (allowEmptyCatch && node.parent.type === "CatchClause") { + return; + } + + // any other block is only allowed to be empty, if it contains a comment + if (sourceCode.getCommentsInside(node).length > 0) { + return; + } + + context.report({ node, messageId: "unexpected", data: { type: "block" } }); + }, + + SwitchStatement(node) { + + if (typeof node.cases === "undefined" || node.cases.length === 0) { + context.report({ node, messageId: "unexpected", data: { type: "switch" } }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-eq-null.js b/node_modules/eslint/lib/rules/no-eq-null.js new file mode 100644 index 0000000..b693737 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-eq-null.js @@ -0,0 +1,46 @@ +/** + * @fileoverview Rule to flag comparisons to null without a type-checking + * operator. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `null` comparisons without type-checking operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-eq-null" + }, + + schema: [], + + messages: { + unexpected: "Use '===' to compare with null." + } + }, + + create(context) { + + return { + + BinaryExpression(node) { + const badOperator = node.operator === "==" || node.operator === "!="; + + if (node.right.type === "Literal" && node.right.raw === "null" && badOperator || + node.left.type === "Literal" && node.left.raw === "null" && badOperator) { + context.report({ node, messageId: "unexpected" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-eval.js b/node_modules/eslint/lib/rules/no-eval.js new file mode 100644 index 0000000..7af8dfa --- /dev/null +++ b/node_modules/eslint/lib/rules/no-eval.js @@ -0,0 +1,286 @@ +/** + * @fileoverview Rule to flag use of eval() statement + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const candidatesOfGlobalObject = Object.freeze([ + "global", + "window", + "globalThis" +]); + +/** + * Checks a given node is a MemberExpression node which has the specified name's + * property. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. + * @returns {boolean} `true` if the node is a MemberExpression node which has + * the specified name's property + */ +function isMember(node, name) { + return astUtils.isSpecificMemberAccess(node, null, name); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `eval()`", + recommended: false, + url: "https://eslint.org/docs/rules/no-eval" + }, + + schema: [ + { + type: "object", + properties: { + allowIndirect: { type: "boolean", default: false } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "eval can be harmful." + } + }, + + create(context) { + const allowIndirect = Boolean( + context.options[0] && + context.options[0].allowIndirect + ); + const sourceCode = context.getSourceCode(); + let funcInfo = null; + + /** + * Pushs a `this` scope (non-arrow function, class static block, or class field initializer) information to the stack. + * Top-level scopes are handled separately. + * + * This is used in order to check whether or not `this` binding is a + * reference to the global object. + * @param {ASTNode} node A node of the scope. + * For functions, this is one of FunctionDeclaration, FunctionExpression. + * For class static blocks, this is StaticBlock. + * For class field initializers, this can be any node that is PropertyDefinition#value. + * @returns {void} + */ + function enterThisScope(node) { + const strict = context.getScope().isStrict; + + funcInfo = { + upper: funcInfo, + node, + strict, + isTopLevelOfScript: false, + defaultThis: false, + initialized: strict + }; + } + + /** + * Pops a variable scope from the stack. + * @returns {void} + */ + function exitThisScope() { + funcInfo = funcInfo.upper; + } + + /** + * Reports a given node. + * + * `node` is `Identifier` or `MemberExpression`. + * The parent of `node` might be `CallExpression`. + * + * The location of the report is always `eval` `Identifier` (or possibly + * `Literal`). The type of the report is `CallExpression` if the parent is + * `CallExpression`. Otherwise, it's the given node type. + * @param {ASTNode} node A node to report. + * @returns {void} + */ + function report(node) { + const parent = node.parent; + const locationNode = node.type === "MemberExpression" + ? node.property + : node; + + const reportNode = parent.type === "CallExpression" && parent.callee === node + ? parent + : node; + + context.report({ + node: reportNode, + loc: locationNode.loc, + messageId: "unexpected" + }); + } + + /** + * Reports accesses of `eval` via the global object. + * @param {eslint-scope.Scope} globalScope The global scope. + * @returns {void} + */ + function reportAccessingEvalViaGlobalObject(globalScope) { + for (let i = 0; i < candidatesOfGlobalObject.length; ++i) { + const name = candidatesOfGlobalObject[i]; + const variable = astUtils.getVariableByName(globalScope, name); + + if (!variable) { + continue; + } + + const references = variable.references; + + for (let j = 0; j < references.length; ++j) { + const identifier = references[j].identifier; + let node = identifier.parent; + + // To detect code like `window.window.eval`. + while (isMember(node, name)) { + node = node.parent; + } + + // Reports. + if (isMember(node, "eval")) { + report(node); + } + } + } + } + + /** + * Reports all accesses of `eval` (excludes direct calls to eval). + * @param {eslint-scope.Scope} globalScope The global scope. + * @returns {void} + */ + function reportAccessingEval(globalScope) { + const variable = astUtils.getVariableByName(globalScope, "eval"); + + if (!variable) { + return; + } + + const references = variable.references; + + for (let i = 0; i < references.length; ++i) { + const reference = references[i]; + const id = reference.identifier; + + if (id.name === "eval" && !astUtils.isCallee(id)) { + + // Is accessing to eval (excludes direct calls to eval) + report(id); + } + } + } + + if (allowIndirect) { + + // Checks only direct calls to eval. It's simple! + return { + "CallExpression:exit"(node) { + const callee = node.callee; + + /* + * Optional call (`eval?.("code")`) is not direct eval. + * The direct eval is only step 6.a.vi of https://tc39.es/ecma262/#sec-function-calls-runtime-semantics-evaluation + * But the optional call is https://tc39.es/ecma262/#sec-optional-chaining-chain-evaluation + */ + if (!node.optional && astUtils.isSpecificId(callee, "eval")) { + report(callee); + } + } + }; + } + + return { + "CallExpression:exit"(node) { + const callee = node.callee; + + if (astUtils.isSpecificId(callee, "eval")) { + report(callee); + } + }, + + Program(node) { + const scope = context.getScope(), + features = context.parserOptions.ecmaFeatures || {}, + strict = + scope.isStrict || + node.sourceType === "module" || + (features.globalReturn && scope.childScopes[0].isStrict), + isTopLevelOfScript = node.sourceType !== "module" && !features.globalReturn; + + funcInfo = { + upper: null, + node, + strict, + isTopLevelOfScript, + defaultThis: true, + initialized: true + }; + }, + + "Program:exit"() { + const globalScope = context.getScope(); + + exitThisScope(); + reportAccessingEval(globalScope); + reportAccessingEvalViaGlobalObject(globalScope); + }, + + FunctionDeclaration: enterThisScope, + "FunctionDeclaration:exit": exitThisScope, + FunctionExpression: enterThisScope, + "FunctionExpression:exit": exitThisScope, + "PropertyDefinition > *.value": enterThisScope, + "PropertyDefinition > *.value:exit": exitThisScope, + StaticBlock: enterThisScope, + "StaticBlock:exit": exitThisScope, + + ThisExpression(node) { + if (!isMember(node.parent, "eval")) { + return; + } + + /* + * `this.eval` is found. + * Checks whether or not the value of `this` is the global object. + */ + if (!funcInfo.initialized) { + funcInfo.initialized = true; + funcInfo.defaultThis = astUtils.isDefaultThisBinding( + funcInfo.node, + sourceCode + ); + } + + // `this` at the top level of scripts always refers to the global object + if (funcInfo.isTopLevelOfScript || (!funcInfo.strict && funcInfo.defaultThis)) { + + // `this.eval` is possible built-in `eval`. + report(node.parent); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-ex-assign.js b/node_modules/eslint/lib/rules/no-ex-assign.js new file mode 100644 index 0000000..3db1420 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-ex-assign.js @@ -0,0 +1,52 @@ +/** + * @fileoverview Rule to flag assignment of the exception parameter + * @author Stephen Murray + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow reassigning exceptions in `catch` clauses", + recommended: true, + url: "https://eslint.org/docs/rules/no-ex-assign" + }, + + schema: [], + + messages: { + unexpected: "Do not assign to the exception parameter." + } + }, + + create(context) { + + /** + * Finds and reports references that are non initializer and writable. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + astUtils.getModifyingReferences(variable.references).forEach(reference => { + context.report({ node: reference.identifier, messageId: "unexpected" }); + }); + } + + return { + CatchClause(node) { + context.getDeclaredVariables(node).forEach(checkVariable); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-extend-native.js b/node_modules/eslint/lib/rules/no-extend-native.js new file mode 100644 index 0000000..771200f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extend-native.js @@ -0,0 +1,178 @@ +/** + * @fileoverview Rule to flag adding properties to native object's prototypes. + * @author David Nelson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const globals = require("globals"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow extending native types", + recommended: false, + url: "https://eslint.org/docs/rules/no-extend-native" + }, + + schema: [ + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpected: "{{builtin}} prototype is read only, properties should not be added." + } + }, + + create(context) { + + const config = context.options[0] || {}; + const exceptions = new Set(config.exceptions || []); + const modifiedBuiltins = new Set( + Object.keys(globals.builtin) + .filter(builtin => builtin[0].toUpperCase() === builtin[0]) + .filter(builtin => !exceptions.has(builtin)) + ); + + /** + * Reports a lint error for the given node. + * @param {ASTNode} node The node to report. + * @param {string} builtin The name of the native builtin being extended. + * @returns {void} + */ + function reportNode(node, builtin) { + context.report({ + node, + messageId: "unexpected", + data: { + builtin + } + }); + } + + /** + * Check to see if the `prototype` property of the given object + * identifier node is being accessed. + * @param {ASTNode} identifierNode The Identifier representing the object + * to check. + * @returns {boolean} True if the identifier is the object of a + * MemberExpression and its `prototype` property is being accessed, + * false otherwise. + */ + function isPrototypePropertyAccessed(identifierNode) { + return Boolean( + identifierNode && + identifierNode.parent && + identifierNode.parent.type === "MemberExpression" && + identifierNode.parent.object === identifierNode && + astUtils.getStaticPropertyName(identifierNode.parent) === "prototype" + ); + } + + /** + * Check if it's an assignment to the property of the given node. + * Example: `*.prop = 0` // the `*` is the given node. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if an assignment to the property of the node. + */ + function isAssigningToPropertyOf(node) { + return ( + node.parent.type === "MemberExpression" && + node.parent.object === node && + node.parent.parent.type === "AssignmentExpression" && + node.parent.parent.left === node.parent + ); + } + + /** + * Checks if the given node is at the first argument of the method call of `Object.defineProperty()` or `Object.defineProperties()`. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is at the first argument of the method call of `Object.defineProperty()` or `Object.defineProperties()`. + */ + function isInDefinePropertyCall(node) { + return ( + node.parent.type === "CallExpression" && + node.parent.arguments[0] === node && + astUtils.isSpecificMemberAccess(node.parent.callee, "Object", /^definePropert(?:y|ies)$/u) + ); + } + + /** + * Check to see if object prototype access is part of a prototype + * extension. There are three ways a prototype can be extended: + * 1. Assignment to prototype property (Object.prototype.foo = 1) + * 2. Object.defineProperty()/Object.defineProperties() on a prototype + * If prototype extension is detected, report the AssignmentExpression + * or CallExpression node. + * @param {ASTNode} identifierNode The Identifier representing the object + * which prototype is being accessed and possibly extended. + * @returns {void} + */ + function checkAndReportPrototypeExtension(identifierNode) { + if (!isPrototypePropertyAccessed(identifierNode)) { + return; // This is not `*.prototype` access. + } + + /* + * `identifierNode.parent` is a MemberExpression `*.prototype`. + * If it's an optional member access, it may be wrapped by a `ChainExpression` node. + */ + const prototypeNode = + identifierNode.parent.parent.type === "ChainExpression" + ? identifierNode.parent.parent + : identifierNode.parent; + + if (isAssigningToPropertyOf(prototypeNode)) { + + // `*.prototype` -> MemberExpression -> AssignmentExpression + reportNode(prototypeNode.parent.parent, identifierNode.name); + } else if (isInDefinePropertyCall(prototypeNode)) { + + // `*.prototype` -> CallExpression + reportNode(prototypeNode.parent, identifierNode.name); + } + } + + return { + + "Program:exit"() { + const globalScope = context.getScope(); + + modifiedBuiltins.forEach(builtin => { + const builtinVar = globalScope.set.get(builtin); + + if (builtinVar && builtinVar.references) { + builtinVar.references + .map(ref => ref.identifier) + .forEach(checkAndReportPrototypeExtension); + } + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-extra-bind.js b/node_modules/eslint/lib/rules/no-extra-bind.js new file mode 100644 index 0000000..561cb1a --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extra-bind.js @@ -0,0 +1,213 @@ +/** + * @fileoverview Rule to flag unnecessary bind calls + * @author Bence Dányi + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SIDE_EFFECT_FREE_NODE_TYPES = new Set(["Literal", "Identifier", "ThisExpression", "FunctionExpression"]); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary calls to `.bind()`", + recommended: false, + url: "https://eslint.org/docs/rules/no-extra-bind" + }, + + schema: [], + fixable: "code", + + messages: { + unexpected: "The function binding is unnecessary." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let scopeInfo = null; + + /** + * Checks if a node is free of side effects. + * + * This check is stricter than it needs to be, in order to keep the implementation simple. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node is known to be side-effect free, false otherwise. + */ + function isSideEffectFree(node) { + return SIDE_EFFECT_FREE_NODE_TYPES.has(node.type); + } + + /** + * Reports a given function node. + * @param {ASTNode} node A node to report. This is a FunctionExpression or + * an ArrowFunctionExpression. + * @returns {void} + */ + function report(node) { + const memberNode = node.parent; + const callNode = memberNode.parent.type === "ChainExpression" + ? memberNode.parent.parent + : memberNode.parent; + + context.report({ + node: callNode, + messageId: "unexpected", + loc: memberNode.property.loc, + + fix(fixer) { + if (!isSideEffectFree(callNode.arguments[0])) { + return null; + } + + /* + * The list of the first/last token pair of a removal range. + * This is two parts because closing parentheses may exist between the method name and arguments. + * E.g. `(function(){}.bind ) (obj)` + * ^^^^^ ^^^^^ < removal ranges + * E.g. `(function(){}?.['bind'] ) ?.(obj)` + * ^^^^^^^^^^ ^^^^^^^ < removal ranges + */ + const tokenPairs = [ + [ + + // `.`, `?.`, or `[` token. + sourceCode.getTokenAfter( + memberNode.object, + astUtils.isNotClosingParenToken + ), + + // property name or `]` token. + sourceCode.getLastToken(memberNode) + ], + [ + + // `?.` or `(` token of arguments. + sourceCode.getTokenAfter( + memberNode, + astUtils.isNotClosingParenToken + ), + + // `)` token of arguments. + sourceCode.getLastToken(callNode) + ] + ]; + const firstTokenToRemove = tokenPairs[0][0]; + const lastTokenToRemove = tokenPairs[1][1]; + + if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { + return null; + } + + return tokenPairs.map(([start, end]) => + fixer.removeRange([start.range[0], end.range[1]])); + } + }); + } + + /** + * Checks whether or not a given function node is the callee of `.bind()` + * method. + * + * e.g. `(function() {}.bind(foo))` + * @param {ASTNode} node A node to report. This is a FunctionExpression or + * an ArrowFunctionExpression. + * @returns {boolean} `true` if the node is the callee of `.bind()` method. + */ + function isCalleeOfBindMethod(node) { + if (!astUtils.isSpecificMemberAccess(node.parent, null, "bind")) { + return false; + } + + // The node of `*.bind` member access. + const bindNode = node.parent.parent.type === "ChainExpression" + ? node.parent.parent + : node.parent; + + return ( + bindNode.parent.type === "CallExpression" && + bindNode.parent.callee === bindNode && + bindNode.parent.arguments.length === 1 && + bindNode.parent.arguments[0].type !== "SpreadElement" + ); + } + + /** + * Adds a scope information object to the stack. + * @param {ASTNode} node A node to add. This node is a FunctionExpression + * or a FunctionDeclaration node. + * @returns {void} + */ + function enterFunction(node) { + scopeInfo = { + isBound: isCalleeOfBindMethod(node), + thisFound: false, + upper: scopeInfo + }; + } + + /** + * Removes the scope information object from the top of the stack. + * At the same time, this reports the function node if the function has + * `.bind()` and the `this` keywords found. + * @param {ASTNode} node A node to remove. This node is a + * FunctionExpression or a FunctionDeclaration node. + * @returns {void} + */ + function exitFunction(node) { + if (scopeInfo.isBound && !scopeInfo.thisFound) { + report(node); + } + + scopeInfo = scopeInfo.upper; + } + + /** + * Reports a given arrow function if the function is callee of `.bind()` + * method. + * @param {ASTNode} node A node to report. This node is an + * ArrowFunctionExpression. + * @returns {void} + */ + function exitArrowFunction(node) { + if (isCalleeOfBindMethod(node)) { + report(node); + } + } + + /** + * Set the mark as the `this` keyword was found in this scope. + * @returns {void} + */ + function markAsThisFound() { + if (scopeInfo) { + scopeInfo.thisFound = true; + } + } + + return { + "ArrowFunctionExpression:exit": exitArrowFunction, + FunctionDeclaration: enterFunction, + "FunctionDeclaration:exit": exitFunction, + FunctionExpression: enterFunction, + "FunctionExpression:exit": exitFunction, + ThisExpression: markAsThisFound + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/node_modules/eslint/lib/rules/no-extra-boolean-cast.js new file mode 100644 index 0000000..ddb1d83 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extra-boolean-cast.js @@ -0,0 +1,317 @@ +/** + * @fileoverview Rule to flag unnecessary double negation in Boolean contexts + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const eslintUtils = require("eslint-utils"); + +const precedence = astUtils.getPrecedence; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary boolean casts", + recommended: true, + url: "https://eslint.org/docs/rules/no-extra-boolean-cast" + }, + + schema: [{ + type: "object", + properties: { + enforceForLogicalOperands: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + fixable: "code", + + messages: { + unexpectedCall: "Redundant Boolean call.", + unexpectedNegation: "Redundant double negation." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + // Node types which have a test which will coerce values to booleans. + const BOOLEAN_NODE_TYPES = new Set([ + "IfStatement", + "DoWhileStatement", + "WhileStatement", + "ConditionalExpression", + "ForStatement" + ]); + + /** + * Check if a node is a Boolean function or constructor. + * @param {ASTNode} node the node + * @returns {boolean} If the node is Boolean function or constructor + */ + function isBooleanFunctionOrConstructorCall(node) { + + // Boolean() and new Boolean() + return (node.type === "CallExpression" || node.type === "NewExpression") && + node.callee.type === "Identifier" && + node.callee.name === "Boolean"; + } + + /** + * Checks whether the node is a logical expression and that the option is enabled + * @param {ASTNode} node the node + * @returns {boolean} if the node is a logical expression and option is enabled + */ + function isLogicalContext(node) { + return node.type === "LogicalExpression" && + (node.operator === "||" || node.operator === "&&") && + (context.options.length && context.options[0].enforceForLogicalOperands === true); + + } + + + /** + * Check if a node is in a context where its value would be coerced to a boolean at runtime. + * @param {ASTNode} node The node + * @returns {boolean} If it is in a boolean context + */ + function isInBooleanContext(node) { + return ( + (isBooleanFunctionOrConstructorCall(node.parent) && + node === node.parent.arguments[0]) || + + (BOOLEAN_NODE_TYPES.has(node.parent.type) && + node === node.parent.test) || + + // ! + (node.parent.type === "UnaryExpression" && + node.parent.operator === "!") + ); + } + + /** + * Checks whether the node is a context that should report an error + * Acts recursively if it is in a logical context + * @param {ASTNode} node the node + * @returns {boolean} If the node is in one of the flagged contexts + */ + function isInFlaggedContext(node) { + if (node.parent.type === "ChainExpression") { + return isInFlaggedContext(node.parent); + } + + return isInBooleanContext(node) || + (isLogicalContext(node.parent) && + + // For nested logical statements + isInFlaggedContext(node.parent) + ); + } + + + /** + * Check if a node has comments inside. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if it has comments inside. + */ + function hasCommentsInside(node) { + return Boolean(sourceCode.getCommentsInside(node).length); + } + + /** + * Checks if the given node is wrapped in grouping parentheses. Parentheses for constructs such as if() don't count. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is parenthesized. + * @private + */ + function isParenthesized(node) { + return eslintUtils.isParenthesized(1, node, sourceCode); + } + + /** + * Determines whether the given node needs to be parenthesized when replacing the previous node. + * It assumes that `previousNode` is the node to be reported by this rule, so it has a limited list + * of possible parent node types. By the same assumption, the node's role in a particular parent is already known. + * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. + * @param {ASTNode} previousNode Previous node. + * @param {ASTNode} node The node to check. + * @throws {Error} (Unreachable.) + * @returns {boolean} `true` if the node needs to be parenthesized. + */ + function needsParens(previousNode, node) { + if (previousNode.parent.type === "ChainExpression") { + return needsParens(previousNode.parent, node); + } + if (isParenthesized(previousNode)) { + + // parentheses around the previous node will stay, so there is no need for an additional pair + return false; + } + + // parent of the previous node will become parent of the replacement node + const parent = previousNode.parent; + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + return node.type === "SequenceExpression"; + case "IfStatement": + case "DoWhileStatement": + case "WhileStatement": + case "ForStatement": + return false; + case "ConditionalExpression": + return precedence(node) <= precedence(parent); + case "UnaryExpression": + return precedence(node) < precedence(parent); + case "LogicalExpression": + if (astUtils.isMixedLogicalAndCoalesceExpressions(node, parent)) { + return true; + } + if (previousNode === parent.left) { + return precedence(node) < precedence(parent); + } + return precedence(node) <= precedence(parent); + + /* istanbul ignore next */ + default: + throw new Error(`Unexpected parent type: ${parent.type}`); + } + } + + return { + UnaryExpression(node) { + const parent = node.parent; + + + // Exit early if it's guaranteed not to match + if (node.operator !== "!" || + parent.type !== "UnaryExpression" || + parent.operator !== "!") { + return; + } + + + if (isInFlaggedContext(parent)) { + context.report({ + node: parent, + messageId: "unexpectedNegation", + fix(fixer) { + if (hasCommentsInside(parent)) { + return null; + } + + if (needsParens(parent, node.argument)) { + return fixer.replaceText(parent, `(${sourceCode.getText(node.argument)})`); + } + + let prefix = ""; + const tokenBefore = sourceCode.getTokenBefore(parent); + const firstReplacementToken = sourceCode.getFirstToken(node.argument); + + if ( + tokenBefore && + tokenBefore.range[1] === parent.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken) + ) { + prefix = " "; + } + + return fixer.replaceText(parent, prefix + sourceCode.getText(node.argument)); + } + }); + } + }, + + CallExpression(node) { + if (node.callee.type !== "Identifier" || node.callee.name !== "Boolean") { + return; + } + + if (isInFlaggedContext(node)) { + context.report({ + node, + messageId: "unexpectedCall", + fix(fixer) { + const parent = node.parent; + + if (node.arguments.length === 0) { + if (parent.type === "UnaryExpression" && parent.operator === "!") { + + /* + * !Boolean() -> true + */ + + if (hasCommentsInside(parent)) { + return null; + } + + const replacement = "true"; + let prefix = ""; + const tokenBefore = sourceCode.getTokenBefore(parent); + + if ( + tokenBefore && + tokenBefore.range[1] === parent.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, replacement) + ) { + prefix = " "; + } + + return fixer.replaceText(parent, prefix + replacement); + } + + /* + * Boolean() -> false + */ + + if (hasCommentsInside(node)) { + return null; + } + + return fixer.replaceText(node, "false"); + } + + if (node.arguments.length === 1) { + const argument = node.arguments[0]; + + if (argument.type === "SpreadElement" || hasCommentsInside(node)) { + return null; + } + + /* + * Boolean(expression) -> expression + */ + + if (needsParens(node, argument)) { + return fixer.replaceText(node, `(${sourceCode.getText(argument)})`); + } + + return fixer.replaceText(node, sourceCode.getText(argument)); + } + + // two or more arguments + return null; + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-extra-label.js b/node_modules/eslint/lib/rules/no-extra-label.js new file mode 100644 index 0000000..9186a9f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extra-label.js @@ -0,0 +1,149 @@ +/** + * @fileoverview Rule to disallow unnecessary labels + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary labels", + recommended: false, + url: "https://eslint.org/docs/rules/no-extra-label" + }, + + schema: [], + fixable: "code", + + messages: { + unexpected: "This label '{{name}}' is unnecessary." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let scopeInfo = null; + + /** + * Creates a new scope with a breakable statement. + * @param {ASTNode} node A node to create. This is a BreakableStatement. + * @returns {void} + */ + function enterBreakableStatement(node) { + scopeInfo = { + label: node.parent.type === "LabeledStatement" ? node.parent.label : null, + breakable: true, + upper: scopeInfo + }; + } + + /** + * Removes the top scope of the stack. + * @returns {void} + */ + function exitBreakableStatement() { + scopeInfo = scopeInfo.upper; + } + + /** + * Creates a new scope with a labeled statement. + * + * This ignores it if the body is a breakable statement. + * In this case it's handled in the `enterBreakableStatement` function. + * @param {ASTNode} node A node to create. This is a LabeledStatement. + * @returns {void} + */ + function enterLabeledStatement(node) { + if (!astUtils.isBreakableStatement(node.body)) { + scopeInfo = { + label: node.label, + breakable: false, + upper: scopeInfo + }; + } + } + + /** + * Removes the top scope of the stack. + * + * This ignores it if the body is a breakable statement. + * In this case it's handled in the `exitBreakableStatement` function. + * @param {ASTNode} node A node. This is a LabeledStatement. + * @returns {void} + */ + function exitLabeledStatement(node) { + if (!astUtils.isBreakableStatement(node.body)) { + scopeInfo = scopeInfo.upper; + } + } + + /** + * Reports a given control node if it's unnecessary. + * @param {ASTNode} node A node. This is a BreakStatement or a + * ContinueStatement. + * @returns {void} + */ + function reportIfUnnecessary(node) { + if (!node.label) { + return; + } + + const labelNode = node.label; + + for (let info = scopeInfo; info !== null; info = info.upper) { + if (info.breakable || info.label && info.label.name === labelNode.name) { + if (info.breakable && info.label && info.label.name === labelNode.name) { + context.report({ + node: labelNode, + messageId: "unexpected", + data: labelNode, + fix(fixer) { + const breakOrContinueToken = sourceCode.getFirstToken(node); + + if (sourceCode.commentsExistBetween(breakOrContinueToken, labelNode)) { + return null; + } + + return fixer.removeRange([breakOrContinueToken.range[1], labelNode.range[1]]); + } + }); + } + return; + } + } + } + + return { + WhileStatement: enterBreakableStatement, + "WhileStatement:exit": exitBreakableStatement, + DoWhileStatement: enterBreakableStatement, + "DoWhileStatement:exit": exitBreakableStatement, + ForStatement: enterBreakableStatement, + "ForStatement:exit": exitBreakableStatement, + ForInStatement: enterBreakableStatement, + "ForInStatement:exit": exitBreakableStatement, + ForOfStatement: enterBreakableStatement, + "ForOfStatement:exit": exitBreakableStatement, + SwitchStatement: enterBreakableStatement, + "SwitchStatement:exit": exitBreakableStatement, + LabeledStatement: enterLabeledStatement, + "LabeledStatement:exit": exitLabeledStatement, + BreakStatement: reportIfUnnecessary, + ContinueStatement: reportIfUnnecessary + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-extra-parens.js b/node_modules/eslint/lib/rules/no-extra-parens.js new file mode 100644 index 0000000..5b54ae2 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extra-parens.js @@ -0,0 +1,1235 @@ +/** + * @fileoverview Disallow parenthesising higher precedence subexpressions. + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const { isParenthesized: isParenthesizedRaw } = require("eslint-utils"); +const astUtils = require("./utils/ast-utils.js"); + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow unnecessary parentheses", + recommended: false, + url: "https://eslint.org/docs/rules/no-extra-parens" + }, + + fixable: "code", + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["functions"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["all"] + }, + { + type: "object", + properties: { + conditionalAssign: { type: "boolean" }, + nestedBinaryExpressions: { type: "boolean" }, + returnAssign: { type: "boolean" }, + ignoreJSX: { enum: ["none", "all", "single-line", "multi-line"] }, + enforceForArrowConditionals: { type: "boolean" }, + enforceForSequenceExpressions: { type: "boolean" }, + enforceForNewInMemberExpressions: { type: "boolean" }, + enforceForFunctionPrototypeMethods: { type: "boolean" } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + messages: { + unexpected: "Unnecessary parentheses around expression." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const tokensToIgnore = new WeakSet(); + const precedence = astUtils.getPrecedence; + const ALL_NODES = context.options[0] !== "functions"; + const EXCEPT_COND_ASSIGN = ALL_NODES && context.options[1] && context.options[1].conditionalAssign === false; + const NESTED_BINARY = ALL_NODES && context.options[1] && context.options[1].nestedBinaryExpressions === false; + const EXCEPT_RETURN_ASSIGN = ALL_NODES && context.options[1] && context.options[1].returnAssign === false; + const IGNORE_JSX = ALL_NODES && context.options[1] && context.options[1].ignoreJSX; + const IGNORE_ARROW_CONDITIONALS = ALL_NODES && context.options[1] && + context.options[1].enforceForArrowConditionals === false; + const IGNORE_SEQUENCE_EXPRESSIONS = ALL_NODES && context.options[1] && + context.options[1].enforceForSequenceExpressions === false; + const IGNORE_NEW_IN_MEMBER_EXPR = ALL_NODES && context.options[1] && + context.options[1].enforceForNewInMemberExpressions === false; + const IGNORE_FUNCTION_PROTOTYPE_METHODS = ALL_NODES && context.options[1] && + context.options[1].enforceForFunctionPrototypeMethods === false; + + const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" }); + const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" }); + + let reportsBuffer; + + /** + * Determines whether the given node is a `call` or `apply` method call, invoked directly on a `FunctionExpression` node. + * Example: function(){}.call() + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is an immediate `call` or `apply` method call. + * @private + */ + function isImmediateFunctionPrototypeMethodCall(node) { + const callNode = astUtils.skipChainExpression(node); + + if (callNode.type !== "CallExpression") { + return false; + } + const callee = astUtils.skipChainExpression(callNode.callee); + + return ( + callee.type === "MemberExpression" && + callee.object.type === "FunctionExpression" && + ["call", "apply"].includes(astUtils.getStaticPropertyName(callee)) + ); + } + + /** + * Determines if this rule should be enforced for a node given the current configuration. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the rule should be enforced for this node. + * @private + */ + function ruleApplies(node) { + if (node.type === "JSXElement" || node.type === "JSXFragment") { + const isSingleLine = node.loc.start.line === node.loc.end.line; + + switch (IGNORE_JSX) { + + // Exclude this JSX element from linting + case "all": + return false; + + // Exclude this JSX element if it is multi-line element + case "multi-line": + return isSingleLine; + + // Exclude this JSX element if it is single-line element + case "single-line": + return !isSingleLine; + + // Nothing special to be done for JSX elements + case "none": + break; + + // no default + } + } + + if (node.type === "SequenceExpression" && IGNORE_SEQUENCE_EXPRESSIONS) { + return false; + } + + if (isImmediateFunctionPrototypeMethodCall(node) && IGNORE_FUNCTION_PROTOTYPE_METHODS) { + return false; + } + + return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression"; + } + + /** + * Determines if a node is surrounded by parentheses. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is parenthesised. + * @private + */ + function isParenthesised(node) { + return isParenthesizedRaw(1, node, sourceCode); + } + + /** + * Determines if a node is surrounded by parentheses twice. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is doubly parenthesised. + * @private + */ + function isParenthesisedTwice(node) { + return isParenthesizedRaw(2, node, sourceCode); + } + + /** + * Determines if a node is surrounded by (potentially) invalid parentheses. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is incorrectly parenthesised. + * @private + */ + function hasExcessParens(node) { + return ruleApplies(node) && isParenthesised(node); + } + + /** + * Determines if a node that is expected to be parenthesised is surrounded by + * (potentially) invalid extra parentheses. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. + * @private + */ + function hasDoubleExcessParens(node) { + return ruleApplies(node) && isParenthesisedTwice(node); + } + + /** + * Determines if a node that is expected to be parenthesised is surrounded by + * (potentially) invalid extra parentheses with considering precedence level of the node. + * If the preference level of the node is not higher or equal to precedence lower limit, it also checks + * whether the node is surrounded by parentheses twice or not. + * @param {ASTNode} node The node to be checked. + * @param {number} precedenceLowerLimit The lower limit of precedence. + * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. + * @private + */ + function hasExcessParensWithPrecedence(node, precedenceLowerLimit) { + if (ruleApplies(node) && isParenthesised(node)) { + if ( + precedence(node) >= precedenceLowerLimit || + isParenthesisedTwice(node) + ) { + return true; + } + } + return false; + } + + /** + * Determines if a node test expression is allowed to have a parenthesised assignment + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the assignment can be parenthesised. + * @private + */ + function isCondAssignException(node) { + return EXCEPT_COND_ASSIGN && node.test.type === "AssignmentExpression"; + } + + /** + * Determines if a node is in a return statement + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is in a return statement. + * @private + */ + function isInReturnStatement(node) { + for (let currentNode = node; currentNode; currentNode = currentNode.parent) { + if ( + currentNode.type === "ReturnStatement" || + (currentNode.type === "ArrowFunctionExpression" && currentNode.body.type !== "BlockStatement") + ) { + return true; + } + } + + return false; + } + + /** + * Determines if a constructor function is newed-up with parens + * @param {ASTNode} newExpression The NewExpression node to be checked. + * @returns {boolean} True if the constructor is called with parens. + * @private + */ + function isNewExpressionWithParens(newExpression) { + const lastToken = sourceCode.getLastToken(newExpression); + const penultimateToken = sourceCode.getTokenBefore(lastToken); + + return newExpression.arguments.length > 0 || + ( + + // The expression should end with its own parens, e.g., new new foo() is not a new expression with parens + astUtils.isOpeningParenToken(penultimateToken) && + astUtils.isClosingParenToken(lastToken) && + newExpression.callee.range[1] < newExpression.range[1] + ); + } + + /** + * Determines if a node is or contains an assignment expression + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is or contains an assignment expression. + * @private + */ + function containsAssignment(node) { + if (node.type === "AssignmentExpression") { + return true; + } + if (node.type === "ConditionalExpression" && + (node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) { + return true; + } + if ((node.left && node.left.type === "AssignmentExpression") || + (node.right && node.right.type === "AssignmentExpression")) { + return true; + } + + return false; + } + + /** + * Determines if a node is contained by or is itself a return statement and is allowed to have a parenthesised assignment + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the assignment can be parenthesised. + * @private + */ + function isReturnAssignException(node) { + if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node)) { + return false; + } + + if (node.type === "ReturnStatement") { + return node.argument && containsAssignment(node.argument); + } + if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") { + return containsAssignment(node.body); + } + return containsAssignment(node); + + } + + /** + * Determines if a node following a [no LineTerminator here] restriction is + * surrounded by (potentially) invalid extra parentheses. + * @param {Token} token The token preceding the [no LineTerminator here] restriction. + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is incorrectly parenthesised. + * @private + */ + function hasExcessParensNoLineTerminator(token, node) { + if (token.loc.end.line === node.loc.start.line) { + return hasExcessParens(node); + } + + return hasDoubleExcessParens(node); + } + + /** + * Determines whether a node should be preceded by an additional space when removing parens + * @param {ASTNode} node node to evaluate; must be surrounded by parentheses + * @returns {boolean} `true` if a space should be inserted before the node + * @private + */ + function requiresLeadingSpace(node) { + const leftParenToken = sourceCode.getTokenBefore(node); + const tokenBeforeLeftParen = sourceCode.getTokenBefore(leftParenToken, { includeComments: true }); + const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParenToken, { includeComments: true }); + + return tokenBeforeLeftParen && + tokenBeforeLeftParen.range[1] === leftParenToken.range[0] && + leftParenToken.range[1] === tokenAfterLeftParen.range[0] && + !astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, tokenAfterLeftParen); + } + + /** + * Determines whether a node should be followed by an additional space when removing parens + * @param {ASTNode} node node to evaluate; must be surrounded by parentheses + * @returns {boolean} `true` if a space should be inserted after the node + * @private + */ + function requiresTrailingSpace(node) { + const nextTwoTokens = sourceCode.getTokensAfter(node, { count: 2 }); + const rightParenToken = nextTwoTokens[0]; + const tokenAfterRightParen = nextTwoTokens[1]; + const tokenBeforeRightParen = sourceCode.getLastToken(node); + + return rightParenToken && tokenAfterRightParen && + !sourceCode.isSpaceBetweenTokens(rightParenToken, tokenAfterRightParen) && + !astUtils.canTokensBeAdjacent(tokenBeforeRightParen, tokenAfterRightParen); + } + + /** + * Determines if a given expression node is an IIFE + * @param {ASTNode} node The node to check + * @returns {boolean} `true` if the given node is an IIFE + */ + function isIIFE(node) { + const maybeCallNode = astUtils.skipChainExpression(node); + + return maybeCallNode.type === "CallExpression" && maybeCallNode.callee.type === "FunctionExpression"; + } + + /** + * Determines if the given node can be the assignment target in destructuring or the LHS of an assignment. + * This is to avoid an autofix that could change behavior because parsers mistakenly allow invalid syntax, + * such as `(a = b) = c` and `[(a = b) = c] = []`. Ideally, this function shouldn't be necessary. + * @param {ASTNode} [node] The node to check + * @returns {boolean} `true` if the given node can be a valid assignment target + */ + function canBeAssignmentTarget(node) { + return node && (node.type === "Identifier" || node.type === "MemberExpression"); + } + + /** + * Report the node + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function report(node) { + const leftParenToken = sourceCode.getTokenBefore(node); + const rightParenToken = sourceCode.getTokenAfter(node); + + if (!isParenthesisedTwice(node)) { + if (tokensToIgnore.has(sourceCode.getFirstToken(node))) { + return; + } + + if (isIIFE(node) && !isParenthesised(node.callee)) { + return; + } + } + + /** + * Finishes reporting + * @returns {void} + * @private + */ + function finishReport() { + context.report({ + node, + loc: leftParenToken.loc, + messageId: "unexpected", + fix(fixer) { + const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]); + + return fixer.replaceTextRange([ + leftParenToken.range[0], + rightParenToken.range[1] + ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : "")); + } + }); + } + + if (reportsBuffer) { + reportsBuffer.reports.push({ node, finishReport }); + return; + } + + finishReport(); + } + + /** + * Evaluate a argument of the node. + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkArgumentWithPrecedence(node) { + if (hasExcessParensWithPrecedence(node.argument, precedence(node))) { + report(node.argument); + } + } + + /** + * Check if a member expression contains a call expression + * @param {ASTNode} node MemberExpression node to evaluate + * @returns {boolean} true if found, false if not + */ + function doesMemberExpressionContainCallExpression(node) { + let currentNode = node.object; + let currentNodeType = node.object.type; + + while (currentNodeType === "MemberExpression") { + currentNode = currentNode.object; + currentNodeType = currentNode.type; + } + + return currentNodeType === "CallExpression"; + } + + /** + * Evaluate a new call + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkCallNew(node) { + const callee = node.callee; + + if (hasExcessParensWithPrecedence(callee, precedence(node))) { + if ( + hasDoubleExcessParens(callee) || + !( + isIIFE(node) || + + // (new A)(); new (new A)(); + ( + callee.type === "NewExpression" && + !isNewExpressionWithParens(callee) && + !( + node.type === "NewExpression" && + !isNewExpressionWithParens(node) + ) + ) || + + // new (a().b)(); new (a.b().c); + ( + node.type === "NewExpression" && + callee.type === "MemberExpression" && + doesMemberExpressionContainCallExpression(callee) + ) || + + // (a?.b)(); (a?.())(); + ( + !node.optional && + callee.type === "ChainExpression" + ) + ) + ) { + report(node.callee); + } + } + node.arguments + .filter(arg => hasExcessParensWithPrecedence(arg, PRECEDENCE_OF_ASSIGNMENT_EXPR)) + .forEach(report); + } + + /** + * Evaluate binary logicals + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkBinaryLogical(node) { + const prec = precedence(node); + const leftPrecedence = precedence(node.left); + const rightPrecedence = precedence(node.right); + const isExponentiation = node.operator === "**"; + const shouldSkipLeft = NESTED_BINARY && (node.left.type === "BinaryExpression" || node.left.type === "LogicalExpression"); + const shouldSkipRight = NESTED_BINARY && (node.right.type === "BinaryExpression" || node.right.type === "LogicalExpression"); + + if (!shouldSkipLeft && hasExcessParens(node.left)) { + if ( + !(["AwaitExpression", "UnaryExpression"].includes(node.left.type) && isExponentiation) && + !astUtils.isMixedLogicalAndCoalesceExpressions(node.left, node) && + (leftPrecedence > prec || (leftPrecedence === prec && !isExponentiation)) || + isParenthesisedTwice(node.left) + ) { + report(node.left); + } + } + + if (!shouldSkipRight && hasExcessParens(node.right)) { + if ( + !astUtils.isMixedLogicalAndCoalesceExpressions(node.right, node) && + (rightPrecedence > prec || (rightPrecedence === prec && isExponentiation)) || + isParenthesisedTwice(node.right) + ) { + report(node.right); + } + } + } + + /** + * Check the parentheses around the super class of the given class definition. + * @param {ASTNode} node The node of class declarations to check. + * @returns {void} + */ + function checkClass(node) { + if (!node.superClass) { + return; + } + + /* + * If `node.superClass` is a LeftHandSideExpression, parentheses are extra. + * Otherwise, parentheses are needed. + */ + const hasExtraParens = precedence(node.superClass) > PRECEDENCE_OF_UPDATE_EXPR + ? hasExcessParens(node.superClass) + : hasDoubleExcessParens(node.superClass); + + if (hasExtraParens) { + report(node.superClass); + } + } + + /** + * Check the parentheses around the argument of the given spread operator. + * @param {ASTNode} node The node of spread elements/properties to check. + * @returns {void} + */ + function checkSpreadOperator(node) { + if (hasExcessParensWithPrecedence(node.argument, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.argument); + } + } + + /** + * Checks the parentheses for an ExpressionStatement or ExportDefaultDeclaration + * @param {ASTNode} node The ExpressionStatement.expression or ExportDefaultDeclaration.declaration node + * @returns {void} + */ + function checkExpressionOrExportStatement(node) { + const firstToken = isParenthesised(node) ? sourceCode.getTokenBefore(node) : sourceCode.getFirstToken(node); + const secondToken = sourceCode.getTokenAfter(firstToken, astUtils.isNotOpeningParenToken); + const thirdToken = secondToken ? sourceCode.getTokenAfter(secondToken) : null; + const tokenAfterClosingParens = secondToken ? sourceCode.getTokenAfter(secondToken, astUtils.isNotClosingParenToken) : null; + + if ( + astUtils.isOpeningParenToken(firstToken) && + ( + astUtils.isOpeningBraceToken(secondToken) || + secondToken.type === "Keyword" && ( + secondToken.value === "function" || + secondToken.value === "class" || + secondToken.value === "let" && + tokenAfterClosingParens && + ( + astUtils.isOpeningBracketToken(tokenAfterClosingParens) || + tokenAfterClosingParens.type === "Identifier" + ) + ) || + secondToken && secondToken.type === "Identifier" && secondToken.value === "async" && thirdToken && thirdToken.type === "Keyword" && thirdToken.value === "function" + ) + ) { + tokensToIgnore.add(secondToken); + } + + const hasExtraParens = node.parent.type === "ExportDefaultDeclaration" + ? hasExcessParensWithPrecedence(node, PRECEDENCE_OF_ASSIGNMENT_EXPR) + : hasExcessParens(node); + + if (hasExtraParens) { + report(node); + } + } + + /** + * Finds the path from the given node to the specified ancestor. + * @param {ASTNode} node First node in the path. + * @param {ASTNode} ancestor Last node in the path. + * @returns {ASTNode[]} Path, including both nodes. + * @throws {Error} If the given node does not have the specified ancestor. + */ + function pathToAncestor(node, ancestor) { + const path = [node]; + let currentNode = node; + + while (currentNode !== ancestor) { + + currentNode = currentNode.parent; + + /* istanbul ignore if */ + if (currentNode === null) { + throw new Error("Nodes are not in the ancestor-descendant relationship."); + } + + path.push(currentNode); + } + + return path; + } + + /** + * Finds the path from the given node to the specified descendant. + * @param {ASTNode} node First node in the path. + * @param {ASTNode} descendant Last node in the path. + * @returns {ASTNode[]} Path, including both nodes. + * @throws {Error} If the given node does not have the specified descendant. + */ + function pathToDescendant(node, descendant) { + return pathToAncestor(descendant, node).reverse(); + } + + /** + * Checks whether the syntax of the given ancestor of an 'in' expression inside a for-loop initializer + * is preventing the 'in' keyword from being interpreted as a part of an ill-formed for-in loop. + * @param {ASTNode} node Ancestor of an 'in' expression. + * @param {ASTNode} child Child of the node, ancestor of the same 'in' expression or the 'in' expression itself. + * @returns {boolean} True if the keyword 'in' would be interpreted as the 'in' operator, without any parenthesis. + */ + function isSafelyEnclosingInExpression(node, child) { + switch (node.type) { + case "ArrayExpression": + case "ArrayPattern": + case "BlockStatement": + case "ObjectExpression": + case "ObjectPattern": + case "TemplateLiteral": + return true; + case "ArrowFunctionExpression": + case "FunctionExpression": + return node.params.includes(child); + case "CallExpression": + case "NewExpression": + return node.arguments.includes(child); + case "MemberExpression": + return node.computed && node.property === child; + case "ConditionalExpression": + return node.consequent === child; + default: + return false; + } + } + + /** + * Starts a new reports buffering. Warnings will be stored in a buffer instead of being reported immediately. + * An additional logic that requires multiple nodes (e.g. a whole subtree) may dismiss some of the stored warnings. + * @returns {void} + */ + function startNewReportsBuffering() { + reportsBuffer = { + upper: reportsBuffer, + inExpressionNodes: [], + reports: [] + }; + } + + /** + * Ends the current reports buffering. + * @returns {void} + */ + function endCurrentReportsBuffering() { + const { upper, inExpressionNodes, reports } = reportsBuffer; + + if (upper) { + upper.inExpressionNodes.push(...inExpressionNodes); + upper.reports.push(...reports); + } else { + + // flush remaining reports + reports.forEach(({ finishReport }) => finishReport()); + } + + reportsBuffer = upper; + } + + /** + * Checks whether the given node is in the current reports buffer. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is in the current buffer, false otherwise. + */ + function isInCurrentReportsBuffer(node) { + return reportsBuffer.reports.some(r => r.node === node); + } + + /** + * Removes the given node from the current reports buffer. + * @param {ASTNode} node Node to remove. + * @returns {void} + */ + function removeFromCurrentReportsBuffer(node) { + reportsBuffer.reports = reportsBuffer.reports.filter(r => r.node !== node); + } + + /** + * Checks whether a node is a MemberExpression at NewExpression's callee. + * @param {ASTNode} node node to check. + * @returns {boolean} True if the node is a MemberExpression at NewExpression's callee. false otherwise. + */ + function isMemberExpInNewCallee(node) { + if (node.type === "MemberExpression") { + return node.parent.type === "NewExpression" && node.parent.callee === node + ? true + : node.parent.object === node && isMemberExpInNewCallee(node.parent); + } + return false; + } + + return { + ArrayExpression(node) { + node.elements + .filter(e => e && hasExcessParensWithPrecedence(e, PRECEDENCE_OF_ASSIGNMENT_EXPR)) + .forEach(report); + }, + + ArrayPattern(node) { + node.elements + .filter(e => canBeAssignmentTarget(e) && hasExcessParens(e)) + .forEach(report); + }, + + ArrowFunctionExpression(node) { + if (isReturnAssignException(node)) { + return; + } + + if (node.body.type === "ConditionalExpression" && + IGNORE_ARROW_CONDITIONALS + ) { + return; + } + + if (node.body.type !== "BlockStatement") { + const firstBodyToken = sourceCode.getFirstToken(node.body, astUtils.isNotOpeningParenToken); + const tokenBeforeFirst = sourceCode.getTokenBefore(firstBodyToken); + + if (astUtils.isOpeningParenToken(tokenBeforeFirst) && astUtils.isOpeningBraceToken(firstBodyToken)) { + tokensToIgnore.add(firstBodyToken); + } + if (hasExcessParensWithPrecedence(node.body, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.body); + } + } + }, + + AssignmentExpression(node) { + if (canBeAssignmentTarget(node.left) && hasExcessParens(node.left)) { + report(node.left); + } + + if (!isReturnAssignException(node) && hasExcessParensWithPrecedence(node.right, precedence(node))) { + report(node.right); + } + }, + + BinaryExpression(node) { + if (reportsBuffer && node.operator === "in") { + reportsBuffer.inExpressionNodes.push(node); + } + + checkBinaryLogical(node); + }, + + CallExpression: checkCallNew, + + ConditionalExpression(node) { + if (isReturnAssignException(node)) { + return; + } + if ( + !isCondAssignException(node) && + hasExcessParensWithPrecedence(node.test, precedence({ type: "LogicalExpression", operator: "||" })) + ) { + report(node.test); + } + + if (hasExcessParensWithPrecedence(node.consequent, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.consequent); + } + + if (hasExcessParensWithPrecedence(node.alternate, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.alternate); + } + }, + + DoWhileStatement(node) { + if (hasExcessParens(node.test) && !isCondAssignException(node)) { + report(node.test); + } + }, + + ExportDefaultDeclaration: node => checkExpressionOrExportStatement(node.declaration), + ExpressionStatement: node => checkExpressionOrExportStatement(node.expression), + + ForInStatement(node) { + if (node.left.type !== "VariableDeclaration") { + const firstLeftToken = sourceCode.getFirstToken(node.left, astUtils.isNotOpeningParenToken); + + if ( + firstLeftToken.value === "let" && + astUtils.isOpeningBracketToken( + sourceCode.getTokenAfter(firstLeftToken, astUtils.isNotClosingParenToken) + ) + ) { + + // ForInStatement#left expression cannot start with `let[`. + tokensToIgnore.add(firstLeftToken); + } + } + + if (hasExcessParens(node.left)) { + report(node.left); + } + + if (hasExcessParens(node.right)) { + report(node.right); + } + }, + + ForOfStatement(node) { + if (node.left.type !== "VariableDeclaration") { + const firstLeftToken = sourceCode.getFirstToken(node.left, astUtils.isNotOpeningParenToken); + + if (firstLeftToken.value === "let") { + + // ForOfStatement#left expression cannot start with `let`. + tokensToIgnore.add(firstLeftToken); + } + } + + if (hasExcessParens(node.left)) { + report(node.left); + } + + if (hasExcessParensWithPrecedence(node.right, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.right); + } + }, + + ForStatement(node) { + if (node.test && hasExcessParens(node.test) && !isCondAssignException(node)) { + report(node.test); + } + + if (node.update && hasExcessParens(node.update)) { + report(node.update); + } + + if (node.init) { + + if (node.init.type !== "VariableDeclaration") { + const firstToken = sourceCode.getFirstToken(node.init, astUtils.isNotOpeningParenToken); + + if ( + firstToken.value === "let" && + astUtils.isOpeningBracketToken( + sourceCode.getTokenAfter(firstToken, astUtils.isNotClosingParenToken) + ) + ) { + + // ForStatement#init expression cannot start with `let[`. + tokensToIgnore.add(firstToken); + } + } + + startNewReportsBuffering(); + + if (hasExcessParens(node.init)) { + report(node.init); + } + } + }, + + "ForStatement > *.init:exit"(node) { + + /* + * Removing parentheses around `in` expressions might change semantics and cause errors. + * + * For example, this valid for loop: + * for (let a = (b in c); ;); + * after removing parentheses would be treated as an invalid for-in loop: + * for (let a = b in c; ;); + */ + + if (reportsBuffer.reports.length) { + reportsBuffer.inExpressionNodes.forEach(inExpressionNode => { + const path = pathToDescendant(node, inExpressionNode); + let nodeToExclude; + + for (let i = 0; i < path.length; i++) { + const pathNode = path[i]; + + if (i < path.length - 1) { + const nextPathNode = path[i + 1]; + + if (isSafelyEnclosingInExpression(pathNode, nextPathNode)) { + + // The 'in' expression in safely enclosed by the syntax of its ancestor nodes (e.g. by '{}' or '[]'). + return; + } + } + + if (isParenthesised(pathNode)) { + if (isInCurrentReportsBuffer(pathNode)) { + + // This node was supposed to be reported, but parentheses might be necessary. + + if (isParenthesisedTwice(pathNode)) { + + /* + * This node is parenthesised twice, it certainly has at least one pair of `extra` parentheses. + * If the --fix option is on, the current fixing iteration will remove only one pair of parentheses. + * The remaining pair is safely enclosing the 'in' expression. + */ + return; + } + + // Exclude the outermost node only. + if (!nodeToExclude) { + nodeToExclude = pathNode; + } + + // Don't break the loop here, there might be some safe nodes or parentheses that will stay inside. + + } else { + + // This node will stay parenthesised, the 'in' expression in safely enclosed by '()'. + return; + } + } + } + + // Exclude the node from the list (i.e. treat parentheses as necessary) + removeFromCurrentReportsBuffer(nodeToExclude); + }); + } + + endCurrentReportsBuffering(); + }, + + IfStatement(node) { + if (hasExcessParens(node.test) && !isCondAssignException(node)) { + report(node.test); + } + }, + + ImportExpression(node) { + const { source } = node; + + if (source.type === "SequenceExpression") { + if (hasDoubleExcessParens(source)) { + report(source); + } + } else if (hasExcessParens(source)) { + report(source); + } + }, + + LogicalExpression: checkBinaryLogical, + + MemberExpression(node) { + const shouldAllowWrapOnce = isMemberExpInNewCallee(node) && + doesMemberExpressionContainCallExpression(node); + const nodeObjHasExcessParens = shouldAllowWrapOnce + ? hasDoubleExcessParens(node.object) + : hasExcessParens(node.object) && + !( + isImmediateFunctionPrototypeMethodCall(node.parent) && + node.parent.callee === node && + IGNORE_FUNCTION_PROTOTYPE_METHODS + ); + + if ( + nodeObjHasExcessParens && + precedence(node.object) >= precedence(node) && + ( + node.computed || + !( + astUtils.isDecimalInteger(node.object) || + + // RegExp literal is allowed to have parens (#1589) + (node.object.type === "Literal" && node.object.regex) + ) + ) + ) { + report(node.object); + } + + if (nodeObjHasExcessParens && + node.object.type === "CallExpression" + ) { + report(node.object); + } + + if (nodeObjHasExcessParens && + !IGNORE_NEW_IN_MEMBER_EXPR && + node.object.type === "NewExpression" && + isNewExpressionWithParens(node.object)) { + report(node.object); + } + + if (nodeObjHasExcessParens && + node.optional && + node.object.type === "ChainExpression" + ) { + report(node.object); + } + + if (node.computed && hasExcessParens(node.property)) { + report(node.property); + } + }, + + "MethodDefinition[computed=true]"(node) { + if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + }, + + NewExpression: checkCallNew, + + ObjectExpression(node) { + node.properties + .filter(property => property.value && hasExcessParensWithPrecedence(property.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) + .forEach(property => report(property.value)); + }, + + ObjectPattern(node) { + node.properties + .filter(property => { + const value = property.value; + + return canBeAssignmentTarget(value) && hasExcessParens(value); + }).forEach(property => report(property.value)); + }, + + Property(node) { + if (node.computed) { + const { key } = node; + + if (key && hasExcessParensWithPrecedence(key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(key); + } + } + }, + + PropertyDefinition(node) { + if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + + if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.value); + } + }, + + RestElement(node) { + const argument = node.argument; + + if (canBeAssignmentTarget(argument) && hasExcessParens(argument)) { + report(argument); + } + }, + + ReturnStatement(node) { + const returnToken = sourceCode.getFirstToken(node); + + if (isReturnAssignException(node)) { + return; + } + + if (node.argument && + hasExcessParensNoLineTerminator(returnToken, node.argument) && + + // RegExp literal is allowed to have parens (#1589) + !(node.argument.type === "Literal" && node.argument.regex)) { + report(node.argument); + } + }, + + SequenceExpression(node) { + const precedenceOfNode = precedence(node); + + node.expressions + .filter(e => hasExcessParensWithPrecedence(e, precedenceOfNode)) + .forEach(report); + }, + + SwitchCase(node) { + if (node.test && hasExcessParens(node.test)) { + report(node.test); + } + }, + + SwitchStatement(node) { + if (hasExcessParens(node.discriminant)) { + report(node.discriminant); + } + }, + + ThrowStatement(node) { + const throwToken = sourceCode.getFirstToken(node); + + if (hasExcessParensNoLineTerminator(throwToken, node.argument)) { + report(node.argument); + } + }, + + UnaryExpression: checkArgumentWithPrecedence, + UpdateExpression(node) { + if (node.prefix) { + checkArgumentWithPrecedence(node); + } else { + const { argument } = node; + const operatorToken = sourceCode.getLastToken(node); + + if (argument.loc.end.line === operatorToken.loc.start.line) { + checkArgumentWithPrecedence(node); + } else { + if (hasDoubleExcessParens(argument)) { + report(argument); + } + } + } + }, + AwaitExpression: checkArgumentWithPrecedence, + + VariableDeclarator(node) { + if ( + node.init && hasExcessParensWithPrecedence(node.init, PRECEDENCE_OF_ASSIGNMENT_EXPR) && + + // RegExp literal is allowed to have parens (#1589) + !(node.init.type === "Literal" && node.init.regex) + ) { + report(node.init); + } + }, + + WhileStatement(node) { + if (hasExcessParens(node.test) && !isCondAssignException(node)) { + report(node.test); + } + }, + + WithStatement(node) { + if (hasExcessParens(node.object)) { + report(node.object); + } + }, + + YieldExpression(node) { + if (node.argument) { + const yieldToken = sourceCode.getFirstToken(node); + + if ((precedence(node.argument) >= precedence(node) && + hasExcessParensNoLineTerminator(yieldToken, node.argument)) || + hasDoubleExcessParens(node.argument)) { + report(node.argument); + } + } + }, + + ClassDeclaration: checkClass, + ClassExpression: checkClass, + + SpreadElement: checkSpreadOperator, + SpreadProperty: checkSpreadOperator, + ExperimentalSpreadProperty: checkSpreadOperator, + + TemplateLiteral(node) { + node.expressions + .filter(e => e && hasExcessParens(e)) + .forEach(report); + }, + + AssignmentPattern(node) { + const { left, right } = node; + + if (canBeAssignmentTarget(left) && hasExcessParens(left)) { + report(left); + } + + if (right && hasExcessParensWithPrecedence(right, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(right); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-extra-semi.js b/node_modules/eslint/lib/rules/no-extra-semi.js new file mode 100644 index 0000000..625310e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-extra-semi.js @@ -0,0 +1,126 @@ +/** + * @fileoverview Rule to flag use of unnecessary semicolons + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const FixTracker = require("./utils/fix-tracker"); +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary semicolons", + recommended: true, + url: "https://eslint.org/docs/rules/no-extra-semi" + }, + + fixable: "code", + schema: [], + + messages: { + unexpected: "Unnecessary semicolon." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Reports an unnecessary semicolon error. + * @param {Node|Token} nodeOrToken A node or a token to be reported. + * @returns {void} + */ + function report(nodeOrToken) { + context.report({ + node: nodeOrToken, + messageId: "unexpected", + fix(fixer) { + + /* + * Expand the replacement range to include the surrounding + * tokens to avoid conflicting with semi. + * https://github.com/eslint/eslint/issues/7928 + */ + return new FixTracker(fixer, context.getSourceCode()) + .retainSurroundingTokens(nodeOrToken) + .remove(nodeOrToken); + } + }); + } + + /** + * Checks for a part of a class body. + * This checks tokens from a specified token to a next MethodDefinition or the end of class body. + * @param {Token} firstToken The first token to check. + * @returns {void} + */ + function checkForPartOfClassBody(firstToken) { + for (let token = firstToken; + token.type === "Punctuator" && !astUtils.isClosingBraceToken(token); + token = sourceCode.getTokenAfter(token) + ) { + if (astUtils.isSemicolonToken(token)) { + report(token); + } + } + } + + return { + + /** + * Reports this empty statement, except if the parent node is a loop. + * @param {Node} node A EmptyStatement node to be reported. + * @returns {void} + */ + EmptyStatement(node) { + const parent = node.parent, + allowedParentTypes = [ + "ForStatement", + "ForInStatement", + "ForOfStatement", + "WhileStatement", + "DoWhileStatement", + "IfStatement", + "LabeledStatement", + "WithStatement" + ]; + + if (!allowedParentTypes.includes(parent.type)) { + report(node); + } + }, + + /** + * Checks tokens from the head of this class body to the first MethodDefinition or the end of this class body. + * @param {Node} node A ClassBody node to check. + * @returns {void} + */ + ClassBody(node) { + checkForPartOfClassBody(sourceCode.getFirstToken(node, 1)); // 0 is `{`. + }, + + /** + * Checks tokens from this MethodDefinition to the next MethodDefinition or the end of this class body. + * @param {Node} node A MethodDefinition node of the start point. + * @returns {void} + */ + "MethodDefinition, PropertyDefinition, StaticBlock"(node) { + checkForPartOfClassBody(sourceCode.getTokenAfter(node)); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-fallthrough.js b/node_modules/eslint/lib/rules/no-fallthrough.js new file mode 100644 index 0000000..f3b7c85 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-fallthrough.js @@ -0,0 +1,147 @@ +/** + * @fileoverview Rule to flag fall-through cases in switch statements. + * @author Matt DuVall + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; + +/** + * Checks whether or not a given case has a fallthrough comment. + * @param {ASTNode} caseWhichFallsThrough SwitchCase node which falls through. + * @param {ASTNode} subsequentCase The case after caseWhichFallsThrough. + * @param {RuleContext} context A rule context which stores comments. + * @param {RegExp} fallthroughCommentPattern A pattern to match comment to. + * @returns {boolean} `true` if the case has a valid fallthrough comment. + */ +function hasFallthroughComment(caseWhichFallsThrough, subsequentCase, context, fallthroughCommentPattern) { + const sourceCode = context.getSourceCode(); + + if (caseWhichFallsThrough.consequent.length === 1 && caseWhichFallsThrough.consequent[0].type === "BlockStatement") { + const trailingCloseBrace = sourceCode.getLastToken(caseWhichFallsThrough.consequent[0]); + const commentInBlock = sourceCode.getCommentsBefore(trailingCloseBrace).pop(); + + if (commentInBlock && fallthroughCommentPattern.test(commentInBlock.value)) { + return true; + } + } + + const comment = sourceCode.getCommentsBefore(subsequentCase).pop(); + + return Boolean(comment && fallthroughCommentPattern.test(comment.value)); +} + +/** + * Checks whether or not a given code path segment is reachable. + * @param {CodePathSegment} segment A CodePathSegment to check. + * @returns {boolean} `true` if the segment is reachable. + */ +function isReachable(segment) { + return segment.reachable; +} + +/** + * Checks whether a node and a token are separated by blank lines + * @param {ASTNode} node The node to check + * @param {Token} token The token to compare against + * @returns {boolean} `true` if there are blank lines between node and token + */ +function hasBlankLinesBetween(node, token) { + return token.loc.start.line > node.loc.end.line + 1; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow fallthrough of `case` statements", + recommended: true, + url: "https://eslint.org/docs/rules/no-fallthrough" + }, + + schema: [ + { + type: "object", + properties: { + commentPattern: { + type: "string", + default: "" + } + }, + additionalProperties: false + } + ], + messages: { + case: "Expected a 'break' statement before 'case'.", + default: "Expected a 'break' statement before 'default'." + } + }, + + create(context) { + const options = context.options[0] || {}; + let currentCodePath = null; + const sourceCode = context.getSourceCode(); + + /* + * We need to use leading comments of the next SwitchCase node because + * trailing comments is wrong if semicolons are omitted. + */ + let fallthroughCase = null; + let fallthroughCommentPattern = null; + + if (options.commentPattern) { + fallthroughCommentPattern = new RegExp(options.commentPattern, "u"); + } else { + fallthroughCommentPattern = DEFAULT_FALLTHROUGH_COMMENT; + } + + return { + onCodePathStart(codePath) { + currentCodePath = codePath; + }, + onCodePathEnd() { + currentCodePath = currentCodePath.upper; + }, + + SwitchCase(node) { + + /* + * Checks whether or not there is a fallthrough comment. + * And reports the previous fallthrough node if that does not exist. + */ + if (fallthroughCase && !hasFallthroughComment(fallthroughCase, node, context, fallthroughCommentPattern)) { + context.report({ + messageId: node.test ? "case" : "default", + node + }); + } + fallthroughCase = null; + }, + + "SwitchCase:exit"(node) { + const nextToken = sourceCode.getTokenAfter(node); + + /* + * `reachable` meant fall through because statements preceded by + * `break`, `return`, or `throw` are unreachable. + * And allows empty cases and the last case. + */ + if (currentCodePath.currentSegments.some(isReachable) && + (node.consequent.length > 0 || hasBlankLinesBetween(node, nextToken)) && + node.parent.cases[node.parent.cases.length - 1] !== node) { + fallthroughCase = node; + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-floating-decimal.js b/node_modules/eslint/lib/rules/no-floating-decimal.js new file mode 100644 index 0000000..8831bb8 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-floating-decimal.js @@ -0,0 +1,70 @@ +/** + * @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow leading or trailing decimal points in numeric literals", + recommended: false, + url: "https://eslint.org/docs/rules/no-floating-decimal" + }, + + schema: [], + fixable: "code", + messages: { + leading: "A leading decimal point can be confused with a dot.", + trailing: "A trailing decimal point can be confused with a dot." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + Literal(node) { + + if (typeof node.value === "number") { + if (node.raw.startsWith(".")) { + context.report({ + node, + messageId: "leading", + fix(fixer) { + const tokenBefore = sourceCode.getTokenBefore(node); + const needsSpaceBefore = tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, `0${node.raw}`); + + return fixer.insertTextBefore(node, needsSpaceBefore ? " 0" : "0"); + } + }); + } + if (node.raw.indexOf(".") === node.raw.length - 1) { + context.report({ + node, + messageId: "trailing", + fix: fixer => fixer.insertTextAfter(node, "0") + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-func-assign.js b/node_modules/eslint/lib/rules/no-func-assign.js new file mode 100644 index 0000000..04a7dd3 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-func-assign.js @@ -0,0 +1,76 @@ +/** + * @fileoverview Rule to flag use of function declaration identifiers as variables. + * @author Ian Christian Myers + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow reassigning `function` declarations", + recommended: true, + url: "https://eslint.org/docs/rules/no-func-assign" + }, + + schema: [], + + messages: { + isAFunction: "'{{name}}' is a function." + } + }, + + create(context) { + + /** + * Reports a reference if is non initializer and writable. + * @param {References} references Collection of reference to check. + * @returns {void} + */ + function checkReference(references) { + astUtils.getModifyingReferences(references).forEach(reference => { + context.report({ + node: reference.identifier, + messageId: "isAFunction", + data: { + name: reference.identifier.name + } + }); + }); + } + + /** + * Finds and reports references that are non initializer and writable. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + if (variable.defs[0].type === "FunctionName") { + checkReference(variable.references); + } + } + + /** + * Checks parameters of a given function node. + * @param {ASTNode} node A function node to check. + * @returns {void} + */ + function checkForFunction(node) { + context.getDeclaredVariables(node).forEach(checkVariable); + } + + return { + FunctionDeclaration: checkForFunction, + FunctionExpression: checkForFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-global-assign.js b/node_modules/eslint/lib/rules/no-global-assign.js new file mode 100644 index 0000000..1225bae --- /dev/null +++ b/node_modules/eslint/lib/rules/no-global-assign.js @@ -0,0 +1,94 @@ +/** + * @fileoverview Rule to disallow assignments to native objects or read-only global variables + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow assignments to native objects or read-only global variables", + recommended: true, + url: "https://eslint.org/docs/rules/no-global-assign" + }, + + schema: [ + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { type: "string" }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + globalShouldNotBeModified: "Read-only global '{{name}}' should not be modified." + } + }, + + create(context) { + const config = context.options[0]; + const exceptions = (config && config.exceptions) || []; + + /** + * Reports write references. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. + * @returns {void} + */ + function checkReference(reference, index, references) { + const identifier = reference.identifier; + + if (reference.init === false && + reference.isWrite() && + + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + (index === 0 || references[index - 1].identifier !== identifier) + ) { + context.report({ + node: identifier, + messageId: "globalShouldNotBeModified", + data: { + name: identifier.name + } + }); + } + } + + /** + * Reports write references if a given variable is read-only builtin. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + if (variable.writeable === false && !exceptions.includes(variable.name)) { + variable.references.forEach(checkReference); + } + } + + return { + Program() { + const globalScope = context.getScope(); + + globalScope.variables.forEach(checkVariable); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-implicit-coercion.js b/node_modules/eslint/lib/rules/no-implicit-coercion.js new file mode 100644 index 0000000..428f63b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-implicit-coercion.js @@ -0,0 +1,361 @@ +/** + * @fileoverview A rule to disallow the type conversions with shorter notations. + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const INDEX_OF_PATTERN = /^(?:i|lastI)ndexOf$/u; +const ALLOWABLE_OPERATORS = ["~", "!!", "+", "*"]; + +/** + * Parses and normalizes an option object. + * @param {Object} options An option object to parse. + * @returns {Object} The parsed and normalized option object. + */ +function parseOptions(options) { + return { + boolean: "boolean" in options ? options.boolean : true, + number: "number" in options ? options.number : true, + string: "string" in options ? options.string : true, + disallowTemplateShorthand: "disallowTemplateShorthand" in options ? options.disallowTemplateShorthand : false, + allow: options.allow || [] + }; +} + +/** + * Checks whether or not a node is a double logical negating. + * @param {ASTNode} node An UnaryExpression node to check. + * @returns {boolean} Whether or not the node is a double logical negating. + */ +function isDoubleLogicalNegating(node) { + return ( + node.operator === "!" && + node.argument.type === "UnaryExpression" && + node.argument.operator === "!" + ); +} + +/** + * Checks whether or not a node is a binary negating of `.indexOf()` method calling. + * @param {ASTNode} node An UnaryExpression node to check. + * @returns {boolean} Whether or not the node is a binary negating of `.indexOf()` method calling. + */ +function isBinaryNegatingOfIndexOf(node) { + if (node.operator !== "~") { + return false; + } + const callNode = astUtils.skipChainExpression(node.argument); + + return ( + callNode.type === "CallExpression" && + astUtils.isSpecificMemberAccess(callNode.callee, null, INDEX_OF_PATTERN) + ); +} + +/** + * Checks whether or not a node is a multiplying by one. + * @param {BinaryExpression} node A BinaryExpression node to check. + * @returns {boolean} Whether or not the node is a multiplying by one. + */ +function isMultiplyByOne(node) { + return node.operator === "*" && ( + node.left.type === "Literal" && node.left.value === 1 || + node.right.type === "Literal" && node.right.value === 1 + ); +} + +/** + * Checks whether the result of a node is numeric or not + * @param {ASTNode} node The node to test + * @returns {boolean} true if the node is a number literal or a `Number()`, `parseInt` or `parseFloat` call + */ +function isNumeric(node) { + return ( + node.type === "Literal" && typeof node.value === "number" || + node.type === "CallExpression" && ( + node.callee.name === "Number" || + node.callee.name === "parseInt" || + node.callee.name === "parseFloat" + ) + ); +} + +/** + * Returns the first non-numeric operand in a BinaryExpression. Designed to be + * used from bottom to up since it walks up the BinaryExpression trees using + * node.parent to find the result. + * @param {BinaryExpression} node The BinaryExpression node to be walked up on + * @returns {ASTNode|null} The first non-numeric item in the BinaryExpression tree or null + */ +function getNonNumericOperand(node) { + const left = node.left, + right = node.right; + + if (right.type !== "BinaryExpression" && !isNumeric(right)) { + return right; + } + + if (left.type !== "BinaryExpression" && !isNumeric(left)) { + return left; + } + + return null; +} + +/** + * Checks whether an expression evaluates to a string. + * @param {ASTNode} node node that represents the expression to check. + * @returns {boolean} Whether or not the expression evaluates to a string. + */ +function isStringType(node) { + return astUtils.isStringLiteral(node) || + ( + node.type === "CallExpression" && + node.callee.type === "Identifier" && + node.callee.name === "String" + ); +} + +/** + * Checks whether a node is an empty string literal or not. + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the passed in node is an + * empty string literal or not. + */ +function isEmptyString(node) { + return astUtils.isStringLiteral(node) && (node.value === "" || (node.type === "TemplateLiteral" && node.quasis.length === 1 && node.quasis[0].value.cooked === "")); +} + +/** + * Checks whether or not a node is a concatenating with an empty string. + * @param {ASTNode} node A BinaryExpression node to check. + * @returns {boolean} Whether or not the node is a concatenating with an empty string. + */ +function isConcatWithEmptyString(node) { + return node.operator === "+" && ( + (isEmptyString(node.left) && !isStringType(node.right)) || + (isEmptyString(node.right) && !isStringType(node.left)) + ); +} + +/** + * Checks whether or not a node is appended with an empty string. + * @param {ASTNode} node An AssignmentExpression node to check. + * @returns {boolean} Whether or not the node is appended with an empty string. + */ +function isAppendEmptyString(node) { + return node.operator === "+=" && isEmptyString(node.right); +} + +/** + * Returns the operand that is not an empty string from a flagged BinaryExpression. + * @param {ASTNode} node The flagged BinaryExpression node to check. + * @returns {ASTNode} The operand that is not an empty string from a flagged BinaryExpression. + */ +function getNonEmptyOperand(node) { + return isEmptyString(node.left) ? node.right : node.left; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow shorthand type conversions", + recommended: false, + url: "https://eslint.org/docs/rules/no-implicit-coercion" + }, + + fixable: "code", + + schema: [{ + type: "object", + properties: { + boolean: { + type: "boolean", + default: true + }, + number: { + type: "boolean", + default: true + }, + string: { + type: "boolean", + default: true + }, + disallowTemplateShorthand: { + type: "boolean", + default: false + }, + allow: { + type: "array", + items: { + enum: ALLOWABLE_OPERATORS + }, + uniqueItems: true + } + }, + additionalProperties: false + }], + + messages: { + useRecommendation: "use `{{recommendation}}` instead." + } + }, + + create(context) { + const options = parseOptions(context.options[0] || {}); + const sourceCode = context.getSourceCode(); + + /** + * Reports an error and autofixes the node + * @param {ASTNode} node An ast node to report the error on. + * @param {string} recommendation The recommended code for the issue + * @param {bool} shouldFix Whether this report should fix the node + * @returns {void} + */ + function report(node, recommendation, shouldFix) { + context.report({ + node, + messageId: "useRecommendation", + data: { + recommendation + }, + fix(fixer) { + if (!shouldFix) { + return null; + } + + const tokenBefore = sourceCode.getTokenBefore(node); + + if ( + tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, recommendation) + ) { + return fixer.replaceText(node, ` ${recommendation}`); + } + return fixer.replaceText(node, recommendation); + } + }); + } + + return { + UnaryExpression(node) { + let operatorAllowed; + + // !!foo + operatorAllowed = options.allow.includes("!!"); + if (!operatorAllowed && options.boolean && isDoubleLogicalNegating(node)) { + const recommendation = `Boolean(${sourceCode.getText(node.argument.argument)})`; + + report(node, recommendation, true); + } + + // ~foo.indexOf(bar) + operatorAllowed = options.allow.includes("~"); + if (!operatorAllowed && options.boolean && isBinaryNegatingOfIndexOf(node)) { + + // `foo?.indexOf(bar) !== -1` will be true (== found) if the `foo` is nullish. So use `>= 0` in that case. + const comparison = node.argument.type === "ChainExpression" ? ">= 0" : "!== -1"; + const recommendation = `${sourceCode.getText(node.argument)} ${comparison}`; + + report(node, recommendation, false); + } + + // +foo + operatorAllowed = options.allow.includes("+"); + if (!operatorAllowed && options.number && node.operator === "+" && !isNumeric(node.argument)) { + const recommendation = `Number(${sourceCode.getText(node.argument)})`; + + report(node, recommendation, true); + } + }, + + // Use `:exit` to prevent double reporting + "BinaryExpression:exit"(node) { + let operatorAllowed; + + // 1 * foo + operatorAllowed = options.allow.includes("*"); + const nonNumericOperand = !operatorAllowed && options.number && isMultiplyByOne(node) && getNonNumericOperand(node); + + if (nonNumericOperand) { + const recommendation = `Number(${sourceCode.getText(nonNumericOperand)})`; + + report(node, recommendation, true); + } + + // "" + foo + operatorAllowed = options.allow.includes("+"); + if (!operatorAllowed && options.string && isConcatWithEmptyString(node)) { + const recommendation = `String(${sourceCode.getText(getNonEmptyOperand(node))})`; + + report(node, recommendation, true); + } + }, + + AssignmentExpression(node) { + + // foo += "" + const operatorAllowed = options.allow.includes("+"); + + if (!operatorAllowed && options.string && isAppendEmptyString(node)) { + const code = sourceCode.getText(getNonEmptyOperand(node)); + const recommendation = `${code} = String(${code})`; + + report(node, recommendation, true); + } + }, + + TemplateLiteral(node) { + if (!options.disallowTemplateShorthand) { + return; + } + + // tag`${foo}` + if (node.parent.type === "TaggedTemplateExpression") { + return; + } + + // `` or `${foo}${bar}` + if (node.expressions.length !== 1) { + return; + } + + + // `prefix${foo}` + if (node.quasis[0].value.cooked !== "") { + return; + } + + // `${foo}postfix` + if (node.quasis[1].value.cooked !== "") { + return; + } + + // if the expression is already a string, then this isn't a coercion + if (isStringType(node.expressions[0])) { + return; + } + + const code = sourceCode.getText(node.expressions[0]); + const recommendation = `String(${code})`; + + report(node, recommendation, true); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-implicit-globals.js b/node_modules/eslint/lib/rules/no-implicit-globals.js new file mode 100644 index 0000000..5dd6aa7 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-implicit-globals.js @@ -0,0 +1,140 @@ +/** + * @fileoverview Rule to check for implicit global variables, functions and classes. + * @author Joshua Peek + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow declarations in the global scope", + recommended: false, + url: "https://eslint.org/docs/rules/no-implicit-globals" + }, + + schema: [{ + type: "object", + properties: { + lexicalBindings: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + globalNonLexicalBinding: "Unexpected {{kind}} declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable.", + globalLexicalBinding: "Unexpected {{kind}} declaration in the global scope, wrap in a block or in an IIFE.", + globalVariableLeak: "Global variable leak, declare the variable if it is intended to be local.", + assignmentToReadonlyGlobal: "Unexpected assignment to read-only global variable.", + redeclarationOfReadonlyGlobal: "Unexpected redeclaration of read-only global variable." + } + }, + + create(context) { + + const checkLexicalBindings = context.options[0] && context.options[0].lexicalBindings === true; + + /** + * Reports the node. + * @param {ASTNode} node Node to report. + * @param {string} messageId Id of the message to report. + * @param {string|undefined} kind Declaration kind, can be 'var', 'const', 'let', function or class. + * @returns {void} + */ + function report(node, messageId, kind) { + context.report({ + node, + messageId, + data: { + kind + } + }); + } + + return { + Program() { + const scope = context.getScope(); + + scope.variables.forEach(variable => { + + // Only ESLint global variables have the `writable` key. + const isReadonlyEslintGlobalVariable = variable.writeable === false; + const isWritableEslintGlobalVariable = variable.writeable === true; + + if (isWritableEslintGlobalVariable) { + + // Everything is allowed with writable ESLint global variables. + return; + } + + variable.defs.forEach(def => { + const defNode = def.node; + + if (def.type === "FunctionName" || (def.type === "Variable" && def.parent.kind === "var")) { + if (isReadonlyEslintGlobalVariable) { + report(defNode, "redeclarationOfReadonlyGlobal"); + } else { + report( + defNode, + "globalNonLexicalBinding", + def.type === "FunctionName" ? "function" : `'${def.parent.kind}'` + ); + } + } + + if (checkLexicalBindings) { + if (def.type === "ClassName" || + (def.type === "Variable" && (def.parent.kind === "let" || def.parent.kind === "const"))) { + if (isReadonlyEslintGlobalVariable) { + report(defNode, "redeclarationOfReadonlyGlobal"); + } else { + report( + defNode, + "globalLexicalBinding", + def.type === "ClassName" ? "class" : `'${def.parent.kind}'` + ); + } + } + } + }); + }); + + // Undeclared assigned variables. + scope.implicit.variables.forEach(variable => { + const scopeVariable = scope.set.get(variable.name); + let messageId; + + if (scopeVariable) { + + // ESLint global variable + if (scopeVariable.writeable) { + return; + } + messageId = "assignmentToReadonlyGlobal"; + + } else { + + // Reference to an unknown variable, possible global leak. + messageId = "globalVariableLeak"; + } + + // def.node is an AssignmentExpression, ForInStatement or ForOfStatement. + variable.defs.forEach(def => { + report(def.node, messageId); + }); + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-implied-eval.js b/node_modules/eslint/lib/rules/no-implied-eval.js new file mode 100644 index 0000000..38de5b3 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-implied-eval.js @@ -0,0 +1,131 @@ +/** + * @fileoverview Rule to flag use of implied eval via setTimeout and setInterval + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { getStaticValue } = require("eslint-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `eval()`-like methods", + recommended: false, + url: "https://eslint.org/docs/rules/no-implied-eval" + }, + + schema: [], + + messages: { + impliedEval: "Implied eval. Consider passing a function instead of a string." + } + }, + + create(context) { + const GLOBAL_CANDIDATES = Object.freeze(["global", "window", "globalThis"]); + const EVAL_LIKE_FUNC_PATTERN = /^(?:set(?:Interval|Timeout)|execScript)$/u; + + /** + * Checks whether a node is evaluated as a string or not. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node is evaluated as a string. + */ + function isEvaluatedString(node) { + if ( + (node.type === "Literal" && typeof node.value === "string") || + node.type === "TemplateLiteral" + ) { + return true; + } + if (node.type === "BinaryExpression" && node.operator === "+") { + return isEvaluatedString(node.left) || isEvaluatedString(node.right); + } + return false; + } + + /** + * Reports if the `CallExpression` node has evaluated argument. + * @param {ASTNode} node A CallExpression to check. + * @returns {void} + */ + function reportImpliedEvalCallExpression(node) { + const [firstArgument] = node.arguments; + + if (firstArgument) { + + const staticValue = getStaticValue(firstArgument, context.getScope()); + const isStaticString = staticValue && typeof staticValue.value === "string"; + const isString = isStaticString || isEvaluatedString(firstArgument); + + if (isString) { + context.report({ + node, + messageId: "impliedEval" + }); + } + } + + } + + /** + * Reports calls of `implied eval` via the global references. + * @param {Variable} globalVar A global variable to check. + * @returns {void} + */ + function reportImpliedEvalViaGlobal(globalVar) { + const { references, name } = globalVar; + + references.forEach(ref => { + const identifier = ref.identifier; + let node = identifier.parent; + + while (astUtils.isSpecificMemberAccess(node, null, name)) { + node = node.parent; + } + + if (astUtils.isSpecificMemberAccess(node, null, EVAL_LIKE_FUNC_PATTERN)) { + const calleeNode = node.parent.type === "ChainExpression" ? node.parent : node; + const parent = calleeNode.parent; + + if (parent.type === "CallExpression" && parent.callee === calleeNode) { + reportImpliedEvalCallExpression(parent); + } + } + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + CallExpression(node) { + if (astUtils.isSpecificId(node.callee, EVAL_LIKE_FUNC_PATTERN)) { + reportImpliedEvalCallExpression(node); + } + }, + "Program:exit"() { + const globalScope = context.getScope(); + + GLOBAL_CANDIDATES + .map(candidate => astUtils.getVariableByName(globalScope, candidate)) + .filter(globalVar => !!globalVar && globalVar.defs.length === 0) + .forEach(reportImpliedEvalViaGlobal); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-import-assign.js b/node_modules/eslint/lib/rules/no-import-assign.js new file mode 100644 index 0000000..385386e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-import-assign.js @@ -0,0 +1,239 @@ +/** + * @fileoverview Rule to flag updates of imported bindings. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const { findVariable } = require("eslint-utils"); +const astUtils = require("./utils/ast-utils"); + +const WellKnownMutationFunctions = { + Object: /^(?:assign|definePropert(?:y|ies)|freeze|setPrototypeOf)$/u, + Reflect: /^(?:(?:define|delete)Property|set(?:PrototypeOf)?)$/u +}; + +/** + * Check if a given node is LHS of an assignment node. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is LHS. + */ +function isAssignmentLeft(node) { + const { parent } = node; + + return ( + ( + parent.type === "AssignmentExpression" && + parent.left === node + ) || + + // Destructuring assignments + parent.type === "ArrayPattern" || + ( + parent.type === "Property" && + parent.value === node && + parent.parent.type === "ObjectPattern" + ) || + parent.type === "RestElement" || + ( + parent.type === "AssignmentPattern" && + parent.left === node + ) + ); +} + +/** + * Check if a given node is the operand of mutation unary operator. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is the operand of mutation unary operator. + */ +function isOperandOfMutationUnaryOperator(node) { + const argumentNode = node.parent.type === "ChainExpression" + ? node.parent + : node; + const { parent } = argumentNode; + + return ( + ( + parent.type === "UpdateExpression" && + parent.argument === argumentNode + ) || + ( + parent.type === "UnaryExpression" && + parent.operator === "delete" && + parent.argument === argumentNode + ) + ); +} + +/** + * Check if a given node is the iteration variable of `for-in`/`for-of` syntax. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is the iteration variable. + */ +function isIterationVariable(node) { + const { parent } = node; + + return ( + ( + parent.type === "ForInStatement" && + parent.left === node + ) || + ( + parent.type === "ForOfStatement" && + parent.left === node + ) + ); +} + +/** + * Check if a given node is at the first argument of a well-known mutation function. + * - `Object.assign` + * - `Object.defineProperty` + * - `Object.defineProperties` + * - `Object.freeze` + * - `Object.setPrototypeOf` + * - `Reflect.defineProperty` + * - `Reflect.deleteProperty` + * - `Reflect.set` + * - `Reflect.setPrototypeOf` + * @param {ASTNode} node The node to check. + * @param {Scope} scope A `escope.Scope` object to find variable (whichever). + * @returns {boolean} `true` if the node is at the first argument of a well-known mutation function. + */ +function isArgumentOfWellKnownMutationFunction(node, scope) { + const { parent } = node; + + if (parent.type !== "CallExpression" || parent.arguments[0] !== node) { + return false; + } + const callee = astUtils.skipChainExpression(parent.callee); + + if ( + !astUtils.isSpecificMemberAccess(callee, "Object", WellKnownMutationFunctions.Object) && + !astUtils.isSpecificMemberAccess(callee, "Reflect", WellKnownMutationFunctions.Reflect) + ) { + return false; + } + const variable = findVariable(scope, callee.object); + + return variable !== null && variable.scope.type === "global"; +} + +/** + * Check if the identifier node is placed at to update members. + * @param {ASTNode} id The Identifier node to check. + * @param {Scope} scope A `escope.Scope` object to find variable (whichever). + * @returns {boolean} `true` if the member of `id` was updated. + */ +function isMemberWrite(id, scope) { + const { parent } = id; + + return ( + ( + parent.type === "MemberExpression" && + parent.object === id && + ( + isAssignmentLeft(parent) || + isOperandOfMutationUnaryOperator(parent) || + isIterationVariable(parent) + ) + ) || + isArgumentOfWellKnownMutationFunction(id, scope) + ); +} + +/** + * Get the mutation node. + * @param {ASTNode} id The Identifier node to get. + * @returns {ASTNode} The mutation node. + */ +function getWriteNode(id) { + let node = id.parent; + + while ( + node && + node.type !== "AssignmentExpression" && + node.type !== "UpdateExpression" && + node.type !== "UnaryExpression" && + node.type !== "CallExpression" && + node.type !== "ForInStatement" && + node.type !== "ForOfStatement" + ) { + node = node.parent; + } + + return node || id; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow assigning to imported bindings", + recommended: true, + url: "https://eslint.org/docs/rules/no-import-assign" + }, + + schema: [], + + messages: { + readonly: "'{{name}}' is read-only.", + readonlyMember: "The members of '{{name}}' are read-only." + } + }, + + create(context) { + return { + ImportDeclaration(node) { + const scope = context.getScope(); + + for (const variable of context.getDeclaredVariables(node)) { + const shouldCheckMembers = variable.defs.some( + d => d.node.type === "ImportNamespaceSpecifier" + ); + let prevIdNode = null; + + for (const reference of variable.references) { + const idNode = reference.identifier; + + /* + * AssignmentPattern (e.g. `[a = 0] = b`) makes two write + * references for the same identifier. This should skip + * the one of the two in order to prevent redundant reports. + */ + if (idNode === prevIdNode) { + continue; + } + prevIdNode = idNode; + + if (reference.isWrite()) { + context.report({ + node: getWriteNode(idNode), + messageId: "readonly", + data: { name: idNode.name } + }); + } else if (shouldCheckMembers && isMemberWrite(idNode, scope)) { + context.report({ + node: getWriteNode(idNode), + messageId: "readonlyMember", + data: { name: idNode.name } + }); + } + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-inline-comments.js b/node_modules/eslint/lib/rules/no-inline-comments.js new file mode 100644 index 0000000..2ed7feb --- /dev/null +++ b/node_modules/eslint/lib/rules/no-inline-comments.js @@ -0,0 +1,110 @@ +/** + * @fileoverview Enforces or disallows inline comments. + * @author Greg Cochard + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow inline comments after code", + recommended: false, + url: "https://eslint.org/docs/rules/no-inline-comments" + }, + + schema: [ + { + type: "object", + properties: { + ignorePattern: { + type: "string" + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedInlineComment: "Unexpected comment inline with code." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = context.options[0]; + let customIgnoreRegExp; + + if (options && options.ignorePattern) { + customIgnoreRegExp = new RegExp(options.ignorePattern, "u"); + } + + /** + * Will check that comments are not on lines starting with or ending with code + * @param {ASTNode} node The comment node to check + * @private + * @returns {void} + */ + function testCodeAroundComment(node) { + + const startLine = String(sourceCode.lines[node.loc.start.line - 1]), + endLine = String(sourceCode.lines[node.loc.end.line - 1]), + preamble = startLine.slice(0, node.loc.start.column).trim(), + postamble = endLine.slice(node.loc.end.column).trim(), + isPreambleEmpty = !preamble, + isPostambleEmpty = !postamble; + + // Nothing on both sides + if (isPreambleEmpty && isPostambleEmpty) { + return; + } + + // Matches the ignore pattern + if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) { + return; + } + + // JSX Exception + if ( + (isPreambleEmpty || preamble === "{") && + (isPostambleEmpty || postamble === "}") + ) { + const enclosingNode = sourceCode.getNodeByRangeIndex(node.range[0]); + + if (enclosingNode && enclosingNode.type === "JSXEmptyExpression") { + return; + } + } + + // Don't report ESLint directive comments + if (astUtils.isDirectiveComment(node)) { + return; + } + + context.report({ + node, + messageId: "unexpectedInlineComment" + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program() { + sourceCode.getAllComments() + .filter(token => token.type !== "Shebang") + .forEach(testCodeAroundComment); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-inner-declarations.js b/node_modules/eslint/lib/rules/no-inner-declarations.js new file mode 100644 index 0000000..3b0feb7 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-inner-declarations.js @@ -0,0 +1,110 @@ +/** + * @fileoverview Rule to enforce declarations in program or function body root. + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const validParent = new Set(["Program", "StaticBlock", "ExportNamedDeclaration", "ExportDefaultDeclaration"]); +const validBlockStatementParent = new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]); + +/** + * Finds the nearest enclosing context where this rule allows declarations and returns its description. + * @param {ASTNode} node Node to search from. + * @returns {string} Description. One of "program", "function body", "class static block body". + */ +function getAllowedBodyDescription(node) { + let { parent } = node; + + while (parent) { + + if (parent.type === "StaticBlock") { + return "class static block body"; + } + + if (astUtils.isFunction(parent)) { + return "function body"; + } + + ({ parent } = parent); + } + + return "program"; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow variable or `function` declarations in nested blocks", + recommended: true, + url: "https://eslint.org/docs/rules/no-inner-declarations" + }, + + schema: [ + { + enum: ["functions", "both"] + } + ], + + messages: { + moveDeclToRoot: "Move {{type}} declaration to {{body}} root." + } + }, + + create(context) { + + /** + * Ensure that a given node is at a program or function body's root. + * @param {ASTNode} node Declaration node to check. + * @returns {void} + */ + function check(node) { + const parent = node.parent; + + if ( + parent.type === "BlockStatement" && validBlockStatementParent.has(parent.parent.type) + ) { + return; + } + + if (validParent.has(parent.type)) { + return; + } + + context.report({ + node, + messageId: "moveDeclToRoot", + data: { + type: (node.type === "FunctionDeclaration" ? "function" : "variable"), + body: getAllowedBodyDescription(node) + } + }); + } + + + return { + + FunctionDeclaration: check, + VariableDeclaration(node) { + if (context.options[0] === "both" && node.kind === "var") { + check(node); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-invalid-regexp.js b/node_modules/eslint/lib/rules/no-invalid-regexp.js new file mode 100644 index 0000000..92ac512 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-invalid-regexp.js @@ -0,0 +1,157 @@ +/** + * @fileoverview Validate strings passed to the RegExp constructor + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const RegExpValidator = require("regexpp").RegExpValidator; +const validator = new RegExpValidator(); +const validFlags = /[dgimsuy]/gu; +const undefined1 = void 0; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow invalid regular expression strings in `RegExp` constructors", + recommended: true, + url: "https://eslint.org/docs/rules/no-invalid-regexp" + }, + + schema: [{ + type: "object", + properties: { + allowConstructorFlags: { + type: "array", + items: { + type: "string" + } + } + }, + additionalProperties: false + }], + + messages: { + regexMessage: "{{message}}." + } + }, + + create(context) { + + const options = context.options[0]; + let allowedFlags = null; + + if (options && options.allowConstructorFlags) { + const temp = options.allowConstructorFlags.join("").replace(validFlags, ""); + + if (temp) { + allowedFlags = new RegExp(`[${temp}]`, "giu"); + } + } + + /** + * Check if node is a string + * @param {ASTNode} node node to evaluate + * @returns {boolean} True if its a string + * @private + */ + function isString(node) { + return node && node.type === "Literal" && typeof node.value === "string"; + } + + /** + * Gets flags of a regular expression created by the given `RegExp()` or `new RegExp()` call + * Examples: + * new RegExp(".") // => "" + * new RegExp(".", "gu") // => "gu" + * new RegExp(".", flags) // => null + * @param {ASTNode} node `CallExpression` or `NewExpression` node + * @returns {string|null} flags if they can be determined, `null` otherwise + * @private + */ + function getFlags(node) { + if (node.arguments.length < 2) { + return ""; + } + + if (isString(node.arguments[1])) { + return node.arguments[1].value; + } + + return null; + } + + /** + * Check syntax error in a given pattern. + * @param {string} pattern The RegExp pattern to validate. + * @param {boolean} uFlag The Unicode flag. + * @returns {string|null} The syntax error. + */ + function validateRegExpPattern(pattern, uFlag) { + try { + validator.validatePattern(pattern, undefined1, undefined1, uFlag); + return null; + } catch (err) { + return err.message; + } + } + + /** + * Check syntax error in a given flags. + * @param {string} flags The RegExp flags to validate. + * @returns {string|null} The syntax error. + */ + function validateRegExpFlags(flags) { + try { + validator.validateFlags(flags); + return null; + } catch { + return `Invalid flags supplied to RegExp constructor '${flags}'`; + } + } + + return { + "CallExpression, NewExpression"(node) { + if (node.callee.type !== "Identifier" || node.callee.name !== "RegExp" || !isString(node.arguments[0])) { + return; + } + const pattern = node.arguments[0].value; + let flags = getFlags(node); + + if (flags && allowedFlags) { + flags = flags.replace(allowedFlags, ""); + } + + const message = + ( + flags && validateRegExpFlags(flags) + ) || + ( + + // If flags are unknown, report the regex only if its pattern is invalid both with and without the "u" flag + flags === null + ? validateRegExpPattern(pattern, true) && validateRegExpPattern(pattern, false) + : validateRegExpPattern(pattern, flags.includes("u")) + ); + + if (message) { + context.report({ + node, + messageId: "regexMessage", + data: { message } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-invalid-this.js b/node_modules/eslint/lib/rules/no-invalid-this.js new file mode 100644 index 0000000..a97696b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-invalid-this.js @@ -0,0 +1,150 @@ +/** + * @fileoverview A rule to disallow `this` keywords in contexts where the value of `this` is `undefined`. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines if the given code path is a code path with lexical `this` binding. + * That is, if `this` within the code path refers to `this` of surrounding code path. + * @param {CodePath} codePath Code path. + * @param {ASTNode} node Node that started the code path. + * @returns {boolean} `true` if it is a code path with lexical `this` binding. + */ +function isCodePathWithLexicalThis(codePath, node) { + return codePath.origin === "function" && node.type === "ArrowFunctionExpression"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow use of `this` in contexts where the value of `this` is `undefined`", + recommended: false, + url: "https://eslint.org/docs/rules/no-invalid-this" + }, + + schema: [ + { + type: "object", + properties: { + capIsConstructor: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedThis: "Unexpected 'this'." + } + }, + + create(context) { + const options = context.options[0] || {}; + const capIsConstructor = options.capIsConstructor !== false; + const stack = [], + sourceCode = context.getSourceCode(); + + /** + * Gets the current checking context. + * + * The return value has a flag that whether or not `this` keyword is valid. + * The flag is initialized when got at the first time. + * @returns {{valid: boolean}} + * an object which has a flag that whether or not `this` keyword is valid. + */ + stack.getCurrent = function() { + const current = this[this.length - 1]; + + if (!current.init) { + current.init = true; + current.valid = !astUtils.isDefaultThisBinding( + current.node, + sourceCode, + { capIsConstructor } + ); + } + return current; + }; + + return { + + onCodePathStart(codePath, node) { + if (isCodePathWithLexicalThis(codePath, node)) { + return; + } + + if (codePath.origin === "program") { + const scope = context.getScope(); + const features = context.parserOptions.ecmaFeatures || {}; + + // `this` at the top level of scripts always refers to the global object + stack.push({ + init: true, + node, + valid: !( + node.sourceType === "module" || + (features.globalReturn && scope.childScopes[0].isStrict) + ) + }); + + return; + } + + /* + * `init: false` means that `valid` isn't determined yet. + * Most functions don't use `this`, and the calculation for `valid` + * is relatively costly, so we'll calculate it lazily when the first + * `this` within the function is traversed. A special case are non-strict + * functions, because `this` refers to the global object and therefore is + * always valid, so we can set `init: true` right away. + */ + stack.push({ + init: !context.getScope().isStrict, + node, + valid: true + }); + }, + + onCodePathEnd(codePath, node) { + if (isCodePathWithLexicalThis(codePath, node)) { + return; + } + + stack.pop(); + }, + + // Reports if `this` of the current context is invalid. + ThisExpression(node) { + const current = stack.getCurrent(); + + if (current && !current.valid) { + context.report({ + node, + messageId: "unexpectedThis" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/node_modules/eslint/lib/rules/no-irregular-whitespace.js new file mode 100644 index 0000000..65c4d67 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-irregular-whitespace.js @@ -0,0 +1,259 @@ +/** + * @fileoverview Rule to disallow whitespace that is not a tab or space, whitespace inside strings and comments are allowed + * @author Jonathan Kingston + * @author Christophe Porteneuve + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/u; +const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mgu; +const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mgu; +const LINE_BREAK = astUtils.createGlobalLinebreakMatcher(); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow irregular whitespace", + recommended: true, + url: "https://eslint.org/docs/rules/no-irregular-whitespace" + }, + + schema: [ + { + type: "object", + properties: { + skipComments: { + type: "boolean", + default: false + }, + skipStrings: { + type: "boolean", + default: true + }, + skipTemplates: { + type: "boolean", + default: false + }, + skipRegExps: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + noIrregularWhitespace: "Irregular whitespace not allowed." + } + }, + + create(context) { + + // Module store of errors that we have found + let errors = []; + + // Lookup the `skipComments` option, which defaults to `false`. + const options = context.options[0] || {}; + const skipComments = !!options.skipComments; + const skipStrings = options.skipStrings !== false; + const skipRegExps = !!options.skipRegExps; + const skipTemplates = !!options.skipTemplates; + + const sourceCode = context.getSourceCode(); + const commentNodes = sourceCode.getAllComments(); + + /** + * Removes errors that occur inside the given node + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeWhitespaceError(node) { + const locStart = node.loc.start; + const locEnd = node.loc.end; + + errors = errors.filter(({ loc: { start: errorLocStart } }) => ( + errorLocStart.line < locStart.line || + errorLocStart.line === locStart.line && errorLocStart.column < locStart.column || + errorLocStart.line === locEnd.line && errorLocStart.column >= locEnd.column || + errorLocStart.line > locEnd.line + )); + } + + /** + * Checks identifier or literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeInvalidNodeErrorsInIdentifierOrLiteral(node) { + const shouldCheckStrings = skipStrings && (typeof node.value === "string"); + const shouldCheckRegExps = skipRegExps && Boolean(node.regex); + + if (shouldCheckStrings || shouldCheckRegExps) { + + // If we have irregular characters remove them from the errors list + if (ALL_IRREGULARS.test(node.raw)) { + removeWhitespaceError(node); + } + } + } + + /** + * Checks template string literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeInvalidNodeErrorsInTemplateLiteral(node) { + if (typeof node.value.raw === "string") { + if (ALL_IRREGULARS.test(node.value.raw)) { + removeWhitespaceError(node); + } + } + } + + /** + * Checks comment nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeInvalidNodeErrorsInComment(node) { + if (ALL_IRREGULARS.test(node.value)) { + removeWhitespaceError(node); + } + } + + /** + * Checks the program source for irregular whitespace + * @param {ASTNode} node The program node + * @returns {void} + * @private + */ + function checkForIrregularWhitespace(node) { + const sourceLines = sourceCode.lines; + + sourceLines.forEach((sourceLine, lineIndex) => { + const lineNumber = lineIndex + 1; + let match; + + while ((match = IRREGULAR_WHITESPACE.exec(sourceLine)) !== null) { + errors.push({ + node, + messageId: "noIrregularWhitespace", + loc: { + start: { + line: lineNumber, + column: match.index + }, + end: { + line: lineNumber, + column: match.index + match[0].length + } + } + }); + } + }); + } + + /** + * Checks the program source for irregular line terminators + * @param {ASTNode} node The program node + * @returns {void} + * @private + */ + function checkForIrregularLineTerminators(node) { + const source = sourceCode.getText(), + sourceLines = sourceCode.lines, + linebreaks = source.match(LINE_BREAK); + let lastLineIndex = -1, + match; + + while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) { + const lineIndex = linebreaks.indexOf(match[0], lastLineIndex + 1) || 0; + + errors.push({ + node, + messageId: "noIrregularWhitespace", + loc: { + start: { + line: lineIndex + 1, + column: sourceLines[lineIndex].length + }, + end: { + line: lineIndex + 2, + column: 0 + } + } + }); + + lastLineIndex = lineIndex; + } + } + + /** + * A no-op function to act as placeholder for comment accumulation when the `skipComments` option is `false`. + * @returns {void} + * @private + */ + function noop() {} + + const nodes = {}; + + if (ALL_IRREGULARS.test(sourceCode.getText())) { + nodes.Program = function(node) { + + /* + * As we can easily fire warnings for all white space issues with + * all the source its simpler to fire them here. + * This means we can check all the application code without having + * to worry about issues caused in the parser tokens. + * When writing this code also evaluating per node was missing out + * connecting tokens in some cases. + * We can later filter the errors when they are found to be not an + * issue in nodes we don't care about. + */ + checkForIrregularWhitespace(node); + checkForIrregularLineTerminators(node); + }; + + nodes.Identifier = removeInvalidNodeErrorsInIdentifierOrLiteral; + nodes.Literal = removeInvalidNodeErrorsInIdentifierOrLiteral; + nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop; + nodes["Program:exit"] = function() { + if (skipComments) { + + // First strip errors occurring in comment nodes. + commentNodes.forEach(removeInvalidNodeErrorsInComment); + } + + // If we have any errors remaining report on them + errors.forEach(error => context.report(error)); + }; + } else { + nodes.Program = noop; + } + + return nodes; + } +}; diff --git a/node_modules/eslint/lib/rules/no-iterator.js b/node_modules/eslint/lib/rules/no-iterator.js new file mode 100644 index 0000000..d112672 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-iterator.js @@ -0,0 +1,52 @@ +/** + * @fileoverview Rule to flag usage of __iterator__ property + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { getStaticPropertyName } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of the `__iterator__` property", + recommended: false, + url: "https://eslint.org/docs/rules/no-iterator" + }, + + schema: [], + + messages: { + noIterator: "Reserved name '__iterator__'." + } + }, + + create(context) { + + return { + + MemberExpression(node) { + + if (getStaticPropertyName(node) === "__iterator__") { + context.report({ + node, + messageId: "noIterator" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-label-var.js b/node_modules/eslint/lib/rules/no-label-var.js new file mode 100644 index 0000000..5021181 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-label-var.js @@ -0,0 +1,79 @@ +/** + * @fileoverview Rule to flag labels that are the same as an identifier + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow labels that share a name with a variable", + recommended: false, + url: "https://eslint.org/docs/rules/no-label-var" + }, + + schema: [], + + messages: { + identifierClashWithLabel: "Found identifier with same name as label." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if the identifier is present inside current scope + * @param {Object} scope current scope + * @param {string} name To evaluate + * @returns {boolean} True if its present + * @private + */ + function findIdentifier(scope, name) { + return astUtils.getVariableByName(scope, name) !== null; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + LabeledStatement(node) { + + // Fetch the innermost scope. + const scope = context.getScope(); + + /* + * Recursively find the identifier walking up the scope, starting + * with the innermost scope. + */ + if (findIdentifier(scope, node.label.name)) { + context.report({ + node, + messageId: "identifierClashWithLabel" + }); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-labels.js b/node_modules/eslint/lib/rules/no-labels.js new file mode 100644 index 0000000..2e79f37 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-labels.js @@ -0,0 +1,149 @@ +/** + * @fileoverview Disallow Labeled Statements + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow labeled statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-labels" + }, + + schema: [ + { + type: "object", + properties: { + allowLoop: { + type: "boolean", + default: false + }, + allowSwitch: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedLabel: "Unexpected labeled statement.", + unexpectedLabelInBreak: "Unexpected label in break statement.", + unexpectedLabelInContinue: "Unexpected label in continue statement." + } + }, + + create(context) { + const options = context.options[0]; + const allowLoop = options && options.allowLoop; + const allowSwitch = options && options.allowSwitch; + let scopeInfo = null; + + /** + * Gets the kind of a given node. + * @param {ASTNode} node A node to get. + * @returns {string} The kind of the node. + */ + function getBodyKind(node) { + if (astUtils.isLoop(node)) { + return "loop"; + } + if (node.type === "SwitchStatement") { + return "switch"; + } + return "other"; + } + + /** + * Checks whether the label of a given kind is allowed or not. + * @param {string} kind A kind to check. + * @returns {boolean} `true` if the kind is allowed. + */ + function isAllowed(kind) { + switch (kind) { + case "loop": return allowLoop; + case "switch": return allowSwitch; + default: return false; + } + } + + /** + * Checks whether a given name is a label of a loop or not. + * @param {string} label A name of a label to check. + * @returns {boolean} `true` if the name is a label of a loop. + */ + function getKind(label) { + let info = scopeInfo; + + while (info) { + if (info.label === label) { + return info.kind; + } + info = info.upper; + } + + /* istanbul ignore next: syntax error */ + return "other"; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + LabeledStatement(node) { + scopeInfo = { + label: node.label.name, + kind: getBodyKind(node.body), + upper: scopeInfo + }; + }, + + "LabeledStatement:exit"(node) { + if (!isAllowed(scopeInfo.kind)) { + context.report({ + node, + messageId: "unexpectedLabel" + }); + } + + scopeInfo = scopeInfo.upper; + }, + + BreakStatement(node) { + if (node.label && !isAllowed(getKind(node.label.name))) { + context.report({ + node, + messageId: "unexpectedLabelInBreak" + }); + } + }, + + ContinueStatement(node) { + if (node.label && !isAllowed(getKind(node.label.name))) { + context.report({ + node, + messageId: "unexpectedLabelInContinue" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-lone-blocks.js b/node_modules/eslint/lib/rules/no-lone-blocks.js new file mode 100644 index 0000000..f9fe951 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-lone-blocks.js @@ -0,0 +1,134 @@ +/** + * @fileoverview Rule to flag blocks with no reason to exist + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary nested blocks", + recommended: false, + url: "https://eslint.org/docs/rules/no-lone-blocks" + }, + + schema: [], + + messages: { + redundantBlock: "Block is redundant.", + redundantNestedBlock: "Nested block is redundant." + } + }, + + create(context) { + + // A stack of lone blocks to be checked for block-level bindings + const loneBlocks = []; + let ruleDef; + + /** + * Reports a node as invalid. + * @param {ASTNode} node The node to be reported. + * @returns {void} + */ + function report(node) { + const messageId = node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock" + ? "redundantNestedBlock" + : "redundantBlock"; + + context.report({ + node, + messageId + }); + } + + /** + * Checks for any occurrence of a BlockStatement in a place where lists of statements can appear + * @param {ASTNode} node The node to check + * @returns {boolean} True if the node is a lone block. + */ + function isLoneBlock(node) { + return node.parent.type === "BlockStatement" || + node.parent.type === "StaticBlock" || + node.parent.type === "Program" || + + // Don't report blocks in switch cases if the block is the only statement of the case. + node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1); + } + + /** + * Checks the enclosing block of the current node for block-level bindings, + * and "marks it" as valid if any. + * @returns {void} + */ + function markLoneBlock() { + if (loneBlocks.length === 0) { + return; + } + + const block = context.getAncestors().pop(); + + if (loneBlocks[loneBlocks.length - 1] === block) { + loneBlocks.pop(); + } + } + + // Default rule definition: report all lone blocks + ruleDef = { + BlockStatement(node) { + if (isLoneBlock(node)) { + report(node); + } + } + }; + + // ES6: report blocks without block-level bindings, or that's only child of another block + if (context.parserOptions.ecmaVersion >= 6) { + ruleDef = { + BlockStatement(node) { + if (isLoneBlock(node)) { + loneBlocks.push(node); + } + }, + "BlockStatement:exit"(node) { + if (loneBlocks.length > 0 && loneBlocks[loneBlocks.length - 1] === node) { + loneBlocks.pop(); + report(node); + } else if ( + ( + node.parent.type === "BlockStatement" || + node.parent.type === "StaticBlock" + ) && + node.parent.body.length === 1 + ) { + report(node); + } + } + }; + + ruleDef.VariableDeclaration = function(node) { + if (node.kind === "let" || node.kind === "const") { + markLoneBlock(); + } + }; + + ruleDef.FunctionDeclaration = function() { + if (context.getScope().isStrict) { + markLoneBlock(); + } + }; + + ruleDef.ClassDeclaration = markLoneBlock; + } + + return ruleDef; + } +}; diff --git a/node_modules/eslint/lib/rules/no-lonely-if.js b/node_modules/eslint/lib/rules/no-lonely-if.js new file mode 100644 index 0000000..9abd465 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-lonely-if.js @@ -0,0 +1,89 @@ +/** + * @fileoverview Rule to disallow if as the only statement in an else block + * @author Brandon Mills + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `if` statements as the only statement in `else` blocks", + recommended: false, + url: "https://eslint.org/docs/rules/no-lonely-if" + }, + + schema: [], + fixable: "code", + + messages: { + unexpectedLonelyIf: "Unexpected if as the only statement in an else block." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + IfStatement(node) { + const ancestors = context.getAncestors(), + parent = ancestors.pop(), + grandparent = ancestors.pop(); + + if (parent && parent.type === "BlockStatement" && + parent.body.length === 1 && grandparent && + grandparent.type === "IfStatement" && + parent === grandparent.alternate) { + context.report({ + node, + messageId: "unexpectedLonelyIf", + fix(fixer) { + const openingElseCurly = sourceCode.getFirstToken(parent); + const closingElseCurly = sourceCode.getLastToken(parent); + const elseKeyword = sourceCode.getTokenBefore(openingElseCurly); + const tokenAfterElseBlock = sourceCode.getTokenAfter(closingElseCurly); + const lastIfToken = sourceCode.getLastToken(node.consequent); + const sourceText = sourceCode.getText(); + + if (sourceText.slice(openingElseCurly.range[1], + node.range[0]).trim() || sourceText.slice(node.range[1], closingElseCurly.range[0]).trim()) { + + // Don't fix if there are any non-whitespace characters interfering (e.g. comments) + return null; + } + + if ( + node.consequent.type !== "BlockStatement" && lastIfToken.value !== ";" && tokenAfterElseBlock && + ( + node.consequent.loc.end.line === tokenAfterElseBlock.loc.start.line || + /^[([/+`-]/u.test(tokenAfterElseBlock.value) || + lastIfToken.value === "++" || + lastIfToken.value === "--" + ) + ) { + + /* + * If the `if` statement has no block, and is not followed by a semicolon, make sure that fixing + * the issue would not change semantics due to ASI. If this would happen, don't do a fix. + */ + return null; + } + + return fixer.replaceTextRange( + [openingElseCurly.range[0], closingElseCurly.range[1]], + (elseKeyword.range[1] === openingElseCurly.range[0] ? " " : "") + sourceCode.getText(node) + ); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-loop-func.js b/node_modules/eslint/lib/rules/no-loop-func.js new file mode 100644 index 0000000..d087974 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-loop-func.js @@ -0,0 +1,204 @@ +/** + * @fileoverview Rule to flag creation of function inside a loop + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets the containing loop node of a specified node. + * + * We don't need to check nested functions, so this ignores those. + * `Scope.through` contains references of nested functions. + * @param {ASTNode} node An AST node to get. + * @returns {ASTNode|null} The containing loop node of the specified node, or + * `null`. + */ +function getContainingLoopNode(node) { + for (let currentNode = node; currentNode.parent; currentNode = currentNode.parent) { + const parent = currentNode.parent; + + switch (parent.type) { + case "WhileStatement": + case "DoWhileStatement": + return parent; + + case "ForStatement": + + // `init` is outside of the loop. + if (parent.init !== currentNode) { + return parent; + } + break; + + case "ForInStatement": + case "ForOfStatement": + + // `right` is outside of the loop. + if (parent.right !== currentNode) { + return parent; + } + break; + + case "ArrowFunctionExpression": + case "FunctionExpression": + case "FunctionDeclaration": + + // We don't need to check nested functions. + return null; + + default: + break; + } + } + + return null; +} + +/** + * Gets the containing loop node of a given node. + * If the loop was nested, this returns the most outer loop. + * @param {ASTNode} node A node to get. This is a loop node. + * @param {ASTNode|null} excludedNode A node that the result node should not + * include. + * @returns {ASTNode} The most outer loop node. + */ +function getTopLoopNode(node, excludedNode) { + const border = excludedNode ? excludedNode.range[1] : 0; + let retv = node; + let containingLoopNode = node; + + while (containingLoopNode && containingLoopNode.range[0] >= border) { + retv = containingLoopNode; + containingLoopNode = getContainingLoopNode(containingLoopNode); + } + + return retv; +} + +/** + * Checks whether a given reference which refers to an upper scope's variable is + * safe or not. + * @param {ASTNode} loopNode A containing loop node. + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is safe or not. + */ +function isSafe(loopNode, reference) { + const variable = reference.resolved; + const definition = variable && variable.defs[0]; + const declaration = definition && definition.parent; + const kind = (declaration && declaration.type === "VariableDeclaration") + ? declaration.kind + : ""; + + // Variables which are declared by `const` is safe. + if (kind === "const") { + return true; + } + + /* + * Variables which are declared by `let` in the loop is safe. + * It's a different instance from the next loop step's. + */ + if (kind === "let" && + declaration.range[0] > loopNode.range[0] && + declaration.range[1] < loopNode.range[1] + ) { + return true; + } + + /* + * WriteReferences which exist after this border are unsafe because those + * can modify the variable. + */ + const border = getTopLoopNode( + loopNode, + (kind === "let") ? declaration : null + ).range[0]; + + /** + * Checks whether a given reference is safe or not. + * The reference is every reference of the upper scope's variable we are + * looking now. + * + * It's safe if the reference matches one of the following condition. + * - is readonly. + * - doesn't exist inside a local function and after the border. + * @param {eslint-scope.Reference} upperRef A reference to check. + * @returns {boolean} `true` if the reference is safe. + */ + function isSafeReference(upperRef) { + const id = upperRef.identifier; + + return ( + !upperRef.isWrite() || + variable.scope.variableScope === upperRef.from.variableScope && + id.range[0] < border + ); + } + + return Boolean(variable) && variable.references.every(isSafeReference); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow function declarations that contain unsafe references inside loop statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-loop-func" + }, + + schema: [], + + messages: { + unsafeRefs: "Function declared in a loop contains unsafe references to variable(s) {{ varNames }}." + } + }, + + create(context) { + + /** + * Reports functions which match the following condition: + * + * - has a loop node in ancestors. + * - has any references which refers to an unsafe variable. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function checkForLoops(node) { + const loopNode = getContainingLoopNode(node); + + if (!loopNode) { + return; + } + + const references = context.getScope().through; + const unsafeRefs = references.filter(r => !isSafe(loopNode, r)).map(r => r.identifier.name); + + if (unsafeRefs.length > 0) { + context.report({ + node, + messageId: "unsafeRefs", + data: { varNames: `'${unsafeRefs.join("', '")}'` } + }); + } + } + + return { + ArrowFunctionExpression: checkForLoops, + FunctionExpression: checkForLoops, + FunctionDeclaration: checkForLoops + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-loss-of-precision.js b/node_modules/eslint/lib/rules/no-loss-of-precision.js new file mode 100644 index 0000000..fefc7b7 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-loss-of-precision.js @@ -0,0 +1,206 @@ +/** + * @fileoverview Rule to flag numbers that will lose significant figure precision at runtime + * @author Jacob Moore + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow literal numbers that lose precision", + recommended: true, + url: "https://eslint.org/docs/rules/no-loss-of-precision" + }, + schema: [], + messages: { + noLossOfPrecision: "This number literal will lose precision at runtime." + } + }, + + create(context) { + + /** + * Returns whether the node is number literal + * @param {Node} node the node literal being evaluated + * @returns {boolean} true if the node is a number literal + */ + function isNumber(node) { + return typeof node.value === "number"; + } + + /** + * Gets the source code of the given number literal. Removes `_` numeric separators from the result. + * @param {Node} node the number `Literal` node + * @returns {string} raw source code of the literal, without numeric separators + */ + function getRaw(node) { + return node.raw.replace(/_/gu, ""); + } + + /** + * Checks whether the number is base ten + * @param {ASTNode} node the node being evaluated + * @returns {boolean} true if the node is in base ten + */ + function isBaseTen(node) { + const prefixes = ["0x", "0X", "0b", "0B", "0o", "0O"]; + + return prefixes.every(prefix => !node.raw.startsWith(prefix)) && + !/^0[0-7]+$/u.test(node.raw); + } + + /** + * Checks that the user-intended non-base ten number equals the actual number after is has been converted to the Number type + * @param {Node} node the node being evaluated + * @returns {boolean} true if they do not match + */ + function notBaseTenLosesPrecision(node) { + const rawString = getRaw(node).toUpperCase(); + let base = 0; + + if (rawString.startsWith("0B")) { + base = 2; + } else if (rawString.startsWith("0X")) { + base = 16; + } else { + base = 8; + } + + return !rawString.endsWith(node.value.toString(base).toUpperCase()); + } + + /** + * Adds a decimal point to the numeric string at index 1 + * @param {string} stringNumber the numeric string without any decimal point + * @returns {string} the numeric string with a decimal point in the proper place + */ + function addDecimalPointToNumber(stringNumber) { + return `${stringNumber.slice(0, 1)}.${stringNumber.slice(1)}`; + } + + /** + * Returns the number stripped of leading zeros + * @param {string} numberAsString the string representation of the number + * @returns {string} the stripped string + */ + function removeLeadingZeros(numberAsString) { + return numberAsString.replace(/^0*/u, ""); + } + + /** + * Returns the number stripped of trailing zeros + * @param {string} numberAsString the string representation of the number + * @returns {string} the stripped string + */ + function removeTrailingZeros(numberAsString) { + return numberAsString.replace(/0*$/u, ""); + } + + /** + * Converts an integer to to an object containing the integer's coefficient and order of magnitude + * @param {string} stringInteger the string representation of the integer being converted + * @returns {Object} the object containing the integer's coefficient and order of magnitude + */ + function normalizeInteger(stringInteger) { + const significantDigits = removeTrailingZeros(removeLeadingZeros(stringInteger)); + + return { + magnitude: stringInteger.startsWith("0") ? stringInteger.length - 2 : stringInteger.length - 1, + coefficient: addDecimalPointToNumber(significantDigits) + }; + } + + /** + * + * Converts a float to to an object containing the floats's coefficient and order of magnitude + * @param {string} stringFloat the string representation of the float being converted + * @returns {Object} the object containing the integer's coefficient and order of magnitude + */ + function normalizeFloat(stringFloat) { + const trimmedFloat = removeLeadingZeros(stringFloat); + + if (trimmedFloat.startsWith(".")) { + const decimalDigits = trimmedFloat.split(".").pop(); + const significantDigits = removeLeadingZeros(decimalDigits); + + return { + magnitude: significantDigits.length - decimalDigits.length - 1, + coefficient: addDecimalPointToNumber(significantDigits) + }; + + } + return { + magnitude: trimmedFloat.indexOf(".") - 1, + coefficient: addDecimalPointToNumber(trimmedFloat.replace(".", "")) + + }; + } + + + /** + * Converts a base ten number to proper scientific notation + * @param {string} stringNumber the string representation of the base ten number to be converted + * @returns {string} the number converted to scientific notation + */ + function convertNumberToScientificNotation(stringNumber) { + const splitNumber = stringNumber.replace("E", "e").split("e"); + const originalCoefficient = splitNumber[0]; + const normalizedNumber = stringNumber.includes(".") ? normalizeFloat(originalCoefficient) + : normalizeInteger(originalCoefficient); + const normalizedCoefficient = normalizedNumber.coefficient; + const magnitude = splitNumber.length > 1 ? (parseInt(splitNumber[1], 10) + normalizedNumber.magnitude) + : normalizedNumber.magnitude; + + return `${normalizedCoefficient}e${magnitude}`; + + } + + /** + * Checks that the user-intended base ten number equals the actual number after is has been converted to the Number type + * @param {Node} node the node being evaluated + * @returns {boolean} true if they do not match + */ + function baseTenLosesPrecision(node) { + const normalizedRawNumber = convertNumberToScientificNotation(getRaw(node)); + const requestedPrecision = normalizedRawNumber.split("e")[0].replace(".", "").length; + + if (requestedPrecision > 100) { + return true; + } + const storedNumber = node.value.toPrecision(requestedPrecision); + const normalizedStoredNumber = convertNumberToScientificNotation(storedNumber); + + return normalizedRawNumber !== normalizedStoredNumber; + } + + + /** + * Checks that the user-intended number equals the actual number after is has been converted to the Number type + * @param {Node} node the node being evaluated + * @returns {boolean} true if they do not match + */ + function losesPrecision(node) { + return isBaseTen(node) ? baseTenLosesPrecision(node) : notBaseTenLosesPrecision(node); + } + + + return { + Literal(node) { + if (node.value && isNumber(node) && losesPrecision(node)) { + context.report({ + messageId: "noLossOfPrecision", + node + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-magic-numbers.js b/node_modules/eslint/lib/rules/no-magic-numbers.js new file mode 100644 index 0000000..6b4cf77 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -0,0 +1,226 @@ +/** + * @fileoverview Rule to flag statements that use magic numbers (adapted from https://github.com/danielstjules/buddy.js) + * @author Vincent Lemeunier + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +// Maximum array length by the ECMAScript Specification. +const MAX_ARRAY_LENGTH = 2 ** 32 - 1; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Convert the value to bigint if it's a string. Otherwise return the value as-is. + * @param {bigint|number|string} x The value to normalize. + * @returns {bigint|number} The normalized value. + */ +function normalizeIgnoreValue(x) { + if (typeof x === "string") { + return BigInt(x.slice(0, -1)); + } + return x; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow magic numbers", + recommended: false, + url: "https://eslint.org/docs/rules/no-magic-numbers" + }, + + schema: [{ + type: "object", + properties: { + detectObjects: { + type: "boolean", + default: false + }, + enforceConst: { + type: "boolean", + default: false + }, + ignore: { + type: "array", + items: { + anyOf: [ + { type: "number" }, + { type: "string", pattern: "^[+-]?(?:0|[1-9][0-9]*)n$" } + ] + }, + uniqueItems: true + }, + ignoreArrayIndexes: { + type: "boolean", + default: false + }, + ignoreDefaultValues: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + useConst: "Number constants declarations must use 'const'.", + noMagic: "No magic number: {{raw}}." + } + }, + + create(context) { + const config = context.options[0] || {}, + detectObjects = !!config.detectObjects, + enforceConst = !!config.enforceConst, + ignore = new Set((config.ignore || []).map(normalizeIgnoreValue)), + ignoreArrayIndexes = !!config.ignoreArrayIndexes, + ignoreDefaultValues = !!config.ignoreDefaultValues; + + const okTypes = detectObjects ? [] : ["ObjectExpression", "Property", "AssignmentExpression"]; + + /** + * Returns whether the rule is configured to ignore the given value + * @param {bigint|number} value The value to check + * @returns {boolean} true if the value is ignored + */ + function isIgnoredValue(value) { + return ignore.has(value); + } + + /** + * Returns whether the number is a default value assignment. + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @returns {boolean} true if the number is a default value + */ + function isDefaultValue(fullNumberNode) { + const parent = fullNumberNode.parent; + + return parent.type === "AssignmentPattern" && parent.right === fullNumberNode; + } + + /** + * Returns whether the given node is used as a radix within parseInt() or Number.parseInt() + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @returns {boolean} true if the node is radix + */ + function isParseIntRadix(fullNumberNode) { + const parent = fullNumberNode.parent; + + return parent.type === "CallExpression" && fullNumberNode === parent.arguments[1] && + ( + astUtils.isSpecificId(parent.callee, "parseInt") || + astUtils.isSpecificMemberAccess(parent.callee, "Number", "parseInt") + ); + } + + /** + * Returns whether the given node is a direct child of a JSX node. + * In particular, it aims to detect numbers used as prop values in JSX tags. + * Example: + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @returns {boolean} true if the node is a JSX number + */ + function isJSXNumber(fullNumberNode) { + return fullNumberNode.parent.type.indexOf("JSX") === 0; + } + + /** + * Returns whether the given node is used as an array index. + * Value must coerce to a valid array index name: "0", "1", "2" ... "4294967294". + * + * All other values, like "-1", "2.5", or "4294967295", are just "normal" object properties, + * which can be created and accessed on an array in addition to the array index properties, + * but they don't affect array's length and are not considered by methods such as .map(), .forEach() etc. + * + * The maximum array length by the specification is 2 ** 32 - 1 = 4294967295, + * thus the maximum valid index is 2 ** 32 - 2 = 4294967294. + * + * All notations are allowed, as long as the value coerces to one of "0", "1", "2" ... "4294967294". + * + * Valid examples: + * a[0], a[1], a[1.2e1], a[0xAB], a[0n], a[1n] + * a[-0] (same as a[0] because -0 coerces to "0") + * a[-0n] (-0n evaluates to 0n) + * + * Invalid examples: + * a[-1], a[-0xAB], a[-1n], a[2.5], a[1.23e1], a[12e-1] + * a[4294967295] (above the max index, it's an access to a regular property a["4294967295"]) + * a[999999999999999999999] (even if it wasn't above the max index, it would be a["1e+21"]) + * a[1e310] (same as a["Infinity"]) + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @param {bigint|number} value Value expressed by the fullNumberNode + * @returns {boolean} true if the node is a valid array index + */ + function isArrayIndex(fullNumberNode, value) { + const parent = fullNumberNode.parent; + + return parent.type === "MemberExpression" && parent.property === fullNumberNode && + (Number.isInteger(value) || typeof value === "bigint") && + value >= 0 && value < MAX_ARRAY_LENGTH; + } + + return { + Literal(node) { + if (!astUtils.isNumericLiteral(node)) { + return; + } + + let fullNumberNode; + let value; + let raw; + + // Treat unary minus as a part of the number + if (node.parent.type === "UnaryExpression" && node.parent.operator === "-") { + fullNumberNode = node.parent; + value = -node.value; + raw = `-${node.raw}`; + } else { + fullNumberNode = node; + value = node.value; + raw = node.raw; + } + + const parent = fullNumberNode.parent; + + // Always allow radix arguments and JSX props + if ( + isIgnoredValue(value) || + (ignoreDefaultValues && isDefaultValue(fullNumberNode)) || + isParseIntRadix(fullNumberNode) || + isJSXNumber(fullNumberNode) || + (ignoreArrayIndexes && isArrayIndex(fullNumberNode, value)) + ) { + return; + } + + if (parent.type === "VariableDeclarator") { + if (enforceConst && parent.parent.kind !== "const") { + context.report({ + node: fullNumberNode, + messageId: "useConst" + }); + } + } else if ( + !okTypes.includes(parent.type) || + (parent.type === "AssignmentExpression" && parent.left.type === "Identifier") + ) { + context.report({ + node: fullNumberNode, + messageId: "noMagic", + data: { + raw + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-misleading-character-class.js b/node_modules/eslint/lib/rules/no-misleading-character-class.js new file mode 100644 index 0000000..d3d9d38 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-misleading-character-class.js @@ -0,0 +1,273 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("eslint-utils"); +const { RegExpValidator, RegExpParser, visitRegExpAST } = require("regexpp"); +const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurrogatePair } = require("./utils/unicode"); +const astUtils = require("./utils/ast-utils.js"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const REGEXPP_LATEST_ECMA_VERSION = 2022; + +/** + * Iterate character sequences of a given nodes. + * + * CharacterClassRange syntax can steal a part of character sequence, + * so this function reverts CharacterClassRange syntax and restore the sequence. + * @param {regexpp.AST.CharacterClassElement[]} nodes The node list to iterate character sequences. + * @returns {IterableIterator} The list of character sequences. + */ +function *iterateCharacterSequence(nodes) { + let seq = []; + + for (const node of nodes) { + switch (node.type) { + case "Character": + seq.push(node.value); + break; + + case "CharacterClassRange": + seq.push(node.min.value); + yield seq; + seq = [node.max.value]; + break; + + case "CharacterSet": + if (seq.length > 0) { + yield seq; + seq = []; + } + break; + + // no default + } + } + + if (seq.length > 0) { + yield seq; + } +} + +const hasCharacterSequence = { + surrogatePairWithoutUFlag(chars) { + return chars.some((c, i) => i !== 0 && isSurrogatePair(chars[i - 1], c)); + }, + + combiningClass(chars) { + return chars.some((c, i) => ( + i !== 0 && + isCombiningCharacter(c) && + !isCombiningCharacter(chars[i - 1]) + )); + }, + + emojiModifier(chars) { + return chars.some((c, i) => ( + i !== 0 && + isEmojiModifier(c) && + !isEmojiModifier(chars[i - 1]) + )); + }, + + regionalIndicatorSymbol(chars) { + return chars.some((c, i) => ( + i !== 0 && + isRegionalIndicatorSymbol(c) && + isRegionalIndicatorSymbol(chars[i - 1]) + )); + }, + + zwj(chars) { + const lastIndex = chars.length - 1; + + return chars.some((c, i) => ( + i !== 0 && + i !== lastIndex && + c === 0x200d && + chars[i - 1] !== 0x200d && + chars[i + 1] !== 0x200d + )); + } +}; + +const kinds = Object.keys(hasCharacterSequence); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow characters which are made with multiple code points in character class syntax", + recommended: true, + url: "https://eslint.org/docs/rules/no-misleading-character-class" + }, + + hasSuggestions: true, + + schema: [], + + messages: { + surrogatePairWithoutUFlag: "Unexpected surrogate pair in character class. Use 'u' flag.", + combiningClass: "Unexpected combined character in character class.", + emojiModifier: "Unexpected modified Emoji in character class.", + regionalIndicatorSymbol: "Unexpected national flag in character class.", + zwj: "Unexpected joined character sequence in character class.", + suggestUnicodeFlag: "Add unicode 'u' flag to regex." + } + }, + create(context) { + const sourceCode = context.getSourceCode(); + const parser = new RegExpParser(); + + /** + * Verify a given regular expression. + * @param {Node} node The node to report. + * @param {string} pattern The regular expression pattern to verify. + * @param {string} flags The flags of the regular expression. + * @param {Function} unicodeFixer Fixer for missing "u" flag. + * @returns {void} + */ + function verify(node, pattern, flags, unicodeFixer) { + let patternNode; + + try { + patternNode = parser.parsePattern( + pattern, + 0, + pattern.length, + flags.includes("u") + ); + } catch { + + // Ignore regular expressions with syntax errors + return; + } + + const foundKinds = new Set(); + + visitRegExpAST(patternNode, { + onCharacterClassEnter(ccNode) { + for (const chars of iterateCharacterSequence(ccNode.elements)) { + for (const kind of kinds) { + if (hasCharacterSequence[kind](chars)) { + foundKinds.add(kind); + } + } + } + } + }); + + for (const kind of foundKinds) { + let suggest; + + if (kind === "surrogatePairWithoutUFlag") { + suggest = [{ + messageId: "suggestUnicodeFlag", + fix: unicodeFixer + }]; + } + + context.report({ + node, + messageId: kind, + suggest + }); + } + } + + /** + * Checks if the given regular expression pattern would be valid with the `u` flag. + * @param {string} pattern The regular expression pattern to verify. + * @returns {boolean} `true` if the pattern would be valid with the `u` flag. + * `false` if the pattern would be invalid with the `u` flag or the configured + * ecmaVersion doesn't support the `u` flag. + */ + function isValidWithUnicodeFlag(pattern) { + const { ecmaVersion } = context.parserOptions; + + // ecmaVersion is unknown or it doesn't support the 'u' flag + if (typeof ecmaVersion !== "number" || ecmaVersion <= 5) { + return false; + } + + const validator = new RegExpValidator({ + ecmaVersion: Math.min(ecmaVersion + 2009, REGEXPP_LATEST_ECMA_VERSION) + }); + + try { + validator.validatePattern(pattern, void 0, void 0, /* uFlag = */ true); + } catch { + return false; + } + + return true; + } + + return { + "Literal[regex]"(node) { + verify(node, node.regex.pattern, node.regex.flags, fixer => { + if (!isValidWithUnicodeFlag(node.regex.pattern)) { + return null; + } + + return fixer.insertTextAfter(node, "u"); + }); + }, + "Program"() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + + /* + * Iterate calls of RegExp. + * E.g., `new RegExp()`, `RegExp()`, `new window.RegExp()`, + * `const {RegExp: a} = window; new a()`, etc... + */ + for (const { node } of tracker.iterateGlobalReferences({ + RegExp: { [CALL]: true, [CONSTRUCT]: true } + })) { + const [patternNode, flagsNode] = node.arguments; + const pattern = getStringIfConstant(patternNode, scope); + const flags = getStringIfConstant(flagsNode, scope); + + if (typeof pattern === "string") { + verify(node, pattern, flags || "", fixer => { + + if (!isValidWithUnicodeFlag(pattern)) { + return null; + } + + if (node.arguments.length === 1) { + const penultimateToken = sourceCode.getLastToken(node, { skip: 1 }); // skip closing parenthesis + + return fixer.insertTextAfter( + penultimateToken, + astUtils.isCommaToken(penultimateToken) + ? ' "u",' + : ', "u"' + ); + } + + if ((flagsNode.type === "Literal" && typeof flagsNode.value === "string") || flagsNode.type === "TemplateLiteral") { + const range = [flagsNode.range[0], flagsNode.range[1] - 1]; + + return fixer.insertTextAfterRange(range, "u"); + } + + return null; + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-mixed-operators.js b/node_modules/eslint/lib/rules/no-mixed-operators.js new file mode 100644 index 0000000..0cace7e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-mixed-operators.js @@ -0,0 +1,226 @@ +/** + * @fileoverview Rule to disallow mixed binary operators. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils.js"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const ARITHMETIC_OPERATORS = ["+", "-", "*", "/", "%", "**"]; +const BITWISE_OPERATORS = ["&", "|", "^", "~", "<<", ">>", ">>>"]; +const COMPARISON_OPERATORS = ["==", "!=", "===", "!==", ">", ">=", "<", "<="]; +const LOGICAL_OPERATORS = ["&&", "||"]; +const RELATIONAL_OPERATORS = ["in", "instanceof"]; +const TERNARY_OPERATOR = ["?:"]; +const COALESCE_OPERATOR = ["??"]; +const ALL_OPERATORS = [].concat( + ARITHMETIC_OPERATORS, + BITWISE_OPERATORS, + COMPARISON_OPERATORS, + LOGICAL_OPERATORS, + RELATIONAL_OPERATORS, + TERNARY_OPERATOR, + COALESCE_OPERATOR +); +const DEFAULT_GROUPS = [ + ARITHMETIC_OPERATORS, + BITWISE_OPERATORS, + COMPARISON_OPERATORS, + LOGICAL_OPERATORS, + RELATIONAL_OPERATORS +]; +const TARGET_NODE_TYPE = /^(?:Binary|Logical|Conditional)Expression$/u; + +/** + * Normalizes options. + * @param {Object|undefined} options A options object to normalize. + * @returns {Object} Normalized option object. + */ +function normalizeOptions(options = {}) { + const hasGroups = options.groups && options.groups.length > 0; + const groups = hasGroups ? options.groups : DEFAULT_GROUPS; + const allowSamePrecedence = options.allowSamePrecedence !== false; + + return { + groups, + allowSamePrecedence + }; +} + +/** + * Checks whether any group which includes both given operator exists or not. + * @param {Array} groups A list of groups to check. + * @param {string} left An operator. + * @param {string} right Another operator. + * @returns {boolean} `true` if such group existed. + */ +function includesBothInAGroup(groups, left, right) { + return groups.some(group => group.includes(left) && group.includes(right)); +} + +/** + * Checks whether the given node is a conditional expression and returns the test node else the left node. + * @param {ASTNode} node A node which can be a BinaryExpression or a LogicalExpression node. + * This parent node can be BinaryExpression, LogicalExpression + * , or a ConditionalExpression node + * @returns {ASTNode} node the appropriate node(left or test). + */ +function getChildNode(node) { + return node.type === "ConditionalExpression" ? node.test : node.left; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow mixed binary operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-mixed-operators" + }, + + schema: [ + { + type: "object", + properties: { + groups: { + type: "array", + items: { + type: "array", + items: { enum: ALL_OPERATORS }, + minItems: 2, + uniqueItems: true + }, + uniqueItems: true + }, + allowSamePrecedence: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'. Use parentheses to clarify the intended order of operations." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = normalizeOptions(context.options[0]); + + /** + * Checks whether a given node should be ignored by options or not. + * @param {ASTNode} node A node to check. This is a BinaryExpression + * node or a LogicalExpression node. This parent node is one of + * them, too. + * @returns {boolean} `true` if the node should be ignored. + */ + function shouldIgnore(node) { + const a = node; + const b = node.parent; + + return ( + !includesBothInAGroup(options.groups, a.operator, b.type === "ConditionalExpression" ? "?:" : b.operator) || + ( + options.allowSamePrecedence && + astUtils.getPrecedence(a) === astUtils.getPrecedence(b) + ) + ); + } + + /** + * Checks whether the operator of a given node is mixed with parent + * node's operator or not. + * @param {ASTNode} node A node to check. This is a BinaryExpression + * node or a LogicalExpression node. This parent node is one of + * them, too. + * @returns {boolean} `true` if the node was mixed. + */ + function isMixedWithParent(node) { + + return ( + node.operator !== node.parent.operator && + !astUtils.isParenthesised(sourceCode, node) + ); + } + + /** + * Gets the operator token of a given node. + * @param {ASTNode} node A node to check. This is a BinaryExpression + * node or a LogicalExpression node. + * @returns {Token} The operator token of the node. + */ + function getOperatorToken(node) { + return sourceCode.getTokenAfter(getChildNode(node), astUtils.isNotClosingParenToken); + } + + /** + * Reports both the operator of a given node and the operator of the + * parent node. + * @param {ASTNode} node A node to check. This is a BinaryExpression + * node or a LogicalExpression node. This parent node is one of + * them, too. + * @returns {void} + */ + function reportBothOperators(node) { + const parent = node.parent; + const left = (getChildNode(parent) === node) ? node : parent; + const right = (getChildNode(parent) !== node) ? node : parent; + const data = { + leftOperator: left.operator || "?:", + rightOperator: right.operator || "?:" + }; + + context.report({ + node: left, + loc: getOperatorToken(left).loc, + messageId: "unexpectedMixedOperator", + data + }); + context.report({ + node: right, + loc: getOperatorToken(right).loc, + messageId: "unexpectedMixedOperator", + data + }); + } + + /** + * Checks between the operator of this node and the operator of the + * parent node. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function check(node) { + if ( + TARGET_NODE_TYPE.test(node.parent.type) && + isMixedWithParent(node) && + !shouldIgnore(node) + ) { + reportBothOperators(node); + } + } + + return { + BinaryExpression: check, + LogicalExpression: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-mixed-requires.js b/node_modules/eslint/lib/rules/no-mixed-requires.js new file mode 100644 index 0000000..9706424 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-mixed-requires.js @@ -0,0 +1,238 @@ +/** + * @fileoverview Rule to enforce grouped require statements for Node.JS + * @author Raphael Pigulla + * @deprecated in ESLint v7.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow `require` calls to be mixed with regular variable declarations", + recommended: false, + url: "https://eslint.org/docs/rules/no-mixed-requires" + }, + + schema: [ + { + oneOf: [ + { + type: "boolean" + }, + { + type: "object", + properties: { + grouping: { + type: "boolean" + }, + allowCall: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + noMixRequire: "Do not mix 'require' and other declarations.", + noMixCoreModuleFileComputed: "Do not mix core, module, file and computed requires." + } + }, + + create(context) { + + const options = context.options[0]; + let grouping = false, + allowCall = false; + + if (typeof options === "object") { + grouping = options.grouping; + allowCall = options.allowCall; + } else { + grouping = !!options; + } + + /** + * Returns the list of built-in modules. + * @returns {string[]} An array of built-in Node.js modules. + */ + function getBuiltinModules() { + + /* + * This list is generated using: + * `require("repl")._builtinLibs.concat('repl').sort()` + * This particular list is as per nodejs v0.12.2 and iojs v0.7.1 + */ + return [ + "assert", "buffer", "child_process", "cluster", "crypto", + "dgram", "dns", "domain", "events", "fs", "http", "https", + "net", "os", "path", "punycode", "querystring", "readline", + "repl", "smalloc", "stream", "string_decoder", "tls", "tty", + "url", "util", "v8", "vm", "zlib" + ]; + } + + const BUILTIN_MODULES = getBuiltinModules(); + + const DECL_REQUIRE = "require", + DECL_UNINITIALIZED = "uninitialized", + DECL_OTHER = "other"; + + const REQ_CORE = "core", + REQ_FILE = "file", + REQ_MODULE = "module", + REQ_COMPUTED = "computed"; + + /** + * Determines the type of a declaration statement. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The type of declaration represented by the expression. + */ + function getDeclarationType(initExpression) { + if (!initExpression) { + + // "var x;" + return DECL_UNINITIALIZED; + } + + if (initExpression.type === "CallExpression" && + initExpression.callee.type === "Identifier" && + initExpression.callee.name === "require" + ) { + + // "var x = require('util');" + return DECL_REQUIRE; + } + if (allowCall && + initExpression.type === "CallExpression" && + initExpression.callee.type === "CallExpression" + ) { + + // "var x = require('diagnose')('sub-module');" + return getDeclarationType(initExpression.callee); + } + if (initExpression.type === "MemberExpression") { + + // "var x = require('glob').Glob;" + return getDeclarationType(initExpression.object); + } + + // "var x = 42;" + return DECL_OTHER; + } + + /** + * Determines the type of module that is loaded via require. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The module type. + */ + function inferModuleType(initExpression) { + if (initExpression.type === "MemberExpression") { + + // "var x = require('glob').Glob;" + return inferModuleType(initExpression.object); + } + if (initExpression.arguments.length === 0) { + + // "var x = require();" + return REQ_COMPUTED; + } + + const arg = initExpression.arguments[0]; + + if (arg.type !== "Literal" || typeof arg.value !== "string") { + + // "var x = require(42);" + return REQ_COMPUTED; + } + + if (BUILTIN_MODULES.includes(arg.value)) { + + // "var fs = require('fs');" + return REQ_CORE; + } + if (/^\.{0,2}\//u.test(arg.value)) { + + // "var utils = require('./utils');" + return REQ_FILE; + } + + // "var async = require('async');" + return REQ_MODULE; + + } + + /** + * Check if the list of variable declarations is mixed, i.e. whether it + * contains both require and other declarations. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are mixed, false if not. + */ + function isMixed(declarations) { + const contains = {}; + + declarations.forEach(declaration => { + const type = getDeclarationType(declaration.init); + + contains[type] = true; + }); + + return !!( + contains[DECL_REQUIRE] && + (contains[DECL_UNINITIALIZED] || contains[DECL_OTHER]) + ); + } + + /** + * Check if all require declarations in the given list are of the same + * type. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are grouped, false if not. + */ + function isGrouped(declarations) { + const found = {}; + + declarations.forEach(declaration => { + if (getDeclarationType(declaration.init) === DECL_REQUIRE) { + found[inferModuleType(declaration.init)] = true; + } + }); + + return Object.keys(found).length <= 1; + } + + + return { + + VariableDeclaration(node) { + + if (isMixed(node.declarations)) { + context.report({ + node, + messageId: "noMixRequire" + }); + } else if (grouping && !isGrouped(node.declarations)) { + context.report({ + node, + messageId: "noMixCoreModuleFileComputed" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js b/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js new file mode 100644 index 0000000..f82a352 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js @@ -0,0 +1,113 @@ +/** + * @fileoverview Disallow mixed spaces and tabs for indentation + * @author Jary Niebur + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow mixed spaces and tabs for indentation", + recommended: true, + url: "https://eslint.org/docs/rules/no-mixed-spaces-and-tabs" + }, + + schema: [ + { + enum: ["smart-tabs", true, false] + } + ], + + messages: { + mixedSpacesAndTabs: "Mixed spaces and tabs." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + let smartTabs; + + switch (context.options[0]) { + case true: // Support old syntax, maybe add deprecation warning here + case "smart-tabs": + smartTabs = true; + break; + default: + smartTabs = false; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program:exit"(node) { + const lines = sourceCode.lines, + comments = sourceCode.getAllComments(), + ignoredCommentLines = new Set(); + + // Add all lines except the first ones. + comments.forEach(comment => { + for (let i = comment.loc.start.line + 1; i <= comment.loc.end.line; i++) { + ignoredCommentLines.add(i); + } + }); + + /* + * At least one space followed by a tab + * or the reverse before non-tab/-space + * characters begin. + */ + let regex = /^(?=( +|\t+))\1(?:\t| )/u; + + if (smartTabs) { + + /* + * At least one space followed by a tab + * before non-tab/-space characters begin. + */ + regex = /^(?=(\t*))\1(?=( +))\2\t/u; + } + + lines.forEach((line, i) => { + const match = regex.exec(line); + + if (match) { + const lineNumber = i + 1; + const loc = { + start: { + line: lineNumber, + column: match[0].length - 2 + }, + end: { + line: lineNumber, + column: match[0].length + } + }; + + if (!ignoredCommentLines.has(lineNumber)) { + const containingNode = sourceCode.getNodeByRangeIndex(sourceCode.getIndexFromLoc(loc.start)); + + if (!(containingNode && ["Literal", "TemplateElement"].includes(containingNode.type))) { + context.report({ + node, + loc, + messageId: "mixedSpacesAndTabs" + }); + } + } + } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-multi-assign.js b/node_modules/eslint/lib/rules/no-multi-assign.js new file mode 100644 index 0000000..be4d41f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-multi-assign.js @@ -0,0 +1,67 @@ +/** + * @fileoverview Rule to check use of chained assignment expressions + * @author Stewart Rand + */ + +"use strict"; + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow use of chained assignment expressions", + recommended: false, + url: "https://eslint.org/docs/rules/no-multi-assign" + }, + + schema: [{ + type: "object", + properties: { + ignoreNonDeclaration: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + unexpectedChain: "Unexpected chained assignment." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + const options = context.options[0] || { + ignoreNonDeclaration: false + }; + const selectors = [ + "VariableDeclarator > AssignmentExpression.init", + "PropertyDefinition > AssignmentExpression.value" + ]; + + if (!options.ignoreNonDeclaration) { + selectors.push("AssignmentExpression > AssignmentExpression.right"); + } + + return { + [selectors](node) { + context.report({ + node, + messageId: "unexpectedChain" + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-multi-spaces.js b/node_modules/eslint/lib/rules/no-multi-spaces.js new file mode 100644 index 0000000..6fac7e3 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-multi-spaces.js @@ -0,0 +1,138 @@ +/** + * @fileoverview Disallow use of multiple spaces. + * @author Nicholas C. Zakas + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow multiple spaces", + recommended: false, + url: "https://eslint.org/docs/rules/no-multi-spaces" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + exceptions: { + type: "object", + patternProperties: { + "^([A-Z][a-z]*)+$": { + type: "boolean" + } + }, + additionalProperties: false + }, + ignoreEOLComments: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + multipleSpaces: "Multiple spaces found before '{{displayValue}}'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = context.options[0] || {}; + const ignoreEOLComments = options.ignoreEOLComments; + const exceptions = Object.assign({ Property: true }, options.exceptions); + const hasExceptions = Object.keys(exceptions).some(key => exceptions[key]); + + /** + * Formats value of given comment token for error message by truncating its length. + * @param {Token} token comment token + * @returns {string} formatted value + * @private + */ + function formatReportedCommentValue(token) { + const valueLines = token.value.split("\n"); + const value = valueLines[0]; + const formattedValue = `${value.slice(0, 12)}...`; + + return valueLines.length === 1 && value.length <= 12 ? value : formattedValue; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program() { + sourceCode.tokensAndComments.forEach((leftToken, leftIndex, tokensAndComments) => { + if (leftIndex === tokensAndComments.length - 1) { + return; + } + const rightToken = tokensAndComments[leftIndex + 1]; + + // Ignore tokens that don't have 2 spaces between them or are on different lines + if ( + !sourceCode.text.slice(leftToken.range[1], rightToken.range[0]).includes(" ") || + leftToken.loc.end.line < rightToken.loc.start.line + ) { + return; + } + + // Ignore comments that are the last token on their line if `ignoreEOLComments` is active. + if ( + ignoreEOLComments && + astUtils.isCommentToken(rightToken) && + ( + leftIndex === tokensAndComments.length - 2 || + rightToken.loc.end.line < tokensAndComments[leftIndex + 2].loc.start.line + ) + ) { + return; + } + + // Ignore tokens that are in a node in the "exceptions" object + if (hasExceptions) { + const parentNode = sourceCode.getNodeByRangeIndex(rightToken.range[0] - 1); + + if (parentNode && exceptions[parentNode.type]) { + return; + } + } + + let displayValue; + + if (rightToken.type === "Block") { + displayValue = `/*${formatReportedCommentValue(rightToken)}*/`; + } else if (rightToken.type === "Line") { + displayValue = `//${formatReportedCommentValue(rightToken)}`; + } else { + displayValue = rightToken.value; + } + + context.report({ + node: rightToken, + loc: { start: leftToken.loc.end, end: rightToken.loc.start }, + messageId: "multipleSpaces", + data: { displayValue }, + fix: fixer => fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ") + }); + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-multi-str.js b/node_modules/eslint/lib/rules/no-multi-str.js new file mode 100644 index 0000000..6a17d58 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-multi-str.js @@ -0,0 +1,65 @@ +/** + * @fileoverview Rule to flag when using multiline strings + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow multiline strings", + recommended: false, + url: "https://eslint.org/docs/rules/no-multi-str" + }, + + schema: [], + + messages: { + multilineString: "Multiline support is limited to browsers supporting ES5 only." + } + }, + + create(context) { + + /** + * Determines if a given node is part of JSX syntax. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a JSX node, false if not. + * @private + */ + function isJSXElement(node) { + return node.type.indexOf("JSX") === 0; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + Literal(node) { + if (astUtils.LINEBREAK_MATCHER.test(node.raw) && !isJSXElement(node.parent)) { + context.report({ + node, + messageId: "multilineString" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-multiple-empty-lines.js b/node_modules/eslint/lib/rules/no-multiple-empty-lines.js new file mode 100644 index 0000000..d012303 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-multiple-empty-lines.js @@ -0,0 +1,151 @@ +/** + * @fileoverview Disallows multiple blank lines. + * implementation adapted from the no-trailing-spaces rule. + * @author Greg Cochard + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow multiple empty lines", + recommended: false, + url: "https://eslint.org/docs/rules/no-multiple-empty-lines" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + max: { + type: "integer", + minimum: 0 + }, + maxEOF: { + type: "integer", + minimum: 0 + }, + maxBOF: { + type: "integer", + minimum: 0 + } + }, + required: ["max"], + additionalProperties: false + } + ], + + messages: { + blankBeginningOfFile: "Too many blank lines at the beginning of file. Max of {{max}} allowed.", + blankEndOfFile: "Too many blank lines at the end of file. Max of {{max}} allowed.", + consecutiveBlank: "More than {{max}} blank {{pluralizedLines}} not allowed." + } + }, + + create(context) { + + // Use options.max or 2 as default + let max = 2, + maxEOF = max, + maxBOF = max; + + if (context.options.length) { + max = context.options[0].max; + maxEOF = typeof context.options[0].maxEOF !== "undefined" ? context.options[0].maxEOF : max; + maxBOF = typeof context.options[0].maxBOF !== "undefined" ? context.options[0].maxBOF : max; + } + + const sourceCode = context.getSourceCode(); + + // Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue + const allLines = sourceCode.lines[sourceCode.lines.length - 1] === "" ? sourceCode.lines.slice(0, -1) : sourceCode.lines; + const templateLiteralLines = new Set(); + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + TemplateLiteral(node) { + node.quasis.forEach(literalPart => { + + // Empty lines have a semantic meaning if they're inside template literals. Don't count these as empty lines. + for (let ignoredLine = literalPart.loc.start.line; ignoredLine < literalPart.loc.end.line; ignoredLine++) { + templateLiteralLines.add(ignoredLine); + } + }); + }, + "Program:exit"(node) { + return allLines + + // Given a list of lines, first get a list of line numbers that are non-empty. + .reduce((nonEmptyLineNumbers, line, index) => { + if (line.trim() || templateLiteralLines.has(index + 1)) { + nonEmptyLineNumbers.push(index + 1); + } + return nonEmptyLineNumbers; + }, []) + + // Add a value at the end to allow trailing empty lines to be checked. + .concat(allLines.length + 1) + + // Given two line numbers of non-empty lines, report the lines between if the difference is too large. + .reduce((lastLineNumber, lineNumber) => { + let messageId, maxAllowed; + + if (lastLineNumber === 0) { + messageId = "blankBeginningOfFile"; + maxAllowed = maxBOF; + } else if (lineNumber === allLines.length + 1) { + messageId = "blankEndOfFile"; + maxAllowed = maxEOF; + } else { + messageId = "consecutiveBlank"; + maxAllowed = max; + } + + if (lineNumber - lastLineNumber - 1 > maxAllowed) { + context.report({ + node, + loc: { + start: { line: lastLineNumber + maxAllowed + 1, column: 0 }, + end: { line: lineNumber, column: 0 } + }, + messageId, + data: { + max: maxAllowed, + pluralizedLines: maxAllowed === 1 ? "line" : "lines" + }, + fix(fixer) { + const rangeStart = sourceCode.getIndexFromLoc({ line: lastLineNumber + 1, column: 0 }); + + /* + * The end of the removal range is usually the start index of the next line. + * However, at the end of the file there is no next line, so the end of the + * range is just the length of the text. + */ + const lineNumberAfterRemovedLines = lineNumber - maxAllowed; + const rangeEnd = lineNumberAfterRemovedLines <= allLines.length + ? sourceCode.getIndexFromLoc({ line: lineNumberAfterRemovedLines, column: 0 }) + : sourceCode.text.length; + + return fixer.removeRange([rangeStart, rangeEnd]); + } + }); + } + + return lineNumber; + }, 0); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-native-reassign.js b/node_modules/eslint/lib/rules/no-native-reassign.js new file mode 100644 index 0000000..5f396e4 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-native-reassign.js @@ -0,0 +1,97 @@ +/** + * @fileoverview Rule to disallow assignments to native objects or read-only global variables + * @author Ilya Volodin + * @deprecated in ESLint v3.3.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow assignments to native objects or read-only global variables", + recommended: false, + url: "https://eslint.org/docs/rules/no-native-reassign" + }, + + deprecated: true, + + replacedBy: ["no-global-assign"], + + schema: [ + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { type: "string" }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + nativeReassign: "Read-only global '{{name}}' should not be modified." + } + }, + + create(context) { + const config = context.options[0]; + const exceptions = (config && config.exceptions) || []; + + /** + * Reports write references. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. + * @returns {void} + */ + function checkReference(reference, index, references) { + const identifier = reference.identifier; + + if (reference.init === false && + reference.isWrite() && + + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + (index === 0 || references[index - 1].identifier !== identifier) + ) { + context.report({ + node: identifier, + messageId: "nativeReassign", + data: identifier + }); + } + } + + /** + * Reports write references if a given variable is read-only builtin. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + if (variable.writeable === false && !exceptions.includes(variable.name)) { + variable.references.forEach(checkReference); + } + } + + return { + Program() { + const globalScope = context.getScope(); + + globalScope.variables.forEach(checkVariable); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-negated-condition.js b/node_modules/eslint/lib/rules/no-negated-condition.js new file mode 100644 index 0000000..a287013 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-negated-condition.js @@ -0,0 +1,95 @@ +/** + * @fileoverview Rule to disallow a negated condition + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow negated conditions", + recommended: false, + url: "https://eslint.org/docs/rules/no-negated-condition" + }, + + schema: [], + + messages: { + unexpectedNegated: "Unexpected negated condition." + } + }, + + create(context) { + + /** + * Determines if a given node is an if-else without a condition on the else + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node has an else without an if. + * @private + */ + function hasElseWithoutCondition(node) { + return node.alternate && node.alternate.type !== "IfStatement"; + } + + /** + * Determines if a given node is a negated unary expression + * @param {Object} test The test object to check. + * @returns {boolean} True if the node is a negated unary expression. + * @private + */ + function isNegatedUnaryExpression(test) { + return test.type === "UnaryExpression" && test.operator === "!"; + } + + /** + * Determines if a given node is a negated binary expression + * @param {Test} test The test to check. + * @returns {boolean} True if the node is a negated binary expression. + * @private + */ + function isNegatedBinaryExpression(test) { + return test.type === "BinaryExpression" && + (test.operator === "!=" || test.operator === "!=="); + } + + /** + * Determines if a given node has a negated if expression + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node has a negated if expression. + * @private + */ + function isNegatedIf(node) { + return isNegatedUnaryExpression(node.test) || isNegatedBinaryExpression(node.test); + } + + return { + IfStatement(node) { + if (!hasElseWithoutCondition(node)) { + return; + } + + if (isNegatedIf(node)) { + context.report({ + node, + messageId: "unexpectedNegated" + }); + } + }, + ConditionalExpression(node) { + if (isNegatedIf(node)) { + context.report({ + node, + messageId: "unexpectedNegated" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-negated-in-lhs.js b/node_modules/eslint/lib/rules/no-negated-in-lhs.js new file mode 100644 index 0000000..95ab58a --- /dev/null +++ b/node_modules/eslint/lib/rules/no-negated-in-lhs.js @@ -0,0 +1,46 @@ +/** + * @fileoverview A rule to disallow negated left operands of the `in` operator + * @author Michael Ficarra + * @deprecated in ESLint v3.3.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow negating the left operand in `in` expressions", + recommended: false, + url: "https://eslint.org/docs/rules/no-negated-in-lhs" + }, + + replacedBy: ["no-unsafe-negation"], + + deprecated: true, + schema: [], + + messages: { + negatedLHS: "The 'in' expression's left operand is negated." + } + }, + + create(context) { + + return { + + BinaryExpression(node) { + if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") { + context.report({ node, messageId: "negatedLHS" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-nested-ternary.js b/node_modules/eslint/lib/rules/no-nested-ternary.js new file mode 100644 index 0000000..c87875e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-nested-ternary.js @@ -0,0 +1,44 @@ +/** + * @fileoverview Rule to flag nested ternary expressions + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow nested ternary expressions", + recommended: false, + url: "https://eslint.org/docs/rules/no-nested-ternary" + }, + + schema: [], + + messages: { + noNestedTernary: "Do not nest ternary expressions." + } + }, + + create(context) { + + return { + ConditionalExpression(node) { + if (node.alternate.type === "ConditionalExpression" || + node.consequent.type === "ConditionalExpression") { + context.report({ + node, + messageId: "noNestedTernary" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-new-func.js b/node_modules/eslint/lib/rules/no-new-func.js new file mode 100644 index 0000000..3b59943 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new-func.js @@ -0,0 +1,86 @@ +/** + * @fileoverview Rule to flag when using new Function + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const callMethods = new Set(["apply", "bind", "call"]); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `new` operators with the `Function` object", + recommended: false, + url: "https://eslint.org/docs/rules/no-new-func" + }, + + schema: [], + + messages: { + noFunctionConstructor: "The Function constructor is eval." + } + }, + + create(context) { + + return { + "Program:exit"() { + const globalScope = context.getScope(); + const variable = globalScope.set.get("Function"); + + if (variable && variable.defs.length === 0) { + variable.references.forEach(ref => { + const node = ref.identifier; + const { parent } = node; + let evalNode; + + if (parent) { + if (node === parent.callee && ( + parent.type === "NewExpression" || + parent.type === "CallExpression" + )) { + evalNode = parent; + } else if ( + parent.type === "MemberExpression" && + node === parent.object && + callMethods.has(astUtils.getStaticPropertyName(parent)) + ) { + const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent; + + if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) { + evalNode = maybeCallee.parent; + } + } + } + + if (evalNode) { + context.report({ + node: evalNode, + messageId: "noFunctionConstructor" + }); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-new-object.js b/node_modules/eslint/lib/rules/no-new-object.js new file mode 100644 index 0000000..02ff772 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new-object.js @@ -0,0 +1,57 @@ +/** + * @fileoverview A rule to disallow calls to the Object constructor + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `Object` constructors", + recommended: false, + url: "https://eslint.org/docs/rules/no-new-object" + }, + + schema: [], + + messages: { + preferLiteral: "The object literal notation {} is preferable." + } + }, + + create(context) { + return { + NewExpression(node) { + const variable = astUtils.getVariableByName( + context.getScope(), + node.callee.name + ); + + if (variable && variable.identifiers.length > 0) { + return; + } + + if (node.callee.name === "Object") { + context.report({ + node, + messageId: "preferLiteral" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-new-require.js b/node_modules/eslint/lib/rules/no-new-require.js new file mode 100644 index 0000000..5dadf6c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new-require.js @@ -0,0 +1,50 @@ +/** + * @fileoverview Rule to disallow use of new operator with the `require` function + * @author Wil Moore III + * @deprecated in ESLint v7.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow `new` operators with calls to `require`", + recommended: false, + url: "https://eslint.org/docs/rules/no-new-require" + }, + + schema: [], + + messages: { + noNewRequire: "Unexpected use of new with require." + } + }, + + create(context) { + + return { + + NewExpression(node) { + if (node.callee.type === "Identifier" && node.callee.name === "require") { + context.report({ + node, + messageId: "noNewRequire" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-new-symbol.js b/node_modules/eslint/lib/rules/no-new-symbol.js new file mode 100644 index 0000000..6acfca9 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new-symbol.js @@ -0,0 +1,54 @@ +/** + * @fileoverview Rule to disallow use of the new operator with the `Symbol` object + * @author Alberto Rodríguez + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow `new` operators with the `Symbol` object", + recommended: true, + url: "https://eslint.org/docs/rules/no-new-symbol" + }, + + schema: [], + + messages: { + noNewSymbol: "`Symbol` cannot be called as a constructor." + } + }, + + create(context) { + + return { + "Program:exit"() { + const globalScope = context.getScope(); + const variable = globalScope.set.get("Symbol"); + + if (variable && variable.defs.length === 0) { + variable.references.forEach(ref => { + const node = ref.identifier; + const parent = node.parent; + + if (parent && parent.type === "NewExpression" && parent.callee === node) { + context.report({ + node, + messageId: "noNewSymbol" + }); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-new-wrappers.js b/node_modules/eslint/lib/rules/no-new-wrappers.js new file mode 100644 index 0000000..1fe06c1 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new-wrappers.js @@ -0,0 +1,48 @@ +/** + * @fileoverview Rule to flag when using constructor for wrapper objects + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects", + recommended: false, + url: "https://eslint.org/docs/rules/no-new-wrappers" + }, + + schema: [], + + messages: { + noConstructor: "Do not use {{fn}} as a constructor." + } + }, + + create(context) { + + return { + + NewExpression(node) { + const wrapperObjects = ["String", "Number", "Boolean"]; + + if (wrapperObjects.includes(node.callee.name)) { + context.report({ + node, + messageId: "noConstructor", + data: { fn: node.callee.name } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-new.js b/node_modules/eslint/lib/rules/no-new.js new file mode 100644 index 0000000..5b09765 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-new.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to flag statements with function invocation preceded by + * "new" and not part of assignment + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `new` operators outside of assignments or comparisons", + recommended: false, + url: "https://eslint.org/docs/rules/no-new" + }, + + schema: [], + + messages: { + noNewStatement: "Do not use 'new' for side effects." + } + }, + + create(context) { + + return { + "ExpressionStatement > NewExpression"(node) { + context.report({ + node: node.parent, + messageId: "noNewStatement" + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js b/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js new file mode 100644 index 0000000..3edd269 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js @@ -0,0 +1,148 @@ +/** + * @fileoverview Rule to disallow `\8` and `\9` escape sequences in string literals. + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const QUICK_TEST_REGEX = /\\[89]/u; + +/** + * Returns unicode escape sequence that represents the given character. + * @param {string} character A single code unit. + * @returns {string} "\uXXXX" sequence. + */ +function getUnicodeEscape(character) { + return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `\\8` and `\\9` escape sequences in string literals", + recommended: true, + url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape" + }, + + hasSuggestions: true, + + schema: [], + + messages: { + decimalEscape: "Don't use '{{decimalEscape}}' escape sequence.", + + // suggestions + refactor: "Replace '{{original}}' with '{{replacement}}'. This maintains the current functionality.", + escapeBackslash: "Replace '{{original}}' with '{{replacement}}' to include the actual backslash character." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Creates a new Suggestion object. + * @param {string} messageId "refactor" or "escapeBackslash". + * @param {int[]} range The range to replace. + * @param {string} replacement New text for the range. + * @returns {Object} Suggestion + */ + function createSuggestion(messageId, range, replacement) { + return { + messageId, + data: { + original: sourceCode.getText().slice(...range), + replacement + }, + fix(fixer) { + return fixer.replaceTextRange(range, replacement); + } + }; + } + + return { + Literal(node) { + if (typeof node.value !== "string") { + return; + } + + if (!QUICK_TEST_REGEX.test(node.raw)) { + return; + } + + const regex = /(?:[^\\]|(?\\.))*?(?\\[89])/suy; + let match; + + while ((match = regex.exec(node.raw))) { + const { previousEscape, decimalEscape } = match.groups; + const decimalEscapeRangeEnd = node.range[0] + match.index + match[0].length; + const decimalEscapeRangeStart = decimalEscapeRangeEnd - decimalEscape.length; + const decimalEscapeRange = [decimalEscapeRangeStart, decimalEscapeRangeEnd]; + const suggest = []; + + // When `regex` is matched, `previousEscape` can only capture characters adjacent to `decimalEscape` + if (previousEscape === "\\0") { + + /* + * Now we have a NULL escape "\0" immediately followed by a decimal escape, e.g.: "\0\8". + * Fixing this to "\08" would turn "\0" into a legacy octal escape. To avoid producing + * an octal escape while fixing a decimal escape, we provide different suggestions. + */ + suggest.push( + createSuggestion( // "\0\8" -> "\u00008" + "refactor", + [decimalEscapeRangeStart - previousEscape.length, decimalEscapeRangeEnd], + `${getUnicodeEscape("\0")}${decimalEscape[1]}` + ), + createSuggestion( // "\8" -> "\u0038" + "refactor", + decimalEscapeRange, + getUnicodeEscape(decimalEscape[1]) + ) + ); + } else { + suggest.push( + createSuggestion( // "\8" -> "8" + "refactor", + decimalEscapeRange, + decimalEscape[1] + ) + ); + } + + suggest.push( + createSuggestion( // "\8" -> "\\8" + "escapeBackslash", + decimalEscapeRange, + `\\${decimalEscape}` + ) + ); + + context.report({ + node, + loc: { + start: sourceCode.getLocFromIndex(decimalEscapeRangeStart), + end: sourceCode.getLocFromIndex(decimalEscapeRangeEnd) + }, + messageId: "decimalEscape", + data: { + decimalEscape + }, + suggest + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-obj-calls.js b/node_modules/eslint/lib/rules/no-obj-calls.js new file mode 100644 index 0000000..667ba69 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-obj-calls.js @@ -0,0 +1,84 @@ +/** + * @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { CALL, CONSTRUCT, ReferenceTracker } = require("eslint-utils"); +const getPropertyName = require("./utils/ast-utils").getStaticPropertyName; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect"]; + +/** + * Returns the name of the node to report + * @param {ASTNode} node A node to report + * @returns {string} name to report + */ +function getReportNodeName(node) { + if (node.type === "ChainExpression") { + return getReportNodeName(node.expression); + } + if (node.type === "MemberExpression") { + return getPropertyName(node); + } + return node.name; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow calling global object properties as functions", + recommended: true, + url: "https://eslint.org/docs/rules/no-obj-calls" + }, + + schema: [], + + messages: { + unexpectedCall: "'{{name}}' is not a function.", + unexpectedRefCall: "'{{name}}' is reference to '{{ref}}', which is not a function." + } + }, + + create(context) { + + return { + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const traceMap = {}; + + for (const g of nonCallableGlobals) { + traceMap[g] = { + [CALL]: true, + [CONSTRUCT]: true + }; + } + + for (const { node, path } of tracker.iterateGlobalReferences(traceMap)) { + const name = getReportNodeName(node.callee); + const ref = path[0]; + const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall"; + + context.report({ node, messageId, data: { name, ref } }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-octal-escape.js b/node_modules/eslint/lib/rules/no-octal-escape.js new file mode 100644 index 0000000..9ac56ab --- /dev/null +++ b/node_modules/eslint/lib/rules/no-octal-escape.js @@ -0,0 +1,56 @@ +/** + * @fileoverview Rule to flag octal escape sequences in string literals. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow octal escape sequences in string literals", + recommended: false, + url: "https://eslint.org/docs/rules/no-octal-escape" + }, + + schema: [], + + messages: { + octalEscapeSequence: "Don't use octal: '\\{{sequence}}'. Use '\\u....' instead." + } + }, + + create(context) { + + return { + + Literal(node) { + if (typeof node.value !== "string") { + return; + } + + // \0 represents a valid NULL character if it isn't followed by a digit. + const match = node.raw.match( + /^(?:[^\\]|\\.)*?\\([0-3][0-7]{1,2}|[4-7][0-7]|0(?=[89])|[1-7])/su + ); + + if (match) { + context.report({ + node, + messageId: "octalEscapeSequence", + data: { sequence: match[1] } + }); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-octal.js b/node_modules/eslint/lib/rules/no-octal.js new file mode 100644 index 0000000..9d05455 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-octal.js @@ -0,0 +1,45 @@ +/** + * @fileoverview Rule to flag when initializing octal literal + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow octal literals", + recommended: true, + url: "https://eslint.org/docs/rules/no-octal" + }, + + schema: [], + + messages: { + noOctal: "Octal literals should not be used." + } + }, + + create(context) { + + return { + + Literal(node) { + if (typeof node.value === "number" && /^0[0-9]/u.test(node.raw)) { + context.report({ + node, + messageId: "noOctal" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-param-reassign.js b/node_modules/eslint/lib/rules/no-param-reassign.js new file mode 100644 index 0000000..87a6b70 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-param-reassign.js @@ -0,0 +1,229 @@ +/** + * @fileoverview Disallow reassignment of function parameters. + * @author Nat Burns + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const stopNodePattern = /(?:Statement|Declaration|Function(?:Expression)?|Program)$/u; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow reassigning `function` parameters", + recommended: false, + url: "https://eslint.org/docs/rules/no-param-reassign" + }, + + schema: [ + { + oneOf: [ + { + type: "object", + properties: { + props: { + enum: [false] + } + }, + additionalProperties: false + }, + { + type: "object", + properties: { + props: { + enum: [true] + }, + ignorePropertyModificationsFor: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + }, + ignorePropertyModificationsForRegex: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + assignmentToFunctionParam: "Assignment to function parameter '{{name}}'.", + assignmentToFunctionParamProp: "Assignment to property of function parameter '{{name}}'." + } + }, + + create(context) { + const props = context.options[0] && context.options[0].props; + const ignoredPropertyAssignmentsFor = context.options[0] && context.options[0].ignorePropertyModificationsFor || []; + const ignoredPropertyAssignmentsForRegex = context.options[0] && context.options[0].ignorePropertyModificationsForRegex || []; + + /** + * Checks whether or not the reference modifies properties of its variable. + * @param {Reference} reference A reference to check. + * @returns {boolean} Whether or not the reference modifies properties of its variable. + */ + function isModifyingProp(reference) { + let node = reference.identifier; + let parent = node.parent; + + while (parent && (!stopNodePattern.test(parent.type) || + parent.type === "ForInStatement" || parent.type === "ForOfStatement")) { + switch (parent.type) { + + // e.g. foo.a = 0; + case "AssignmentExpression": + return parent.left === node; + + // e.g. ++foo.a; + case "UpdateExpression": + return true; + + // e.g. delete foo.a; + case "UnaryExpression": + if (parent.operator === "delete") { + return true; + } + break; + + // e.g. for (foo.a in b) {} + case "ForInStatement": + case "ForOfStatement": + if (parent.left === node) { + return true; + } + + // this is a stop node for parent.right and parent.body + return false; + + // EXCLUDES: e.g. cache.get(foo.a).b = 0; + case "CallExpression": + if (parent.callee !== node) { + return false; + } + break; + + // EXCLUDES: e.g. cache[foo.a] = 0; + case "MemberExpression": + if (parent.property === node) { + return false; + } + break; + + // EXCLUDES: e.g. ({ [foo]: a }) = bar; + case "Property": + if (parent.key === node) { + return false; + } + + break; + + // EXCLUDES: e.g. (foo ? a : b).c = bar; + case "ConditionalExpression": + if (parent.test === node) { + return false; + } + + break; + + // no default + } + + node = parent; + parent = node.parent; + } + + return false; + } + + /** + * Tests that an identifier name matches any of the ignored property assignments. + * First we test strings in ignoredPropertyAssignmentsFor. + * Then we instantiate and test RegExp objects from ignoredPropertyAssignmentsForRegex strings. + * @param {string} identifierName A string that describes the name of an identifier to + * ignore property assignments for. + * @returns {boolean} Whether the string matches an ignored property assignment regular expression or not. + */ + function isIgnoredPropertyAssignment(identifierName) { + return ignoredPropertyAssignmentsFor.includes(identifierName) || + ignoredPropertyAssignmentsForRegex.some(ignored => new RegExp(ignored, "u").test(identifierName)); + } + + /** + * Reports a reference if is non initializer and writable. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. + * @returns {void} + */ + function checkReference(reference, index, references) { + const identifier = reference.identifier; + + if (identifier && + !reference.init && + + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + (index === 0 || references[index - 1].identifier !== identifier) + ) { + if (reference.isWrite()) { + context.report({ + node: identifier, + messageId: "assignmentToFunctionParam", + data: { name: identifier.name } + }); + } else if (props && isModifyingProp(reference) && !isIgnoredPropertyAssignment(identifier.name)) { + context.report({ + node: identifier, + messageId: "assignmentToFunctionParamProp", + data: { name: identifier.name } + }); + } + } + } + + /** + * Finds and reports references that are non initializer and writable. + * @param {Variable} variable A variable to check. + * @returns {void} + */ + function checkVariable(variable) { + if (variable.defs[0].type === "Parameter") { + variable.references.forEach(checkReference); + } + } + + /** + * Checks parameters of a given function node. + * @param {ASTNode} node A function node to check. + * @returns {void} + */ + function checkForFunction(node) { + context.getDeclaredVariables(node).forEach(checkVariable); + } + + return { + + // `:exit` is needed for the `node.parent` property of identifier nodes. + "FunctionDeclaration:exit": checkForFunction, + "FunctionExpression:exit": checkForFunction, + "ArrowFunctionExpression:exit": checkForFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-path-concat.js b/node_modules/eslint/lib/rules/no-path-concat.js new file mode 100644 index 0000000..8d570a3 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-path-concat.js @@ -0,0 +1,64 @@ +/** + * @fileoverview Disallow string concatenation when using __dirname and __filename + * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow string concatenation with `__dirname` and `__filename`", + recommended: false, + url: "https://eslint.org/docs/rules/no-path-concat" + }, + + schema: [], + + messages: { + usePathFunctions: "Use path.join() or path.resolve() instead of + to create paths." + } + }, + + create(context) { + + const MATCHER = /^__(?:dir|file)name$/u; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + BinaryExpression(node) { + + const left = node.left, + right = node.right; + + if (node.operator === "+" && + ((left.type === "Identifier" && MATCHER.test(left.name)) || + (right.type === "Identifier" && MATCHER.test(right.name))) + ) { + + context.report({ + node, + messageId: "usePathFunctions" + }); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-plusplus.js b/node_modules/eslint/lib/rules/no-plusplus.js new file mode 100644 index 0000000..2565da4 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-plusplus.js @@ -0,0 +1,105 @@ +/** + * @fileoverview Rule to flag use of unary increment and decrement operators. + * @author Ian Christian Myers + * @author Brody McKee (github.com/mrmckeb) + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the given node is the update node of a `ForStatement`. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is `ForStatement` update. + */ +function isForStatementUpdate(node) { + const parent = node.parent; + + return parent.type === "ForStatement" && parent.update === node; +} + +/** + * Determines whether the given node is considered to be a for loop "afterthought" by the logic of this rule. + * In particular, it returns `true` if the given node is either: + * - The update node of a `ForStatement`: for (;; i++) {} + * - An operand of a sequence expression that is the update node: for (;; foo(), i++) {} + * - An operand of a sequence expression that is child of another sequence expression, etc., + * up to the sequence expression that is the update node: for (;; foo(), (bar(), (baz(), i++))) {} + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a for loop afterthought. + */ +function isForLoopAfterthought(node) { + const parent = node.parent; + + if (parent.type === "SequenceExpression") { + return isForLoopAfterthought(parent); + } + + return isForStatementUpdate(node); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the unary operators `++` and `--`", + recommended: false, + url: "https://eslint.org/docs/rules/no-plusplus" + }, + + schema: [ + { + type: "object", + properties: { + allowForLoopAfterthoughts: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedUnaryOp: "Unary operator '{{operator}}' used." + } + }, + + create(context) { + + const config = context.options[0]; + let allowForLoopAfterthoughts = false; + + if (typeof config === "object") { + allowForLoopAfterthoughts = config.allowForLoopAfterthoughts === true; + } + + return { + + UpdateExpression(node) { + if (allowForLoopAfterthoughts && isForLoopAfterthought(node)) { + return; + } + + context.report({ + node, + messageId: "unexpectedUnaryOp", + data: { + operator: node.operator + } + }); + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-process-env.js b/node_modules/eslint/lib/rules/no-process-env.js new file mode 100644 index 0000000..f7c2c71 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-process-env.js @@ -0,0 +1,51 @@ +/** + * @fileoverview Disallow the use of process.env() + * @author Vignesh Anand + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow the use of `process.env`", + recommended: false, + url: "https://eslint.org/docs/rules/no-process-env" + }, + + schema: [], + + messages: { + unexpectedProcessEnv: "Unexpected use of process.env." + } + }, + + create(context) { + + return { + + MemberExpression(node) { + const objectName = node.object.name, + propertyName = node.property.name; + + if (objectName === "process" && !node.computed && propertyName && propertyName === "env") { + context.report({ node, messageId: "unexpectedProcessEnv" }); + } + + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-process-exit.js b/node_modules/eslint/lib/rules/no-process-exit.js new file mode 100644 index 0000000..251044b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-process-exit.js @@ -0,0 +1,47 @@ +/** + * @fileoverview Disallow the use of process.exit() + * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow the use of `process.exit()`", + recommended: false, + url: "https://eslint.org/docs/rules/no-process-exit" + }, + + schema: [], + + messages: { + noProcessExit: "Don't use process.exit(); throw an error instead." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) { + context.report({ node: node.parent, messageId: "noProcessExit" }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-promise-executor-return.js b/node_modules/eslint/lib/rules/no-promise-executor-return.js new file mode 100644 index 0000000..e40d4bc --- /dev/null +++ b/node_modules/eslint/lib/rules/no-promise-executor-return.js @@ -0,0 +1,121 @@ +/** + * @fileoverview Rule to disallow returning values from Promise executor functions + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { findVariable } = require("eslint-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const functionTypesToCheck = new Set(["ArrowFunctionExpression", "FunctionExpression"]); + +/** + * Determines whether the given identifier node is a reference to a global variable. + * @param {ASTNode} node `Identifier` node to check. + * @param {Scope} scope Scope to which the node belongs. + * @returns {boolean} True if the identifier is a reference to a global variable. + */ +function isGlobalReference(node, scope) { + const variable = findVariable(scope, node); + + return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; +} + +/** + * Finds function's outer scope. + * @param {Scope} scope Function's own scope. + * @returns {Scope} Function's outer scope. + */ +function getOuterScope(scope) { + const upper = scope.upper; + + if (upper.type === "function-expression-name") { + return upper.upper; + } + return upper; +} + +/** + * Determines whether the given function node is used as a Promise executor. + * @param {ASTNode} node The node to check. + * @param {Scope} scope Function's own scope. + * @returns {boolean} `true` if the node is a Promise executor. + */ +function isPromiseExecutor(node, scope) { + const parent = node.parent; + + return parent.type === "NewExpression" && + parent.arguments[0] === node && + parent.callee.type === "Identifier" && + parent.callee.name === "Promise" && + isGlobalReference(parent.callee, getOuterScope(scope)); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow returning values from Promise executor functions", + recommended: false, + url: "https://eslint.org/docs/rules/no-promise-executor-return" + }, + + schema: [], + + messages: { + returnsValue: "Return values from promise executor functions cannot be read." + } + }, + + create(context) { + + let funcInfo = null; + + /** + * Reports the given node. + * @param {ASTNode} node Node to report. + * @returns {void} + */ + function report(node) { + context.report({ node, messageId: "returnsValue" }); + } + + return { + + onCodePathStart(_, node) { + funcInfo = { + upper: funcInfo, + shouldCheck: functionTypesToCheck.has(node.type) && isPromiseExecutor(node, context.getScope()) + }; + + if (funcInfo.shouldCheck && node.type === "ArrowFunctionExpression" && node.expression) { + report(node.body); + } + }, + + onCodePathEnd() { + funcInfo = funcInfo.upper; + }, + + ReturnStatement(node) { + if (funcInfo.shouldCheck && node.argument) { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-proto.js b/node_modules/eslint/lib/rules/no-proto.js new file mode 100644 index 0000000..e6659e5 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-proto.js @@ -0,0 +1,48 @@ +/** + * @fileoverview Rule to flag usage of __proto__ property + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { getStaticPropertyName } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of the `__proto__` property", + recommended: false, + url: "https://eslint.org/docs/rules/no-proto" + }, + + schema: [], + + messages: { + unexpectedProto: "The '__proto__' property is deprecated." + } + }, + + create(context) { + + return { + + MemberExpression(node) { + if (getStaticPropertyName(node) === "__proto__") { + context.report({ node, messageId: "unexpectedProto" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-prototype-builtins.js b/node_modules/eslint/lib/rules/no-prototype-builtins.js new file mode 100644 index 0000000..dc12669 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-prototype-builtins.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Rule to disallow use of Object.prototype builtins on objects + * @author Andrew Levine + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow calling some `Object.prototype` methods directly on objects", + recommended: true, + url: "https://eslint.org/docs/rules/no-prototype-builtins" + }, + + schema: [], + + messages: { + prototypeBuildIn: "Do not access Object.prototype method '{{prop}}' from target object." + } + }, + + create(context) { + const DISALLOWED_PROPS = new Set([ + "hasOwnProperty", + "isPrototypeOf", + "propertyIsEnumerable" + ]); + + /** + * Reports if a disallowed property is used in a CallExpression + * @param {ASTNode} node The CallExpression node. + * @returns {void} + */ + function disallowBuiltIns(node) { + + const callee = astUtils.skipChainExpression(node.callee); + + if (callee.type !== "MemberExpression") { + return; + } + + const propName = astUtils.getStaticPropertyName(callee); + + if (propName !== null && DISALLOWED_PROPS.has(propName)) { + context.report({ + messageId: "prototypeBuildIn", + loc: callee.property.loc, + data: { prop: propName }, + node + }); + } + } + + return { + CallExpression: disallowBuiltIns + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-redeclare.js b/node_modules/eslint/lib/rules/no-redeclare.js new file mode 100644 index 0000000..cc71a61 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-redeclare.js @@ -0,0 +1,174 @@ +/** + * @fileoverview Rule to flag when the same variable is declared more then once. + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow variable redeclaration", + recommended: true, + url: "https://eslint.org/docs/rules/no-redeclare" + }, + + messages: { + redeclared: "'{{id}}' is already defined.", + redeclaredAsBuiltin: "'{{id}}' is already defined as a built-in global variable.", + redeclaredBySyntax: "'{{id}}' is already defined by a variable declaration." + }, + + schema: [ + { + type: "object", + properties: { + builtinGlobals: { type: "boolean", default: true } + }, + additionalProperties: false + } + ] + }, + + create(context) { + const options = { + builtinGlobals: Boolean( + context.options.length === 0 || + context.options[0].builtinGlobals + ) + }; + const sourceCode = context.getSourceCode(); + + /** + * Iterate declarations of a given variable. + * @param {escope.variable} variable The variable object to iterate declarations. + * @returns {IterableIterator<{type:string,node:ASTNode,loc:SourceLocation}>} The declarations. + */ + function *iterateDeclarations(variable) { + if (options.builtinGlobals && ( + variable.eslintImplicitGlobalSetting === "readonly" || + variable.eslintImplicitGlobalSetting === "writable" + )) { + yield { type: "builtin" }; + } + + for (const id of variable.identifiers) { + yield { type: "syntax", node: id, loc: id.loc }; + } + + if (variable.eslintExplicitGlobalComments) { + for (const comment of variable.eslintExplicitGlobalComments) { + yield { + type: "comment", + node: comment, + loc: astUtils.getNameLocationInGlobalDirectiveComment( + sourceCode, + comment, + variable.name + ) + }; + } + } + } + + /** + * Find variables in a given scope and flag redeclared ones. + * @param {Scope} scope An eslint-scope scope object. + * @returns {void} + * @private + */ + function findVariablesInScope(scope) { + for (const variable of scope.variables) { + const [ + declaration, + ...extraDeclarations + ] = iterateDeclarations(variable); + + if (extraDeclarations.length === 0) { + continue; + } + + /* + * If the type of a declaration is different from the type of + * the first declaration, it shows the location of the first + * declaration. + */ + const detailMessageId = declaration.type === "builtin" + ? "redeclaredAsBuiltin" + : "redeclaredBySyntax"; + const data = { id: variable.name }; + + // Report extra declarations. + for (const { type, node, loc } of extraDeclarations) { + const messageId = type === declaration.type + ? "redeclared" + : detailMessageId; + + context.report({ node, loc, messageId, data }); + } + } + } + + /** + * Find variables in the current scope. + * @param {ASTNode} node The node of the current scope. + * @returns {void} + * @private + */ + function checkForBlock(node) { + const scope = context.getScope(); + + /* + * In ES5, some node type such as `BlockStatement` doesn't have that scope. + * `scope.block` is a different node in such a case. + */ + if (scope.block === node) { + findVariablesInScope(scope); + } + } + + return { + Program() { + const scope = context.getScope(); + + findVariablesInScope(scope); + + // Node.js or ES modules has a special scope. + if ( + scope.type === "global" && + scope.childScopes[0] && + + // The special scope's block is the Program node. + scope.block === scope.childScopes[0].block + ) { + findVariablesInScope(scope.childScopes[0]); + } + }, + + FunctionDeclaration: checkForBlock, + FunctionExpression: checkForBlock, + ArrowFunctionExpression: checkForBlock, + + StaticBlock: checkForBlock, + + BlockStatement: checkForBlock, + ForStatement: checkForBlock, + ForInStatement: checkForBlock, + ForOfStatement: checkForBlock, + SwitchStatement: checkForBlock + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-regex-spaces.js b/node_modules/eslint/lib/rules/no-regex-spaces.js new file mode 100644 index 0000000..400c72b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-regex-spaces.js @@ -0,0 +1,180 @@ +/** + * @fileoverview Rule to count multiple spaces in regular expressions + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const regexpp = require("regexpp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const regExpParser = new regexpp.RegExpParser(); +const DOUBLE_SPACE = / {2}/u; + +/** + * Check if node is a string + * @param {ASTNode} node node to evaluate + * @returns {boolean} True if its a string + * @private + */ +function isString(node) { + return node && node.type === "Literal" && typeof node.value === "string"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow multiple spaces in regular expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-regex-spaces" + }, + + schema: [], + fixable: "code", + + messages: { + multipleSpaces: "Spaces are hard to count. Use {{{length}}}." + } + }, + + create(context) { + + /** + * Validate regular expression + * @param {ASTNode} nodeToReport Node to report. + * @param {string} pattern Regular expression pattern to validate. + * @param {string} rawPattern Raw representation of the pattern in the source code. + * @param {number} rawPatternStartRange Start range of the pattern in the source code. + * @param {string} flags Regular expression flags. + * @returns {void} + * @private + */ + function checkRegex(nodeToReport, pattern, rawPattern, rawPatternStartRange, flags) { + + // Skip if there are no consecutive spaces in the source code, to avoid reporting e.g., RegExp(' \ '). + if (!DOUBLE_SPACE.test(rawPattern)) { + return; + } + + const characterClassNodes = []; + let regExpAST; + + try { + regExpAST = regExpParser.parsePattern(pattern, 0, pattern.length, flags.includes("u")); + } catch { + + // Ignore regular expressions with syntax errors + return; + } + + regexpp.visitRegExpAST(regExpAST, { + onCharacterClassEnter(ccNode) { + characterClassNodes.push(ccNode); + } + }); + + const spacesPattern = /( {2,})(?: [+*{?]|[^+*{?]|$)/gu; + let match; + + while ((match = spacesPattern.exec(pattern))) { + const { 1: { length }, index } = match; + + // Report only consecutive spaces that are not in character classes. + if ( + characterClassNodes.every(({ start, end }) => index < start || end <= index) + ) { + context.report({ + node: nodeToReport, + messageId: "multipleSpaces", + data: { length }, + fix(fixer) { + if (pattern !== rawPattern) { + return null; + } + return fixer.replaceTextRange( + [rawPatternStartRange + index, rawPatternStartRange + index + length], + ` {${length}}` + ); + } + }); + + // Report only the first occurrence of consecutive spaces + return; + } + } + } + + /** + * Validate regular expression literals + * @param {ASTNode} node node to validate + * @returns {void} + * @private + */ + function checkLiteral(node) { + if (node.regex) { + const pattern = node.regex.pattern; + const rawPattern = node.raw.slice(1, node.raw.lastIndexOf("/")); + const rawPatternStartRange = node.range[0] + 1; + const flags = node.regex.flags; + + checkRegex( + node, + pattern, + rawPattern, + rawPatternStartRange, + flags + ); + } + } + + /** + * Validate strings passed to the RegExp constructor + * @param {ASTNode} node node to validate + * @returns {void} + * @private + */ + function checkFunction(node) { + const scope = context.getScope(); + const regExpVar = astUtils.getVariableByName(scope, "RegExp"); + const shadowed = regExpVar && regExpVar.defs.length > 0; + const patternNode = node.arguments[0]; + const flagsNode = node.arguments[1]; + + if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(patternNode) && !shadowed) { + const pattern = patternNode.value; + const rawPattern = patternNode.raw.slice(1, -1); + const rawPatternStartRange = patternNode.range[0] + 1; + const flags = isString(flagsNode) ? flagsNode.value : ""; + + checkRegex( + node, + pattern, + rawPattern, + rawPatternStartRange, + flags + ); + } + } + + return { + Literal: checkLiteral, + CallExpression: checkFunction, + NewExpression: checkFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-exports.js b/node_modules/eslint/lib/rules/no-restricted-exports.js new file mode 100644 index 0000000..5166cec --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-exports.js @@ -0,0 +1,96 @@ +/** + * @fileoverview Rule to disallow specified names in exports + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified names in exports", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-exports" + }, + + schema: [{ + type: "object", + properties: { + restrictedNamedExports: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + } + }, + additionalProperties: false + }], + + messages: { + restrictedNamed: "'{{name}}' is restricted from being used as an exported name." + } + }, + + create(context) { + + const restrictedNames = new Set(context.options[0] && context.options[0].restrictedNamedExports); + + /** + * Checks and reports given exported name. + * @param {ASTNode} node exported `Identifier` or string `Literal` node to check. + * @returns {void} + */ + function checkExportedName(node) { + const name = astUtils.getModuleExportName(node); + + if (restrictedNames.has(name)) { + context.report({ + node, + messageId: "restrictedNamed", + data: { name } + }); + } + } + + return { + ExportAllDeclaration(node) { + if (node.exported) { + checkExportedName(node.exported); + } + }, + + ExportNamedDeclaration(node) { + const declaration = node.declaration; + + if (declaration) { + if (declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") { + checkExportedName(declaration.id); + } else if (declaration.type === "VariableDeclaration") { + context.getDeclaredVariables(declaration) + .map(v => v.defs.find(d => d.parent === declaration)) + .map(d => d.name) // Identifier nodes + .forEach(checkExportedName); + } + } else { + node.specifiers + .map(s => s.exported) + .forEach(checkExportedName); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-globals.js b/node_modules/eslint/lib/rules/no-restricted-globals.js new file mode 100644 index 0000000..09d3478 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-globals.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Restrict usage of specified globals. + * @author Benoît Zugmeyer + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified global variables", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-globals" + }, + + schema: { + type: "array", + items: { + oneOf: [ + { + type: "string" + }, + { + type: "object", + properties: { + name: { type: "string" }, + message: { type: "string" } + }, + required: ["name"], + additionalProperties: false + } + ] + }, + uniqueItems: true, + minItems: 0 + }, + + messages: { + defaultMessage: "Unexpected use of '{{name}}'.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + customMessage: "Unexpected use of '{{name}}'. {{customMessage}}" + } + }, + + create(context) { + + // If no globals are restricted, we don't need to do anything + if (context.options.length === 0) { + return {}; + } + + const restrictedGlobalMessages = context.options.reduce((memo, option) => { + if (typeof option === "string") { + memo[option] = null; + } else { + memo[option.name] = option.message; + } + + return memo; + }, {}); + + /** + * Report a variable to be used as a restricted global. + * @param {Reference} reference the variable reference + * @returns {void} + * @private + */ + function reportReference(reference) { + const name = reference.identifier.name, + customMessage = restrictedGlobalMessages[name], + messageId = customMessage + ? "customMessage" + : "defaultMessage"; + + context.report({ + node: reference.identifier, + messageId, + data: { + name, + customMessage + } + }); + } + + /** + * Check if the given name is a restricted global name. + * @param {string} name name of a variable + * @returns {boolean} whether the variable is a restricted global or not + * @private + */ + function isRestricted(name) { + return Object.prototype.hasOwnProperty.call(restrictedGlobalMessages, name); + } + + return { + Program() { + const scope = context.getScope(); + + // Report variables declared elsewhere (ex: variables defined as "global" by eslint) + scope.variables.forEach(variable => { + if (!variable.defs.length && isRestricted(variable.name)) { + variable.references.forEach(reportReference); + } + }); + + // Report variables not declared at all + scope.through.forEach(reference => { + if (isRestricted(reference.identifier.name)) { + reportReference(reference); + } + }); + + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-imports.js b/node_modules/eslint/lib/rules/no-restricted-imports.js new file mode 100644 index 0000000..3bb45d7 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-imports.js @@ -0,0 +1,322 @@ +/** + * @fileoverview Restrict usage of specified node imports. + * @author Guy Ellis + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const ignore = require("ignore"); + +const arrayOfStringsOrObjects = { + type: "array", + items: { + anyOf: [ + { type: "string" }, + { + type: "object", + properties: { + name: { type: "string" }, + message: { + type: "string", + minLength: 1 + }, + importNames: { + type: "array", + items: { + type: "string" + } + } + }, + additionalProperties: false, + required: ["name"] + } + ] + }, + uniqueItems: true +}; + +const arrayOfStringsOrObjectPatterns = { + anyOf: [ + { + type: "array", + items: { + type: "string" + }, + uniqueItems: true + }, + { + type: "array", + items: { + type: "object", + properties: { + group: { + type: "array", + items: { + type: "string" + }, + minItems: 1, + uniqueItems: true + }, + message: { + type: "string", + minLength: 1 + }, + caseSensitive: { + type: "boolean" + } + }, + additionalProperties: false, + required: ["group"] + }, + uniqueItems: true + } + ] +}; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified modules when loaded by `import`", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-imports" + }, + + messages: { + path: "'{{importSource}}' import is restricted from being used.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}", + + patterns: "'{{importSource}}' import is restricted from being used by a pattern.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}", + + everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}", + + importName: "'{{importName}}' import from '{{importSource}}' is restricted.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}" + }, + + schema: { + anyOf: [ + arrayOfStringsOrObjects, + { + type: "array", + items: [{ + type: "object", + properties: { + paths: arrayOfStringsOrObjects, + patterns: arrayOfStringsOrObjectPatterns + }, + additionalProperties: false + }], + additionalItems: false + } + ] + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = Array.isArray(context.options) ? context.options : []; + const isPathAndPatternsObject = + typeof options[0] === "object" && + (Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns")); + + const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; + const restrictedPathMessages = restrictedPaths.reduce((memo, importSource) => { + if (typeof importSource === "string") { + memo[importSource] = { message: null }; + } else { + memo[importSource.name] = { + message: importSource.message, + importNames: importSource.importNames + }; + } + return memo; + }, {}); + + // Handle patterns too, either as strings or groups + let restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; + + // standardize to array of objects if we have an array of strings + if (restrictedPatterns.length > 0 && typeof restrictedPatterns[0] === "string") { + restrictedPatterns = [{ group: restrictedPatterns }]; + } + + // relative paths are supported for this rule + const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive }) => ({ + matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group), + customMessage: message + })); + + // if no imports are restricted we don't need to check + if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) { + return {}; + } + + /** + * Report a restricted path. + * @param {string} importSource path of the import + * @param {Map} importNames Map of import names that are being imported + * @param {node} node representing the restricted path reference + * @returns {void} + * @private + */ + function checkRestrictedPathAndReport(importSource, importNames, node) { + if (!Object.prototype.hasOwnProperty.call(restrictedPathMessages, importSource)) { + return; + } + + const customMessage = restrictedPathMessages[importSource].message; + const restrictedImportNames = restrictedPathMessages[importSource].importNames; + + if (restrictedImportNames) { + if (importNames.has("*")) { + const specifierData = importNames.get("*")[0]; + + context.report({ + node, + messageId: customMessage ? "everythingWithCustomMessage" : "everything", + loc: specifierData.loc, + data: { + importSource, + importNames: restrictedImportNames, + customMessage + } + }); + } + + restrictedImportNames.forEach(importName => { + if (importNames.has(importName)) { + const specifiers = importNames.get(importName); + + specifiers.forEach(specifier => { + context.report({ + node, + messageId: customMessage ? "importNameWithCustomMessage" : "importName", + loc: specifier.loc, + data: { + importSource, + customMessage, + importName + } + }); + }); + } + }); + } else { + context.report({ + node, + messageId: customMessage ? "pathWithCustomMessage" : "path", + data: { + importSource, + customMessage + } + }); + } + } + + /** + * Report a restricted path specifically for patterns. + * @param {node} node representing the restricted path reference + * @param {Object} group contains a Ignore instance for paths, and the customMessage to show if it fails + * @returns {void} + * @private + */ + function reportPathForPatterns(node, group) { + const importSource = node.source.value.trim(); + + context.report({ + node, + messageId: group.customMessage ? "patternWithCustomMessage" : "patterns", + data: { + importSource, + customMessage: group.customMessage + } + }); + } + + /** + * Check if the given importSource is restricted by a pattern. + * @param {string} importSource path of the import + * @param {Object} group contains a Ignore instance for paths, and the customMessage to show if it fails + * @returns {boolean} whether the variable is a restricted pattern or not + * @private + */ + function isRestrictedPattern(importSource, group) { + return group.matcher.ignores(importSource); + } + + /** + * Checks a node to see if any problems should be reported. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkNode(node) { + const importSource = node.source.value.trim(); + const importNames = new Map(); + + if (node.type === "ExportAllDeclaration") { + const starToken = sourceCode.getFirstToken(node, 1); + + importNames.set("*", [{ loc: starToken.loc }]); + } else if (node.specifiers) { + for (const specifier of node.specifiers) { + let name; + const specifierData = { loc: specifier.loc }; + + if (specifier.type === "ImportDefaultSpecifier") { + name = "default"; + } else if (specifier.type === "ImportNamespaceSpecifier") { + name = "*"; + } else if (specifier.imported) { + name = astUtils.getModuleExportName(specifier.imported); + } else if (specifier.local) { + name = astUtils.getModuleExportName(specifier.local); + } + + if (typeof name === "string") { + if (importNames.has(name)) { + importNames.get(name).push(specifierData); + } else { + importNames.set(name, [specifierData]); + } + } + } + } + + checkRestrictedPathAndReport(importSource, importNames, node); + restrictedPatternGroups.forEach(group => { + if (isRestrictedPattern(importSource, group)) { + reportPathForPatterns(node, group); + } + }); + } + + return { + ImportDeclaration: checkNode, + ExportNamedDeclaration(node) { + if (node.source) { + checkNode(node); + } + }, + ExportAllDeclaration: checkNode + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-modules.js b/node_modules/eslint/lib/rules/no-restricted-modules.js new file mode 100644 index 0000000..d92aa7a --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-modules.js @@ -0,0 +1,216 @@ +/** + * @fileoverview Restrict usage of specified node modules. + * @author Christian Schulz + * @deprecated in ESLint v7.0.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const ignore = require("ignore"); + +const arrayOfStrings = { + type: "array", + items: { type: "string" }, + uniqueItems: true +}; + +const arrayOfStringsOrObjects = { + type: "array", + items: { + anyOf: [ + { type: "string" }, + { + type: "object", + properties: { + name: { type: "string" }, + message: { + type: "string", + minLength: 1 + } + }, + additionalProperties: false, + required: ["name"] + } + ] + }, + uniqueItems: true +}; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow specified modules when loaded by `require`", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-modules" + }, + + schema: { + anyOf: [ + arrayOfStringsOrObjects, + { + type: "array", + items: { + type: "object", + properties: { + paths: arrayOfStringsOrObjects, + patterns: arrayOfStrings + }, + additionalProperties: false + }, + additionalItems: false + } + ] + }, + + messages: { + defaultMessage: "'{{name}}' module is restricted from being used.", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}", + patternMessage: "'{{name}}' module is restricted from being used by a pattern." + } + }, + + create(context) { + const options = Array.isArray(context.options) ? context.options : []; + const isPathAndPatternsObject = + typeof options[0] === "object" && + (Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns")); + + const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; + const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; + + const restrictedPathMessages = restrictedPaths.reduce((memo, importName) => { + if (typeof importName === "string") { + memo[importName] = null; + } else { + memo[importName.name] = importName.message; + } + return memo; + }, {}); + + // if no imports are restricted we don't need to check + if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) { + return {}; + } + + // relative paths are supported for this rule + const ig = ignore({ allowRelativePaths: true }).add(restrictedPatterns); + + + /** + * Function to check if a node is a string literal. + * @param {ASTNode} node The node to check. + * @returns {boolean} If the node is a string literal. + */ + function isStringLiteral(node) { + return node && node.type === "Literal" && typeof node.value === "string"; + } + + /** + * Function to check if a node is a static string template literal. + * @param {ASTNode} node The node to check. + * @returns {boolean} If the node is a string template literal. + */ + function isStaticTemplateLiteral(node) { + return node && node.type === "TemplateLiteral" && node.expressions.length === 0; + } + + /** + * Function to check if a node is a require call. + * @param {ASTNode} node The node to check. + * @returns {boolean} If the node is a require call. + */ + function isRequireCall(node) { + return node.callee.type === "Identifier" && node.callee.name === "require"; + } + + /** + * Extract string from Literal or TemplateLiteral node + * @param {ASTNode} node The node to extract from + * @returns {string|null} Extracted string or null if node doesn't represent a string + */ + function getFirstArgumentString(node) { + if (isStringLiteral(node)) { + return node.value.trim(); + } + + if (isStaticTemplateLiteral(node)) { + return node.quasis[0].value.cooked.trim(); + } + + return null; + } + + /** + * Report a restricted path. + * @param {node} node representing the restricted path reference + * @param {string} name restricted path + * @returns {void} + * @private + */ + function reportPath(node, name) { + const customMessage = restrictedPathMessages[name]; + const messageId = customMessage + ? "customMessage" + : "defaultMessage"; + + context.report({ + node, + messageId, + data: { + name, + customMessage + } + }); + } + + /** + * Check if the given name is a restricted path name + * @param {string} name name of a variable + * @returns {boolean} whether the variable is a restricted path or not + * @private + */ + function isRestrictedPath(name) { + return Object.prototype.hasOwnProperty.call(restrictedPathMessages, name); + } + + return { + CallExpression(node) { + if (isRequireCall(node)) { + + // node has arguments + if (node.arguments.length) { + const name = getFirstArgumentString(node.arguments[0]); + + // if first argument is a string literal or a static string template literal + if (name) { + + // check if argument value is in restricted modules array + if (isRestrictedPath(name)) { + reportPath(node, name); + } + + if (restrictedPatterns.length > 0 && ig.ignores(name)) { + context.report({ + node, + messageId: "patternMessage", + data: { name } + }); + } + } + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-properties.js b/node_modules/eslint/lib/rules/no-restricted-properties.js new file mode 100644 index 0000000..1e8c7a8 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-properties.js @@ -0,0 +1,181 @@ +/** + * @fileoverview Rule to disallow certain object properties + * @author Will Klein & Eli White + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow certain properties on certain objects", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-properties" + }, + + schema: { + type: "array", + items: { + anyOf: [ // `object` and `property` are both optional, but at least one of them must be provided. + { + type: "object", + properties: { + object: { + type: "string" + }, + property: { + type: "string" + }, + message: { + type: "string" + } + }, + additionalProperties: false, + required: ["object"] + }, + { + type: "object", + properties: { + object: { + type: "string" + }, + property: { + type: "string" + }, + message: { + type: "string" + } + }, + additionalProperties: false, + required: ["property"] + } + ] + }, + uniqueItems: true + }, + + messages: { + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}" + } + }, + + create(context) { + const restrictedCalls = context.options; + + if (restrictedCalls.length === 0) { + return {}; + } + + const restrictedProperties = new Map(); + const globallyRestrictedObjects = new Map(); + const globallyRestrictedProperties = new Map(); + + restrictedCalls.forEach(option => { + const objectName = option.object; + const propertyName = option.property; + + if (typeof objectName === "undefined") { + globallyRestrictedProperties.set(propertyName, { message: option.message }); + } else if (typeof propertyName === "undefined") { + globallyRestrictedObjects.set(objectName, { message: option.message }); + } else { + if (!restrictedProperties.has(objectName)) { + restrictedProperties.set(objectName, new Map()); + } + + restrictedProperties.get(objectName).set(propertyName, { + message: option.message + }); + } + }); + + /** + * Checks to see whether a property access is restricted, and reports it if so. + * @param {ASTNode} node The node to report + * @param {string} objectName The name of the object + * @param {string} propertyName The name of the property + * @returns {undefined} + */ + function checkPropertyAccess(node, objectName, propertyName) { + if (propertyName === null) { + return; + } + const matchedObject = restrictedProperties.get(objectName); + const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName); + const globalMatchedProperty = globallyRestrictedProperties.get(propertyName); + + if (matchedObjectProperty) { + const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : ""; + + context.report({ + node, + messageId: "restrictedObjectProperty", + data: { + objectName, + propertyName, + message + } + }); + } else if (globalMatchedProperty) { + const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : ""; + + context.report({ + node, + messageId: "restrictedProperty", + data: { + propertyName, + message + } + }); + } + } + + /** + * Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);` + * @param {ASTNode} node An AssignmentExpression or AssignmentPattern node + * @returns {undefined} + */ + function checkDestructuringAssignment(node) { + if (node.right.type === "Identifier") { + const objectName = node.right.name; + + if (node.left.type === "ObjectPattern") { + node.left.properties.forEach(property => { + checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property)); + }); + } + } + } + + return { + MemberExpression(node) { + checkPropertyAccess(node, node.object && node.object.name, astUtils.getStaticPropertyName(node)); + }, + VariableDeclarator(node) { + if (node.init && node.init.type === "Identifier") { + const objectName = node.init.name; + + if (node.id.type === "ObjectPattern") { + node.id.properties.forEach(property => { + checkPropertyAccess(node.id, objectName, astUtils.getStaticPropertyName(property)); + }); + } + } + }, + AssignmentExpression: checkDestructuringAssignment, + AssignmentPattern: checkDestructuringAssignment + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-restricted-syntax.js b/node_modules/eslint/lib/rules/no-restricted-syntax.js new file mode 100644 index 0000000..713d115 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-restricted-syntax.js @@ -0,0 +1,70 @@ +/** + * @fileoverview Rule to flag use of certain node types + * @author Burak Yigit Kaya + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified syntax", + recommended: false, + url: "https://eslint.org/docs/rules/no-restricted-syntax" + }, + + schema: { + type: "array", + items: { + oneOf: [ + { + type: "string" + }, + { + type: "object", + properties: { + selector: { type: "string" }, + message: { type: "string" } + }, + required: ["selector"], + additionalProperties: false + } + ] + }, + uniqueItems: true, + minItems: 0 + }, + + messages: { + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period + restrictedSyntax: "{{message}}" + } + }, + + create(context) { + return context.options.reduce((result, selectorOrObject) => { + const isStringFormat = (typeof selectorOrObject === "string"); + const hasCustomMessage = !isStringFormat && Boolean(selectorOrObject.message); + + const selector = isStringFormat ? selectorOrObject : selectorOrObject.selector; + const message = hasCustomMessage ? selectorOrObject.message : `Using '${selector}' is not allowed.`; + + return Object.assign(result, { + [selector](node) { + context.report({ + node, + messageId: "restrictedSyntax", + data: { message } + }); + } + }); + }, {}); + + } +}; diff --git a/node_modules/eslint/lib/rules/no-return-assign.js b/node_modules/eslint/lib/rules/no-return-assign.js new file mode 100644 index 0000000..4fd7a3d --- /dev/null +++ b/node_modules/eslint/lib/rules/no-return-assign.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Rule to flag when return statement contains assignment + * @author Ilya Volodin + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SENTINEL_TYPE = /^(?:[a-zA-Z]+?Statement|ArrowFunctionExpression|FunctionExpression|ClassExpression)$/u; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow assignment operators in `return` statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-return-assign" + }, + + schema: [ + { + enum: ["except-parens", "always"] + } + ], + + messages: { + returnAssignment: "Return statement should not contain assignment.", + arrowAssignment: "Arrow function should not return assignment." + } + }, + + create(context) { + const always = (context.options[0] || "except-parens") !== "except-parens"; + const sourceCode = context.getSourceCode(); + + return { + AssignmentExpression(node) { + if (!always && astUtils.isParenthesised(sourceCode, node)) { + return; + } + + let currentChild = node; + let parent = currentChild.parent; + + // Find ReturnStatement or ArrowFunctionExpression in ancestors. + while (parent && !SENTINEL_TYPE.test(parent.type)) { + currentChild = parent; + parent = parent.parent; + } + + // Reports. + if (parent && parent.type === "ReturnStatement") { + context.report({ + node: parent, + messageId: "returnAssignment" + }); + } else if (parent && parent.type === "ArrowFunctionExpression" && parent.body === currentChild) { + context.report({ + node: parent, + messageId: "arrowAssignment" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-return-await.js b/node_modules/eslint/lib/rules/no-return-await.js new file mode 100644 index 0000000..191bf42 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-return-await.js @@ -0,0 +1,103 @@ +/** + * @fileoverview Disallows unnecessary `return await` + * @author Jordan Harband + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary `return await`", + + recommended: false, + + url: "https://eslint.org/docs/rules/no-return-await" + }, + + fixable: null, + + schema: [ + ], + + messages: { + redundantUseOfAwait: "Redundant use of `await` on a return value." + } + }, + + create(context) { + + /** + * Reports a found unnecessary `await` expression. + * @param {ASTNode} node The node representing the `await` expression to report + * @returns {void} + */ + function reportUnnecessaryAwait(node) { + context.report({ + node: context.getSourceCode().getFirstToken(node), + loc: node.loc, + messageId: "redundantUseOfAwait" + }); + } + + /** + * Determines whether a thrown error from this node will be caught/handled within this function rather than immediately halting + * this function. For example, a statement in a `try` block will always have an error handler. A statement in + * a `catch` block will only have an error handler if there is also a `finally` block. + * @param {ASTNode} node A node representing a location where an could be thrown + * @returns {boolean} `true` if a thrown error will be caught/handled in this function + */ + function hasErrorHandler(node) { + let ancestor = node; + + while (!astUtils.isFunction(ancestor) && ancestor.type !== "Program") { + if (ancestor.parent.type === "TryStatement" && (ancestor === ancestor.parent.block || ancestor === ancestor.parent.handler && ancestor.parent.finalizer)) { + return true; + } + ancestor = ancestor.parent; + } + return false; + } + + /** + * Checks if a node is placed in tail call position. Once `return` arguments (or arrow function expressions) can be a complex expression, + * an `await` expression could or could not be unnecessary by the definition of this rule. So we're looking for `await` expressions that are in tail position. + * @param {ASTNode} node A node representing the `await` expression to check + * @returns {boolean} The checking result + */ + function isInTailCallPosition(node) { + if (node.parent.type === "ArrowFunctionExpression") { + return true; + } + if (node.parent.type === "ReturnStatement") { + return !hasErrorHandler(node.parent); + } + if (node.parent.type === "ConditionalExpression" && (node === node.parent.consequent || node === node.parent.alternate)) { + return isInTailCallPosition(node.parent); + } + if (node.parent.type === "LogicalExpression" && node === node.parent.right) { + return isInTailCallPosition(node.parent); + } + if (node.parent.type === "SequenceExpression" && node === node.parent.expressions[node.parent.expressions.length - 1]) { + return isInTailCallPosition(node.parent); + } + return false; + } + + return { + AwaitExpression(node) { + if (isInTailCallPosition(node) && !hasErrorHandler(node)) { + reportUnnecessaryAwait(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-script-url.js b/node_modules/eslint/lib/rules/no-script-url.js new file mode 100644 index 0000000..0eef254 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-script-url.js @@ -0,0 +1,61 @@ +/** + * @fileoverview Rule to flag when using javascript: urls + * @author Ilya Volodin + */ +/* eslint no-script-url: 0 -- Code is checking to report such URLs */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `javascript:` urls", + recommended: false, + url: "https://eslint.org/docs/rules/no-script-url" + }, + + schema: [], + + messages: { + unexpectedScriptURL: "Script URL is a form of eval." + } + }, + + create(context) { + + /** + * Check whether a node's static value starts with "javascript:" or not. + * And report an error for unexpected script URL. + * @param {ASTNode} node node to check + * @returns {void} + */ + function check(node) { + const value = astUtils.getStaticStringValue(node); + + if (typeof value === "string" && value.toLowerCase().indexOf("javascript:") === 0) { + context.report({ node, messageId: "unexpectedScriptURL" }); + } + } + return { + Literal(node) { + if (node.value && typeof node.value === "string") { + check(node); + } + }, + TemplateLiteral(node) { + if (!(node.parent && node.parent.type === "TaggedTemplateExpression")) { + check(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-self-assign.js b/node_modules/eslint/lib/rules/no-self-assign.js new file mode 100644 index 0000000..060cc8e --- /dev/null +++ b/node_modules/eslint/lib/rules/no-self-assign.js @@ -0,0 +1,183 @@ +/** + * @fileoverview Rule to disallow assignments where both sides are exactly the same + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SPACES = /\s+/gu; + +/** + * Traverses 2 Pattern nodes in parallel, then reports self-assignments. + * @param {ASTNode|null} left A left node to traverse. This is a Pattern or + * a Property. + * @param {ASTNode|null} right A right node to traverse. This is a Pattern or + * a Property. + * @param {boolean} props The flag to check member expressions as well. + * @param {Function} report A callback function to report. + * @returns {void} + */ +function eachSelfAssignment(left, right, props, report) { + if (!left || !right) { + + // do nothing + } else if ( + left.type === "Identifier" && + right.type === "Identifier" && + left.name === right.name + ) { + report(right); + } else if ( + left.type === "ArrayPattern" && + right.type === "ArrayExpression" + ) { + const end = Math.min(left.elements.length, right.elements.length); + + for (let i = 0; i < end; ++i) { + const leftElement = left.elements[i]; + const rightElement = right.elements[i]; + + // Avoid cases such as [...a] = [...a, 1] + if ( + leftElement && + leftElement.type === "RestElement" && + i < right.elements.length - 1 + ) { + break; + } + + eachSelfAssignment(leftElement, rightElement, props, report); + + // After a spread element, those indices are unknown. + if (rightElement && rightElement.type === "SpreadElement") { + break; + } + } + } else if ( + left.type === "RestElement" && + right.type === "SpreadElement" + ) { + eachSelfAssignment(left.argument, right.argument, props, report); + } else if ( + left.type === "ObjectPattern" && + right.type === "ObjectExpression" && + right.properties.length >= 1 + ) { + + /* + * Gets the index of the last spread property. + * It's possible to overwrite properties followed by it. + */ + let startJ = 0; + + for (let i = right.properties.length - 1; i >= 0; --i) { + const propType = right.properties[i].type; + + if (propType === "SpreadElement" || propType === "ExperimentalSpreadProperty") { + startJ = i + 1; + break; + } + } + + for (let i = 0; i < left.properties.length; ++i) { + for (let j = startJ; j < right.properties.length; ++j) { + eachSelfAssignment( + left.properties[i], + right.properties[j], + props, + report + ); + } + } + } else if ( + left.type === "Property" && + right.type === "Property" && + right.kind === "init" && + !right.method + ) { + const leftName = astUtils.getStaticPropertyName(left); + + if (leftName !== null && leftName === astUtils.getStaticPropertyName(right)) { + eachSelfAssignment(left.value, right.value, props, report); + } + } else if ( + props && + astUtils.skipChainExpression(left).type === "MemberExpression" && + astUtils.skipChainExpression(right).type === "MemberExpression" && + astUtils.isSameReference(left, right) + ) { + report(right); + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow assignments where both sides are exactly the same", + recommended: true, + url: "https://eslint.org/docs/rules/no-self-assign" + }, + + schema: [ + { + type: "object", + properties: { + props: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + selfAssignment: "'{{name}}' is assigned to itself." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const [{ props = true } = {}] = context.options; + + /** + * Reports a given node as self assignments. + * @param {ASTNode} node A node to report. This is an Identifier node. + * @returns {void} + */ + function report(node) { + context.report({ + node, + messageId: "selfAssignment", + data: { + name: sourceCode.getText(node).replace(SPACES, "") + } + }); + } + + return { + AssignmentExpression(node) { + if (["=", "&&=", "||=", "??="].includes(node.operator)) { + eachSelfAssignment(node.left, node.right, props, report); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-self-compare.js b/node_modules/eslint/lib/rules/no-self-compare.js new file mode 100644 index 0000000..c351289 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-self-compare.js @@ -0,0 +1,60 @@ +/** + * @fileoverview Rule to flag comparison where left part is the same as the right + * part. + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow comparisons where both sides are exactly the same", + recommended: false, + url: "https://eslint.org/docs/rules/no-self-compare" + }, + + schema: [], + + messages: { + comparingToSelf: "Comparing to itself is potentially pointless." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Determines whether two nodes are composed of the same tokens. + * @param {ASTNode} nodeA The first node + * @param {ASTNode} nodeB The second node + * @returns {boolean} true if the nodes have identical token representations + */ + function hasSameTokens(nodeA, nodeB) { + const tokensA = sourceCode.getTokens(nodeA); + const tokensB = sourceCode.getTokens(nodeB); + + return tokensA.length === tokensB.length && + tokensA.every((token, index) => token.type === tokensB[index].type && token.value === tokensB[index].value); + } + + return { + + BinaryExpression(node) { + const operators = new Set(["===", "==", "!==", "!=", ">", "<", ">=", "<="]); + + if (operators.has(node.operator) && hasSameTokens(node.left, node.right)) { + context.report({ node, messageId: "comparingToSelf" }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-sequences.js b/node_modules/eslint/lib/rules/no-sequences.js new file mode 100644 index 0000000..376aec3 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-sequences.js @@ -0,0 +1,138 @@ +/** + * @fileoverview Rule to flag use of comma operator + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const DEFAULT_OPTIONS = { + allowInParentheses: true +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow comma operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-sequences" + }, + + schema: [{ + properties: { + allowInParentheses: { + type: "boolean", + default: true + } + }, + additionalProperties: false + }], + + messages: { + unexpectedCommaExpression: "Unexpected use of comma operator." + } + }, + + create(context) { + const options = Object.assign({}, DEFAULT_OPTIONS, context.options[0]); + const sourceCode = context.getSourceCode(); + + /** + * Parts of the grammar that are required to have parens. + */ + const parenthesized = { + DoWhileStatement: "test", + IfStatement: "test", + SwitchStatement: "discriminant", + WhileStatement: "test", + WithStatement: "object", + ArrowFunctionExpression: "body" + + /* + * Omitting CallExpression - commas are parsed as argument separators + * Omitting NewExpression - commas are parsed as argument separators + * Omitting ForInStatement - parts aren't individually parenthesised + * Omitting ForStatement - parts aren't individually parenthesised + */ + }; + + /** + * Determines whether a node is required by the grammar to be wrapped in + * parens, e.g. the test of an if statement. + * @param {ASTNode} node The AST node + * @returns {boolean} True if parens around node belong to parent node. + */ + function requiresExtraParens(node) { + return node.parent && parenthesized[node.parent.type] && + node === node.parent[parenthesized[node.parent.type]]; + } + + /** + * Check if a node is wrapped in parens. + * @param {ASTNode} node The AST node + * @returns {boolean} True if the node has a paren on each side. + */ + function isParenthesised(node) { + return astUtils.isParenthesised(sourceCode, node); + } + + /** + * Check if a node is wrapped in two levels of parens. + * @param {ASTNode} node The AST node + * @returns {boolean} True if two parens surround the node on each side. + */ + function isParenthesisedTwice(node) { + const previousToken = sourceCode.getTokenBefore(node, 1), + nextToken = sourceCode.getTokenAfter(node, 1); + + return isParenthesised(node) && previousToken && nextToken && + astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] && + astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1]; + } + + return { + SequenceExpression(node) { + + // Always allow sequences in for statement update + if (node.parent.type === "ForStatement" && + (node === node.parent.init || node === node.parent.update)) { + return; + } + + // Wrapping a sequence in extra parens indicates intent + if (options.allowInParentheses) { + if (requiresExtraParens(node)) { + if (isParenthesisedTwice(node)) { + return; + } + } else { + if (isParenthesised(node)) { + return; + } + } + } + + const firstCommaToken = sourceCode.getTokenAfter(node.expressions[0], astUtils.isCommaToken); + + context.report({ node, loc: firstCommaToken.loc, messageId: "unexpectedCommaExpression" }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-setter-return.js b/node_modules/eslint/lib/rules/no-setter-return.js new file mode 100644 index 0000000..7204e5c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-setter-return.js @@ -0,0 +1,225 @@ +/** + * @fileoverview Rule to disallow returning values from setters + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { findVariable } = require("eslint-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the given identifier node is a reference to a global variable. + * @param {ASTNode} node `Identifier` node to check. + * @param {Scope} scope Scope to which the node belongs. + * @returns {boolean} True if the identifier is a reference to a global variable. + */ +function isGlobalReference(node, scope) { + const variable = findVariable(scope, node); + + return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; +} + +/** + * Determines whether the given node is an argument of the specified global method call, at the given `index` position. + * E.g., for given `index === 1`, this function checks for `objectName.methodName(foo, node)`, where objectName is a global variable. + * @param {ASTNode} node The node to check. + * @param {Scope} scope Scope to which the node belongs. + * @param {string} objectName Name of the global object. + * @param {string} methodName Name of the method. + * @param {number} index The given position. + * @returns {boolean} `true` if the node is argument at the given position. + */ +function isArgumentOfGlobalMethodCall(node, scope, objectName, methodName, index) { + const callNode = node.parent; + + return callNode.type === "CallExpression" && + callNode.arguments[index] === node && + astUtils.isSpecificMemberAccess(callNode.callee, objectName, methodName) && + isGlobalReference(astUtils.skipChainExpression(callNode.callee).object, scope); +} + +/** + * Determines whether the given node is used as a property descriptor. + * @param {ASTNode} node The node to check. + * @param {Scope} scope Scope to which the node belongs. + * @returns {boolean} `true` if the node is a property descriptor. + */ +function isPropertyDescriptor(node, scope) { + if ( + isArgumentOfGlobalMethodCall(node, scope, "Object", "defineProperty", 2) || + isArgumentOfGlobalMethodCall(node, scope, "Reflect", "defineProperty", 2) + ) { + return true; + } + + const parent = node.parent; + + if ( + parent.type === "Property" && + parent.value === node + ) { + const grandparent = parent.parent; + + if ( + grandparent.type === "ObjectExpression" && + ( + isArgumentOfGlobalMethodCall(grandparent, scope, "Object", "create", 1) || + isArgumentOfGlobalMethodCall(grandparent, scope, "Object", "defineProperties", 1) + ) + ) { + return true; + } + } + + return false; +} + +/** + * Determines whether the given function node is used as a setter function. + * @param {ASTNode} node The node to check. + * @param {Scope} scope Scope to which the node belongs. + * @returns {boolean} `true` if the node is a setter. + */ +function isSetter(node, scope) { + const parent = node.parent; + + if ( + (parent.type === "Property" || parent.type === "MethodDefinition") && + parent.kind === "set" && + parent.value === node + ) { + + // Setter in an object literal or in a class + return true; + } + + if ( + parent.type === "Property" && + parent.value === node && + astUtils.getStaticPropertyName(parent) === "set" && + parent.parent.type === "ObjectExpression" && + isPropertyDescriptor(parent.parent, scope) + ) { + + // Setter in a property descriptor + return true; + } + + return false; +} + +/** + * Finds function's outer scope. + * @param {Scope} scope Function's own scope. + * @returns {Scope} Function's outer scope. + */ +function getOuterScope(scope) { + const upper = scope.upper; + + if (upper.type === "function-expression-name") { + return upper.upper; + } + + return upper; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow returning values from setters", + recommended: true, + url: "https://eslint.org/docs/rules/no-setter-return" + }, + + schema: [], + + messages: { + returnsValue: "Setter cannot return a value." + } + }, + + create(context) { + let funcInfo = null; + + /** + * Creates and pushes to the stack a function info object for the given function node. + * @param {ASTNode} node The function node. + * @returns {void} + */ + function enterFunction(node) { + const outerScope = getOuterScope(context.getScope()); + + funcInfo = { + upper: funcInfo, + isSetter: isSetter(node, outerScope) + }; + } + + /** + * Pops the current function info object from the stack. + * @returns {void} + */ + function exitFunction() { + funcInfo = funcInfo.upper; + } + + /** + * Reports the given node. + * @param {ASTNode} node Node to report. + * @returns {void} + */ + function report(node) { + context.report({ node, messageId: "returnsValue" }); + } + + return { + + /* + * Function declarations cannot be setters, but we still have to track them in the `funcInfo` stack to avoid + * false positives, because a ReturnStatement node can belong to a function declaration inside a setter. + * + * Note: A previously declared function can be referenced and actually used as a setter in a property descriptor, + * but that's out of scope for this rule. + */ + FunctionDeclaration: enterFunction, + FunctionExpression: enterFunction, + ArrowFunctionExpression(node) { + enterFunction(node); + + if (funcInfo.isSetter && node.expression) { + + // { set: foo => bar } property descriptor. Report implicit return 'bar' as the equivalent for a return statement. + report(node.body); + } + }, + + "FunctionDeclaration:exit": exitFunction, + "FunctionExpression:exit": exitFunction, + "ArrowFunctionExpression:exit": exitFunction, + + ReturnStatement(node) { + + // Global returns (e.g., at the top level of a Node module) don't have `funcInfo`. + if (funcInfo && funcInfo.isSetter && node.argument) { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-shadow-restricted-names.js b/node_modules/eslint/lib/rules/no-shadow-restricted-names.js new file mode 100644 index 0000000..52620e5 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-shadow-restricted-names.js @@ -0,0 +1,64 @@ +/** + * @fileoverview Disallow shadowing of NaN, undefined, and Infinity (ES5 section 15.1.1) + * @author Michael Ficarra + */ +"use strict"; + +/** + * Determines if a variable safely shadows undefined. + * This is the case when a variable named `undefined` is never assigned to a value (i.e. it always shares the same value + * as the global). + * @param {eslintScope.Variable} variable The variable to check + * @returns {boolean} true if this variable safely shadows `undefined` + */ +function safelyShadowsUndefined(variable) { + return variable.name === "undefined" && + variable.references.every(ref => !ref.isWrite()) && + variable.defs.every(def => def.node.type === "VariableDeclarator" && def.node.init === null); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow identifiers from shadowing restricted names", + recommended: true, + url: "https://eslint.org/docs/rules/no-shadow-restricted-names" + }, + + schema: [], + + messages: { + shadowingRestrictedName: "Shadowing of global property '{{name}}'." + } + }, + + create(context) { + + + const RESTRICTED = new Set(["undefined", "NaN", "Infinity", "arguments", "eval"]); + + return { + "VariableDeclaration, :function, CatchClause"(node) { + for (const variable of context.getDeclaredVariables(node)) { + if (variable.defs.length > 0 && RESTRICTED.has(variable.name) && !safelyShadowsUndefined(variable)) { + context.report({ + node: variable.defs[0].name, + messageId: "shadowingRestrictedName", + data: { + name: variable.name + } + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-shadow.js b/node_modules/eslint/lib/rules/no-shadow.js new file mode 100644 index 0000000..b4ef334 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-shadow.js @@ -0,0 +1,335 @@ +/** + * @fileoverview Rule to flag on declaring variables already declared in the outer scope + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const FUNC_EXPR_NODE_TYPES = new Set(["ArrowFunctionExpression", "FunctionExpression"]); +const CALL_EXPR_NODE_TYPE = new Set(["CallExpression"]); +const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; +const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow variable declarations from shadowing variables declared in the outer scope", + recommended: false, + url: "https://eslint.org/docs/rules/no-shadow" + }, + + schema: [ + { + type: "object", + properties: { + builtinGlobals: { type: "boolean", default: false }, + hoist: { enum: ["all", "functions", "never"], default: "functions" }, + allow: { + type: "array", + items: { + type: "string" + } + }, + ignoreOnInitialization: { type: "boolean", default: false } + }, + additionalProperties: false + } + ], + + messages: { + noShadow: "'{{name}}' is already declared in the upper scope on line {{shadowedLine}} column {{shadowedColumn}}.", + noShadowGlobal: "'{{name}}' is already a global variable." + } + }, + + create(context) { + + const options = { + builtinGlobals: context.options[0] && context.options[0].builtinGlobals, + hoist: (context.options[0] && context.options[0].hoist) || "functions", + allow: (context.options[0] && context.options[0].allow) || [], + ignoreOnInitialization: context.options[0] && context.options[0].ignoreOnInitialization + }; + + /** + * Checks whether or not a given location is inside of the range of a given node. + * @param {ASTNode} node An node to check. + * @param {number} location A location to check. + * @returns {boolean} `true` if the location is inside of the range of the node. + */ + function isInRange(node, location) { + return node && node.range[0] <= location && location <= node.range[1]; + } + + /** + * Searches from the current node through its ancestry to find a matching node. + * @param {ASTNode} node a node to get. + * @param {(node: ASTNode) => boolean} match a callback that checks whether or not the node verifies its condition or not. + * @returns {ASTNode|null} the matching node. + */ + function findSelfOrAncestor(node, match) { + let currentNode = node; + + while (currentNode && !match(currentNode)) { + currentNode = currentNode.parent; + } + return currentNode; + } + + /** + * Finds function's outer scope. + * @param {Scope} scope Function's own scope. + * @returns {Scope} Function's outer scope. + */ + function getOuterScope(scope) { + const upper = scope.upper; + + if (upper.type === "function-expression-name") { + return upper.upper; + } + return upper; + } + + /** + * Checks if a variable and a shadowedVariable have the same init pattern ancestor. + * @param {Object} variable a variable to check. + * @param {Object} shadowedVariable a shadowedVariable to check. + * @returns {boolean} Whether or not the variable and the shadowedVariable have the same init pattern ancestor. + */ + function isInitPatternNode(variable, shadowedVariable) { + const outerDef = shadowedVariable.defs[0]; + + if (!outerDef) { + return false; + } + + const { variableScope } = variable.scope; + + + if (!(FUNC_EXPR_NODE_TYPES.has(variableScope.block.type) && getOuterScope(variableScope) === shadowedVariable.scope)) { + return false; + } + + const fun = variableScope.block; + const { parent } = fun; + + const callExpression = findSelfOrAncestor( + parent, + node => CALL_EXPR_NODE_TYPE.has(node.type) + ); + + if (!callExpression) { + return false; + } + + let node = outerDef.name; + const location = callExpression.range[1]; + + while (node) { + if (node.type === "VariableDeclarator") { + if (isInRange(node.init, location)) { + return true; + } + if (FOR_IN_OF_TYPE.test(node.parent.parent.type) && + isInRange(node.parent.parent.right, location) + ) { + return true; + } + break; + } else if (node.type === "AssignmentPattern") { + if (isInRange(node.right, location)) { + return true; + } + } else if (SENTINEL_TYPE.test(node.type)) { + break; + } + + node = node.parent; + } + + return false; + } + + /** + * Check if variable name is allowed. + * @param {ASTNode} variable The variable to check. + * @returns {boolean} Whether or not the variable name is allowed. + */ + function isAllowed(variable) { + return options.allow.includes(variable.name); + } + + /** + * Checks if a variable of the class name in the class scope of ClassDeclaration. + * + * ClassDeclaration creates two variables of its name into its outer scope and its class scope. + * So we should ignore the variable in the class scope. + * @param {Object} variable The variable to check. + * @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration. + */ + function isDuplicatedClassNameVariable(variable) { + const block = variable.scope.block; + + return block.type === "ClassDeclaration" && block.id === variable.identifiers[0]; + } + + /** + * Checks if a variable is inside the initializer of scopeVar. + * + * To avoid reporting at declarations such as `var a = function a() {};`. + * But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`. + * @param {Object} variable The variable to check. + * @param {Object} scopeVar The scope variable to look for. + * @returns {boolean} Whether or not the variable is inside initializer of scopeVar. + */ + function isOnInitializer(variable, scopeVar) { + const outerScope = scopeVar.scope; + const outerDef = scopeVar.defs[0]; + const outer = outerDef && outerDef.parent && outerDef.parent.range; + const innerScope = variable.scope; + const innerDef = variable.defs[0]; + const inner = innerDef && innerDef.name.range; + + return ( + outer && + inner && + outer[0] < inner[0] && + inner[1] < outer[1] && + ((innerDef.type === "FunctionName" && innerDef.node.type === "FunctionExpression") || innerDef.node.type === "ClassExpression") && + outerScope === innerScope.upper + ); + } + + /** + * Get a range of a variable's identifier node. + * @param {Object} variable The variable to get. + * @returns {Array|undefined} The range of the variable's identifier node. + */ + function getNameRange(variable) { + const def = variable.defs[0]; + + return def && def.name.range; + } + + /** + * Get declared line and column of a variable. + * @param {eslint-scope.Variable} variable The variable to get. + * @returns {Object} The declared line and column of the variable. + */ + function getDeclaredLocation(variable) { + const identifier = variable.identifiers[0]; + let obj; + + if (identifier) { + obj = { + global: false, + line: identifier.loc.start.line, + column: identifier.loc.start.column + 1 + }; + } else { + obj = { + global: true + }; + } + return obj; + } + + /** + * Checks if a variable is in TDZ of scopeVar. + * @param {Object} variable The variable to check. + * @param {Object} scopeVar The variable of TDZ. + * @returns {boolean} Whether or not the variable is in TDZ of scopeVar. + */ + function isInTdz(variable, scopeVar) { + const outerDef = scopeVar.defs[0]; + const inner = getNameRange(variable); + const outer = getNameRange(scopeVar); + + return ( + inner && + outer && + inner[1] < outer[0] && + + // Excepts FunctionDeclaration if is {"hoist":"function"}. + (options.hoist !== "functions" || !outerDef || outerDef.node.type !== "FunctionDeclaration") + ); + } + + /** + * Checks the current context for shadowed variables. + * @param {Scope} scope Fixme + * @returns {void} + */ + function checkForShadows(scope) { + const variables = scope.variables; + + for (let i = 0; i < variables.length; ++i) { + const variable = variables[i]; + + // Skips "arguments" or variables of a class name in the class scope of ClassDeclaration. + if (variable.identifiers.length === 0 || + isDuplicatedClassNameVariable(variable) || + isAllowed(variable) + ) { + continue; + } + + // Gets shadowed variable. + const shadowed = astUtils.getVariableByName(scope.upper, variable.name); + + if (shadowed && + (shadowed.identifiers.length > 0 || (options.builtinGlobals && "writeable" in shadowed)) && + !isOnInitializer(variable, shadowed) && + !(options.ignoreOnInitialization && isInitPatternNode(variable, shadowed)) && + !(options.hoist !== "all" && isInTdz(variable, shadowed)) + ) { + const location = getDeclaredLocation(shadowed); + const messageId = location.global ? "noShadowGlobal" : "noShadow"; + const data = { name: variable.name }; + + if (!location.global) { + data.shadowedLine = location.line; + data.shadowedColumn = location.column; + } + context.report({ + node: variable.identifiers[0], + messageId, + data + }); + } + } + } + + return { + "Program:exit"() { + const globalScope = context.getScope(); + const stack = globalScope.childScopes.slice(); + + while (stack.length) { + const scope = stack.pop(); + + stack.push(...scope.childScopes); + checkForShadows(scope); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-spaced-func.js b/node_modules/eslint/lib/rules/no-spaced-func.js new file mode 100644 index 0000000..1d29943 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-spaced-func.js @@ -0,0 +1,83 @@ +/** + * @fileoverview Rule to check that spaced function application + * @author Matt DuVall + * @deprecated in ESLint v3.3.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow spacing between function identifiers and their applications (deprecated)", + recommended: false, + url: "https://eslint.org/docs/rules/no-spaced-func" + }, + + deprecated: true, + + replacedBy: ["func-call-spacing"], + + fixable: "whitespace", + schema: [], + + messages: { + noSpacedFunction: "Unexpected space between function name and paren." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + + /** + * Check if open space is present in a function name + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function detectOpenSpaces(node) { + const lastCalleeToken = sourceCode.getLastToken(node.callee); + let prevToken = lastCalleeToken, + parenToken = sourceCode.getTokenAfter(lastCalleeToken); + + // advances to an open parenthesis. + while ( + parenToken && + parenToken.range[1] < node.range[1] && + parenToken.value !== "(" + ) { + prevToken = parenToken; + parenToken = sourceCode.getTokenAfter(parenToken); + } + + // look for a space between the callee and the open paren + if (parenToken && + parenToken.range[1] < node.range[1] && + sourceCode.isSpaceBetweenTokens(prevToken, parenToken) + ) { + context.report({ + node, + loc: lastCalleeToken.loc.start, + messageId: "noSpacedFunction", + fix(fixer) { + return fixer.removeRange([prevToken.range[1], parenToken.range[0]]); + } + }); + } + } + + return { + CallExpression: detectOpenSpaces, + NewExpression: detectOpenSpaces + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-sparse-arrays.js b/node_modules/eslint/lib/rules/no-sparse-arrays.js new file mode 100644 index 0000000..ff5c2cf --- /dev/null +++ b/node_modules/eslint/lib/rules/no-sparse-arrays.js @@ -0,0 +1,50 @@ +/** + * @fileoverview Disallow sparse arrays + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow sparse arrays", + recommended: true, + url: "https://eslint.org/docs/rules/no-sparse-arrays" + }, + + schema: [], + + messages: { + unexpectedSparseArray: "Unexpected comma in middle of array." + } + }, + + create(context) { + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + ArrayExpression(node) { + + const emptySpot = node.elements.includes(null); + + if (emptySpot) { + context.report({ node, messageId: "unexpectedSparseArray" }); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-sync.js b/node_modules/eslint/lib/rules/no-sync.js new file mode 100644 index 0000000..3536d9f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-sync.js @@ -0,0 +1,64 @@ +/** + * @fileoverview Rule to check for properties whose identifier ends with the string Sync + * @author Matt DuVall + * @deprecated in ESLint v7.0.0 + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + deprecated: true, + + replacedBy: [], + + type: "suggestion", + + docs: { + description: "disallow synchronous methods", + recommended: false, + url: "https://eslint.org/docs/rules/no-sync" + }, + + schema: [ + { + type: "object", + properties: { + allowAtRootLevel: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + noSync: "Unexpected sync method: '{{propertyName}}'." + } + }, + + create(context) { + const selector = context.options[0] && context.options[0].allowAtRootLevel + ? ":function MemberExpression[property.name=/.*Sync$/]" + : "MemberExpression[property.name=/.*Sync$/]"; + + return { + [selector](node) { + context.report({ + node, + messageId: "noSync", + data: { + propertyName: node.property.name + } + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-tabs.js b/node_modules/eslint/lib/rules/no-tabs.js new file mode 100644 index 0000000..9758b85 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-tabs.js @@ -0,0 +1,78 @@ +/** + * @fileoverview Rule to check for tabs inside a file + * @author Gyandeep Singh + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const tabRegex = /\t+/gu; +const anyNonWhitespaceRegex = /\S/u; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow all tabs", + recommended: false, + url: "https://eslint.org/docs/rules/no-tabs" + }, + schema: [{ + type: "object", + properties: { + allowIndentationTabs: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + unexpectedTab: "Unexpected tab character." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const allowIndentationTabs = context.options && context.options[0] && context.options[0].allowIndentationTabs; + + return { + Program(node) { + sourceCode.getLines().forEach((line, index) => { + let match; + + while ((match = tabRegex.exec(line)) !== null) { + if (allowIndentationTabs && !anyNonWhitespaceRegex.test(line.slice(0, match.index))) { + continue; + } + + context.report({ + node, + loc: { + start: { + line: index + 1, + column: match.index + }, + end: { + line: index + 1, + column: match.index + match[0].length + } + }, + messageId: "unexpectedTab" + }); + } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-template-curly-in-string.js b/node_modules/eslint/lib/rules/no-template-curly-in-string.js new file mode 100644 index 0000000..1901460 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-template-curly-in-string.js @@ -0,0 +1,44 @@ +/** + * @fileoverview Warn when using template string syntax in regular strings + * @author Jeroen Engels + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow template literal placeholder syntax in regular strings", + recommended: false, + url: "https://eslint.org/docs/rules/no-template-curly-in-string" + }, + + schema: [], + + messages: { + unexpectedTemplateExpression: "Unexpected template string expression." + } + }, + + create(context) { + const regex = /\$\{[^}]+\}/u; + + return { + Literal(node) { + if (typeof node.value === "string" && regex.test(node.value)) { + context.report({ + node, + messageId: "unexpectedTemplateExpression" + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-ternary.js b/node_modules/eslint/lib/rules/no-ternary.js new file mode 100644 index 0000000..b0dc626 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-ternary.js @@ -0,0 +1,41 @@ +/** + * @fileoverview Rule to flag use of ternary operators. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow ternary operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-ternary" + }, + + schema: [], + + messages: { + noTernaryOperator: "Ternary operator used." + } + }, + + create(context) { + + return { + + ConditionalExpression(node) { + context.report({ node, messageId: "noTernaryOperator" }); + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-this-before-super.js b/node_modules/eslint/lib/rules/no-this-before-super.js new file mode 100644 index 0000000..929eded --- /dev/null +++ b/node_modules/eslint/lib/rules/no-this-before-super.js @@ -0,0 +1,304 @@ +/** + * @fileoverview A rule to disallow using `this`/`super` before `super()`. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given node is a constructor. + * @param {ASTNode} node A node to check. This node type is one of + * `Program`, `FunctionDeclaration`, `FunctionExpression`, and + * `ArrowFunctionExpression`. + * @returns {boolean} `true` if the node is a constructor. + */ +function isConstructorFunction(node) { + return ( + node.type === "FunctionExpression" && + node.parent.type === "MethodDefinition" && + node.parent.kind === "constructor" + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow `this`/`super` before calling `super()` in constructors", + recommended: true, + url: "https://eslint.org/docs/rules/no-this-before-super" + }, + + schema: [], + + messages: { + noBeforeSuper: "'{{kind}}' is not allowed before 'super()'." + } + }, + + create(context) { + + /* + * Information for each constructor. + * - upper: Information of the upper constructor. + * - hasExtends: A flag which shows whether the owner class has a valid + * `extends` part. + * - scope: The scope of the owner class. + * - codePath: The code path of this constructor. + */ + let funcInfo = null; + + /* + * Information for each code path segment. + * Each key is the id of a code path segment. + * Each value is an object: + * - superCalled: The flag which shows `super()` called in all code paths. + * - invalidNodes: The array of invalid ThisExpression and Super nodes. + */ + let segInfoMap = Object.create(null); + + /** + * Gets whether or not `super()` is called in a given code path segment. + * @param {CodePathSegment} segment A code path segment to get. + * @returns {boolean} `true` if `super()` is called. + */ + function isCalled(segment) { + return !segment.reachable || segInfoMap[segment.id].superCalled; + } + + /** + * Checks whether or not this is in a constructor. + * @returns {boolean} `true` if this is in a constructor. + */ + function isInConstructorOfDerivedClass() { + return Boolean(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends); + } + + /** + * Checks whether or not this is before `super()` is called. + * @returns {boolean} `true` if this is before `super()` is called. + */ + function isBeforeCallOfSuper() { + return ( + isInConstructorOfDerivedClass() && + !funcInfo.codePath.currentSegments.every(isCalled) + ); + } + + /** + * Sets a given node as invalid. + * @param {ASTNode} node A node to set as invalid. This is one of + * a ThisExpression and a Super. + * @returns {void} + */ + function setInvalid(node) { + const segments = funcInfo.codePath.currentSegments; + + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + if (segment.reachable) { + segInfoMap[segment.id].invalidNodes.push(node); + } + } + } + + /** + * Sets the current segment as `super` was called. + * @returns {void} + */ + function setSuperCalled() { + const segments = funcInfo.codePath.currentSegments; + + for (let i = 0; i < segments.length; ++i) { + const segment = segments[i]; + + if (segment.reachable) { + segInfoMap[segment.id].superCalled = true; + } + } + } + + return { + + /** + * Adds information of a constructor into the stack. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. + * @returns {void} + */ + onCodePathStart(codePath, node) { + if (isConstructorFunction(node)) { + + // Class > ClassBody > MethodDefinition > FunctionExpression + const classNode = node.parent.parent.parent; + + funcInfo = { + upper: funcInfo, + isConstructor: true, + hasExtends: Boolean( + classNode.superClass && + !astUtils.isNullOrUndefined(classNode.superClass) + ), + codePath + }; + } else { + funcInfo = { + upper: funcInfo, + isConstructor: false, + hasExtends: false, + codePath + }; + } + }, + + /** + * Removes the top of stack item. + * + * And this traverses all segments of this code path then reports every + * invalid node. + * @param {CodePath} codePath A code path which was ended. + * @returns {void} + */ + onCodePathEnd(codePath) { + const isDerivedClass = funcInfo.hasExtends; + + funcInfo = funcInfo.upper; + if (!isDerivedClass) { + return; + } + + codePath.traverseSegments((segment, controller) => { + const info = segInfoMap[segment.id]; + + for (let i = 0; i < info.invalidNodes.length; ++i) { + const invalidNode = info.invalidNodes[i]; + + context.report({ + messageId: "noBeforeSuper", + node: invalidNode, + data: { + kind: invalidNode.type === "Super" ? "super" : "this" + } + }); + } + + if (info.superCalled) { + controller.skip(); + } + }); + }, + + /** + * Initialize information of a given code path segment. + * @param {CodePathSegment} segment A code path segment to initialize. + * @returns {void} + */ + onCodePathSegmentStart(segment) { + if (!isInConstructorOfDerivedClass()) { + return; + } + + // Initialize info. + segInfoMap[segment.id] = { + superCalled: ( + segment.prevSegments.length > 0 && + segment.prevSegments.every(isCalled) + ), + invalidNodes: [] + }; + }, + + /** + * Update information of the code path segment when a code path was + * looped. + * @param {CodePathSegment} fromSegment The code path segment of the + * end of a loop. + * @param {CodePathSegment} toSegment A code path segment of the head + * of a loop. + * @returns {void} + */ + onCodePathSegmentLoop(fromSegment, toSegment) { + if (!isInConstructorOfDerivedClass()) { + return; + } + + // Update information inside of the loop. + funcInfo.codePath.traverseSegments( + { first: toSegment, last: fromSegment }, + (segment, controller) => { + const info = segInfoMap[segment.id]; + + if (info.superCalled) { + info.invalidNodes = []; + controller.skip(); + } else if ( + segment.prevSegments.length > 0 && + segment.prevSegments.every(isCalled) + ) { + info.superCalled = true; + info.invalidNodes = []; + } + } + ); + }, + + /** + * Reports if this is before `super()`. + * @param {ASTNode} node A target node. + * @returns {void} + */ + ThisExpression(node) { + if (isBeforeCallOfSuper()) { + setInvalid(node); + } + }, + + /** + * Reports if this is before `super()`. + * @param {ASTNode} node A target node. + * @returns {void} + */ + Super(node) { + if (!astUtils.isCallee(node) && isBeforeCallOfSuper()) { + setInvalid(node); + } + }, + + /** + * Marks `super()` called. + * @param {ASTNode} node A target node. + * @returns {void} + */ + "CallExpression:exit"(node) { + if (node.callee.type === "Super" && isBeforeCallOfSuper()) { + setSuperCalled(); + } + }, + + /** + * Resets state. + * @returns {void} + */ + "Program:exit"() { + segInfoMap = Object.create(null); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-throw-literal.js b/node_modules/eslint/lib/rules/no-throw-literal.js new file mode 100644 index 0000000..c670ed9 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-throw-literal.js @@ -0,0 +1,51 @@ +/** + * @fileoverview Rule to restrict what can be thrown as an exception. + * @author Dieter Oberkofler + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow throwing literals as exceptions", + recommended: false, + url: "https://eslint.org/docs/rules/no-throw-literal" + }, + + schema: [], + + messages: { + object: "Expected an error object to be thrown.", + undef: "Do not throw undefined." + } + }, + + create(context) { + + return { + + ThrowStatement(node) { + if (!astUtils.couldBeError(node.argument)) { + context.report({ node, messageId: "object" }); + } else if (node.argument.type === "Identifier") { + if (node.argument.name === "undefined") { + context.report({ node, messageId: "undef" }); + } + } + + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-trailing-spaces.js b/node_modules/eslint/lib/rules/no-trailing-spaces.js new file mode 100644 index 0000000..9e720ad --- /dev/null +++ b/node_modules/eslint/lib/rules/no-trailing-spaces.js @@ -0,0 +1,190 @@ +/** + * @fileoverview Disallow trailing spaces at the end of lines. + * @author Nodeca Team + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow trailing whitespace at the end of lines", + recommended: false, + url: "https://eslint.org/docs/rules/no-trailing-spaces" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + skipBlankLines: { + type: "boolean", + default: false + }, + ignoreComments: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + trailingSpace: "Trailing spaces not allowed." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]", + SKIP_BLANK = `^${BLANK_CLASS}*$`, + NONBLANK = `${BLANK_CLASS}+$`; + + const options = context.options[0] || {}, + skipBlankLines = options.skipBlankLines || false, + ignoreComments = options.ignoreComments || false; + + /** + * Report the error message + * @param {ASTNode} node node to report + * @param {int[]} location range information + * @param {int[]} fixRange Range based on the whole program + * @returns {void} + */ + function report(node, location, fixRange) { + + /* + * Passing node is a bit dirty, because message data will contain big + * text in `source`. But... who cares :) ? + * One more kludge will not make worse the bloody wizardry of this + * plugin. + */ + context.report({ + node, + loc: location, + messageId: "trailingSpace", + fix(fixer) { + return fixer.removeRange(fixRange); + } + }); + } + + /** + * Given a list of comment nodes, return the line numbers for those comments. + * @param {Array} comments An array of comment nodes. + * @returns {number[]} An array of line numbers containing comments. + */ + function getCommentLineNumbers(comments) { + const lines = new Set(); + + comments.forEach(comment => { + const endLine = comment.type === "Block" + ? comment.loc.end.line - 1 + : comment.loc.end.line; + + for (let i = comment.loc.start.line; i <= endLine; i++) { + lines.add(i); + } + }); + + return lines; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + Program: function checkTrailingSpaces(node) { + + /* + * Let's hack. Since Espree does not return whitespace nodes, + * fetch the source code and do matching via regexps. + */ + + const re = new RegExp(NONBLANK, "u"), + skipMatch = new RegExp(SKIP_BLANK, "u"), + lines = sourceCode.lines, + linebreaks = sourceCode.getText().match(astUtils.createGlobalLinebreakMatcher()), + comments = sourceCode.getAllComments(), + commentLineNumbers = getCommentLineNumbers(comments); + + let totalLength = 0, + fixRange = []; + + for (let i = 0, ii = lines.length; i < ii; i++) { + const lineNumber = i + 1; + + /* + * Always add linebreak length to line length to accommodate for line break (\n or \r\n) + * Because during the fix time they also reserve one spot in the array. + * Usually linebreak length is 2 for \r\n (CRLF) and 1 for \n (LF) + */ + const linebreakLength = linebreaks && linebreaks[i] ? linebreaks[i].length : 1; + const lineLength = lines[i].length + linebreakLength; + + const matches = re.exec(lines[i]); + + if (matches) { + const location = { + start: { + line: lineNumber, + column: matches.index + }, + end: { + line: lineNumber, + column: lineLength - linebreakLength + } + }; + + const rangeStart = totalLength + location.start.column; + const rangeEnd = totalLength + location.end.column; + const containingNode = sourceCode.getNodeByRangeIndex(rangeStart); + + if (containingNode && containingNode.type === "TemplateElement" && + rangeStart > containingNode.parent.range[0] && + rangeEnd < containingNode.parent.range[1]) { + totalLength += lineLength; + continue; + } + + /* + * If the line has only whitespace, and skipBlankLines + * is true, don't report it + */ + if (skipBlankLines && skipMatch.test(lines[i])) { + totalLength += lineLength; + continue; + } + + fixRange = [rangeStart, rangeEnd]; + + if (!ignoreComments || !commentLineNumbers.has(lineNumber)) { + report(node, location, fixRange); + } + } + + totalLength += lineLength; + } + } + + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-undef-init.js b/node_modules/eslint/lib/rules/no-undef-init.js new file mode 100644 index 0000000..2c2204c --- /dev/null +++ b/node_modules/eslint/lib/rules/no-undef-init.js @@ -0,0 +1,75 @@ +/** + * @fileoverview Rule to flag when initializing to undefined + * @author Ilya Volodin + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow initializing variables to `undefined`", + recommended: false, + url: "https://eslint.org/docs/rules/no-undef-init" + }, + + schema: [], + fixable: "code", + + messages: { + unnecessaryUndefinedInit: "It's not necessary to initialize '{{name}}' to undefined." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + + return { + + VariableDeclarator(node) { + const name = sourceCode.getText(node.id), + init = node.init && node.init.name, + scope = context.getScope(), + undefinedVar = astUtils.getVariableByName(scope, "undefined"), + shadowed = undefinedVar && undefinedVar.defs.length > 0, + lastToken = sourceCode.getLastToken(node); + + if (init === "undefined" && node.parent.kind !== "const" && !shadowed) { + context.report({ + node, + messageId: "unnecessaryUndefinedInit", + data: { name }, + fix(fixer) { + if (node.parent.kind === "var") { + return null; + } + + if (node.id.type === "ArrayPattern" || node.id.type === "ObjectPattern") { + + // Don't fix destructuring assignment to `undefined`. + return null; + } + + if (sourceCode.commentsExistBetween(node.id, lastToken)) { + return null; + } + + return fixer.removeRange([node.id.range[1], node.range[1]]); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-undef.js b/node_modules/eslint/lib/rules/no-undef.js new file mode 100644 index 0000000..f659032 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-undef.js @@ -0,0 +1,78 @@ +/** + * @fileoverview Rule to flag references to undeclared variables. + * @author Mark Macdonald + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks if the given node is the argument of a typeof operator. + * @param {ASTNode} node The AST node being checked. + * @returns {boolean} Whether or not the node is the argument of a typeof operator. + */ +function hasTypeOfOperator(node) { + const parent = node.parent; + + return parent.type === "UnaryExpression" && parent.operator === "typeof"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow the use of undeclared variables unless mentioned in `/*global */` comments", + recommended: true, + url: "https://eslint.org/docs/rules/no-undef" + }, + + schema: [ + { + type: "object", + properties: { + typeof: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { + undef: "'{{name}}' is not defined." + } + }, + + create(context) { + const options = context.options[0]; + const considerTypeOf = options && options.typeof === true || false; + + return { + "Program:exit"(/* node */) { + const globalScope = context.getScope(); + + globalScope.through.forEach(ref => { + const identifier = ref.identifier; + + if (!considerTypeOf && hasTypeOfOperator(identifier)) { + return; + } + + context.report({ + node: identifier, + messageId: "undef", + data: identifier + }); + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-undefined.js b/node_modules/eslint/lib/rules/no-undefined.js new file mode 100644 index 0000000..de396d8 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-undefined.js @@ -0,0 +1,84 @@ +/** + * @fileoverview Rule to flag references to the undefined variable. + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `undefined` as an identifier", + recommended: false, + url: "https://eslint.org/docs/rules/no-undefined" + }, + + schema: [], + + messages: { + unexpectedUndefined: "Unexpected use of undefined." + } + }, + + create(context) { + + /** + * Report an invalid "undefined" identifier node. + * @param {ASTNode} node The node to report. + * @returns {void} + */ + function report(node) { + context.report({ + node, + messageId: "unexpectedUndefined" + }); + } + + /** + * Checks the given scope for references to `undefined` and reports + * all references found. + * @param {eslint-scope.Scope} scope The scope to check. + * @returns {void} + */ + function checkScope(scope) { + const undefinedVar = scope.set.get("undefined"); + + if (!undefinedVar) { + return; + } + + const references = undefinedVar.references; + + const defs = undefinedVar.defs; + + // Report non-initializing references (those are covered in defs below) + references + .filter(ref => !ref.init) + .forEach(ref => report(ref.identifier)); + + defs.forEach(def => report(def.name)); + } + + return { + "Program:exit"() { + const globalScope = context.getScope(); + + const stack = [globalScope]; + + while (stack.length) { + const scope = stack.pop(); + + stack.push(...scope.childScopes); + checkScope(scope); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-underscore-dangle.js b/node_modules/eslint/lib/rules/no-underscore-dangle.js new file mode 100644 index 0000000..a3a9f65 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-underscore-dangle.js @@ -0,0 +1,309 @@ +/** + * @fileoverview Rule to flag dangling underscores in variable declarations. + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow dangling underscores in identifiers", + recommended: false, + url: "https://eslint.org/docs/rules/no-underscore-dangle" + }, + + schema: [ + { + type: "object", + properties: { + allow: { + type: "array", + items: { + type: "string" + } + }, + allowAfterThis: { + type: "boolean", + default: false + }, + allowAfterSuper: { + type: "boolean", + default: false + }, + allowAfterThisConstructor: { + type: "boolean", + default: false + }, + enforceInMethodNames: { + type: "boolean", + default: false + }, + allowFunctionParams: { + type: "boolean", + default: true + }, + enforceInClassFields: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedUnderscore: "Unexpected dangling '_' in '{{identifier}}'." + } + }, + + create(context) { + + const options = context.options[0] || {}; + const ALLOWED_VARIABLES = options.allow ? options.allow : []; + const allowAfterThis = typeof options.allowAfterThis !== "undefined" ? options.allowAfterThis : false; + const allowAfterSuper = typeof options.allowAfterSuper !== "undefined" ? options.allowAfterSuper : false; + const allowAfterThisConstructor = typeof options.allowAfterThisConstructor !== "undefined" ? options.allowAfterThisConstructor : false; + const enforceInMethodNames = typeof options.enforceInMethodNames !== "undefined" ? options.enforceInMethodNames : false; + const enforceInClassFields = typeof options.enforceInClassFields !== "undefined" ? options.enforceInClassFields : false; + const allowFunctionParams = typeof options.allowFunctionParams !== "undefined" ? options.allowFunctionParams : true; + + //------------------------------------------------------------------------- + // Helpers + //------------------------------------------------------------------------- + + /** + * Check if identifier is present inside the allowed option + * @param {string} identifier name of the node + * @returns {boolean} true if its is present + * @private + */ + function isAllowed(identifier) { + return ALLOWED_VARIABLES.includes(identifier); + } + + /** + * Check if identifier has a dangling underscore + * @param {string} identifier name of the node + * @returns {boolean} true if its is present + * @private + */ + function hasDanglingUnderscore(identifier) { + const len = identifier.length; + + return identifier !== "_" && (identifier[0] === "_" || identifier[len - 1] === "_"); + } + + /** + * Check if identifier is a special case member expression + * @param {string} identifier name of the node + * @returns {boolean} true if its is a special case + * @private + */ + function isSpecialCaseIdentifierForMemberExpression(identifier) { + return identifier === "__proto__"; + } + + /** + * Check if identifier is a special case variable expression + * @param {string} identifier name of the node + * @returns {boolean} true if its is a special case + * @private + */ + function isSpecialCaseIdentifierInVariableExpression(identifier) { + + // Checks for the underscore library usage here + return identifier === "_"; + } + + /** + * Check if a node is a member reference of this.constructor + * @param {ASTNode} node node to evaluate + * @returns {boolean} true if it is a reference on this.constructor + * @private + */ + function isThisConstructorReference(node) { + return node.object.type === "MemberExpression" && + node.object.property.name === "constructor" && + node.object.object.type === "ThisExpression"; + } + + /** + * Check if function parameter has a dangling underscore. + * @param {ASTNode} node function node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInFunctionParameters(node) { + if (!allowFunctionParams) { + node.params.forEach(param => { + const { type } = param; + let nodeToCheck; + + if (type === "RestElement") { + nodeToCheck = param.argument; + } else if (type === "AssignmentPattern") { + nodeToCheck = param.left; + } else { + nodeToCheck = param; + } + + if (nodeToCheck.type === "Identifier") { + const identifier = nodeToCheck.name; + + if (hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { + context.report({ + node: param, + messageId: "unexpectedUnderscore", + data: { + identifier + } + }); + } + } + }); + } + } + + /** + * Check if function has a dangling underscore + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInFunction(node) { + if (node.type === "FunctionDeclaration" && node.id) { + const identifier = node.id.name; + + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { + context.report({ + node, + messageId: "unexpectedUnderscore", + data: { + identifier + } + }); + } + } + checkForDanglingUnderscoreInFunctionParameters(node); + } + + /** + * Check if variable expression has a dangling underscore + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInVariableExpression(node) { + const identifier = node.id.name; + + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && + !isSpecialCaseIdentifierInVariableExpression(identifier) && !isAllowed(identifier)) { + context.report({ + node, + messageId: "unexpectedUnderscore", + data: { + identifier + } + }); + } + } + + /** + * Check if member expression has a dangling underscore + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInMemberExpression(node) { + const identifier = node.property.name, + isMemberOfThis = node.object.type === "ThisExpression", + isMemberOfSuper = node.object.type === "Super", + isMemberOfThisConstructor = isThisConstructorReference(node); + + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && + !(isMemberOfThis && allowAfterThis) && + !(isMemberOfSuper && allowAfterSuper) && + !(isMemberOfThisConstructor && allowAfterThisConstructor) && + !isSpecialCaseIdentifierForMemberExpression(identifier) && !isAllowed(identifier)) { + context.report({ + node, + messageId: "unexpectedUnderscore", + data: { + identifier + } + }); + } + } + + /** + * Check if method declaration or method property has a dangling underscore + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInMethod(node) { + const identifier = node.key.name; + const isMethod = node.type === "MethodDefinition" || node.type === "Property" && node.method; + + if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { + context.report({ + node, + messageId: "unexpectedUnderscore", + data: { + identifier: node.key.type === "PrivateIdentifier" + ? `#${identifier}` + : identifier + } + }); + } + } + + /** + * Check if a class field has a dangling underscore + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInClassField(node) { + const identifier = node.key.name; + + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && + enforceInClassFields && + !isAllowed(identifier)) { + context.report({ + node, + messageId: "unexpectedUnderscore", + data: { + identifier: node.key.type === "PrivateIdentifier" + ? `#${identifier}` + : identifier + } + }); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + FunctionDeclaration: checkForDanglingUnderscoreInFunction, + VariableDeclarator: checkForDanglingUnderscoreInVariableExpression, + MemberExpression: checkForDanglingUnderscoreInMemberExpression, + MethodDefinition: checkForDanglingUnderscoreInMethod, + PropertyDefinition: checkForDanglingUnderscoreInClassField, + Property: checkForDanglingUnderscoreInMethod, + FunctionExpression: checkForDanglingUnderscoreInFunction, + ArrowFunctionExpression: checkForDanglingUnderscoreInFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-unexpected-multiline.js b/node_modules/eslint/lib/rules/no-unexpected-multiline.js new file mode 100644 index 0000000..60d8f31 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unexpected-multiline.js @@ -0,0 +1,120 @@ +/** + * @fileoverview Rule to spot scenarios where a newline looks like it is ending a statement, but is not. + * @author Glen Mailer + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow confusing multiline expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-unexpected-multiline" + }, + + schema: [], + messages: { + function: "Unexpected newline between function and ( of function call.", + property: "Unexpected newline between object and [ of property access.", + taggedTemplate: "Unexpected newline between template tag and template literal.", + division: "Unexpected newline between numerator and division operator." + } + }, + + create(context) { + + const REGEX_FLAG_MATCHER = /^[gimsuy]+$/u; + + const sourceCode = context.getSourceCode(); + + /** + * Check to see if there is a newline between the node and the following open bracket + * line's expression + * @param {ASTNode} node The node to check. + * @param {string} messageId The error messageId to use. + * @returns {void} + * @private + */ + function checkForBreakAfter(node, messageId) { + const openParen = sourceCode.getTokenAfter(node, astUtils.isNotClosingParenToken); + const nodeExpressionEnd = sourceCode.getTokenBefore(openParen); + + if (openParen.loc.start.line !== nodeExpressionEnd.loc.end.line) { + context.report({ + node, + loc: openParen.loc, + messageId + }); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + MemberExpression(node) { + if (!node.computed || node.optional) { + return; + } + checkForBreakAfter(node.object, "property"); + }, + + TaggedTemplateExpression(node) { + const { quasi } = node; + + // handles common tags, parenthesized tags, and typescript's generic type arguments + const tokenBefore = sourceCode.getTokenBefore(quasi); + + if (tokenBefore.loc.end.line !== quasi.loc.start.line) { + context.report({ + node, + loc: { + start: quasi.loc.start, + end: { + line: quasi.loc.start.line, + column: quasi.loc.start.column + 1 + } + }, + messageId: "taggedTemplate" + }); + } + }, + + CallExpression(node) { + if (node.arguments.length === 0 || node.optional) { + return; + } + checkForBreakAfter(node.callee, "function"); + }, + + "BinaryExpression[operator='/'] > BinaryExpression[operator='/'].left"(node) { + const secondSlash = sourceCode.getTokenAfter(node, token => token.value === "/"); + const tokenAfterOperator = sourceCode.getTokenAfter(secondSlash); + + if ( + tokenAfterOperator.type === "Identifier" && + REGEX_FLAG_MATCHER.test(tokenAfterOperator.value) && + secondSlash.range[1] === tokenAfterOperator.range[0] + ) { + checkForBreakAfter(node.left, "division"); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js b/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js new file mode 100644 index 0000000..5b8da26 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js @@ -0,0 +1,360 @@ +/** + * @fileoverview Rule to disallow use of unmodified expressions in loop conditions + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Traverser = require("../shared/traverser"), + astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SENTINEL_PATTERN = /(?:(?:Call|Class|Function|Member|New|Yield)Expression|Statement|Declaration)$/u; +const LOOP_PATTERN = /^(?:DoWhile|For|While)Statement$/u; // for-in/of statements don't have `test` property. +const GROUP_PATTERN = /^(?:BinaryExpression|ConditionalExpression)$/u; +const SKIP_PATTERN = /^(?:ArrowFunction|Class|Function)Expression$/u; +const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u; + +/** + * @typedef {Object} LoopConditionInfo + * @property {eslint-scope.Reference} reference - The reference. + * @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes + * that the reference is belonging to. + * @property {Function} isInLoop - The predicate which checks a given reference + * is in this loop. + * @property {boolean} modified - The flag that the reference is modified in + * this loop. + */ + +/** + * Checks whether or not a given reference is a write reference. + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is a write reference. + */ +function isWriteReference(reference) { + if (reference.init) { + const def = reference.resolved && reference.resolved.defs[0]; + + if (!def || def.type !== "Variable" || def.parent.kind !== "var") { + return false; + } + } + return reference.isWrite(); +} + +/** + * Checks whether or not a given loop condition info does not have the modified + * flag. + * @param {LoopConditionInfo} condition A loop condition info to check. + * @returns {boolean} `true` if the loop condition info is "unmodified". + */ +function isUnmodified(condition) { + return !condition.modified; +} + +/** + * Checks whether or not a given loop condition info does not have the modified + * flag and does not have the group this condition belongs to. + * @param {LoopConditionInfo} condition A loop condition info to check. + * @returns {boolean} `true` if the loop condition info is "unmodified". + */ +function isUnmodifiedAndNotBelongToGroup(condition) { + return !(condition.modified || condition.group); +} + +/** + * Checks whether or not a given reference is inside of a given node. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is inside of the node. + */ +function isInRange(node, reference) { + const or = node.range; + const ir = reference.identifier.range; + + return or[0] <= ir[0] && ir[1] <= or[1]; +} + +/** + * Checks whether or not a given reference is inside of a loop node's condition. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is inside of the loop node's + * condition. + */ +const isInLoop = { + WhileStatement: isInRange, + DoWhileStatement: isInRange, + ForStatement(node, reference) { + return ( + isInRange(node, reference) && + !(node.init && isInRange(node.init, reference)) + ); + } +}; + +/** + * Gets the function which encloses a given reference. + * This supports only FunctionDeclaration. + * @param {eslint-scope.Reference} reference A reference to get. + * @returns {ASTNode|null} The function node or null. + */ +function getEncloseFunctionDeclaration(reference) { + let node = reference.identifier; + + while (node) { + if (node.type === "FunctionDeclaration") { + return node.id ? node : null; + } + + node = node.parent; + } + + return null; +} + +/** + * Updates the "modified" flags of given loop conditions with given modifiers. + * @param {LoopConditionInfo[]} conditions The loop conditions to be updated. + * @param {eslint-scope.Reference[]} modifiers The references to update. + * @returns {void} + */ +function updateModifiedFlag(conditions, modifiers) { + + for (let i = 0; i < conditions.length; ++i) { + const condition = conditions[i]; + + for (let j = 0; !condition.modified && j < modifiers.length; ++j) { + const modifier = modifiers[j]; + let funcNode, funcVar; + + /* + * Besides checking for the condition being in the loop, we want to + * check the function that this modifier is belonging to is called + * in the loop. + * FIXME: This should probably be extracted to a function. + */ + const inLoop = condition.isInLoop(modifier) || Boolean( + (funcNode = getEncloseFunctionDeclaration(modifier)) && + (funcVar = astUtils.getVariableByName(modifier.from.upper, funcNode.id.name)) && + funcVar.references.some(condition.isInLoop) + ); + + condition.modified = inLoop; + } + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow unmodified loop conditions", + recommended: false, + url: "https://eslint.org/docs/rules/no-unmodified-loop-condition" + }, + + schema: [], + + messages: { + loopConditionNotModified: "'{{name}}' is not modified in this loop." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let groupMap = null; + + /** + * Reports a given condition info. + * @param {LoopConditionInfo} condition A loop condition info to report. + * @returns {void} + */ + function report(condition) { + const node = condition.reference.identifier; + + context.report({ + node, + messageId: "loopConditionNotModified", + data: node + }); + } + + /** + * Registers given conditions to the group the condition belongs to. + * @param {LoopConditionInfo[]} conditions A loop condition info to + * register. + * @returns {void} + */ + function registerConditionsToGroup(conditions) { + for (let i = 0; i < conditions.length; ++i) { + const condition = conditions[i]; + + if (condition.group) { + let group = groupMap.get(condition.group); + + if (!group) { + group = []; + groupMap.set(condition.group, group); + } + group.push(condition); + } + } + } + + /** + * Reports references which are inside of unmodified groups. + * @param {LoopConditionInfo[]} conditions A loop condition info to report. + * @returns {void} + */ + function checkConditionsInGroup(conditions) { + if (conditions.every(isUnmodified)) { + conditions.forEach(report); + } + } + + /** + * Checks whether or not a given group node has any dynamic elements. + * @param {ASTNode} root A node to check. + * This node is one of BinaryExpression or ConditionalExpression. + * @returns {boolean} `true` if the node is dynamic. + */ + function hasDynamicExpressions(root) { + let retv = false; + + Traverser.traverse(root, { + visitorKeys: sourceCode.visitorKeys, + enter(node) { + if (DYNAMIC_PATTERN.test(node.type)) { + retv = true; + this.break(); + } else if (SKIP_PATTERN.test(node.type)) { + this.skip(); + } + } + }); + + return retv; + } + + /** + * Creates the loop condition information from a given reference. + * @param {eslint-scope.Reference} reference A reference to create. + * @returns {LoopConditionInfo|null} Created loop condition info, or null. + */ + function toLoopCondition(reference) { + if (reference.init) { + return null; + } + + let group = null; + let child = reference.identifier; + let node = child.parent; + + while (node) { + if (SENTINEL_PATTERN.test(node.type)) { + if (LOOP_PATTERN.test(node.type) && node.test === child) { + + // This reference is inside of a loop condition. + return { + reference, + group, + isInLoop: isInLoop[node.type].bind(null, node), + modified: false + }; + } + + // This reference is outside of a loop condition. + break; + } + + /* + * If it's inside of a group, OK if either operand is modified. + * So stores the group this reference belongs to. + */ + if (GROUP_PATTERN.test(node.type)) { + + // If this expression is dynamic, no need to check. + if (hasDynamicExpressions(node)) { + break; + } else { + group = node; + } + } + + child = node; + node = node.parent; + } + + return null; + } + + /** + * Finds unmodified references which are inside of a loop condition. + * Then reports the references which are outside of groups. + * @param {eslint-scope.Variable} variable A variable to report. + * @returns {void} + */ + function checkReferences(variable) { + + // Gets references that exist in loop conditions. + const conditions = variable + .references + .map(toLoopCondition) + .filter(Boolean); + + if (conditions.length === 0) { + return; + } + + // Registers the conditions to belonging groups. + registerConditionsToGroup(conditions); + + // Check the conditions are modified. + const modifiers = variable.references.filter(isWriteReference); + + if (modifiers.length > 0) { + updateModifiedFlag(conditions, modifiers); + } + + /* + * Reports the conditions which are not belonging to groups. + * Others will be reported after all variables are done. + */ + conditions + .filter(isUnmodifiedAndNotBelongToGroup) + .forEach(report); + } + + return { + "Program:exit"() { + const queue = [context.getScope()]; + + groupMap = new Map(); + + let scope; + + while ((scope = queue.pop())) { + queue.push(...scope.childScopes); + scope.variables.forEach(checkReferences); + } + + groupMap.forEach(checkConditionsInGroup); + groupMap = null; + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unneeded-ternary.js b/node_modules/eslint/lib/rules/no-unneeded-ternary.js new file mode 100644 index 0000000..e00d527 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unneeded-ternary.js @@ -0,0 +1,166 @@ +/** + * @fileoverview Rule to flag no-unneeded-ternary + * @author Gyandeep Singh + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +// Operators that always result in a boolean value +const BOOLEAN_OPERATORS = new Set(["==", "===", "!=", "!==", ">", ">=", "<", "<=", "in", "instanceof"]); +const OPERATOR_INVERSES = { + "==": "!=", + "!=": "==", + "===": "!==", + "!==": "===" + + // Operators like < and >= are not true inverses, since both will return false with NaN. +}; +const OR_PRECEDENCE = astUtils.getPrecedence({ type: "LogicalExpression", operator: "||" }); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow ternary operators when simpler alternatives exist", + recommended: false, + url: "https://eslint.org/docs/rules/no-unneeded-ternary" + }, + + schema: [ + { + type: "object", + properties: { + defaultAssignment: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + unnecessaryConditionalExpression: "Unnecessary use of boolean literals in conditional expression.", + unnecessaryConditionalAssignment: "Unnecessary use of conditional expression for default assignment." + } + }, + + create(context) { + const options = context.options[0] || {}; + const defaultAssignment = options.defaultAssignment !== false; + const sourceCode = context.getSourceCode(); + + /** + * Test if the node is a boolean literal + * @param {ASTNode} node The node to report. + * @returns {boolean} True if the its a boolean literal + * @private + */ + function isBooleanLiteral(node) { + return node.type === "Literal" && typeof node.value === "boolean"; + } + + /** + * Creates an expression that represents the boolean inverse of the expression represented by the original node + * @param {ASTNode} node A node representing an expression + * @returns {string} A string representing an inverted expression + */ + function invertExpression(node) { + if (node.type === "BinaryExpression" && Object.prototype.hasOwnProperty.call(OPERATOR_INVERSES, node.operator)) { + const operatorToken = sourceCode.getFirstTokenBetween( + node.left, + node.right, + token => token.value === node.operator + ); + const text = sourceCode.getText(); + + return text.slice(node.range[0], + operatorToken.range[0]) + OPERATOR_INVERSES[node.operator] + text.slice(operatorToken.range[1], node.range[1]); + } + + if (astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression" })) { + return `!(${astUtils.getParenthesisedText(sourceCode, node)})`; + } + return `!${astUtils.getParenthesisedText(sourceCode, node)}`; + } + + /** + * Tests if a given node always evaluates to a boolean value + * @param {ASTNode} node An expression node + * @returns {boolean} True if it is determined that the node will always evaluate to a boolean value + */ + function isBooleanExpression(node) { + return node.type === "BinaryExpression" && BOOLEAN_OPERATORS.has(node.operator) || + node.type === "UnaryExpression" && node.operator === "!"; + } + + /** + * Test if the node matches the pattern id ? id : expression + * @param {ASTNode} node The ConditionalExpression to check. + * @returns {boolean} True if the pattern is matched, and false otherwise + * @private + */ + function matchesDefaultAssignment(node) { + return node.test.type === "Identifier" && + node.consequent.type === "Identifier" && + node.test.name === node.consequent.name; + } + + return { + + ConditionalExpression(node) { + if (isBooleanLiteral(node.alternate) && isBooleanLiteral(node.consequent)) { + context.report({ + node, + messageId: "unnecessaryConditionalExpression", + fix(fixer) { + if (node.consequent.value === node.alternate.value) { + + // Replace `foo ? true : true` with just `true`, but don't replace `foo() ? true : true` + return node.test.type === "Identifier" ? fixer.replaceText(node, node.consequent.value.toString()) : null; + } + if (node.alternate.value) { + + // Replace `foo() ? false : true` with `!(foo())` + return fixer.replaceText(node, invertExpression(node.test)); + } + + // Replace `foo ? true : false` with `foo` if `foo` is guaranteed to be a boolean, or `!!foo` otherwise. + + return fixer.replaceText(node, isBooleanExpression(node.test) ? astUtils.getParenthesisedText(sourceCode, node.test) : `!${invertExpression(node.test)}`); + } + }); + } else if (!defaultAssignment && matchesDefaultAssignment(node)) { + context.report({ + node, + messageId: "unnecessaryConditionalAssignment", + fix: fixer => { + const shouldParenthesizeAlternate = + ( + astUtils.getPrecedence(node.alternate) < OR_PRECEDENCE || + astUtils.isCoalesceExpression(node.alternate) + ) && + !astUtils.isParenthesised(sourceCode, node.alternate); + const alternateText = shouldParenthesizeAlternate + ? `(${sourceCode.getText(node.alternate)})` + : astUtils.getParenthesisedText(sourceCode, node.alternate); + const testText = astUtils.getParenthesisedText(sourceCode, node.test); + + return fixer.replaceText(node, `${testText} || ${alternateText}`); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unreachable-loop.js b/node_modules/eslint/lib/rules/no-unreachable-loop.js new file mode 100644 index 0000000..f100263 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unreachable-loop.js @@ -0,0 +1,150 @@ +/** + * @fileoverview Rule to disallow loops with a body that allows only one iteration + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const allLoopTypes = ["WhileStatement", "DoWhileStatement", "ForStatement", "ForInStatement", "ForOfStatement"]; + +/** + * Determines whether the given node is the first node in the code path to which a loop statement + * 'loops' for the next iteration. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a looping target. + */ +function isLoopingTarget(node) { + const parent = node.parent; + + if (parent) { + switch (parent.type) { + case "WhileStatement": + return node === parent.test; + case "DoWhileStatement": + return node === parent.body; + case "ForStatement": + return node === (parent.update || parent.test || parent.body); + case "ForInStatement": + case "ForOfStatement": + return node === parent.left; + + // no default + } + } + + return false; +} + +/** + * Creates an array with elements from the first given array that are not included in the second given array. + * @param {Array} arrA The array to compare from. + * @param {Array} arrB The array to compare against. + * @returns {Array} a new array that represents `arrA \ arrB`. + */ +function getDifference(arrA, arrB) { + return arrA.filter(a => !arrB.includes(a)); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow loops with a body that allows only one iteration", + recommended: false, + url: "https://eslint.org/docs/rules/no-unreachable-loop" + }, + + schema: [{ + type: "object", + properties: { + ignore: { + type: "array", + items: { + enum: allLoopTypes + }, + uniqueItems: true + } + }, + additionalProperties: false + }], + + messages: { + invalid: "Invalid loop. Its body allows only one iteration." + } + }, + + create(context) { + const ignoredLoopTypes = context.options[0] && context.options[0].ignore || [], + loopTypesToCheck = getDifference(allLoopTypes, ignoredLoopTypes), + loopSelector = loopTypesToCheck.join(","), + loopsByTargetSegments = new Map(), + loopsToReport = new Set(); + + let currentCodePath = null; + + return { + onCodePathStart(codePath) { + currentCodePath = codePath; + }, + + onCodePathEnd() { + currentCodePath = currentCodePath.upper; + }, + + [loopSelector](node) { + + /** + * Ignore unreachable loop statements to avoid unnecessary complexity in the implementation, or false positives otherwise. + * For unreachable segments, the code path analysis does not raise events required for this implementation. + */ + if (currentCodePath.currentSegments.some(segment => segment.reachable)) { + loopsToReport.add(node); + } + }, + + onCodePathSegmentStart(segment, node) { + if (isLoopingTarget(node)) { + const loop = node.parent; + + loopsByTargetSegments.set(segment, loop); + } + }, + + onCodePathSegmentLoop(_, toSegment, node) { + const loop = loopsByTargetSegments.get(toSegment); + + /** + * The second iteration is reachable, meaning that the loop is valid by the logic of this rule, + * only if there is at least one loop event with the appropriate target (which has been already + * determined in the `loopsByTargetSegments` map), raised from either: + * + * - the end of the loop's body (in which case `node === loop`) + * - a `continue` statement + * + * This condition skips loop events raised from `ForInStatement > .right` and `ForOfStatement > .right` nodes. + */ + if (node === loop || node.type === "ContinueStatement") { + + // Removes loop if it exists in the set. Otherwise, `Set#delete` has no effect and doesn't throw. + loopsToReport.delete(loop); + } + }, + + "Program:exit"() { + loopsToReport.forEach( + node => context.report({ node, messageId: "invalid" }) + ); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unreachable.js b/node_modules/eslint/lib/rules/no-unreachable.js new file mode 100644 index 0000000..4dda51f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unreachable.js @@ -0,0 +1,264 @@ +/** + * @fileoverview Checks for unreachable code due to return, throws, break, and continue. + * @author Joel Feenstra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * @typedef {Object} ConstructorInfo + * @property {ConstructorInfo | null} upper Info about the constructor that encloses this constructor. + * @property {boolean} hasSuperCall The flag about having `super()` expressions. + */ + +/** + * Checks whether or not a given variable declarator has the initializer. + * @param {ASTNode} node A VariableDeclarator node to check. + * @returns {boolean} `true` if the node has the initializer. + */ +function isInitialized(node) { + return Boolean(node.init); +} + +/** + * Checks whether or not a given code path segment is unreachable. + * @param {CodePathSegment} segment A CodePathSegment to check. + * @returns {boolean} `true` if the segment is unreachable. + */ +function isUnreachable(segment) { + return !segment.reachable; +} + +/** + * The class to distinguish consecutive unreachable statements. + */ +class ConsecutiveRange { + constructor(sourceCode) { + this.sourceCode = sourceCode; + this.startNode = null; + this.endNode = null; + } + + /** + * The location object of this range. + * @type {Object} + */ + get location() { + return { + start: this.startNode.loc.start, + end: this.endNode.loc.end + }; + } + + /** + * `true` if this range is empty. + * @type {boolean} + */ + get isEmpty() { + return !(this.startNode && this.endNode); + } + + /** + * Checks whether the given node is inside of this range. + * @param {ASTNode|Token} node The node to check. + * @returns {boolean} `true` if the node is inside of this range. + */ + contains(node) { + return ( + node.range[0] >= this.startNode.range[0] && + node.range[1] <= this.endNode.range[1] + ); + } + + /** + * Checks whether the given node is consecutive to this range. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is consecutive to this range. + */ + isConsecutive(node) { + return this.contains(this.sourceCode.getTokenBefore(node)); + } + + /** + * Merges the given node to this range. + * @param {ASTNode} node The node to merge. + * @returns {void} + */ + merge(node) { + this.endNode = node; + } + + /** + * Resets this range by the given node or null. + * @param {ASTNode|null} node The node to reset, or null. + * @returns {void} + */ + reset(node) { + this.startNode = this.endNode = node; + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", + recommended: true, + url: "https://eslint.org/docs/rules/no-unreachable" + }, + + schema: [], + + messages: { + unreachableCode: "Unreachable code." + } + }, + + create(context) { + let currentCodePath = null; + + /** @type {ConstructorInfo | null} */ + let constructorInfo = null; + + /** @type {ConsecutiveRange} */ + const range = new ConsecutiveRange(context.getSourceCode()); + + /** + * Reports a given node if it's unreachable. + * @param {ASTNode} node A statement node to report. + * @returns {void} + */ + function reportIfUnreachable(node) { + let nextNode = null; + + if (node && (node.type === "PropertyDefinition" || currentCodePath.currentSegments.every(isUnreachable))) { + + // Store this statement to distinguish consecutive statements. + if (range.isEmpty) { + range.reset(node); + return; + } + + // Skip if this statement is inside of the current range. + if (range.contains(node)) { + return; + } + + // Merge if this statement is consecutive to the current range. + if (range.isConsecutive(node)) { + range.merge(node); + return; + } + + nextNode = node; + } + + /* + * Report the current range since this statement is reachable or is + * not consecutive to the current range. + */ + if (!range.isEmpty) { + context.report({ + messageId: "unreachableCode", + loc: range.location, + node: range.startNode + }); + } + + // Update the current range. + range.reset(nextNode); + } + + return { + + // Manages the current code path. + onCodePathStart(codePath) { + currentCodePath = codePath; + }, + + onCodePathEnd() { + currentCodePath = currentCodePath.upper; + }, + + // Registers for all statement nodes (excludes FunctionDeclaration). + BlockStatement: reportIfUnreachable, + BreakStatement: reportIfUnreachable, + ClassDeclaration: reportIfUnreachable, + ContinueStatement: reportIfUnreachable, + DebuggerStatement: reportIfUnreachable, + DoWhileStatement: reportIfUnreachable, + ExpressionStatement: reportIfUnreachable, + ForInStatement: reportIfUnreachable, + ForOfStatement: reportIfUnreachable, + ForStatement: reportIfUnreachable, + IfStatement: reportIfUnreachable, + ImportDeclaration: reportIfUnreachable, + LabeledStatement: reportIfUnreachable, + ReturnStatement: reportIfUnreachable, + SwitchStatement: reportIfUnreachable, + ThrowStatement: reportIfUnreachable, + TryStatement: reportIfUnreachable, + + VariableDeclaration(node) { + if (node.kind !== "var" || node.declarations.some(isInitialized)) { + reportIfUnreachable(node); + } + }, + + WhileStatement: reportIfUnreachable, + WithStatement: reportIfUnreachable, + ExportNamedDeclaration: reportIfUnreachable, + ExportDefaultDeclaration: reportIfUnreachable, + ExportAllDeclaration: reportIfUnreachable, + + "Program:exit"() { + reportIfUnreachable(); + }, + + /* + * Instance fields defined in a subclass are never created if the constructor of the subclass + * doesn't call `super()`, so their definitions are unreachable code. + */ + "MethodDefinition[kind='constructor']"() { + constructorInfo = { + upper: constructorInfo, + hasSuperCall: false + }; + }, + "MethodDefinition[kind='constructor']:exit"(node) { + const { hasSuperCall } = constructorInfo; + + constructorInfo = constructorInfo.upper; + + // skip typescript constructors without the body + if (!node.value.body) { + return; + } + + const classDefinition = node.parent.parent; + + if (classDefinition.superClass && !hasSuperCall) { + for (const element of classDefinition.body.body) { + if (element.type === "PropertyDefinition" && !element.static) { + reportIfUnreachable(element); + } + } + } + }, + "CallExpression > Super.callee"() { + if (constructorInfo) { + constructorInfo.hasSuperCall = true; + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-finally.js b/node_modules/eslint/lib/rules/no-unsafe-finally.js new file mode 100644 index 0000000..26c05ea --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unsafe-finally.js @@ -0,0 +1,111 @@ +/** + * @fileoverview Rule to flag unsafe statements in finally block + * @author Onur Temizkan + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SENTINEL_NODE_TYPE_RETURN_THROW = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression)$/u; +const SENTINEL_NODE_TYPE_BREAK = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|DoWhileStatement|WhileStatement|ForOfStatement|ForInStatement|ForStatement|SwitchStatement)$/u; +const SENTINEL_NODE_TYPE_CONTINUE = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|DoWhileStatement|WhileStatement|ForOfStatement|ForInStatement|ForStatement)$/u; + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow control flow statements in `finally` blocks", + recommended: true, + url: "https://eslint.org/docs/rules/no-unsafe-finally" + }, + + schema: [], + + messages: { + unsafeUsage: "Unsafe usage of {{nodeType}}." + } + }, + create(context) { + + /** + * Checks if the node is the finalizer of a TryStatement + * @param {ASTNode} node node to check. + * @returns {boolean} - true if the node is the finalizer of a TryStatement + */ + function isFinallyBlock(node) { + return node.parent.type === "TryStatement" && node.parent.finalizer === node; + } + + /** + * Climbs up the tree if the node is not a sentinel node + * @param {ASTNode} node node to check. + * @param {string} label label of the break or continue statement + * @returns {boolean} - return whether the node is a finally block or a sentinel node + */ + function isInFinallyBlock(node, label) { + let labelInside = false; + let sentinelNodeType; + + if (node.type === "BreakStatement" && !node.label) { + sentinelNodeType = SENTINEL_NODE_TYPE_BREAK; + } else if (node.type === "ContinueStatement") { + sentinelNodeType = SENTINEL_NODE_TYPE_CONTINUE; + } else { + sentinelNodeType = SENTINEL_NODE_TYPE_RETURN_THROW; + } + + for ( + let currentNode = node; + currentNode && !sentinelNodeType.test(currentNode.type); + currentNode = currentNode.parent + ) { + if (currentNode.parent.label && label && (currentNode.parent.label.name === label.name)) { + labelInside = true; + } + if (isFinallyBlock(currentNode)) { + if (label && labelInside) { + return false; + } + return true; + } + } + return false; + } + + /** + * Checks whether the possibly-unsafe statement is inside a finally block. + * @param {ASTNode} node node to check. + * @returns {void} + */ + function check(node) { + if (isInFinallyBlock(node, node.label)) { + context.report({ + messageId: "unsafeUsage", + data: { + nodeType: node.type + }, + node, + line: node.loc.line, + column: node.loc.column + }); + } + } + + return { + ReturnStatement: check, + ThrowStatement: check, + BreakStatement: check, + ContinueStatement: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-negation.js b/node_modules/eslint/lib/rules/no-unsafe-negation.js new file mode 100644 index 0000000..057b174 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unsafe-negation.js @@ -0,0 +1,128 @@ +/** + * @fileoverview Rule to disallow negating the left operand of relational operators + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given operator is `in` or `instanceof` + * @param {string} op The operator type to check. + * @returns {boolean} `true` if the operator is `in` or `instanceof` + */ +function isInOrInstanceOfOperator(op) { + return op === "in" || op === "instanceof"; +} + +/** + * Checks whether the given operator is an ordering relational operator or not. + * @param {string} op The operator type to check. + * @returns {boolean} `true` if the operator is an ordering relational operator. + */ +function isOrderingRelationalOperator(op) { + return op === "<" || op === ">" || op === ">=" || op === "<="; +} + +/** + * Checks whether the given node is a logical negation expression or not. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a logical negation expression. + */ +function isNegation(node) { + return node.type === "UnaryExpression" && node.operator === "!"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow negating the left operand of relational operators", + recommended: true, + url: "https://eslint.org/docs/rules/no-unsafe-negation" + }, + + hasSuggestions: true, + + schema: [ + { + type: "object", + properties: { + enforceForOrderingRelations: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: null, + + messages: { + unexpected: "Unexpected negating the left operand of '{{operator}}' operator.", + suggestNegatedExpression: "Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.", + suggestParenthesisedNegation: "Wrap negation in '()' to make the intention explicit. This preserves the current behavior." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = context.options[0] || {}; + const enforceForOrderingRelations = options.enforceForOrderingRelations === true; + + return { + BinaryExpression(node) { + const operator = node.operator; + const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(operator); + + if ( + (isInOrInstanceOfOperator(operator) || orderingRelationRuleApplies) && + isNegation(node.left) && + !astUtils.isParenthesised(sourceCode, node.left) + ) { + context.report({ + node, + loc: node.left.loc, + messageId: "unexpected", + data: { operator }, + suggest: [ + { + messageId: "suggestNegatedExpression", + data: { operator }, + fix(fixer) { + const negationToken = sourceCode.getFirstToken(node.left); + const fixRange = [negationToken.range[1], node.range[1]]; + const text = sourceCode.text.slice(fixRange[0], fixRange[1]); + + return fixer.replaceTextRange(fixRange, `(${text})`); + } + }, + { + messageId: "suggestParenthesisedNegation", + fix(fixer) { + return fixer.replaceText(node.left, `(${sourceCode.getText(node.left)})`); + } + } + ] + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js b/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js new file mode 100644 index 0000000..8556ccb --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js @@ -0,0 +1,205 @@ +/** + * @fileoverview Rule to disallow unsafe optional chaining + * @author Yeon JuAn + */ + +"use strict"; + +const UNSAFE_ARITHMETIC_OPERATORS = new Set(["+", "-", "/", "*", "%", "**"]); +const UNSAFE_ASSIGNMENT_OPERATORS = new Set(["+=", "-=", "/=", "*=", "%=", "**="]); +const UNSAFE_RELATIONAL_OPERATORS = new Set(["in", "instanceof"]); + +/** + * Checks whether a node is a destructuring pattern or not + * @param {ASTNode} node node to check + * @returns {boolean} `true` if a node is a destructuring pattern, otherwise `false` + */ +function isDestructuringPattern(node) { + return node.type === "ObjectPattern" || node.type === "ArrayPattern"; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow use of optional chaining in contexts where the `undefined` value is not allowed", + recommended: true, + url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining" + }, + schema: [{ + type: "object", + properties: { + disallowArithmeticOperators: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + fixable: null, + messages: { + unsafeOptionalChain: "Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError.", + unsafeArithmetic: "Unsafe arithmetic operation on optional chaining. It can result in NaN." + } + }, + + create(context) { + const options = context.options[0] || {}; + const disallowArithmeticOperators = (options.disallowArithmeticOperators) || false; + + /** + * Reports unsafe usage of optional chaining + * @param {ASTNode} node node to report + * @returns {void} + */ + function reportUnsafeUsage(node) { + context.report({ + messageId: "unsafeOptionalChain", + node + }); + } + + /** + * Reports unsafe arithmetic operation on optional chaining + * @param {ASTNode} node node to report + * @returns {void} + */ + function reportUnsafeArithmetic(node) { + context.report({ + messageId: "unsafeArithmetic", + node + }); + } + + /** + * Checks and reports if a node can short-circuit with `undefined` by optional chaining. + * @param {ASTNode} [node] node to check + * @param {Function} reportFunc report function + * @returns {void} + */ + function checkUndefinedShortCircuit(node, reportFunc) { + if (!node) { + return; + } + switch (node.type) { + case "LogicalExpression": + if (node.operator === "||" || node.operator === "??") { + checkUndefinedShortCircuit(node.right, reportFunc); + } else if (node.operator === "&&") { + checkUndefinedShortCircuit(node.left, reportFunc); + checkUndefinedShortCircuit(node.right, reportFunc); + } + break; + case "SequenceExpression": + checkUndefinedShortCircuit( + node.expressions[node.expressions.length - 1], + reportFunc + ); + break; + case "ConditionalExpression": + checkUndefinedShortCircuit(node.consequent, reportFunc); + checkUndefinedShortCircuit(node.alternate, reportFunc); + break; + case "AwaitExpression": + checkUndefinedShortCircuit(node.argument, reportFunc); + break; + case "ChainExpression": + reportFunc(node); + break; + default: + break; + } + } + + /** + * Checks unsafe usage of optional chaining + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkUnsafeUsage(node) { + checkUndefinedShortCircuit(node, reportUnsafeUsage); + } + + /** + * Checks unsafe arithmetic operations on optional chaining + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkUnsafeArithmetic(node) { + checkUndefinedShortCircuit(node, reportUnsafeArithmetic); + } + + return { + "AssignmentExpression, AssignmentPattern"(node) { + if (isDestructuringPattern(node.left)) { + checkUnsafeUsage(node.right); + } + }, + "ClassDeclaration, ClassExpression"(node) { + checkUnsafeUsage(node.superClass); + }, + CallExpression(node) { + if (!node.optional) { + checkUnsafeUsage(node.callee); + } + }, + NewExpression(node) { + checkUnsafeUsage(node.callee); + }, + VariableDeclarator(node) { + if (isDestructuringPattern(node.id)) { + checkUnsafeUsage(node.init); + } + }, + MemberExpression(node) { + if (!node.optional) { + checkUnsafeUsage(node.object); + } + }, + TaggedTemplateExpression(node) { + checkUnsafeUsage(node.tag); + }, + ForOfStatement(node) { + checkUnsafeUsage(node.right); + }, + SpreadElement(node) { + if (node.parent && node.parent.type !== "ObjectExpression") { + checkUnsafeUsage(node.argument); + } + }, + BinaryExpression(node) { + if (UNSAFE_RELATIONAL_OPERATORS.has(node.operator)) { + checkUnsafeUsage(node.right); + } + if ( + disallowArithmeticOperators && + UNSAFE_ARITHMETIC_OPERATORS.has(node.operator) + ) { + checkUnsafeArithmetic(node.right); + checkUnsafeArithmetic(node.left); + } + }, + WithStatement(node) { + checkUnsafeUsage(node.object); + }, + UnaryExpression(node) { + if ( + disallowArithmeticOperators && + UNSAFE_ARITHMETIC_OPERATORS.has(node.operator) + ) { + checkUnsafeArithmetic(node.argument); + } + }, + AssignmentExpression(node) { + if ( + disallowArithmeticOperators && + UNSAFE_ASSIGNMENT_OPERATORS.has(node.operator) + ) { + checkUnsafeArithmetic(node.right); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unused-expressions.js b/node_modules/eslint/lib/rules/no-unused-expressions.js new file mode 100644 index 0000000..e90099d --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unused-expressions.js @@ -0,0 +1,189 @@ +/** + * @fileoverview Flag expressions in statement position that do not side effect + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Returns `true`. + * @returns {boolean} `true`. + */ +function alwaysTrue() { + return true; +} + +/** + * Returns `false`. + * @returns {boolean} `false`. + */ +function alwaysFalse() { + return false; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unused expressions", + recommended: false, + url: "https://eslint.org/docs/rules/no-unused-expressions" + }, + + schema: [ + { + type: "object", + properties: { + allowShortCircuit: { + type: "boolean", + default: false + }, + allowTernary: { + type: "boolean", + default: false + }, + allowTaggedTemplates: { + type: "boolean", + default: false + }, + enforceForJSX: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unusedExpression: "Expected an assignment or function call and instead saw an expression." + } + }, + + create(context) { + const config = context.options[0] || {}, + allowShortCircuit = config.allowShortCircuit || false, + allowTernary = config.allowTernary || false, + allowTaggedTemplates = config.allowTaggedTemplates || false, + enforceForJSX = config.enforceForJSX || false; + + /** + * Has AST suggesting a directive. + * @param {ASTNode} node any node + * @returns {boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === "ExpressionStatement" && + node.expression.type === "Literal" && typeof node.expression.value === "string"; + } + + /** + * Gets the leading sequence of members in a list that pass the predicate. + * @param {Function} predicate ([a] -> Boolean) the function used to make the determination + * @param {a[]} list the input list + * @returns {a[]} the leading sequence of members in the given list that pass the given predicate + */ + function takeWhile(predicate, list) { + for (let i = 0; i < list.length; ++i) { + if (!predicate(list[i])) { + return list.slice(0, i); + } + } + return list.slice(); + } + + /** + * Gets leading directives nodes in a Node body. + * @param {ASTNode} node a Program or BlockStatement node + * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body + */ + function directives(node) { + return takeWhile(looksLikeDirective, node.body); + } + + /** + * Detect if a Node is a directive. + * @param {ASTNode} node any node + * @param {ASTNode[]} ancestors the given node's ancestors + * @returns {boolean} whether the given node is considered a directive in its current position + */ + function isDirective(node, ancestors) { + const parent = ancestors[ancestors.length - 1], + grandparent = ancestors[ancestors.length - 2]; + + /** + * https://tc39.es/ecma262/#directive-prologue + * + * Only `FunctionBody`, `ScriptBody` and `ModuleBody` can have directive prologue. + * Class static blocks do not have directive prologue. + */ + return (parent.type === "Program" || parent.type === "BlockStatement" && + (/Function/u.test(grandparent.type))) && + directives(parent).includes(node); + } + + /** + * The member functions return `true` if the type has no side-effects. + * Unknown nodes are handled as `false`, then this rule ignores those. + */ + const Checker = Object.assign(Object.create(null), { + isDisallowed(node) { + return (Checker[node.type] || alwaysFalse)(node); + }, + + ArrayExpression: alwaysTrue, + ArrowFunctionExpression: alwaysTrue, + BinaryExpression: alwaysTrue, + ChainExpression(node) { + return Checker.isDisallowed(node.expression); + }, + ClassExpression: alwaysTrue, + ConditionalExpression(node) { + if (allowTernary) { + return Checker.isDisallowed(node.consequent) || Checker.isDisallowed(node.alternate); + } + return true; + }, + FunctionExpression: alwaysTrue, + Identifier: alwaysTrue, + JSXElement() { + return enforceForJSX; + }, + JSXFragment() { + return enforceForJSX; + }, + Literal: alwaysTrue, + LogicalExpression(node) { + if (allowShortCircuit) { + return Checker.isDisallowed(node.right); + } + return true; + }, + MemberExpression: alwaysTrue, + MetaProperty: alwaysTrue, + ObjectExpression: alwaysTrue, + SequenceExpression: alwaysTrue, + TaggedTemplateExpression() { + return !allowTaggedTemplates; + }, + TemplateLiteral: alwaysTrue, + ThisExpression: alwaysTrue, + UnaryExpression(node) { + return node.operator !== "void" && node.operator !== "delete"; + } + }); + + return { + ExpressionStatement(node) { + if (Checker.isDisallowed(node.expression) && !isDirective(node, context.getAncestors())) { + context.report({ node, messageId: "unusedExpression" }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unused-labels.js b/node_modules/eslint/lib/rules/no-unused-labels.js new file mode 100644 index 0000000..f309dd1 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unused-labels.js @@ -0,0 +1,110 @@ +/** + * @fileoverview Rule to disallow unused labels. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unused labels", + recommended: true, + url: "https://eslint.org/docs/rules/no-unused-labels" + }, + + schema: [], + + fixable: "code", + + messages: { + unused: "'{{name}}:' is defined but never used." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let scopeInfo = null; + + /** + * Adds a scope info to the stack. + * @param {ASTNode} node A node to add. This is a LabeledStatement. + * @returns {void} + */ + function enterLabeledScope(node) { + scopeInfo = { + label: node.label.name, + used: false, + upper: scopeInfo + }; + } + + /** + * Removes the top of the stack. + * At the same time, this reports the label if it's never used. + * @param {ASTNode} node A node to report. This is a LabeledStatement. + * @returns {void} + */ + function exitLabeledScope(node) { + if (!scopeInfo.used) { + context.report({ + node: node.label, + messageId: "unused", + data: node.label, + fix(fixer) { + + /* + * Only perform a fix if there are no comments between the label and the body. This will be the case + * when there is exactly one token/comment (the ":") between the label and the body. + */ + if (sourceCode.getTokenAfter(node.label, { includeComments: true }) === + sourceCode.getTokenBefore(node.body, { includeComments: true })) { + return fixer.removeRange([node.range[0], node.body.range[0]]); + } + + return null; + } + }); + } + + scopeInfo = scopeInfo.upper; + } + + /** + * Marks the label of a given node as used. + * @param {ASTNode} node A node to mark. This is a BreakStatement or + * ContinueStatement. + * @returns {void} + */ + function markAsUsed(node) { + if (!node.label) { + return; + } + + const label = node.label.name; + let info = scopeInfo; + + while (info) { + if (info.label === label) { + info.used = true; + break; + } + info = info.upper; + } + } + + return { + LabeledStatement: enterLabeledScope, + "LabeledStatement:exit": exitLabeledScope, + BreakStatement: markAsUsed, + ContinueStatement: markAsUsed + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unused-private-class-members.js b/node_modules/eslint/lib/rules/no-unused-private-class-members.js new file mode 100644 index 0000000..754c360 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unused-private-class-members.js @@ -0,0 +1,195 @@ +/** + * @fileoverview Rule to flag declared but unused private class members + * @author Tim van der Lippe + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow unused private class members", + recommended: false, + url: "https://eslint.org/docs/rules/no-unused-private-class-members" + }, + + schema: [], + + messages: { + unusedPrivateClassMember: "'{{classMemberName}}' is defined but never used." + } + }, + + create(context) { + const trackedClasses = []; + + /** + * Check whether the current node is in a write only assignment. + * @param {ASTNode} privateIdentifierNode Node referring to a private identifier + * @returns {boolean} Whether the node is in a write only assignment + * @private + */ + function isWriteOnlyAssignment(privateIdentifierNode) { + const parentStatement = privateIdentifierNode.parent.parent; + const isAssignmentExpression = parentStatement.type === "AssignmentExpression"; + + if (!isAssignmentExpression && + parentStatement.type !== "ForInStatement" && + parentStatement.type !== "ForOfStatement" && + parentStatement.type !== "AssignmentPattern") { + return false; + } + + // It is a write-only usage, since we still allow usages on the right for reads + if (parentStatement.left !== privateIdentifierNode.parent) { + return false; + } + + // For any other operator (such as '+=') we still consider it a read operation + if (isAssignmentExpression && parentStatement.operator !== "=") { + + /* + * However, if the read operation is "discarded" in an empty statement, then + * we consider it write only. + */ + return parentStatement.parent.type === "ExpressionStatement"; + } + + return true; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + // Collect all declared members up front and assume they are all unused + ClassBody(classBodyNode) { + const privateMembers = new Map(); + + trackedClasses.unshift(privateMembers); + for (const bodyMember of classBodyNode.body) { + if (bodyMember.type === "PropertyDefinition" || bodyMember.type === "MethodDefinition") { + if (bodyMember.key.type === "PrivateIdentifier") { + privateMembers.set(bodyMember.key.name, { + declaredNode: bodyMember, + isAccessor: bodyMember.type === "MethodDefinition" && + (bodyMember.kind === "set" || bodyMember.kind === "get") + }); + } + } + } + }, + + /* + * Process all usages of the private identifier and remove a member from + * `declaredAndUnusedPrivateMembers` if we deem it used. + */ + PrivateIdentifier(privateIdentifierNode) { + const classBody = trackedClasses.find(classProperties => classProperties.has(privateIdentifierNode.name)); + + // Can't happen, as it is a parser to have a missing class body, but let's code defensively here. + if (!classBody) { + return; + } + + // In case any other usage was already detected, we can short circuit the logic here. + const memberDefinition = classBody.get(privateIdentifierNode.name); + + if (memberDefinition.isUsed) { + return; + } + + // The definition of the class member itself + if (privateIdentifierNode.parent.type === "PropertyDefinition" || + privateIdentifierNode.parent.type === "MethodDefinition") { + return; + } + + /* + * Any usage of an accessor is considered a read, as the getter/setter can have + * side-effects in its definition. + */ + if (memberDefinition.isAccessor) { + memberDefinition.isUsed = true; + return; + } + + // Any assignments to this member, except for assignments that also read + if (isWriteOnlyAssignment(privateIdentifierNode)) { + return; + } + + const wrappingExpressionType = privateIdentifierNode.parent.parent.type; + const parentOfWrappingExpressionType = privateIdentifierNode.parent.parent.parent.type; + + // A statement which only increments (`this.#x++;`) + if (wrappingExpressionType === "UpdateExpression" && + parentOfWrappingExpressionType === "ExpressionStatement") { + return; + } + + /* + * ({ x: this.#usedInDestructuring } = bar); + * + * But should treat the following as a read: + * ({ [this.#x]: a } = foo); + */ + if (wrappingExpressionType === "Property" && + parentOfWrappingExpressionType === "ObjectPattern" && + privateIdentifierNode.parent.parent.value === privateIdentifierNode.parent) { + return; + } + + // [...this.#unusedInRestPattern] = bar; + if (wrappingExpressionType === "RestElement") { + return; + } + + // [this.#unusedInAssignmentPattern] = bar; + if (wrappingExpressionType === "ArrayPattern") { + return; + } + + /* + * We can't delete the memberDefinition, as we need to keep track of which member we are marking as used. + * In the case of nested classes, we only mark the first member we encounter as used. If you were to delete + * the member, then any subsequent usage could incorrectly mark the member of an encapsulating parent class + * as used, which is incorrect. + */ + memberDefinition.isUsed = true; + }, + + /* + * Post-process the class members and report any remaining members. + * Since private members can only be accessed in the current class context, + * we can safely assume that all usages are within the current class body. + */ + "ClassBody:exit"() { + const unusedPrivateMembers = trackedClasses.shift(); + + for (const [classMemberName, { declaredNode, isUsed }] of unusedPrivateMembers.entries()) { + if (isUsed) { + continue; + } + context.report({ + node: declaredNode, + loc: declaredNode.key.loc, + messageId: "unusedPrivateClassMember", + data: { + classMemberName: `#${classMemberName}` + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-unused-vars.js b/node_modules/eslint/lib/rules/no-unused-vars.js new file mode 100644 index 0000000..2114e6f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-unused-vars.js @@ -0,0 +1,717 @@ +/** + * @fileoverview Rule to flag declared but unused variables + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * Bag of data used for formatting the `unusedVar` lint message. + * @typedef {Object} UnusedVarMessageData + * @property {string} varName The name of the unused var. + * @property {'defined'|'assigned a value'} action Description of the vars state. + * @property {string} additional Any additional info to be appended at the end. + */ + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow unused variables", + recommended: true, + url: "https://eslint.org/docs/rules/no-unused-vars" + }, + + schema: [ + { + oneOf: [ + { + enum: ["all", "local"] + }, + { + type: "object", + properties: { + vars: { + enum: ["all", "local"] + }, + varsIgnorePattern: { + type: "string" + }, + args: { + enum: ["all", "after-used", "none"] + }, + ignoreRestSiblings: { + type: "boolean" + }, + argsIgnorePattern: { + type: "string" + }, + caughtErrors: { + enum: ["all", "none"] + }, + caughtErrorsIgnorePattern: { + type: "string" + }, + destructuredArrayIgnorePattern: { + type: "string" + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const REST_PROPERTY_TYPE = /^(?:RestElement|(?:Experimental)?RestProperty)$/u; + + const config = { + vars: "all", + args: "after-used", + ignoreRestSiblings: false, + caughtErrors: "none" + }; + + const firstOption = context.options[0]; + + if (firstOption) { + if (typeof firstOption === "string") { + config.vars = firstOption; + } else { + config.vars = firstOption.vars || config.vars; + config.args = firstOption.args || config.args; + config.ignoreRestSiblings = firstOption.ignoreRestSiblings || config.ignoreRestSiblings; + config.caughtErrors = firstOption.caughtErrors || config.caughtErrors; + + if (firstOption.varsIgnorePattern) { + config.varsIgnorePattern = new RegExp(firstOption.varsIgnorePattern, "u"); + } + + if (firstOption.argsIgnorePattern) { + config.argsIgnorePattern = new RegExp(firstOption.argsIgnorePattern, "u"); + } + + if (firstOption.caughtErrorsIgnorePattern) { + config.caughtErrorsIgnorePattern = new RegExp(firstOption.caughtErrorsIgnorePattern, "u"); + } + + if (firstOption.destructuredArrayIgnorePattern) { + config.destructuredArrayIgnorePattern = new RegExp(firstOption.destructuredArrayIgnorePattern, "u"); + } + } + } + + /** + * Generates the message data about the variable being defined and unused, + * including the ignore pattern if configured. + * @param {Variable} unusedVar eslint-scope variable object. + * @returns {UnusedVarMessageData} The message data to be used with this unused variable. + */ + function getDefinedMessageData(unusedVar) { + const defType = unusedVar.defs && unusedVar.defs[0] && unusedVar.defs[0].type; + let type; + let pattern; + + if (defType === "CatchClause" && config.caughtErrorsIgnorePattern) { + type = "args"; + pattern = config.caughtErrorsIgnorePattern.toString(); + } else if (defType === "Parameter" && config.argsIgnorePattern) { + type = "args"; + pattern = config.argsIgnorePattern.toString(); + } else if (defType !== "Parameter" && config.varsIgnorePattern) { + type = "vars"; + pattern = config.varsIgnorePattern.toString(); + } + + const additional = type ? `. Allowed unused ${type} must match ${pattern}` : ""; + + return { + varName: unusedVar.name, + action: "defined", + additional + }; + } + + /** + * Generate the warning message about the variable being + * assigned and unused, including the ignore pattern if configured. + * @param {Variable} unusedVar eslint-scope variable object. + * @returns {UnusedVarMessageData} The message data to be used with this unused variable. + */ + function getAssignedMessageData(unusedVar) { + const def = unusedVar.defs[0]; + let additional = ""; + + if (config.destructuredArrayIgnorePattern && def && def.name.parent.type === "ArrayPattern") { + additional = `. Allowed unused elements of array destructuring patterns must match ${config.destructuredArrayIgnorePattern.toString()}`; + } else if (config.varsIgnorePattern) { + additional = `. Allowed unused vars must match ${config.varsIgnorePattern.toString()}`; + } + + return { + varName: unusedVar.name, + action: "assigned a value", + additional + }; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const STATEMENT_TYPE = /(?:Statement|Declaration)$/u; + + /** + * Determines if a given variable is being exported from a module. + * @param {Variable} variable eslint-scope variable object. + * @returns {boolean} True if the variable is exported, false if not. + * @private + */ + function isExported(variable) { + + const definition = variable.defs[0]; + + if (definition) { + + let node = definition.node; + + if (node.type === "VariableDeclarator") { + node = node.parent; + } else if (definition.type === "Parameter") { + return false; + } + + return node.parent.type.indexOf("Export") === 0; + } + return false; + + } + + /** + * Checks whether a node is a sibling of the rest property or not. + * @param {ASTNode} node a node to check + * @returns {boolean} True if the node is a sibling of the rest property, otherwise false. + */ + function hasRestSibling(node) { + return node.type === "Property" && + node.parent.type === "ObjectPattern" && + REST_PROPERTY_TYPE.test(node.parent.properties[node.parent.properties.length - 1].type); + } + + /** + * Determines if a variable has a sibling rest property + * @param {Variable} variable eslint-scope variable object. + * @returns {boolean} True if the variable is exported, false if not. + * @private + */ + function hasRestSpreadSibling(variable) { + if (config.ignoreRestSiblings) { + const hasRestSiblingDefinition = variable.defs.some(def => hasRestSibling(def.name.parent)); + const hasRestSiblingReference = variable.references.some(ref => hasRestSibling(ref.identifier.parent)); + + return hasRestSiblingDefinition || hasRestSiblingReference; + } + + return false; + } + + /** + * Determines if a reference is a read operation. + * @param {Reference} ref An eslint-scope Reference + * @returns {boolean} whether the given reference represents a read operation + * @private + */ + function isReadRef(ref) { + return ref.isRead(); + } + + /** + * Determine if an identifier is referencing an enclosing function name. + * @param {Reference} ref The reference to check. + * @param {ASTNode[]} nodes The candidate function nodes. + * @returns {boolean} True if it's a self-reference, false if not. + * @private + */ + function isSelfReference(ref, nodes) { + let scope = ref.from; + + while (scope) { + if (nodes.includes(scope.block)) { + return true; + } + + scope = scope.upper; + } + + return false; + } + + /** + * Gets a list of function definitions for a specified variable. + * @param {Variable} variable eslint-scope variable object. + * @returns {ASTNode[]} Function nodes. + * @private + */ + function getFunctionDefinitions(variable) { + const functionDefinitions = []; + + variable.defs.forEach(def => { + const { type, node } = def; + + // FunctionDeclarations + if (type === "FunctionName") { + functionDefinitions.push(node); + } + + // FunctionExpressions + if (type === "Variable" && node.init && + (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) { + functionDefinitions.push(node.init); + } + }); + return functionDefinitions; + } + + /** + * Checks the position of given nodes. + * @param {ASTNode} inner A node which is expected as inside. + * @param {ASTNode} outer A node which is expected as outside. + * @returns {boolean} `true` if the `inner` node exists in the `outer` node. + * @private + */ + function isInside(inner, outer) { + return ( + inner.range[0] >= outer.range[0] && + inner.range[1] <= outer.range[1] + ); + } + + /** + * Checks whether a given node is unused expression or not. + * @param {ASTNode} node The node itself + * @returns {boolean} The node is an unused expression. + * @private + */ + function isUnusedExpression(node) { + const parent = node.parent; + + if (parent.type === "ExpressionStatement") { + return true; + } + + if (parent.type === "SequenceExpression") { + const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; + + if (!isLastExpression) { + return true; + } + return isUnusedExpression(parent); + } + + return false; + } + + /** + * If a given reference is left-hand side of an assignment, this gets + * the right-hand side node of the assignment. + * + * In the following cases, this returns null. + * + * - The reference is not the LHS of an assignment expression. + * - The reference is inside of a loop. + * - The reference is inside of a function scope which is different from + * the declaration. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} prevRhsNode The previous RHS node. + * @returns {ASTNode|null} The RHS node or null. + * @private + */ + function getRhsNode(ref, prevRhsNode) { + const id = ref.identifier; + const parent = id.parent; + const refScope = ref.from.variableScope; + const varScope = ref.resolved.scope.variableScope; + const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); + + /* + * Inherits the previous node if this reference is in the node. + * This is for `a = a + a`-like code. + */ + if (prevRhsNode && isInside(id, prevRhsNode)) { + return prevRhsNode; + } + + if (parent.type === "AssignmentExpression" && + isUnusedExpression(parent) && + id === parent.left && + !canBeUsedLater + ) { + return parent.right; + } + return null; + } + + /** + * Checks whether a given function node is stored to somewhere or not. + * If the function node is stored, the function can be used later. + * @param {ASTNode} funcNode A function node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean} `true` if under the following conditions: + * - the funcNode is assigned to a variable. + * - the funcNode is bound as an argument of a function call. + * - the function is bound to a property and the object satisfies above conditions. + * @private + */ + function isStorableFunction(funcNode, rhsNode) { + let node = funcNode; + let parent = funcNode.parent; + + while (parent && isInside(parent, rhsNode)) { + switch (parent.type) { + case "SequenceExpression": + if (parent.expressions[parent.expressions.length - 1] !== node) { + return false; + } + break; + + case "CallExpression": + case "NewExpression": + return parent.callee !== node; + + case "AssignmentExpression": + case "TaggedTemplateExpression": + case "YieldExpression": + return true; + + default: + if (STATEMENT_TYPE.test(parent.type)) { + + /* + * If it encountered statements, this is a complex pattern. + * Since analyzing complex patterns is hard, this returns `true` to avoid false positive. + */ + return true; + } + } + + node = parent; + parent = parent.parent; + } + + return false; + } + + /** + * Checks whether a given Identifier node exists inside of a function node which can be used later. + * + * "can be used later" means: + * - the function is assigned to a variable. + * - the function is bound to a property and the object can be used later. + * - the function is bound as an argument of a function call. + * + * If a reference exists in a function which can be used later, the reference is read when the function is called. + * @param {ASTNode} id An Identifier node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean} `true` if the `id` node exists inside of a function node which can be used later. + * @private + */ + function isInsideOfStorableFunction(id, rhsNode) { + const funcNode = astUtils.getUpperFunction(id); + + return ( + funcNode && + isInside(funcNode, rhsNode) && + isStorableFunction(funcNode, rhsNode) + ); + } + + /** + * Checks whether a given reference is a read to update itself or not. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean} The reference is a read to update itself. + * @private + */ + function isReadForItself(ref, rhsNode) { + const id = ref.identifier; + const parent = id.parent; + + return ref.isRead() && ( + + // self update. e.g. `a += 1`, `a++` + ( + ( + parent.type === "AssignmentExpression" && + parent.left === id && + isUnusedExpression(parent) + ) || + ( + parent.type === "UpdateExpression" && + isUnusedExpression(parent) + ) + ) || + + // in RHS of an assignment for itself. e.g. `a = a + 1` + ( + rhsNode && + isInside(id, rhsNode) && + !isInsideOfStorableFunction(id, rhsNode) + ) + ); + } + + /** + * Determine if an identifier is used either in for-in or for-of loops. + * @param {Reference} ref The reference to check. + * @returns {boolean} whether reference is used in the for-in loops + * @private + */ + function isForInOfRef(ref) { + let target = ref.identifier.parent; + + + // "for (var ...) { return; }" + if (target.type === "VariableDeclarator") { + target = target.parent.parent; + } + + if (target.type !== "ForInStatement" && target.type !== "ForOfStatement") { + return false; + } + + // "for (...) { return; }" + if (target.body.type === "BlockStatement") { + target = target.body.body[0]; + + // "for (...) return;" + } else { + target = target.body; + } + + // For empty loop body + if (!target) { + return false; + } + + return target.type === "ReturnStatement"; + } + + /** + * Determines if the variable is used. + * @param {Variable} variable The variable to check. + * @returns {boolean} True if the variable is used + * @private + */ + function isUsedVariable(variable) { + const functionNodes = getFunctionDefinitions(variable), + isFunctionDefinition = functionNodes.length > 0; + let rhsNode = null; + + return variable.references.some(ref => { + if (isForInOfRef(ref)) { + return true; + } + + const forItself = isReadForItself(ref, rhsNode); + + rhsNode = getRhsNode(ref, rhsNode); + + return ( + isReadRef(ref) && + !forItself && + !(isFunctionDefinition && isSelfReference(ref, functionNodes)) + ); + }); + } + + /** + * Checks whether the given variable is after the last used parameter. + * @param {eslint-scope.Variable} variable The variable to check. + * @returns {boolean} `true` if the variable is defined after the last + * used parameter. + */ + function isAfterLastUsedArg(variable) { + const def = variable.defs[0]; + const params = context.getDeclaredVariables(def.node); + const posteriorParams = params.slice(params.indexOf(variable) + 1); + + // If any used parameters occur after this parameter, do not report. + return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed); + } + + /** + * Gets an array of variables without read references. + * @param {Scope} scope an eslint-scope Scope object. + * @param {Variable[]} unusedVars an array that saving result. + * @returns {Variable[]} unused variables of the scope and descendant scopes. + * @private + */ + function collectUnusedVariables(scope, unusedVars) { + const variables = scope.variables; + const childScopes = scope.childScopes; + let i, l; + + if (scope.type !== "global" || config.vars === "all") { + for (i = 0, l = variables.length; i < l; ++i) { + const variable = variables[i]; + + // skip a variable of class itself name in the class scope + if (scope.type === "class" && scope.block.id === variable.identifiers[0]) { + continue; + } + + // skip function expression names and variables marked with markVariableAsUsed() + if (scope.functionExpressionScope || variable.eslintUsed) { + continue; + } + + // skip implicit "arguments" variable + if (scope.type === "function" && variable.name === "arguments" && variable.identifiers.length === 0) { + continue; + } + + // explicit global variables don't have definitions. + const def = variable.defs[0]; + + if (def) { + const type = def.type; + const refUsedInArrayPatterns = variable.references.some(ref => ref.identifier.parent.type === "ArrayPattern"); + + // skip elements of array destructuring patterns + if ( + ( + def.name.parent.type === "ArrayPattern" || + refUsedInArrayPatterns + ) && + config.destructuredArrayIgnorePattern && + config.destructuredArrayIgnorePattern.test(def.name.name) + ) { + continue; + } + + // skip catch variables + if (type === "CatchClause") { + if (config.caughtErrors === "none") { + continue; + } + + // skip ignored parameters + if (config.caughtErrorsIgnorePattern && config.caughtErrorsIgnorePattern.test(def.name.name)) { + continue; + } + } + + if (type === "Parameter") { + + // skip any setter argument + if ((def.node.parent.type === "Property" || def.node.parent.type === "MethodDefinition") && def.node.parent.kind === "set") { + continue; + } + + // if "args" option is "none", skip any parameter + if (config.args === "none") { + continue; + } + + // skip ignored parameters + if (config.argsIgnorePattern && config.argsIgnorePattern.test(def.name.name)) { + continue; + } + + // if "args" option is "after-used", skip used variables + if (config.args === "after-used" && astUtils.isFunction(def.name.parent) && !isAfterLastUsedArg(variable)) { + continue; + } + } else { + + // skip ignored variables + if (config.varsIgnorePattern && config.varsIgnorePattern.test(def.name.name)) { + continue; + } + } + } + + if (!isUsedVariable(variable) && !isExported(variable) && !hasRestSpreadSibling(variable)) { + unusedVars.push(variable); + } + } + } + + for (i = 0, l = childScopes.length; i < l; ++i) { + collectUnusedVariables(childScopes[i], unusedVars); + } + + return unusedVars; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "Program:exit"(programNode) { + const unusedVars = collectUnusedVariables(context.getScope(), []); + + for (let i = 0, l = unusedVars.length; i < l; ++i) { + const unusedVar = unusedVars[i]; + + // Report the first declaration. + if (unusedVar.defs.length > 0) { + + // report last write reference, https://github.com/eslint/eslint/issues/14324 + const writeReferences = unusedVar.references.filter(ref => ref.isWrite() && ref.from.variableScope === unusedVar.scope.variableScope); + + let referenceToReport; + + if (writeReferences.length > 0) { + referenceToReport = writeReferences[writeReferences.length - 1]; + } + + context.report({ + node: referenceToReport ? referenceToReport.identifier : unusedVar.identifiers[0], + messageId: "unusedVar", + data: unusedVar.references.some(ref => ref.isWrite()) + ? getAssignedMessageData(unusedVar) + : getDefinedMessageData(unusedVar) + }); + + // If there are no regular declaration, report the first `/*globals*/` comment directive. + } else if (unusedVar.eslintExplicitGlobalComments) { + const directiveComment = unusedVar.eslintExplicitGlobalComments[0]; + + context.report({ + node: programNode, + loc: astUtils.getNameLocationInGlobalDirectiveComment(sourceCode, directiveComment, unusedVar.name), + messageId: "unusedVar", + data: getDefinedMessageData(unusedVar) + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/no-use-before-define.js b/node_modules/eslint/lib/rules/no-use-before-define.js new file mode 100644 index 0000000..0dc4d76 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-use-before-define.js @@ -0,0 +1,347 @@ +/** + * @fileoverview Rule to flag use of variables before they are defined + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u; +const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; + +/** + * Parses a given value as options. + * @param {any} options A value to parse. + * @returns {Object} The parsed options. + */ +function parseOptions(options) { + let functions = true; + let classes = true; + let variables = true; + let allowNamedExports = false; + + if (typeof options === "string") { + functions = (options !== "nofunc"); + } else if (typeof options === "object" && options !== null) { + functions = options.functions !== false; + classes = options.classes !== false; + variables = options.variables !== false; + allowNamedExports = !!options.allowNamedExports; + } + + return { functions, classes, variables, allowNamedExports }; +} + +/** + * Checks whether or not a given location is inside of the range of a given node. + * @param {ASTNode} node An node to check. + * @param {number} location A location to check. + * @returns {boolean} `true` if the location is inside of the range of the node. + */ +function isInRange(node, location) { + return node && node.range[0] <= location && location <= node.range[1]; +} + +/** + * Checks whether or not a given location is inside of the range of a class static initializer. + * Static initializers are static blocks and initializers of static fields. + * @param {ASTNode} node `ClassBody` node to check static initializers. + * @param {number} location A location to check. + * @returns {boolean} `true` if the location is inside of a class static initializer. + */ +function isInClassStaticInitializerRange(node, location) { + return node.body.some(classMember => ( + ( + classMember.type === "StaticBlock" && + isInRange(classMember, location) + ) || + ( + classMember.type === "PropertyDefinition" && + classMember.static && + classMember.value && + isInRange(classMember.value, location) + ) + )); +} + +/** + * Checks whether a given scope is the scope of a a class static initializer. + * Static initializers are static blocks and initializers of static fields. + * @param {eslint-scope.Scope} scope A scope to check. + * @returns {boolean} `true` if the scope is a class static initializer scope. + */ +function isClassStaticInitializerScope(scope) { + if (scope.type === "class-static-block") { + return true; + } + + if (scope.type === "class-field-initializer") { + + // `scope.block` is PropertyDefinition#value node + const propertyDefinition = scope.block.parent; + + return propertyDefinition.static; + } + + return false; +} + +/** + * Checks whether a given reference is evaluated in an execution context + * that isn't the one where the variable it refers to is defined. + * Execution contexts are: + * - top-level + * - functions + * - class field initializers (implicit functions) + * - class static blocks (implicit functions) + * Static class field initializers and class static blocks are automatically run during the class definition evaluation, + * and therefore we'll consider them as a part of the parent execution context. + * Example: + * + * const x = 1; + * + * x; // returns `false` + * () => x; // returns `true` + * + * class C { + * field = x; // returns `true` + * static field = x; // returns `false` + * + * method() { + * x; // returns `true` + * } + * + * static method() { + * x; // returns `true` + * } + * + * static { + * x; // returns `false` + * } + * } + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is from a separate execution context. + */ +function isFromSeparateExecutionContext(reference) { + const variable = reference.resolved; + let scope = reference.from; + + // Scope#variableScope represents execution context + while (variable.scope.variableScope !== scope.variableScope) { + if (isClassStaticInitializerScope(scope.variableScope)) { + scope = scope.variableScope.upper; + } else { + return true; + } + } + + return false; +} + +/** + * Checks whether or not a given reference is evaluated during the initialization of its variable. + * + * This returns `true` in the following cases: + * + * var a = a + * var [a = a] = list + * var {a = a} = obj + * for (var a in a) {} + * for (var a of a) {} + * var C = class { [C]; }; + * var C = class { static foo = C; }; + * var C = class { static { foo = C; } }; + * class C extends C {} + * class C extends (class { static foo = C; }) {} + * class C { [C]; } + * @param {Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is evaluated during the initialization. + */ +function isEvaluatedDuringInitialization(reference) { + if (isFromSeparateExecutionContext(reference)) { + + /* + * Even if the reference appears in the initializer, it isn't evaluated during the initialization. + * For example, `const x = () => x;` is valid. + */ + return false; + } + + const location = reference.identifier.range[1]; + const definition = reference.resolved.defs[0]; + + if (definition.type === "ClassName") { + + // `ClassDeclaration` or `ClassExpression` + const classDefinition = definition.node; + + return ( + isInRange(classDefinition, location) && + + /* + * Class binding is initialized before running static initializers. + * For example, `class C { static foo = C; static { bar = C; } }` is valid. + */ + !isInClassStaticInitializerRange(classDefinition.body, location) + ); + } + + let node = definition.name.parent; + + while (node) { + if (node.type === "VariableDeclarator") { + if (isInRange(node.init, location)) { + return true; + } + if (FOR_IN_OF_TYPE.test(node.parent.parent.type) && + isInRange(node.parent.parent.right, location) + ) { + return true; + } + break; + } else if (node.type === "AssignmentPattern") { + if (isInRange(node.right, location)) { + return true; + } + } else if (SENTINEL_TYPE.test(node.type)) { + break; + } + + node = node.parent; + } + + return false; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow the use of variables before they are defined", + recommended: false, + url: "https://eslint.org/docs/rules/no-use-before-define" + }, + + schema: [ + { + oneOf: [ + { + enum: ["nofunc"] + }, + { + type: "object", + properties: { + functions: { type: "boolean" }, + classes: { type: "boolean" }, + variables: { type: "boolean" }, + allowNamedExports: { type: "boolean" } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + usedBeforeDefined: "'{{name}}' was used before it was defined." + } + }, + + create(context) { + const options = parseOptions(context.options[0]); + + /** + * Determines whether a given reference should be checked. + * + * Returns `false` if the reference is: + * - initialization's (e.g., `let a = 1`). + * - referring to an undefined variable (i.e., if it's an unresolved reference). + * - referring to a variable that is defined, but not in the given source code + * (e.g., global environment variable or `arguments` in functions). + * - allowed by options. + * @param {eslint-scope.Reference} reference The reference + * @returns {boolean} `true` if the reference should be checked + */ + function shouldCheck(reference) { + if (reference.init) { + return false; + } + + const { identifier } = reference; + + if ( + options.allowNamedExports && + identifier.parent.type === "ExportSpecifier" && + identifier.parent.local === identifier + ) { + return false; + } + + const variable = reference.resolved; + + if (!variable || variable.defs.length === 0) { + return false; + } + + const definitionType = variable.defs[0].type; + + if (!options.functions && definitionType === "FunctionName") { + return false; + } + + if ( + ( + !options.variables && definitionType === "Variable" || + !options.classes && definitionType === "ClassName" + ) && + + // don't skip checking the reference if it's in the same execution context, because of TDZ + isFromSeparateExecutionContext(reference) + ) { + return false; + } + + return true; + } + + /** + * Finds and validates all references in a given scope and its child scopes. + * @param {eslint-scope.Scope} scope The scope object. + * @returns {void} + */ + function checkReferencesInScope(scope) { + scope.references.filter(shouldCheck).forEach(reference => { + const variable = reference.resolved; + const definitionIdentifier = variable.defs[0].name; + + if ( + reference.identifier.range[1] < definitionIdentifier.range[1] || + isEvaluatedDuringInitialization(reference) + ) { + context.report({ + node: reference.identifier, + messageId: "usedBeforeDefined", + data: reference.identifier + }); + } + }); + + scope.childScopes.forEach(checkReferencesInScope); + } + + return { + Program() { + checkReferencesInScope(context.getScope()); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-backreference.js b/node_modules/eslint/lib/rules/no-useless-backreference.js new file mode 100644 index 0000000..1a09988 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-backreference.js @@ -0,0 +1,192 @@ +/** + * @fileoverview Rule to disallow useless backreferences in regular expressions + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("eslint-utils"); +const { RegExpParser, visitRegExpAST } = require("regexpp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const parser = new RegExpParser(); + +/** + * Finds the path from the given `regexpp` AST node to the root node. + * @param {regexpp.Node} node Node. + * @returns {regexpp.Node[]} Array that starts with the given node and ends with the root node. + */ +function getPathToRoot(node) { + const path = []; + let current = node; + + do { + path.push(current); + current = current.parent; + } while (current); + + return path; +} + +/** + * Determines whether the given `regexpp` AST node is a lookaround node. + * @param {regexpp.Node} node Node. + * @returns {boolean} `true` if it is a lookaround node. + */ +function isLookaround(node) { + return node.type === "Assertion" && + (node.kind === "lookahead" || node.kind === "lookbehind"); +} + +/** + * Determines whether the given `regexpp` AST node is a negative lookaround node. + * @param {regexpp.Node} node Node. + * @returns {boolean} `true` if it is a negative lookaround node. + */ +function isNegativeLookaround(node) { + return isLookaround(node) && node.negate; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow useless backreferences in regular expressions", + recommended: true, + url: "https://eslint.org/docs/rules/no-useless-backreference" + }, + + schema: [], + + messages: { + nested: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' from within that group.", + forward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears later in the pattern.", + backward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears before in the same lookbehind.", + disjunctive: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in another alternative.", + intoNegativeLookaround: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in a negative lookaround." + } + }, + + create(context) { + + /** + * Checks and reports useless backreferences in the given regular expression. + * @param {ASTNode} node Node that represents regular expression. A regex literal or RegExp constructor call. + * @param {string} pattern Regular expression pattern. + * @param {string} flags Regular expression flags. + * @returns {void} + */ + function checkRegex(node, pattern, flags) { + let regExpAST; + + try { + regExpAST = parser.parsePattern(pattern, 0, pattern.length, flags.includes("u")); + } catch { + + // Ignore regular expressions with syntax errors + return; + } + + visitRegExpAST(regExpAST, { + onBackreferenceEnter(bref) { + const group = bref.resolved, + brefPath = getPathToRoot(bref), + groupPath = getPathToRoot(group); + let messageId = null; + + if (brefPath.includes(group)) { + + // group is bref's ancestor => bref is nested ('nested reference') => group hasn't matched yet when bref starts to match. + messageId = "nested"; + } else { + + // Start from the root to find the lowest common ancestor. + let i = brefPath.length - 1, + j = groupPath.length - 1; + + do { + i--; + j--; + } while (brefPath[i] === groupPath[j]); + + const indexOfLowestCommonAncestor = j + 1, + groupCut = groupPath.slice(0, indexOfLowestCommonAncestor), + commonPath = groupPath.slice(indexOfLowestCommonAncestor), + lowestCommonLookaround = commonPath.find(isLookaround), + isMatchingBackward = lowestCommonLookaround && lowestCommonLookaround.kind === "lookbehind"; + + if (!isMatchingBackward && bref.end <= group.start) { + + // bref is left, group is right ('forward reference') => group hasn't matched yet when bref starts to match. + messageId = "forward"; + } else if (isMatchingBackward && group.end <= bref.start) { + + // the opposite of the previous when the regex is matching backward in a lookbehind context. + messageId = "backward"; + } else if (groupCut[groupCut.length - 1].type === "Alternative") { + + // group's and bref's ancestor nodes below the lowest common ancestor are sibling alternatives => they're disjunctive. + messageId = "disjunctive"; + } else if (groupCut.some(isNegativeLookaround)) { + + // group is in a negative lookaround which isn't bref's ancestor => group has already failed when bref starts to match. + messageId = "intoNegativeLookaround"; + } + } + + if (messageId) { + context.report({ + node, + messageId, + data: { + bref: bref.raw, + group: group.raw + } + }); + } + } + }); + } + + return { + "Literal[regex]"(node) { + const { pattern, flags } = node.regex; + + checkRegex(node, pattern, flags); + }, + Program() { + const scope = context.getScope(), + tracker = new ReferenceTracker(scope), + traceMap = { + RegExp: { + [CALL]: true, + [CONSTRUCT]: true + } + }; + + for (const { node } of tracker.iterateGlobalReferences(traceMap)) { + const [patternNode, flagsNode] = node.arguments, + pattern = getStringIfConstant(patternNode, scope), + flags = getStringIfConstant(flagsNode, scope); + + if (typeof pattern === "string") { + checkRegex(node, pattern, flags || ""); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-call.js b/node_modules/eslint/lib/rules/no-useless-call.js new file mode 100644 index 0000000..8c57cd5 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-call.js @@ -0,0 +1,90 @@ +/** + * @fileoverview A rule to disallow unnecessary `.call()` and `.apply()`. + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a node is a `.call()`/`.apply()`. + * @param {ASTNode} node A CallExpression node to check. + * @returns {boolean} Whether or not the node is a `.call()`/`.apply()`. + */ +function isCallOrNonVariadicApply(node) { + const callee = astUtils.skipChainExpression(node.callee); + + return ( + callee.type === "MemberExpression" && + callee.property.type === "Identifier" && + callee.computed === false && + ( + (callee.property.name === "call" && node.arguments.length >= 1) || + (callee.property.name === "apply" && node.arguments.length === 2 && node.arguments[1].type === "ArrayExpression") + ) + ); +} + + +/** + * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.call()`/`.apply()`. + * @param {SourceCode} sourceCode The ESLint source code object. + * @returns {boolean} Whether or not `thisArg` is not changed by `.call()`/`.apply()`. + */ +function isValidThisArg(expectedThis, thisArg, sourceCode) { + if (!expectedThis) { + return astUtils.isNullOrUndefined(thisArg); + } + return astUtils.equalTokens(expectedThis, thisArg, sourceCode); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary calls to `.call()` and `.apply()`", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-call" + }, + + schema: [], + + messages: { + unnecessaryCall: "Unnecessary '.{{name}}()'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + CallExpression(node) { + if (!isCallOrNonVariadicApply(node)) { + return; + } + + const callee = astUtils.skipChainExpression(node.callee); + const applied = astUtils.skipChainExpression(callee.object); + const expectedThis = (applied.type === "MemberExpression") ? applied.object : null; + const thisArg = node.arguments[0]; + + if (isValidThisArg(expectedThis, thisArg, sourceCode)) { + context.report({ node, messageId: "unnecessaryCall", data: { name: callee.property.name } }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-catch.js b/node_modules/eslint/lib/rules/no-useless-catch.js new file mode 100644 index 0000000..325a2e5 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-catch.js @@ -0,0 +1,57 @@ +/** + * @fileoverview Reports useless `catch` clauses that just rethrow their error. + * @author Teddy Katz + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary `catch` clauses", + recommended: true, + url: "https://eslint.org/docs/rules/no-useless-catch" + }, + + schema: [], + + messages: { + unnecessaryCatchClause: "Unnecessary catch clause.", + unnecessaryCatch: "Unnecessary try/catch wrapper." + } + }, + + create(context) { + return { + CatchClause(node) { + if ( + node.param && + node.param.type === "Identifier" && + node.body.body.length && + node.body.body[0].type === "ThrowStatement" && + node.body.body[0].argument.type === "Identifier" && + node.body.body[0].argument.name === node.param.name + ) { + if (node.parent.finalizer) { + context.report({ + node, + messageId: "unnecessaryCatchClause" + }); + } else { + context.report({ + node: node.parent, + messageId: "unnecessaryCatch" + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-computed-key.js b/node_modules/eslint/lib/rules/no-useless-computed-key.js new file mode 100644 index 0000000..7ebbe09 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-computed-key.js @@ -0,0 +1,168 @@ +/** + * @fileoverview Rule to disallow unnecessary computed property keys in object literals + * @author Burak Yigit Kaya + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the computed key syntax is unnecessarily used for the given node. + * In particular, it determines whether removing the square brackets and using the content between them + * directly as the key (e.g. ['foo'] -> 'foo') would produce valid syntax and preserve the same behavior. + * Valid non-computed keys are only: identifiers, number literals and string literals. + * Only literals can preserve the same behavior, with a few exceptions for specific node types: + * Property + * - { ["__proto__"]: foo } defines a property named "__proto__" + * { "__proto__": foo } defines object's prototype + * PropertyDefinition + * - class C { ["constructor"]; } defines an instance field named "constructor" + * class C { "constructor"; } produces a parsing error + * - class C { static ["constructor"]; } defines a static field named "constructor" + * class C { static "constructor"; } produces a parsing error + * - class C { static ["prototype"]; } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"; } produces a parsing error (breaks the whole script) + * MethodDefinition + * - class C { ["constructor"]() {} } defines a prototype method named "constructor" + * class C { "constructor"() {} } defines the constructor + * - class C { static ["prototype"]() {} } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"() {} } produces a parsing error (breaks the whole script) + * @param {ASTNode} node The node to check. It can be `Property`, `PropertyDefinition` or `MethodDefinition`. + * @throws {Error} (Unreachable.) + * @returns {void} `true` if the node has useless computed key. + */ +function hasUselessComputedKey(node) { + if (!node.computed) { + return false; + } + + const { key } = node; + + if (key.type !== "Literal") { + return false; + } + + const { value } = key; + + if (typeof value !== "number" && typeof value !== "string") { + return false; + } + + switch (node.type) { + case "Property": + return value !== "__proto__"; + + case "PropertyDefinition": + if (node.static) { + return value !== "constructor" && value !== "prototype"; + } + + return value !== "constructor"; + + case "MethodDefinition": + if (node.static) { + return value !== "prototype"; + } + + return value !== "constructor"; + + /* istanbul ignore next */ + default: + throw new Error(`Unexpected node type: ${node.type}`); + } + +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary computed property keys in objects and classes", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-computed-key" + }, + + schema: [{ + type: "object", + properties: { + enforceForClassMembers: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + fixable: "code", + + messages: { + unnecessarilyComputedProperty: "Unnecessarily computed property [{{property}}] found." + } + }, + create(context) { + const sourceCode = context.getSourceCode(); + const enforceForClassMembers = context.options[0] && context.options[0].enforceForClassMembers; + + /** + * Reports a given node if it violated this rule. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function check(node) { + if (hasUselessComputedKey(node)) { + const { key } = node; + + context.report({ + node, + messageId: "unnecessarilyComputedProperty", + data: { property: sourceCode.getText(key) }, + fix(fixer) { + const leftSquareBracket = sourceCode.getTokenBefore(key, astUtils.isOpeningBracketToken); + const rightSquareBracket = sourceCode.getTokenAfter(key, astUtils.isClosingBracketToken); + + // If there are comments between the brackets and the property name, don't do a fix. + if (sourceCode.commentsExistBetween(leftSquareBracket, rightSquareBracket)) { + return null; + } + + const tokenBeforeLeftBracket = sourceCode.getTokenBefore(leftSquareBracket); + + // Insert a space before the key to avoid changing identifiers, e.g. ({ get[2]() {} }) to ({ get2() {} }) + const needsSpaceBeforeKey = tokenBeforeLeftBracket.range[1] === leftSquareBracket.range[0] && + !astUtils.canTokensBeAdjacent(tokenBeforeLeftBracket, sourceCode.getFirstToken(key)); + + const replacementKey = (needsSpaceBeforeKey ? " " : "") + key.raw; + + return fixer.replaceTextRange([leftSquareBracket.range[0], rightSquareBracket.range[1]], replacementKey); + } + }); + } + } + + /** + * A no-op function to act as placeholder for checking a node when the `enforceForClassMembers` option is `false`. + * @returns {void} + * @private + */ + function noop() {} + + return { + Property: check, + MethodDefinition: enforceForClassMembers ? check : noop, + PropertyDefinition: enforceForClassMembers ? check : noop + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-concat.js b/node_modules/eslint/lib/rules/no-useless-concat.js new file mode 100644 index 0000000..36ca84f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-concat.js @@ -0,0 +1,115 @@ +/** + * @fileoverview disallow unnecessary concatenation of template strings + * @author Henry Zhu + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given node is a concatenation. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a concatenation. + */ +function isConcatenation(node) { + return node.type === "BinaryExpression" && node.operator === "+"; +} + +/** + * Checks if the given token is a `+` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a `+` token. + */ +function isConcatOperatorToken(token) { + return token.value === "+" && token.type === "Punctuator"; +} + +/** + * Get's the right most node on the left side of a BinaryExpression with + operator. + * @param {ASTNode} node A BinaryExpression node to check. + * @returns {ASTNode} node + */ +function getLeft(node) { + let left = node.left; + + while (isConcatenation(left)) { + left = left.right; + } + return left; +} + +/** + * Get's the left most node on the right side of a BinaryExpression with + operator. + * @param {ASTNode} node A BinaryExpression node to check. + * @returns {ASTNode} node + */ +function getRight(node) { + let right = node.right; + + while (isConcatenation(right)) { + right = right.left; + } + return right; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary concatenation of literals or template literals", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-concat" + }, + + schema: [], + + messages: { + unexpectedConcat: "Unexpected string concatenation of literals." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + BinaryExpression(node) { + + // check if not concatenation + if (node.operator !== "+") { + return; + } + + // account for the `foo + "a" + "b"` case + const left = getLeft(node); + const right = getRight(node); + + if (astUtils.isStringLiteral(left) && + astUtils.isStringLiteral(right) && + astUtils.isTokenOnSameLine(left, right) + ) { + const operatorToken = sourceCode.getFirstTokenBetween(left, right, isConcatOperatorToken); + + context.report({ + node, + loc: operatorToken.loc, + messageId: "unexpectedConcat" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-constructor.js b/node_modules/eslint/lib/rules/no-useless-constructor.js new file mode 100644 index 0000000..6512c8b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-constructor.js @@ -0,0 +1,189 @@ +/** + * @fileoverview Rule to flag the use of redundant constructors in classes. + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether a given array of statements is a single call of `super`. + * @param {ASTNode[]} body An array of statements to check. + * @returns {boolean} `true` if the body is a single call of `super`. + */ +function isSingleSuperCall(body) { + return ( + body.length === 1 && + body[0].type === "ExpressionStatement" && + body[0].expression.type === "CallExpression" && + body[0].expression.callee.type === "Super" + ); +} + +/** + * Checks whether a given node is a pattern which doesn't have any side effects. + * Default parameters and Destructuring parameters can have side effects. + * @param {ASTNode} node A pattern node. + * @returns {boolean} `true` if the node doesn't have any side effects. + */ +function isSimple(node) { + return node.type === "Identifier" || node.type === "RestElement"; +} + +/** + * Checks whether a given array of expressions is `...arguments` or not. + * `super(...arguments)` passes all arguments through. + * @param {ASTNode[]} superArgs An array of expressions to check. + * @returns {boolean} `true` if the superArgs is `...arguments`. + */ +function isSpreadArguments(superArgs) { + return ( + superArgs.length === 1 && + superArgs[0].type === "SpreadElement" && + superArgs[0].argument.type === "Identifier" && + superArgs[0].argument.name === "arguments" + ); +} + +/** + * Checks whether given 2 nodes are identifiers which have the same name or not. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. + * @returns {boolean} `true` if the nodes are identifiers which have the same + * name. + */ +function isValidIdentifierPair(ctorParam, superArg) { + return ( + ctorParam.type === "Identifier" && + superArg.type === "Identifier" && + ctorParam.name === superArg.name + ); +} + +/** + * Checks whether given 2 nodes are a rest/spread pair which has the same values. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. + * @returns {boolean} `true` if the nodes are a rest/spread pair which has the + * same values. + */ +function isValidRestSpreadPair(ctorParam, superArg) { + return ( + ctorParam.type === "RestElement" && + superArg.type === "SpreadElement" && + isValidIdentifierPair(ctorParam.argument, superArg.argument) + ); +} + +/** + * Checks whether given 2 nodes have the same value or not. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. + * @returns {boolean} `true` if the nodes have the same value or not. + */ +function isValidPair(ctorParam, superArg) { + return ( + isValidIdentifierPair(ctorParam, superArg) || + isValidRestSpreadPair(ctorParam, superArg) + ); +} + +/** + * Checks whether the parameters of a constructor and the arguments of `super()` + * have the same values or not. + * @param {ASTNode} ctorParams The parameters of a constructor to check. + * @param {ASTNode} superArgs The arguments of `super()` to check. + * @returns {boolean} `true` if those have the same values. + */ +function isPassingThrough(ctorParams, superArgs) { + if (ctorParams.length !== superArgs.length) { + return false; + } + + for (let i = 0; i < ctorParams.length; ++i) { + if (!isValidPair(ctorParams[i], superArgs[i])) { + return false; + } + } + + return true; +} + +/** + * Checks whether the constructor body is a redundant super call. + * @param {Array} body constructor body content. + * @param {Array} ctorParams The params to check against super call. + * @returns {boolean} true if the constructor body is redundant + */ +function isRedundantSuperCall(body, ctorParams) { + return ( + isSingleSuperCall(body) && + ctorParams.every(isSimple) && + ( + isSpreadArguments(body[0].expression.arguments) || + isPassingThrough(ctorParams, body[0].expression.arguments) + ) + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary constructors", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-constructor" + }, + + schema: [], + + messages: { + noUselessConstructor: "Useless constructor." + } + }, + + create(context) { + + /** + * Checks whether a node is a redundant constructor + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkForConstructor(node) { + if (node.kind !== "constructor") { + return; + } + + /* + * Prevent crashing on parsers which do not require class constructor + * to have a body, e.g. typescript and flow + */ + if (!node.value.body) { + return; + } + + const body = node.value.body.body; + const ctorParams = node.value.params; + const superClass = node.parent.parent.superClass; + + if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) { + context.report({ + node, + messageId: "noUselessConstructor" + }); + } + } + + return { + MethodDefinition: checkForConstructor + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-escape.js b/node_modules/eslint/lib/rules/no-useless-escape.js new file mode 100644 index 0000000..123bc5b --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-escape.js @@ -0,0 +1,254 @@ +/** + * @fileoverview Look for useless escapes in strings and regexes + * @author Onur Temizkan + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Returns the union of two sets. + * @param {Set} setA The first set + * @param {Set} setB The second set + * @returns {Set} The union of the two sets + */ +function union(setA, setB) { + return new Set(function *() { + yield* setA; + yield* setB; + }()); +} + +const VALID_STRING_ESCAPES = union(new Set("\\nrvtbfux"), astUtils.LINEBREAKS); +const REGEX_GENERAL_ESCAPES = new Set("\\bcdDfnpPrsStvwWxu0123456789]"); +const REGEX_NON_CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("^/.$*+?[{}|()Bk")); + +/** + * Parses a regular expression into a list of characters with character class info. + * @param {string} regExpText The raw text used to create the regular expression + * @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. + * @example + * + * parseRegExp("a\\b[cd-]"); + * + * // returns: + * [ + * { text: "a", index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "b", index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "c", index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false }, + * { text: "d", index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false }, + * { text: "-", index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false } + * ]; + * + */ +function parseRegExp(regExpText) { + const charList = []; + + regExpText.split("").reduce((state, char, index) => { + if (!state.escapeNextChar) { + if (char === "\\") { + return Object.assign(state, { escapeNextChar: true }); + } + if (char === "[" && !state.inCharClass) { + return Object.assign(state, { inCharClass: true, startingCharClass: true }); + } + if (char === "]" && state.inCharClass) { + if (charList.length && charList[charList.length - 1].inCharClass) { + charList[charList.length - 1].endsCharClass = true; + } + return Object.assign(state, { inCharClass: false, startingCharClass: false }); + } + } + charList.push({ + text: char, + index, + escaped: state.escapeNextChar, + inCharClass: state.inCharClass, + startsCharClass: state.startingCharClass, + endsCharClass: false + }); + return Object.assign(state, { escapeNextChar: false, startingCharClass: false }); + }, { escapeNextChar: false, inCharClass: false, startingCharClass: false }); + + return charList; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow unnecessary escape characters", + recommended: true, + url: "https://eslint.org/docs/rules/no-useless-escape" + }, + + hasSuggestions: true, + + messages: { + unnecessaryEscape: "Unnecessary escape character: \\{{character}}.", + removeEscape: "Remove the `\\`. This maintains the current functionality.", + escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character." + }, + + schema: [] + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Reports a node + * @param {ASTNode} node The node to report + * @param {number} startOffset The backslash's offset from the start of the node + * @param {string} character The uselessly escaped character (not including the backslash) + * @returns {void} + */ + function report(node, startOffset, character) { + const rangeStart = node.range[0] + startOffset; + const range = [rangeStart, rangeStart + 1]; + const start = sourceCode.getLocFromIndex(rangeStart); + + context.report({ + node, + loc: { + start, + end: { line: start.line, column: start.column + 1 } + }, + messageId: "unnecessaryEscape", + data: { character }, + suggest: [ + { + messageId: "removeEscape", + fix(fixer) { + return fixer.removeRange(range); + } + }, + { + messageId: "escapeBackslash", + fix(fixer) { + return fixer.insertTextBeforeRange(range, "\\"); + } + } + ] + }); + } + + /** + * Checks if the escape character in given string slice is unnecessary. + * @private + * @param {ASTNode} node node to validate. + * @param {string} match string slice to validate. + * @returns {void} + */ + function validateString(node, match) { + const isTemplateElement = node.type === "TemplateElement"; + const escapedChar = match[0][1]; + let isUnnecessaryEscape = !VALID_STRING_ESCAPES.has(escapedChar); + let isQuoteEscape; + + if (isTemplateElement) { + isQuoteEscape = escapedChar === "`"; + + if (escapedChar === "$") { + + // Warn if `\$` is not followed by `{` + isUnnecessaryEscape = match.input[match.index + 2] !== "{"; + } else if (escapedChar === "{") { + + /* + * Warn if `\{` is not preceded by `$`. If preceded by `$`, escaping + * is necessary and the rule should not warn. If preceded by `/$`, the rule + * will warn for the `/$` instead, as it is the first unnecessarily escaped character. + */ + isUnnecessaryEscape = match.input[match.index - 1] !== "$"; + } + } else { + isQuoteEscape = escapedChar === node.raw[0]; + } + + if (isUnnecessaryEscape && !isQuoteEscape) { + report(node, match.index, match[0].slice(1)); + } + } + + /** + * Checks if a node has an escape. + * @param {ASTNode} node node to check. + * @returns {void} + */ + function check(node) { + const isTemplateElement = node.type === "TemplateElement"; + + if ( + isTemplateElement && + node.parent && + node.parent.parent && + node.parent.parent.type === "TaggedTemplateExpression" && + node.parent === node.parent.parent.quasi + ) { + + // Don't report tagged template literals, because the backslash character is accessible to the tag function. + return; + } + + if (typeof node.value === "string" || isTemplateElement) { + + /* + * JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/. + * In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25. + */ + if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") { + return; + } + + const value = isTemplateElement ? sourceCode.getText(node) : node.raw; + const pattern = /\\[^\d]/gu; + let match; + + while ((match = pattern.exec(value))) { + validateString(node, match); + } + } else if (node.regex) { + parseRegExp(node.regex.pattern) + + /* + * The '-' character is a special case, because it's only valid to escape it if it's in a character + * class, and is not at either edge of the character class. To account for this, don't consider '-' + * characters to be valid in general, and filter out '-' characters that appear in the middle of a + * character class. + */ + .filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass)) + + /* + * The '^' character is also a special case; it must always be escaped outside of character classes, but + * it only needs to be escaped in character classes if it's at the beginning of the character class. To + * account for this, consider it to be a valid escape character outside of character classes, and filter + * out '^' characters that appear at the start of a character class. + */ + .filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass)) + + // Filter out characters that aren't escaped. + .filter(charInfo => charInfo.escaped) + + // Filter out characters that are valid to escape, based on their position in the regular expression. + .filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text)) + + // Report all the remaining characters. + .forEach(charInfo => report(node, charInfo.index, charInfo.text)); + } + + } + + return { + Literal: check, + TemplateElement: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-rename.js b/node_modules/eslint/lib/rules/no-useless-rename.js new file mode 100644 index 0000000..2489f57 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-rename.js @@ -0,0 +1,172 @@ +/** + * @fileoverview Disallow renaming import, export, and destructured assignments to the same name. + * @author Kai Cataldo + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow renaming import, export, and destructured assignments to the same name", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-rename" + }, + + fixable: "code", + + schema: [ + { + type: "object", + properties: { + ignoreDestructuring: { type: "boolean", default: false }, + ignoreImport: { type: "boolean", default: false }, + ignoreExport: { type: "boolean", default: false } + }, + additionalProperties: false + } + ], + + messages: { + unnecessarilyRenamed: "{{type}} {{name}} unnecessarily renamed." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(), + options = context.options[0] || {}, + ignoreDestructuring = options.ignoreDestructuring === true, + ignoreImport = options.ignoreImport === true, + ignoreExport = options.ignoreExport === true; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports error for unnecessarily renamed assignments + * @param {ASTNode} node node to report + * @param {ASTNode} initial node with initial name value + * @param {string} type the type of the offending node + * @returns {void} + */ + function reportError(node, initial, type) { + const name = initial.type === "Identifier" ? initial.name : initial.value; + + return context.report({ + node, + messageId: "unnecessarilyRenamed", + data: { + name, + type + }, + fix(fixer) { + const replacementNode = node.type === "Property" ? node.value : node.local; + + if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(replacementNode).length) { + return null; + } + + // Don't autofix code such as `({foo: (foo) = a} = obj);`, parens are not allowed in shorthand properties. + if ( + replacementNode.type === "AssignmentPattern" && + astUtils.isParenthesised(sourceCode, replacementNode.left) + ) { + return null; + } + + return fixer.replaceText(node, sourceCode.getText(replacementNode)); + } + }); + } + + /** + * Checks whether a destructured assignment is unnecessarily renamed + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkDestructured(node) { + if (ignoreDestructuring) { + return; + } + + for (const property of node.properties) { + + /** + * Properties using shorthand syntax and rest elements can not be renamed. + * If the property is computed, we have no idea if a rename is useless or not. + */ + if (property.type !== "Property" || property.shorthand || property.computed) { + continue; + } + + const key = (property.key.type === "Identifier" && property.key.name) || (property.key.type === "Literal" && property.key.value); + const renamedKey = property.value.type === "AssignmentPattern" ? property.value.left.name : property.value.name; + + if (key === renamedKey) { + reportError(property, property.key, "Destructuring assignment"); + } + } + } + + /** + * Checks whether an import is unnecessarily renamed + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkImport(node) { + if (ignoreImport) { + return; + } + + if ( + node.imported.range[0] !== node.local.range[0] && + astUtils.getModuleExportName(node.imported) === node.local.name + ) { + reportError(node, node.imported, "Import"); + } + } + + /** + * Checks whether an export is unnecessarily renamed + * @param {ASTNode} node node to check + * @returns {void} + */ + function checkExport(node) { + if (ignoreExport) { + return; + } + + if ( + node.local.range[0] !== node.exported.range[0] && + astUtils.getModuleExportName(node.local) === astUtils.getModuleExportName(node.exported) + ) { + reportError(node, node.local, "Export"); + } + + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ObjectPattern: checkDestructured, + ImportSpecifier: checkImport, + ExportSpecifier: checkExport + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-useless-return.js b/node_modules/eslint/lib/rules/no-useless-return.js new file mode 100644 index 0000000..0baa6b2 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-useless-return.js @@ -0,0 +1,305 @@ +/** + * @fileoverview Disallow redundant return statements + * @author Teddy Katz + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"), + FixTracker = require("./utils/fix-tracker"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Removes the given element from the array. + * @param {Array} array The source array to remove. + * @param {any} element The target item to remove. + * @returns {void} + */ +function remove(array, element) { + const index = array.indexOf(element); + + if (index !== -1) { + array.splice(index, 1); + } +} + +/** + * Checks whether it can remove the given return statement or not. + * @param {ASTNode} node The return statement node to check. + * @returns {boolean} `true` if the node is removable. + */ +function isRemovable(node) { + return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type); +} + +/** + * Checks whether the given return statement is in a `finally` block or not. + * @param {ASTNode} node The return statement node to check. + * @returns {boolean} `true` if the node is in a `finally` block. + */ +function isInFinally(node) { + for ( + let currentNode = node; + currentNode && currentNode.parent && !astUtils.isFunction(currentNode); + currentNode = currentNode.parent + ) { + if (currentNode.parent.type === "TryStatement" && currentNode.parent.finalizer === currentNode) { + return true; + } + } + + return false; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow redundant return statements", + recommended: false, + url: "https://eslint.org/docs/rules/no-useless-return" + }, + + fixable: "code", + schema: [], + + messages: { + unnecessaryReturn: "Unnecessary return statement." + } + }, + + create(context) { + const segmentInfoMap = new WeakMap(); + const usedUnreachableSegments = new WeakSet(); + const sourceCode = context.getSourceCode(); + let scopeInfo = null; + + /** + * Checks whether the given segment is terminated by a return statement or not. + * @param {CodePathSegment} segment The segment to check. + * @returns {boolean} `true` if the segment is terminated by a return statement, or if it's still a part of unreachable. + */ + function isReturned(segment) { + const info = segmentInfoMap.get(segment); + + return !info || info.returned; + } + + /** + * Collects useless return statements from the given previous segments. + * + * A previous segment may be an unreachable segment. + * In that case, the information object of the unreachable segment is not + * initialized because `onCodePathSegmentStart` event is not notified for + * unreachable segments. + * This goes to the previous segments of the unreachable segment recursively + * if the unreachable segment was generated by a return statement. Otherwise, + * this ignores the unreachable segment. + * + * This behavior would simulate code paths for the case that the return + * statement does not exist. + * @param {ASTNode[]} uselessReturns The collected return statements. + * @param {CodePathSegment[]} prevSegments The previous segments to traverse. + * @param {WeakSet} [providedTraversedSegments] A set of segments that have already been traversed in this call + * @returns {ASTNode[]} `uselessReturns`. + */ + function getUselessReturns(uselessReturns, prevSegments, providedTraversedSegments) { + const traversedSegments = providedTraversedSegments || new WeakSet(); + + for (const segment of prevSegments) { + if (!segment.reachable) { + if (!traversedSegments.has(segment)) { + traversedSegments.add(segment); + getUselessReturns( + uselessReturns, + segment.allPrevSegments.filter(isReturned), + traversedSegments + ); + } + continue; + } + + uselessReturns.push(...segmentInfoMap.get(segment).uselessReturns); + } + + return uselessReturns; + } + + /** + * Removes the return statements on the given segment from the useless return + * statement list. + * + * This segment may be an unreachable segment. + * In that case, the information object of the unreachable segment is not + * initialized because `onCodePathSegmentStart` event is not notified for + * unreachable segments. + * This goes to the previous segments of the unreachable segment recursively + * if the unreachable segment was generated by a return statement. Otherwise, + * this ignores the unreachable segment. + * + * This behavior would simulate code paths for the case that the return + * statement does not exist. + * @param {CodePathSegment} segment The segment to get return statements. + * @returns {void} + */ + function markReturnStatementsOnSegmentAsUsed(segment) { + if (!segment.reachable) { + usedUnreachableSegments.add(segment); + segment.allPrevSegments + .filter(isReturned) + .filter(prevSegment => !usedUnreachableSegments.has(prevSegment)) + .forEach(markReturnStatementsOnSegmentAsUsed); + return; + } + + const info = segmentInfoMap.get(segment); + + for (const node of info.uselessReturns) { + remove(scopeInfo.uselessReturns, node); + } + info.uselessReturns = []; + } + + /** + * Removes the return statements on the current segments from the useless + * return statement list. + * + * This function will be called at every statement except FunctionDeclaration, + * BlockStatement, and BreakStatement. + * + * - FunctionDeclarations are always executed whether it's returned or not. + * - BlockStatements do nothing. + * - BreakStatements go the next merely. + * @returns {void} + */ + function markReturnStatementsOnCurrentSegmentsAsUsed() { + scopeInfo + .codePath + .currentSegments + .forEach(markReturnStatementsOnSegmentAsUsed); + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + + // Makes and pushs a new scope information. + onCodePathStart(codePath) { + scopeInfo = { + upper: scopeInfo, + uselessReturns: [], + codePath + }; + }, + + // Reports useless return statements if exist. + onCodePathEnd() { + for (const node of scopeInfo.uselessReturns) { + context.report({ + node, + loc: node.loc, + messageId: "unnecessaryReturn", + fix(fixer) { + if (isRemovable(node) && !sourceCode.getCommentsInside(node).length) { + + /* + * Extend the replacement range to include the + * entire function to avoid conflicting with + * no-else-return. + * https://github.com/eslint/eslint/issues/8026 + */ + return new FixTracker(fixer, sourceCode) + .retainEnclosingFunction(node) + .remove(node); + } + return null; + } + }); + } + + scopeInfo = scopeInfo.upper; + }, + + /* + * Initializes segments. + * NOTE: This event is notified for only reachable segments. + */ + onCodePathSegmentStart(segment) { + const info = { + uselessReturns: getUselessReturns([], segment.allPrevSegments), + returned: false + }; + + // Stores the info. + segmentInfoMap.set(segment, info); + }, + + // Adds ReturnStatement node to check whether it's useless or not. + ReturnStatement(node) { + if (node.argument) { + markReturnStatementsOnCurrentSegmentsAsUsed(); + } + if ( + node.argument || + astUtils.isInLoop(node) || + isInFinally(node) || + + // Ignore `return` statements in unreachable places (https://github.com/eslint/eslint/issues/11647). + !scopeInfo.codePath.currentSegments.some(s => s.reachable) + ) { + return; + } + + for (const segment of scopeInfo.codePath.currentSegments) { + const info = segmentInfoMap.get(segment); + + if (info) { + info.uselessReturns.push(node); + info.returned = true; + } + } + scopeInfo.uselessReturns.push(node); + }, + + /* + * Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement. + * Removes return statements of the current segments from the useless return statement list. + */ + ClassDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, + ContinueStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + DebuggerStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + DoWhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + EmptyStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ExpressionStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ForInStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ForOfStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ForStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + IfStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ImportDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, + LabeledStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + SwitchStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ThrowStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + TryStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + VariableDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, + WhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + WithStatement: markReturnStatementsOnCurrentSegmentsAsUsed, + ExportNamedDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, + ExportDefaultDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, + ExportAllDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-var.js b/node_modules/eslint/lib/rules/no-var.js new file mode 100644 index 0000000..83a1f62 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-var.js @@ -0,0 +1,334 @@ +/** + * @fileoverview Rule to check for the usage of var. + * @author Jamund Ferguson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Check whether a given variable is a global variable or not. + * @param {eslint-scope.Variable} variable The variable to check. + * @returns {boolean} `true` if the variable is a global variable. + */ +function isGlobal(variable) { + return Boolean(variable.scope) && variable.scope.type === "global"; +} + +/** + * Finds the nearest function scope or global scope walking up the scope + * hierarchy. + * @param {eslint-scope.Scope} scope The scope to traverse. + * @returns {eslint-scope.Scope} a function scope or global scope containing the given + * scope. + */ +function getEnclosingFunctionScope(scope) { + let currentScope = scope; + + while (currentScope.type !== "function" && currentScope.type !== "global") { + currentScope = currentScope.upper; + } + return currentScope; +} + +/** + * Checks whether the given variable has any references from a more specific + * function expression (i.e. a closure). + * @param {eslint-scope.Variable} variable A variable to check. + * @returns {boolean} `true` if the variable is used from a closure. + */ +function isReferencedInClosure(variable) { + const enclosingFunctionScope = getEnclosingFunctionScope(variable.scope); + + return variable.references.some(reference => + getEnclosingFunctionScope(reference.from) !== enclosingFunctionScope); +} + +/** + * Checks whether the given node is the assignee of a loop. + * @param {ASTNode} node A VariableDeclaration node to check. + * @returns {boolean} `true` if the declaration is assigned as part of loop + * iteration. + */ +function isLoopAssignee(node) { + return (node.parent.type === "ForOfStatement" || node.parent.type === "ForInStatement") && + node === node.parent.left; +} + +/** + * Checks whether the given variable declaration is immediately initialized. + * @param {ASTNode} node A VariableDeclaration node to check. + * @returns {boolean} `true` if the declaration has an initializer. + */ +function isDeclarationInitialized(node) { + return node.declarations.every(declarator => declarator.init !== null); +} + +const SCOPE_NODE_TYPE = /^(?:Program|BlockStatement|SwitchStatement|ForStatement|ForInStatement|ForOfStatement)$/u; + +/** + * Gets the scope node which directly contains a given node. + * @param {ASTNode} node A node to get. This is a `VariableDeclaration` or + * an `Identifier`. + * @returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`, + * `SwitchStatement`, `ForStatement`, `ForInStatement`, and + * `ForOfStatement`. + */ +function getScopeNode(node) { + for (let currentNode = node; currentNode; currentNode = currentNode.parent) { + if (SCOPE_NODE_TYPE.test(currentNode.type)) { + return currentNode; + } + } + + /* istanbul ignore next : unreachable */ + return null; +} + +/** + * Checks whether a given variable is redeclared or not. + * @param {eslint-scope.Variable} variable A variable to check. + * @returns {boolean} `true` if the variable is redeclared. + */ +function isRedeclared(variable) { + return variable.defs.length >= 2; +} + +/** + * Checks whether a given variable is used from outside of the specified scope. + * @param {ASTNode} scopeNode A scope node to check. + * @returns {Function} The predicate function which checks whether a given + * variable is used from outside of the specified scope. + */ +function isUsedFromOutsideOf(scopeNode) { + + /** + * Checks whether a given reference is inside of the specified scope or not. + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is inside of the specified + * scope. + */ + function isOutsideOfScope(reference) { + const scope = scopeNode.range; + const id = reference.identifier.range; + + return id[0] < scope[0] || id[1] > scope[1]; + } + + return function(variable) { + return variable.references.some(isOutsideOfScope); + }; +} + +/** + * Creates the predicate function which checks whether a variable has their references in TDZ. + * + * The predicate function would return `true`: + * + * - if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};) + * - if a reference is in the expression of their default value. E.g. (var {a = a} = {};) + * - if a reference is in the expression of their initializer. E.g. (var a = a;) + * @param {ASTNode} node The initializer node of VariableDeclarator. + * @returns {Function} The predicate function. + * @private + */ +function hasReferenceInTDZ(node) { + const initStart = node.range[0]; + const initEnd = node.range[1]; + + return variable => { + const id = variable.defs[0].name; + const idStart = id.range[0]; + const defaultValue = (id.parent.type === "AssignmentPattern" ? id.parent.right : null); + const defaultStart = defaultValue && defaultValue.range[0]; + const defaultEnd = defaultValue && defaultValue.range[1]; + + return variable.references.some(reference => { + const start = reference.identifier.range[0]; + const end = reference.identifier.range[1]; + + return !reference.init && ( + start < idStart || + (defaultValue !== null && start >= defaultStart && end <= defaultEnd) || + (start >= initStart && end <= initEnd) + ); + }); + }; +} + +/** + * Checks whether a given variable has name that is allowed for 'var' declarations, + * but disallowed for `let` declarations. + * @param {eslint-scope.Variable} variable The variable to check. + * @returns {boolean} `true` if the variable has a disallowed name. + */ +function hasNameDisallowedForLetDeclarations(variable) { + return variable.name === "let"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `let` or `const` instead of `var`", + recommended: false, + url: "https://eslint.org/docs/rules/no-var" + }, + + schema: [], + fixable: "code", + + messages: { + unexpectedVar: "Unexpected var, use let or const instead." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Checks whether the variables which are defined by the given declarator node have their references in TDZ. + * @param {ASTNode} declarator The VariableDeclarator node to check. + * @returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ. + */ + function hasSelfReferenceInTDZ(declarator) { + if (!declarator.init) { + return false; + } + const variables = context.getDeclaredVariables(declarator); + + return variables.some(hasReferenceInTDZ(declarator.init)); + } + + /** + * Checks whether it can fix a given variable declaration or not. + * It cannot fix if the following cases: + * + * - A variable is a global variable. + * - A variable is declared on a SwitchCase node. + * - A variable is redeclared. + * - A variable is used from outside the scope. + * - A variable is used from a closure within a loop. + * - A variable might be used before it is assigned within a loop. + * - A variable might be used in TDZ. + * - A variable is declared in statement position (e.g. a single-line `IfStatement`) + * - A variable has name that is disallowed for `let` declarations. + * + * ## A variable is declared on a SwitchCase node. + * + * If this rule modifies 'var' declarations on a SwitchCase node, it + * would generate the warnings of 'no-case-declarations' rule. And the + * 'eslint:recommended' preset includes 'no-case-declarations' rule, so + * this rule doesn't modify those declarations. + * + * ## A variable is redeclared. + * + * The language spec disallows redeclarations of `let` declarations. + * Those variables would cause syntax errors. + * + * ## A variable is used from outside the scope. + * + * The language spec disallows accesses from outside of the scope for + * `let` declarations. Those variables would cause reference errors. + * + * ## A variable is used from a closure within a loop. + * + * A `var` declaration within a loop shares the same variable instance + * across all loop iterations, while a `let` declaration creates a new + * instance for each iteration. This means if a variable in a loop is + * referenced by any closure, changing it from `var` to `let` would + * change the behavior in a way that is generally unsafe. + * + * ## A variable might be used before it is assigned within a loop. + * + * Within a loop, a `let` declaration without an initializer will be + * initialized to null, while a `var` declaration will retain its value + * from the previous iteration, so it is only safe to change `var` to + * `let` if we can statically determine that the variable is always + * assigned a value before its first access in the loop body. To keep + * the implementation simple, we only convert `var` to `let` within + * loops when the variable is a loop assignee or the declaration has an + * initializer. + * @param {ASTNode} node A variable declaration node to check. + * @returns {boolean} `true` if it can fix the node. + */ + function canFix(node) { + const variables = context.getDeclaredVariables(node); + const scopeNode = getScopeNode(node); + + if (node.parent.type === "SwitchCase" || + node.declarations.some(hasSelfReferenceInTDZ) || + variables.some(isGlobal) || + variables.some(isRedeclared) || + variables.some(isUsedFromOutsideOf(scopeNode)) || + variables.some(hasNameDisallowedForLetDeclarations) + ) { + return false; + } + + if (astUtils.isInLoop(node)) { + if (variables.some(isReferencedInClosure)) { + return false; + } + if (!isLoopAssignee(node) && !isDeclarationInitialized(node)) { + return false; + } + } + + if ( + !isLoopAssignee(node) && + !(node.parent.type === "ForStatement" && node.parent.init === node) && + !astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type) + ) { + + // If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed. + return false; + } + + return true; + } + + /** + * Reports a given variable declaration node. + * @param {ASTNode} node A variable declaration node to report. + * @returns {void} + */ + function report(node) { + context.report({ + node, + messageId: "unexpectedVar", + + fix(fixer) { + const varToken = sourceCode.getFirstToken(node, { filter: t => t.value === "var" }); + + return canFix(node) + ? fixer.replaceText(varToken, "let") + : null; + } + }); + } + + return { + "VariableDeclaration:exit"(node) { + if (node.kind === "var") { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-void.js b/node_modules/eslint/lib/rules/no-void.js new file mode 100644 index 0000000..8631caf --- /dev/null +++ b/node_modules/eslint/lib/rules/no-void.js @@ -0,0 +1,64 @@ +/** + * @fileoverview Rule to disallow use of void operator. + * @author Mike Sidorov + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `void` operators", + recommended: false, + url: "https://eslint.org/docs/rules/no-void" + }, + + messages: { + noVoid: "Expected 'undefined' and instead saw 'void'." + }, + + schema: [ + { + type: "object", + properties: { + allowAsStatement: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ] + }, + + create(context) { + const allowAsStatement = + context.options[0] && context.options[0].allowAsStatement; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + 'UnaryExpression[operator="void"]'(node) { + if ( + allowAsStatement && + node.parent && + node.parent.type === "ExpressionStatement" + ) { + return; + } + context.report({ + node, + messageId: "noVoid" + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-warning-comments.js b/node_modules/eslint/lib/rules/no-warning-comments.js new file mode 100644 index 0000000..5f3ea21 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-warning-comments.js @@ -0,0 +1,196 @@ +/** + * @fileoverview Rule that warns about used warning comments + * @author Alexander Schmidt + */ + +"use strict"; + +const escapeRegExp = require("escape-string-regexp"); +const astUtils = require("./utils/ast-utils"); + +const CHAR_LIMIT = 40; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow specified warning terms in comments", + recommended: false, + url: "https://eslint.org/docs/rules/no-warning-comments" + }, + + schema: [ + { + type: "object", + properties: { + terms: { + type: "array", + items: { + type: "string" + } + }, + location: { + enum: ["start", "anywhere"] + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedComment: "Unexpected '{{matchedTerm}}' comment: '{{comment}}'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(), + configuration = context.options[0] || {}, + warningTerms = configuration.terms || ["todo", "fixme", "xxx"], + location = configuration.location || "start", + selfConfigRegEx = /\bno-warning-comments\b/u; + + /** + * Convert a warning term into a RegExp which will match a comment containing that whole word in the specified + * location ("start" or "anywhere"). If the term starts or ends with non word characters, then the match will not + * require word boundaries on that side. + * @param {string} term A term to convert to a RegExp + * @returns {RegExp} The term converted to a RegExp + */ + function convertToRegExp(term) { + const escaped = escapeRegExp(term); + const wordBoundary = "\\b"; + const eitherOrWordBoundary = `|${wordBoundary}`; + let prefix; + + /* + * If the term ends in a word character (a-z0-9_), ensure a word + * boundary at the end, so that substrings do not get falsely + * matched. eg "todo" in a string such as "mastodon". + * If the term ends in a non-word character, then \b won't match on + * the boundary to the next non-word character, which would likely + * be a space. For example `/\bFIX!\b/.test('FIX! blah') === false`. + * In these cases, use no bounding match. Same applies for the + * prefix, handled below. + */ + const suffix = /\w$/u.test(term) ? "\\b" : ""; + + if (location === "start") { + + /* + * When matching at the start, ignore leading whitespace, and + * there's no need to worry about word boundaries. + */ + prefix = "^\\s*"; + } else if (/^\w/u.test(term)) { + prefix = wordBoundary; + } else { + prefix = ""; + } + + if (location === "start") { + + /* + * For location "start" the regex should be + * ^\s*TERM\b. This checks the word boundary + * at the beginning of the comment. + */ + return new RegExp(prefix + escaped + suffix, "iu"); + } + + /* + * For location "anywhere" the regex should be + * \bTERM\b|\bTERM\b, this checks the entire comment + * for the term. + */ + return new RegExp( + prefix + + escaped + + suffix + + eitherOrWordBoundary + + term + + wordBoundary, + "iu" + ); + } + + const warningRegExps = warningTerms.map(convertToRegExp); + + /** + * Checks the specified comment for matches of the configured warning terms and returns the matches. + * @param {string} comment The comment which is checked. + * @returns {Array} All matched warning terms for this comment. + */ + function commentContainsWarningTerm(comment) { + const matches = []; + + warningRegExps.forEach((regex, index) => { + if (regex.test(comment)) { + matches.push(warningTerms[index]); + } + }); + + return matches; + } + + /** + * Checks the specified node for matching warning comments and reports them. + * @param {ASTNode} node The AST node being checked. + * @returns {void} undefined. + */ + function checkComment(node) { + const comment = node.value; + + if ( + astUtils.isDirectiveComment(node) && + selfConfigRegEx.test(comment) + ) { + return; + } + + const matches = commentContainsWarningTerm(comment); + + matches.forEach(matchedTerm => { + let commentToDisplay = ""; + let truncated = false; + + for (const c of comment.trim().split(/\s+/u)) { + const tmp = commentToDisplay ? `${commentToDisplay} ${c}` : c; + + if (tmp.length <= CHAR_LIMIT) { + commentToDisplay = tmp; + } else { + truncated = true; + break; + } + } + + context.report({ + node, + messageId: "unexpectedComment", + data: { + matchedTerm, + comment: `${commentToDisplay}${ + truncated ? "..." : "" + }` + } + }); + }); + } + + return { + Program() { + const comments = sourceCode.getAllComments(); + + comments + .filter(token => token.type !== "Shebang") + .forEach(checkComment); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-whitespace-before-property.js b/node_modules/eslint/lib/rules/no-whitespace-before-property.js new file mode 100644 index 0000000..95e920f --- /dev/null +++ b/node_modules/eslint/lib/rules/no-whitespace-before-property.js @@ -0,0 +1,113 @@ +/** + * @fileoverview Rule to disallow whitespace before properties + * @author Kai Cataldo + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "disallow whitespace before properties", + recommended: false, + url: "https://eslint.org/docs/rules/no-whitespace-before-property" + }, + + fixable: "whitespace", + schema: [], + + messages: { + unexpectedWhitespace: "Unexpected whitespace before property {{propName}}." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports whitespace before property token + * @param {ASTNode} node the node to report in the event of an error + * @param {Token} leftToken the left token + * @param {Token} rightToken the right token + * @returns {void} + * @private + */ + function reportError(node, leftToken, rightToken) { + context.report({ + node, + messageId: "unexpectedWhitespace", + data: { + propName: sourceCode.getText(node.property) + }, + fix(fixer) { + let replacementText = ""; + + if (!node.computed && !node.optional && astUtils.isDecimalInteger(node.object)) { + + /* + * If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError. + * Don't fix this case. + */ + return null; + } + + // Don't fix if comments exist. + if (sourceCode.commentsExistBetween(leftToken, rightToken)) { + return null; + } + + if (node.optional) { + replacementText = "?."; + } else if (!node.computed) { + replacementText = "."; + } + + return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], replacementText); + } + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + MemberExpression(node) { + let rightToken; + let leftToken; + + if (!astUtils.isTokenOnSameLine(node.object, node.property)) { + return; + } + + if (node.computed) { + rightToken = sourceCode.getTokenBefore(node.property, astUtils.isOpeningBracketToken); + leftToken = sourceCode.getTokenBefore(rightToken, node.optional ? 1 : 0); + } else { + rightToken = sourceCode.getFirstToken(node.property); + leftToken = sourceCode.getTokenBefore(rightToken, 1); + } + + if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken)) { + reportError(node, leftToken, rightToken); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/no-with.js b/node_modules/eslint/lib/rules/no-with.js new file mode 100644 index 0000000..fc93f19 --- /dev/null +++ b/node_modules/eslint/lib/rules/no-with.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Rule to flag use of with statement + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `with` statements", + recommended: true, + url: "https://eslint.org/docs/rules/no-with" + }, + + schema: [], + + messages: { + unexpectedWith: "Unexpected use of 'with' statement." + } + }, + + create(context) { + + return { + WithStatement(node) { + context.report({ node, messageId: "unexpectedWith" }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/nonblock-statement-body-position.js b/node_modules/eslint/lib/rules/nonblock-statement-body-position.js new file mode 100644 index 0000000..c177cf3 --- /dev/null +++ b/node_modules/eslint/lib/rules/nonblock-statement-body-position.js @@ -0,0 +1,124 @@ +/** + * @fileoverview enforce the location of single-line statements + * @author Teddy Katz + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const POSITION_SCHEMA = { enum: ["beside", "below", "any"] }; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce the location of single-line statements", + recommended: false, + url: "https://eslint.org/docs/rules/nonblock-statement-body-position" + }, + + fixable: "whitespace", + + schema: [ + POSITION_SCHEMA, + { + properties: { + overrides: { + properties: { + if: POSITION_SCHEMA, + else: POSITION_SCHEMA, + while: POSITION_SCHEMA, + do: POSITION_SCHEMA, + for: POSITION_SCHEMA + }, + additionalProperties: false + } + }, + additionalProperties: false + } + ], + + messages: { + expectNoLinebreak: "Expected no linebreak before this statement.", + expectLinebreak: "Expected a linebreak before this statement." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Gets the applicable preference for a particular keyword + * @param {string} keywordName The name of a keyword, e.g. 'if' + * @returns {string} The applicable option for the keyword, e.g. 'beside' + */ + function getOption(keywordName) { + return context.options[1] && context.options[1].overrides && context.options[1].overrides[keywordName] || + context.options[0] || + "beside"; + } + + /** + * Validates the location of a single-line statement + * @param {ASTNode} node The single-line statement + * @param {string} keywordName The applicable keyword name for the single-line statement + * @returns {void} + */ + function validateStatement(node, keywordName) { + const option = getOption(keywordName); + + if (node.type === "BlockStatement" || option === "any") { + return; + } + + const tokenBefore = sourceCode.getTokenBefore(node); + + if (tokenBefore.loc.end.line === node.loc.start.line && option === "below") { + context.report({ + node, + messageId: "expectLinebreak", + fix: fixer => fixer.insertTextBefore(node, "\n") + }); + } else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") { + context.report({ + node, + messageId: "expectNoLinebreak", + fix(fixer) { + if (sourceCode.getText().slice(tokenBefore.range[1], node.range[0]).trim()) { + return null; + } + return fixer.replaceTextRange([tokenBefore.range[1], node.range[0]], " "); + } + }); + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + IfStatement(node) { + validateStatement(node.consequent, "if"); + + // Check the `else` node, but don't check 'else if' statements. + if (node.alternate && node.alternate.type !== "IfStatement") { + validateStatement(node.alternate, "else"); + } + }, + WhileStatement: node => validateStatement(node.body, "while"), + DoWhileStatement: node => validateStatement(node.body, "do"), + ForStatement: node => validateStatement(node.body, "for"), + ForInStatement: node => validateStatement(node.body, "for"), + ForOfStatement: node => validateStatement(node.body, "for") + }; + } +}; diff --git a/node_modules/eslint/lib/rules/object-curly-newline.js b/node_modules/eslint/lib/rules/object-curly-newline.js new file mode 100644 index 0000000..e052cd8 --- /dev/null +++ b/node_modules/eslint/lib/rules/object-curly-newline.js @@ -0,0 +1,321 @@ +/** + * @fileoverview Rule to require or disallow line breaks inside braces. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Schema objects. +const OPTION_VALUE = { + oneOf: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + multiline: { + type: "boolean" + }, + minProperties: { + type: "integer", + minimum: 0 + }, + consistent: { + type: "boolean" + } + }, + additionalProperties: false, + minProperties: 1 + } + ] +}; + +/** + * Normalizes a given option value. + * @param {string|Object|undefined} value An option value to parse. + * @returns {{multiline: boolean, minProperties: number, consistent: boolean}} Normalized option object. + */ +function normalizeOptionValue(value) { + let multiline = false; + let minProperties = Number.POSITIVE_INFINITY; + let consistent = false; + + if (value) { + if (value === "always") { + minProperties = 0; + } else if (value === "never") { + minProperties = Number.POSITIVE_INFINITY; + } else { + multiline = Boolean(value.multiline); + minProperties = value.minProperties || Number.POSITIVE_INFINITY; + consistent = Boolean(value.consistent); + } + } else { + consistent = true; + } + + return { multiline, minProperties, consistent }; +} + +/** + * Checks if a value is an object. + * @param {any} value The value to check + * @returns {boolean} `true` if the value is an object, otherwise `false` + */ +function isObject(value) { + return typeof value === "object" && value !== null; +} + +/** + * Checks if an option is a node-specific option + * @param {any} option The option to check + * @returns {boolean} `true` if the option is node-specific, otherwise `false` + */ +function isNodeSpecificOption(option) { + return isObject(option) || typeof option === "string"; +} + +/** + * Normalizes a given option value. + * @param {string|Object|undefined} options An option value to parse. + * @returns {{ + * ObjectExpression: {multiline: boolean, minProperties: number, consistent: boolean}, + * ObjectPattern: {multiline: boolean, minProperties: number, consistent: boolean}, + * ImportDeclaration: {multiline: boolean, minProperties: number, consistent: boolean}, + * ExportNamedDeclaration : {multiline: boolean, minProperties: number, consistent: boolean} + * }} Normalized option object. + */ +function normalizeOptions(options) { + if (isObject(options) && Object.values(options).some(isNodeSpecificOption)) { + return { + ObjectExpression: normalizeOptionValue(options.ObjectExpression), + ObjectPattern: normalizeOptionValue(options.ObjectPattern), + ImportDeclaration: normalizeOptionValue(options.ImportDeclaration), + ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration) + }; + } + + const value = normalizeOptionValue(options); + + return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value }; +} + +/** + * Determines if ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration + * node needs to be checked for missing line breaks + * @param {ASTNode} node Node under inspection + * @param {Object} options option specific to node type + * @param {Token} first First object property + * @param {Token} last Last object property + * @returns {boolean} `true` if node needs to be checked for missing line breaks + */ +function areLineBreaksRequired(node, options, first, last) { + let objectProperties; + + if (node.type === "ObjectExpression" || node.type === "ObjectPattern") { + objectProperties = node.properties; + } else { + + // is ImportDeclaration or ExportNamedDeclaration + objectProperties = node.specifiers + .filter(s => s.type === "ImportSpecifier" || s.type === "ExportSpecifier"); + } + + return objectProperties.length >= options.minProperties || + ( + options.multiline && + objectProperties.length > 0 && + first.loc.start.line !== last.loc.end.line + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent line breaks after opening and before closing braces", + recommended: false, + url: "https://eslint.org/docs/rules/object-curly-newline" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + OPTION_VALUE, + { + type: "object", + properties: { + ObjectExpression: OPTION_VALUE, + ObjectPattern: OPTION_VALUE, + ImportDeclaration: OPTION_VALUE, + ExportDeclaration: OPTION_VALUE + }, + additionalProperties: false, + minProperties: 1 + } + ] + } + ], + + messages: { + unexpectedLinebreakBeforeClosingBrace: "Unexpected line break before this closing brace.", + unexpectedLinebreakAfterOpeningBrace: "Unexpected line break after this opening brace.", + expectedLinebreakBeforeClosingBrace: "Expected a line break before this closing brace.", + expectedLinebreakAfterOpeningBrace: "Expected a line break after this opening brace." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const normalizedOptions = normalizeOptions(context.options[0]); + + /** + * Reports a given node if it violated this rule. + * @param {ASTNode} node A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. + * @returns {void} + */ + function check(node) { + const options = normalizedOptions[node.type]; + + if ( + (node.type === "ImportDeclaration" && + !node.specifiers.some(specifier => specifier.type === "ImportSpecifier")) || + (node.type === "ExportNamedDeclaration" && + !node.specifiers.some(specifier => specifier.type === "ExportSpecifier")) + ) { + return; + } + + const openBrace = sourceCode.getFirstToken(node, token => token.value === "{"); + + let closeBrace; + + if (node.typeAnnotation) { + closeBrace = sourceCode.getTokenBefore(node.typeAnnotation); + } else { + closeBrace = sourceCode.getLastToken(node, token => token.value === "}"); + } + + let first = sourceCode.getTokenAfter(openBrace, { includeComments: true }); + let last = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); + + const needsLineBreaks = areLineBreaksRequired(node, options, first, last); + + const hasCommentsFirstToken = astUtils.isCommentToken(first); + const hasCommentsLastToken = astUtils.isCommentToken(last); + + /* + * Use tokens or comments to check multiline or not. + * But use only tokens to check whether line breaks are needed. + * This allows: + * var obj = { // eslint-disable-line foo + * a: 1 + * } + */ + first = sourceCode.getTokenAfter(openBrace); + last = sourceCode.getTokenBefore(closeBrace); + + if (needsLineBreaks) { + if (astUtils.isTokenOnSameLine(openBrace, first)) { + context.report({ + messageId: "expectedLinebreakAfterOpeningBrace", + node, + loc: openBrace.loc, + fix(fixer) { + if (hasCommentsFirstToken) { + return null; + } + + return fixer.insertTextAfter(openBrace, "\n"); + } + }); + } + if (astUtils.isTokenOnSameLine(last, closeBrace)) { + context.report({ + messageId: "expectedLinebreakBeforeClosingBrace", + node, + loc: closeBrace.loc, + fix(fixer) { + if (hasCommentsLastToken) { + return null; + } + + return fixer.insertTextBefore(closeBrace, "\n"); + } + }); + } + } else { + const consistent = options.consistent; + const hasLineBreakBetweenOpenBraceAndFirst = !astUtils.isTokenOnSameLine(openBrace, first); + const hasLineBreakBetweenCloseBraceAndLast = !astUtils.isTokenOnSameLine(last, closeBrace); + + if ( + (!consistent && hasLineBreakBetweenOpenBraceAndFirst) || + (consistent && hasLineBreakBetweenOpenBraceAndFirst && !hasLineBreakBetweenCloseBraceAndLast) + ) { + context.report({ + messageId: "unexpectedLinebreakAfterOpeningBrace", + node, + loc: openBrace.loc, + fix(fixer) { + if (hasCommentsFirstToken) { + return null; + } + + return fixer.removeRange([ + openBrace.range[1], + first.range[0] + ]); + } + }); + } + if ( + (!consistent && hasLineBreakBetweenCloseBraceAndLast) || + (consistent && !hasLineBreakBetweenOpenBraceAndFirst && hasLineBreakBetweenCloseBraceAndLast) + ) { + context.report({ + messageId: "unexpectedLinebreakBeforeClosingBrace", + node, + loc: closeBrace.loc, + fix(fixer) { + if (hasCommentsLastToken) { + return null; + } + + return fixer.removeRange([ + last.range[1], + closeBrace.range[0] + ]); + } + }); + } + } + } + + return { + ObjectExpression: check, + ObjectPattern: check, + ImportDeclaration: check, + ExportNamedDeclaration: check + }; + } +}; diff --git a/node_modules/eslint/lib/rules/object-curly-spacing.js b/node_modules/eslint/lib/rules/object-curly-spacing.js new file mode 100644 index 0000000..9122da3 --- /dev/null +++ b/node_modules/eslint/lib/rules/object-curly-spacing.js @@ -0,0 +1,308 @@ +/** + * @fileoverview Disallows or enforces spaces inside of object literals. + * @author Jamund Ferguson + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing inside braces", + recommended: false, + url: "https://eslint.org/docs/rules/object-curly-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + arraysInObjects: { + type: "boolean" + }, + objectsInObjects: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + + messages: { + requireSpaceBefore: "A space is required before '{{token}}'.", + requireSpaceAfter: "A space is required after '{{token}}'.", + unexpectedSpaceBefore: "There should be no space before '{{token}}'.", + unexpectedSpaceAfter: "There should be no space after '{{token}}'." + } + }, + + create(context) { + const spaced = context.options[0] === "always", + sourceCode = context.getSourceCode(); + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] ? context.options[1][option] === !spaced : false; + } + + const options = { + spaced, + arraysInObjectsException: isOptionSet("arraysInObjects"), + objectsInObjectsException: isOptionSet("objectsInObjects") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + const nextToken = context.getSourceCode().getTokenAfter(token, { includeComments: true }); + + context.report({ + node, + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "unexpectedSpaceAfter", + data: { + token: token.value + }, + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + const previousToken = context.getSourceCode().getTokenBefore(token, { includeComments: true }); + + context.report({ + node, + loc: { start: previousToken.loc.end, end: token.loc.start }, + messageId: "unexpectedSpaceBefore", + data: { + token: token.value + }, + fix(fixer) { + return fixer.removeRange([previousToken.range[1], token.range[0]]); + } + }); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "requireSpaceAfter", + data: { + token: token.value + }, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report({ + node, + loc: token.loc, + messageId: "requireSpaceBefore", + data: { + token: token.value + }, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + + /** + * Determines if spacing in curly braces is valid. + * @param {ASTNode} node The AST node to check. + * @param {Token} first The first token to check (should be the opening brace) + * @param {Token} second The second token to check (should be first after the opening brace) + * @param {Token} penultimate The penultimate token to check (should be last before closing brace) + * @param {Token} last The last token to check (should be closing brace) + * @returns {void} + */ + function validateBraceSpacing(node, first, second, penultimate, last) { + if (astUtils.isTokenOnSameLine(first, second)) { + const firstSpaced = sourceCode.isSpaceBetweenTokens(first, second); + + if (options.spaced && !firstSpaced) { + reportRequiredBeginningSpace(node, first); + } + if (!options.spaced && firstSpaced && second.type !== "Line") { + reportNoBeginningSpace(node, first); + } + } + + if (astUtils.isTokenOnSameLine(penultimate, last)) { + const shouldCheckPenultimate = ( + options.arraysInObjectsException && astUtils.isClosingBracketToken(penultimate) || + options.objectsInObjectsException && astUtils.isClosingBraceToken(penultimate) + ); + const penultimateType = shouldCheckPenultimate && sourceCode.getNodeByRangeIndex(penultimate.range[0]).type; + + const closingCurlyBraceMustBeSpaced = ( + options.arraysInObjectsException && penultimateType === "ArrayExpression" || + options.objectsInObjectsException && (penultimateType === "ObjectExpression" || penultimateType === "ObjectPattern") + ) ? !options.spaced : options.spaced; + + const lastSpaced = sourceCode.isSpaceBetweenTokens(penultimate, last); + + if (closingCurlyBraceMustBeSpaced && !lastSpaced) { + reportRequiredEndingSpace(node, last); + } + if (!closingCurlyBraceMustBeSpaced && lastSpaced) { + reportNoEndingSpace(node, last); + } + } + } + + /** + * Gets '}' token of an object node. + * + * Because the last token of object patterns might be a type annotation, + * this traverses tokens preceded by the last property, then returns the + * first '}' token. + * @param {ASTNode} node The node to get. This node is an + * ObjectExpression or an ObjectPattern. And this node has one or + * more properties. + * @returns {Token} '}' token. + */ + function getClosingBraceOfObject(node) { + const lastProperty = node.properties[node.properties.length - 1]; + + return sourceCode.getTokenAfter(lastProperty, astUtils.isClosingBraceToken); + } + + /** + * Reports a given object node if spacing in curly braces is invalid. + * @param {ASTNode} node An ObjectExpression or ObjectPattern node to check. + * @returns {void} + */ + function checkForObject(node) { + if (node.properties.length === 0) { + return; + } + + const first = sourceCode.getFirstToken(node), + last = getClosingBraceOfObject(node), + second = sourceCode.getTokenAfter(first, { includeComments: true }), + penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + /** + * Reports a given import node if spacing in curly braces is invalid. + * @param {ASTNode} node An ImportDeclaration node to check. + * @returns {void} + */ + function checkForImport(node) { + if (node.specifiers.length === 0) { + return; + } + + let firstSpecifier = node.specifiers[0]; + const lastSpecifier = node.specifiers[node.specifiers.length - 1]; + + if (lastSpecifier.type !== "ImportSpecifier") { + return; + } + if (firstSpecifier.type !== "ImportSpecifier") { + firstSpecifier = node.specifiers[1]; + } + + const first = sourceCode.getTokenBefore(firstSpecifier), + last = sourceCode.getTokenAfter(lastSpecifier, astUtils.isNotCommaToken), + second = sourceCode.getTokenAfter(first, { includeComments: true }), + penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + /** + * Reports a given export node if spacing in curly braces is invalid. + * @param {ASTNode} node An ExportNamedDeclaration node to check. + * @returns {void} + */ + function checkForExport(node) { + if (node.specifiers.length === 0) { + return; + } + + const firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1], + first = sourceCode.getTokenBefore(firstSpecifier), + last = sourceCode.getTokenAfter(lastSpecifier, astUtils.isNotCommaToken), + second = sourceCode.getTokenAfter(first, { includeComments: true }), + penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + // var {x} = y; + ObjectPattern: checkForObject, + + // var y = {x: 'y'} + ObjectExpression: checkForObject, + + // import {y} from 'x'; + ImportDeclaration: checkForImport, + + // export {name} from 'yo'; + ExportNamedDeclaration: checkForExport + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/object-property-newline.js b/node_modules/eslint/lib/rules/object-property-newline.js new file mode 100644 index 0000000..dac084c --- /dev/null +++ b/node_modules/eslint/lib/rules/object-property-newline.js @@ -0,0 +1,99 @@ +/** + * @fileoverview Rule to enforce placing object properties on separate lines. + * @author Vitor Balocco + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce placing object properties on separate lines", + recommended: false, + url: "https://eslint.org/docs/rules/object-property-newline" + }, + + schema: [ + { + type: "object", + properties: { + allowAllPropertiesOnSameLine: { + type: "boolean", + default: false + }, + allowMultiplePropertiesPerLine: { // Deprecated + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "whitespace", + + messages: { + propertiesOnNewlineAll: "Object properties must go on a new line if they aren't all on the same line.", + propertiesOnNewline: "Object properties must go on a new line." + } + }, + + create(context) { + const allowSameLine = context.options[0] && ( + (context.options[0].allowAllPropertiesOnSameLine || context.options[0].allowMultiplePropertiesPerLine /* Deprecated */) + ); + const messageId = allowSameLine + ? "propertiesOnNewlineAll" + : "propertiesOnNewline"; + + const sourceCode = context.getSourceCode(); + + return { + ObjectExpression(node) { + if (allowSameLine) { + if (node.properties.length > 1) { + const firstTokenOfFirstProperty = sourceCode.getFirstToken(node.properties[0]); + const lastTokenOfLastProperty = sourceCode.getLastToken(node.properties[node.properties.length - 1]); + + if (firstTokenOfFirstProperty.loc.end.line === lastTokenOfLastProperty.loc.start.line) { + + // All keys and values are on the same line + return; + } + } + } + + for (let i = 1; i < node.properties.length; i++) { + const lastTokenOfPreviousProperty = sourceCode.getLastToken(node.properties[i - 1]); + const firstTokenOfCurrentProperty = sourceCode.getFirstToken(node.properties[i]); + + if (lastTokenOfPreviousProperty.loc.end.line === firstTokenOfCurrentProperty.loc.start.line) { + context.report({ + node, + loc: firstTokenOfCurrentProperty.loc, + messageId, + fix(fixer) { + const comma = sourceCode.getTokenBefore(firstTokenOfCurrentProperty); + const rangeAfterComma = [comma.range[1], firstTokenOfCurrentProperty.range[0]]; + + // Don't perform a fix if there are any comments between the comma and the next property. + if (sourceCode.text.slice(rangeAfterComma[0], rangeAfterComma[1]).trim()) { + return null; + } + + return fixer.replaceTextRange(rangeAfterComma, "\n"); + } + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/object-shorthand.js b/node_modules/eslint/lib/rules/object-shorthand.js new file mode 100644 index 0000000..aa03450 --- /dev/null +++ b/node_modules/eslint/lib/rules/object-shorthand.js @@ -0,0 +1,504 @@ +/** + * @fileoverview Rule to enforce concise object methods and properties. + * @author Jamund Ferguson + */ + +"use strict"; + +const OPTIONS = { + always: "always", + never: "never", + methods: "methods", + properties: "properties", + consistent: "consistent", + consistentAsNeeded: "consistent-as-needed" +}; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow method and property shorthand syntax for object literals", + recommended: false, + url: "https://eslint.org/docs/rules/object-shorthand" + }, + + fixable: "code", + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always", "methods", "properties", "never", "consistent", "consistent-as-needed"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["always", "methods", "properties"] + }, + { + type: "object", + properties: { + avoidQuotes: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + }, + { + type: "array", + items: [ + { + enum: ["always", "methods"] + }, + { + type: "object", + properties: { + ignoreConstructors: { + type: "boolean" + }, + avoidQuotes: { + type: "boolean" + }, + avoidExplicitReturnArrows: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + messages: { + expectedAllPropertiesShorthanded: "Expected shorthand for all properties.", + expectedLiteralMethodLongform: "Expected longform method syntax for string literal keys.", + expectedPropertyShorthand: "Expected property shorthand.", + expectedPropertyLongform: "Expected longform property syntax.", + expectedMethodShorthand: "Expected method shorthand.", + expectedMethodLongform: "Expected longform method syntax.", + unexpectedMix: "Unexpected mix of shorthand and non-shorthand properties." + } + }, + + create(context) { + const APPLY = context.options[0] || OPTIONS.always; + const APPLY_TO_METHODS = APPLY === OPTIONS.methods || APPLY === OPTIONS.always; + const APPLY_TO_PROPS = APPLY === OPTIONS.properties || APPLY === OPTIONS.always; + const APPLY_NEVER = APPLY === OPTIONS.never; + const APPLY_CONSISTENT = APPLY === OPTIONS.consistent; + const APPLY_CONSISTENT_AS_NEEDED = APPLY === OPTIONS.consistentAsNeeded; + + const PARAMS = context.options[1] || {}; + const IGNORE_CONSTRUCTORS = PARAMS.ignoreConstructors; + const AVOID_QUOTES = PARAMS.avoidQuotes; + const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows; + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const CTOR_PREFIX_REGEX = /[^_$0-9]/u; + + /** + * Determines if the first character of the name is a capital letter. + * @param {string} name The name of the node to evaluate. + * @returns {boolean} True if the first character of the property name is a capital letter, false if not. + * @private + */ + function isConstructor(name) { + const match = CTOR_PREFIX_REGEX.exec(name); + + // Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8' + if (!match) { + return false; + } + + const firstChar = name.charAt(match.index); + + return firstChar === firstChar.toUpperCase(); + } + + /** + * Determines if the property can have a shorthand form. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the property can have a shorthand form + * @private + */ + function canHaveShorthand(property) { + return (property.kind !== "set" && property.kind !== "get" && property.type !== "SpreadElement" && property.type !== "SpreadProperty" && property.type !== "ExperimentalSpreadProperty"); + } + + /** + * Checks whether a node is a string literal. + * @param {ASTNode} node Any AST node. + * @returns {boolean} `true` if it is a string literal. + */ + function isStringLiteral(node) { + return node.type === "Literal" && typeof node.value === "string"; + } + + /** + * Determines if the property is a shorthand or not. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the property is considered shorthand, false if not. + * @private + */ + function isShorthand(property) { + + // property.method is true when `{a(){}}`. + return (property.shorthand || property.method); + } + + /** + * Determines if the property's key and method or value are named equally. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the key and value are named equally, false if not. + * @private + */ + function isRedundant(property) { + const value = property.value; + + if (value.type === "FunctionExpression") { + return !value.id; // Only anonymous should be shorthand method. + } + if (value.type === "Identifier") { + return astUtils.getStaticPropertyName(property) === value.name; + } + + return false; + } + + /** + * Ensures that an object's properties are consistently shorthand, or not shorthand at all. + * @param {ASTNode} node Property AST node + * @param {boolean} checkRedundancy Whether to check longform redundancy + * @returns {void} + */ + function checkConsistency(node, checkRedundancy) { + + // We are excluding getters/setters and spread properties as they are considered neither longform nor shorthand. + const properties = node.properties.filter(canHaveShorthand); + + // Do we still have properties left after filtering the getters and setters? + if (properties.length > 0) { + const shorthandProperties = properties.filter(isShorthand); + + /* + * If we do not have an equal number of longform properties as + * shorthand properties, we are using the annotations inconsistently + */ + if (shorthandProperties.length !== properties.length) { + + // We have at least 1 shorthand property + if (shorthandProperties.length > 0) { + context.report({ node, messageId: "unexpectedMix" }); + } else if (checkRedundancy) { + + /* + * If all properties of the object contain a method or value with a name matching it's key, + * all the keys are redundant. + */ + const canAlwaysUseShorthand = properties.every(isRedundant); + + if (canAlwaysUseShorthand) { + context.report({ node, messageId: "expectedAllPropertiesShorthanded" }); + } + } + } + } + } + + /** + * Fixes a FunctionExpression node by making it into a shorthand property. + * @param {SourceCodeFixer} fixer The fixer object + * @param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value + * @returns {Object} A fix for this node + */ + function makeFunctionShorthand(fixer, node) { + const firstKeyToken = node.computed + ? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken) + : sourceCode.getFirstToken(node.key); + const lastKeyToken = node.computed + ? sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isClosingBracketToken) + : sourceCode.getLastToken(node.key); + const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]); + let keyPrefix = ""; + + // key: /* */ () => {} + if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) { + return null; + } + + if (node.value.async) { + keyPrefix += "async "; + } + if (node.value.generator) { + keyPrefix += "*"; + } + + const fixRange = [firstKeyToken.range[0], node.range[1]]; + const methodPrefix = keyPrefix + keyText; + + if (node.value.type === "FunctionExpression") { + const functionToken = sourceCode.getTokens(node.value).find(token => token.type === "Keyword" && token.value === "function"); + const tokenBeforeParams = node.value.generator ? sourceCode.getTokenAfter(functionToken) : functionToken; + + return fixer.replaceTextRange( + fixRange, + methodPrefix + sourceCode.text.slice(tokenBeforeParams.range[1], node.value.range[1]) + ); + } + + const arrowToken = sourceCode.getTokenBefore(node.value.body, astUtils.isArrowToken); + const fnBody = sourceCode.text.slice(arrowToken.range[1], node.value.range[1]); + + let shouldAddParensAroundParameters = false; + let tokenBeforeParams; + + if (node.value.params.length === 0) { + tokenBeforeParams = sourceCode.getFirstToken(node.value, astUtils.isOpeningParenToken); + } else { + tokenBeforeParams = sourceCode.getTokenBefore(node.value.params[0]); + } + + if (node.value.params.length === 1) { + const hasParen = astUtils.isOpeningParenToken(tokenBeforeParams); + const isTokenOutsideNode = tokenBeforeParams.range[0] < node.range[0]; + + shouldAddParensAroundParameters = !hasParen || isTokenOutsideNode; + } + + const sliceStart = shouldAddParensAroundParameters + ? node.value.params[0].range[0] + : tokenBeforeParams.range[0]; + const sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1]; + + const oldParamText = sourceCode.text.slice(sliceStart, sliceEnd); + const newParamText = shouldAddParensAroundParameters ? `(${oldParamText})` : oldParamText; + + return fixer.replaceTextRange( + fixRange, + methodPrefix + newParamText + fnBody + ); + + } + + /** + * Fixes a FunctionExpression node by making it into a longform property. + * @param {SourceCodeFixer} fixer The fixer object + * @param {ASTNode} node A `Property` node that has a `FunctionExpression` as its value + * @returns {Object} A fix for this node + */ + function makeFunctionLongform(fixer, node) { + const firstKeyToken = node.computed ? sourceCode.getTokens(node).find(token => token.value === "[") : sourceCode.getFirstToken(node.key); + const lastKeyToken = node.computed ? sourceCode.getTokensBetween(node.key, node.value).find(token => token.value === "]") : sourceCode.getLastToken(node.key); + const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]); + let functionHeader = "function"; + + if (node.value.async) { + functionHeader = `async ${functionHeader}`; + } + if (node.value.generator) { + functionHeader = `${functionHeader}*`; + } + + return fixer.replaceTextRange([node.range[0], lastKeyToken.range[1]], `${keyText}: ${functionHeader}`); + } + + /* + * To determine whether a given arrow function has a lexical identifier (`this`, `arguments`, `super`, or `new.target`), + * create a stack of functions that define these identifiers (i.e. all functions except arrow functions) as the AST is + * traversed. Whenever a new function is encountered, create a new entry on the stack (corresponding to a different lexical + * scope of `this`), and whenever a function is exited, pop that entry off the stack. When an arrow function is entered, + * keep a reference to it on the current stack entry, and remove that reference when the arrow function is exited. + * When a lexical identifier is encountered, mark all the arrow functions on the current stack entry by adding them + * to an `arrowsWithLexicalIdentifiers` set. Any arrow function in that set will not be reported by this rule, + * because converting it into a method would change the value of one of the lexical identifiers. + */ + const lexicalScopeStack = []; + const arrowsWithLexicalIdentifiers = new WeakSet(); + const argumentsIdentifiers = new WeakSet(); + + /** + * Enters a function. This creates a new lexical identifier scope, so a new Set of arrow functions is pushed onto the stack. + * Also, this marks all `arguments` identifiers so that they can be detected later. + * @returns {void} + */ + function enterFunction() { + lexicalScopeStack.unshift(new Set()); + context.getScope().variables.filter(variable => variable.name === "arguments").forEach(variable => { + variable.references.map(ref => ref.identifier).forEach(identifier => argumentsIdentifiers.add(identifier)); + }); + } + + /** + * Exits a function. This pops the current set of arrow functions off the lexical scope stack. + * @returns {void} + */ + function exitFunction() { + lexicalScopeStack.shift(); + } + + /** + * Marks the current function as having a lexical keyword. This implies that all arrow functions + * in the current lexical scope contain a reference to this lexical keyword. + * @returns {void} + */ + function reportLexicalIdentifier() { + lexicalScopeStack[0].forEach(arrowFunction => arrowsWithLexicalIdentifiers.add(arrowFunction)); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program: enterFunction, + FunctionDeclaration: enterFunction, + FunctionExpression: enterFunction, + "Program:exit": exitFunction, + "FunctionDeclaration:exit": exitFunction, + "FunctionExpression:exit": exitFunction, + + ArrowFunctionExpression(node) { + lexicalScopeStack[0].add(node); + }, + "ArrowFunctionExpression:exit"(node) { + lexicalScopeStack[0].delete(node); + }, + + ThisExpression: reportLexicalIdentifier, + Super: reportLexicalIdentifier, + MetaProperty(node) { + if (node.meta.name === "new" && node.property.name === "target") { + reportLexicalIdentifier(); + } + }, + Identifier(node) { + if (argumentsIdentifiers.has(node)) { + reportLexicalIdentifier(); + } + }, + + ObjectExpression(node) { + if (APPLY_CONSISTENT) { + checkConsistency(node, false); + } else if (APPLY_CONSISTENT_AS_NEEDED) { + checkConsistency(node, true); + } + }, + + "Property:exit"(node) { + const isConciseProperty = node.method || node.shorthand; + + // Ignore destructuring assignment + if (node.parent.type === "ObjectPattern") { + return; + } + + // getters and setters are ignored + if (node.kind === "get" || node.kind === "set") { + return; + } + + // only computed methods can fail the following checks + if (node.computed && node.value.type !== "FunctionExpression" && node.value.type !== "ArrowFunctionExpression") { + return; + } + + //-------------------------------------------------------------- + // Checks for property/method shorthand. + if (isConciseProperty) { + if (node.method && (APPLY_NEVER || AVOID_QUOTES && isStringLiteral(node.key))) { + const messageId = APPLY_NEVER ? "expectedMethodLongform" : "expectedLiteralMethodLongform"; + + // { x() {} } should be written as { x: function() {} } + context.report({ + node, + messageId, + fix: fixer => makeFunctionLongform(fixer, node) + }); + } else if (APPLY_NEVER) { + + // { x } should be written as { x: x } + context.report({ + node, + messageId: "expectedPropertyLongform", + fix: fixer => fixer.insertTextAfter(node.key, `: ${node.key.name}`) + }); + } + } else if (APPLY_TO_METHODS && !node.value.id && (node.value.type === "FunctionExpression" || node.value.type === "ArrowFunctionExpression")) { + if (IGNORE_CONSTRUCTORS && node.key.type === "Identifier" && isConstructor(node.key.name)) { + return; + } + if (AVOID_QUOTES && isStringLiteral(node.key)) { + return; + } + + // {[x]: function(){}} should be written as {[x]() {}} + if (node.value.type === "FunctionExpression" || + node.value.type === "ArrowFunctionExpression" && + node.value.body.type === "BlockStatement" && + AVOID_EXPLICIT_RETURN_ARROWS && + !arrowsWithLexicalIdentifiers.has(node.value) + ) { + context.report({ + node, + messageId: "expectedMethodShorthand", + fix: fixer => makeFunctionShorthand(fixer, node) + }); + } + } else if (node.value.type === "Identifier" && node.key.name === node.value.name && APPLY_TO_PROPS) { + + // {x: x} should be written as {x} + context.report({ + node, + messageId: "expectedPropertyShorthand", + fix(fixer) { + return fixer.replaceText(node, node.value.name); + } + }); + } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) { + if (AVOID_QUOTES) { + return; + } + + // {"x": x} should be written as {x} + context.report({ + node, + messageId: "expectedPropertyShorthand", + fix(fixer) { + return fixer.replaceText(node, node.value.name); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/one-var-declaration-per-line.js b/node_modules/eslint/lib/rules/one-var-declaration-per-line.js new file mode 100644 index 0000000..440146b --- /dev/null +++ b/node_modules/eslint/lib/rules/one-var-declaration-per-line.js @@ -0,0 +1,92 @@ +/** + * @fileoverview Rule to check multiple var declarations per line + * @author Alberto Rodríguez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow newlines around variable declarations", + recommended: false, + url: "https://eslint.org/docs/rules/one-var-declaration-per-line" + }, + + schema: [ + { + enum: ["always", "initializations"] + } + ], + + fixable: "whitespace", + + messages: { + expectVarOnNewline: "Expected variable declaration to be on a new line." + } + }, + + create(context) { + + const always = context.options[0] === "always"; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + + /** + * Determine if provided keyword is a variant of for specifiers + * @private + * @param {string} keyword keyword to test + * @returns {boolean} True if `keyword` is a variant of for specifier + */ + function isForTypeSpecifier(keyword) { + return keyword === "ForStatement" || keyword === "ForInStatement" || keyword === "ForOfStatement"; + } + + /** + * Checks newlines around variable declarations. + * @private + * @param {ASTNode} node `VariableDeclaration` node to test + * @returns {void} + */ + function checkForNewLine(node) { + if (isForTypeSpecifier(node.parent.type)) { + return; + } + + const declarations = node.declarations; + let prev; + + declarations.forEach(current => { + if (prev && prev.loc.end.line === current.loc.start.line) { + if (always || prev.init || current.init) { + context.report({ + node, + messageId: "expectVarOnNewline", + loc: current.loc, + fix: fixer => fixer.insertTextBefore(current, "\n") + }); + } + } + prev = current; + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + VariableDeclaration: checkForNewLine + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/one-var.js b/node_modules/eslint/lib/rules/one-var.js new file mode 100644 index 0000000..1818c02 --- /dev/null +++ b/node_modules/eslint/lib/rules/one-var.js @@ -0,0 +1,567 @@ +/** + * @fileoverview A rule to control the use of single variable declarations. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the given node is in a statement list. + * @param {ASTNode} node node to check + * @returns {boolean} `true` if the given node is in a statement list + */ +function isInStatementList(node) { + return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce variables to be declared either together or separately in functions", + recommended: false, + url: "https://eslint.org/docs/rules/one-var" + }, + + fixable: "code", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never", "consecutive"] + }, + { + type: "object", + properties: { + separateRequires: { + type: "boolean" + }, + var: { + enum: ["always", "never", "consecutive"] + }, + let: { + enum: ["always", "never", "consecutive"] + }, + const: { + enum: ["always", "never", "consecutive"] + } + }, + additionalProperties: false + }, + { + type: "object", + properties: { + initialized: { + enum: ["always", "never", "consecutive"] + }, + uninitialized: { + enum: ["always", "never", "consecutive"] + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + combineUninitialized: "Combine this with the previous '{{type}}' statement with uninitialized variables.", + combineInitialized: "Combine this with the previous '{{type}}' statement with initialized variables.", + splitUninitialized: "Split uninitialized '{{type}}' declarations into multiple statements.", + splitInitialized: "Split initialized '{{type}}' declarations into multiple statements.", + splitRequires: "Split requires to be separated into a single block.", + combine: "Combine this with the previous '{{type}}' statement.", + split: "Split '{{type}}' declarations into multiple statements." + } + }, + + create(context) { + const MODE_ALWAYS = "always"; + const MODE_NEVER = "never"; + const MODE_CONSECUTIVE = "consecutive"; + const mode = context.options[0] || MODE_ALWAYS; + + const options = {}; + + if (typeof mode === "string") { // simple options configuration with just a string + options.var = { uninitialized: mode, initialized: mode }; + options.let = { uninitialized: mode, initialized: mode }; + options.const = { uninitialized: mode, initialized: mode }; + } else if (typeof mode === "object") { // options configuration is an object + options.separateRequires = !!mode.separateRequires; + options.var = { uninitialized: mode.var, initialized: mode.var }; + options.let = { uninitialized: mode.let, initialized: mode.let }; + options.const = { uninitialized: mode.const, initialized: mode.const }; + if (Object.prototype.hasOwnProperty.call(mode, "uninitialized")) { + options.var.uninitialized = mode.uninitialized; + options.let.uninitialized = mode.uninitialized; + options.const.uninitialized = mode.uninitialized; + } + if (Object.prototype.hasOwnProperty.call(mode, "initialized")) { + options.var.initialized = mode.initialized; + options.let.initialized = mode.initialized; + options.const.initialized = mode.initialized; + } + } + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + const functionStack = []; + const blockStack = []; + + /** + * Increments the blockStack counter. + * @returns {void} + * @private + */ + function startBlock() { + blockStack.push({ + let: { initialized: false, uninitialized: false }, + const: { initialized: false, uninitialized: false } + }); + } + + /** + * Increments the functionStack counter. + * @returns {void} + * @private + */ + function startFunction() { + functionStack.push({ initialized: false, uninitialized: false }); + startBlock(); + } + + /** + * Decrements the blockStack counter. + * @returns {void} + * @private + */ + function endBlock() { + blockStack.pop(); + } + + /** + * Decrements the functionStack counter. + * @returns {void} + * @private + */ + function endFunction() { + functionStack.pop(); + endBlock(); + } + + /** + * Check if a variable declaration is a require. + * @param {ASTNode} decl variable declaration Node + * @returns {bool} if decl is a require, return true; else return false. + * @private + */ + function isRequire(decl) { + return decl.init && decl.init.type === "CallExpression" && decl.init.callee.name === "require"; + } + + /** + * Records whether initialized/uninitialized/required variables are defined in current scope. + * @param {string} statementType node.kind, one of: "var", "let", or "const" + * @param {ASTNode[]} declarations List of declarations + * @param {Object} currentScope The scope being investigated + * @returns {void} + * @private + */ + function recordTypes(statementType, declarations, currentScope) { + for (let i = 0; i < declarations.length; i++) { + if (declarations[i].init === null) { + if (options[statementType] && options[statementType].uninitialized === MODE_ALWAYS) { + currentScope.uninitialized = true; + } + } else { + if (options[statementType] && options[statementType].initialized === MODE_ALWAYS) { + if (options.separateRequires && isRequire(declarations[i])) { + currentScope.required = true; + } else { + currentScope.initialized = true; + } + } + } + } + } + + /** + * Determines the current scope (function or block) + * @param {string} statementType node.kind, one of: "var", "let", or "const" + * @returns {Object} The scope associated with statementType + */ + function getCurrentScope(statementType) { + let currentScope; + + if (statementType === "var") { + currentScope = functionStack[functionStack.length - 1]; + } else if (statementType === "let") { + currentScope = blockStack[blockStack.length - 1].let; + } else if (statementType === "const") { + currentScope = blockStack[blockStack.length - 1].const; + } + return currentScope; + } + + /** + * Counts the number of initialized and uninitialized declarations in a list of declarations + * @param {ASTNode[]} declarations List of declarations + * @returns {Object} Counts of 'uninitialized' and 'initialized' declarations + * @private + */ + function countDeclarations(declarations) { + const counts = { uninitialized: 0, initialized: 0 }; + + for (let i = 0; i < declarations.length; i++) { + if (declarations[i].init === null) { + counts.uninitialized++; + } else { + counts.initialized++; + } + } + return counts; + } + + /** + * Determines if there is more than one var statement in the current scope. + * @param {string} statementType node.kind, one of: "var", "let", or "const" + * @param {ASTNode[]} declarations List of declarations + * @returns {boolean} Returns true if it is the first var declaration, false if not. + * @private + */ + function hasOnlyOneStatement(statementType, declarations) { + + const declarationCounts = countDeclarations(declarations); + const currentOptions = options[statementType] || {}; + const currentScope = getCurrentScope(statementType); + const hasRequires = declarations.some(isRequire); + + if (currentOptions.uninitialized === MODE_ALWAYS && currentOptions.initialized === MODE_ALWAYS) { + if (currentScope.uninitialized || currentScope.initialized) { + if (!hasRequires) { + return false; + } + } + } + + if (declarationCounts.uninitialized > 0) { + if (currentOptions.uninitialized === MODE_ALWAYS && currentScope.uninitialized) { + return false; + } + } + if (declarationCounts.initialized > 0) { + if (currentOptions.initialized === MODE_ALWAYS && currentScope.initialized) { + if (!hasRequires) { + return false; + } + } + } + if (currentScope.required && hasRequires) { + return false; + } + recordTypes(statementType, declarations, currentScope); + return true; + } + + /** + * Fixer to join VariableDeclaration's into a single declaration + * @param {VariableDeclarator[]} declarations The `VariableDeclaration` to join + * @returns {Function} The fixer function + */ + function joinDeclarations(declarations) { + const declaration = declarations[0]; + const body = Array.isArray(declaration.parent.parent.body) ? declaration.parent.parent.body : []; + const currentIndex = body.findIndex(node => node.range[0] === declaration.parent.range[0]); + const previousNode = body[currentIndex - 1]; + + return fixer => { + const type = sourceCode.getTokenBefore(declaration); + const prevSemi = sourceCode.getTokenBefore(type); + const res = []; + + if (previousNode && previousNode.kind === sourceCode.getText(type)) { + if (prevSemi.value === ";") { + res.push(fixer.replaceText(prevSemi, ",")); + } else { + res.push(fixer.insertTextAfter(prevSemi, ",")); + } + res.push(fixer.replaceText(type, "")); + } + + return res; + }; + } + + /** + * Fixer to split a VariableDeclaration into individual declarations + * @param {VariableDeclaration} declaration The `VariableDeclaration` to split + * @returns {Function|null} The fixer function + */ + function splitDeclarations(declaration) { + const { parent } = declaration; + + // don't autofix code such as: if (foo) var x, y; + if (!isInStatementList(parent.type === "ExportNamedDeclaration" ? parent : declaration)) { + return null; + } + + return fixer => declaration.declarations.map(declarator => { + const tokenAfterDeclarator = sourceCode.getTokenAfter(declarator); + + if (tokenAfterDeclarator === null) { + return null; + } + + const afterComma = sourceCode.getTokenAfter(tokenAfterDeclarator, { includeComments: true }); + + if (tokenAfterDeclarator.value !== ",") { + return null; + } + + const exportPlacement = declaration.parent.type === "ExportNamedDeclaration" ? "export " : ""; + + /* + * `var x,y` + * tokenAfterDeclarator ^^ afterComma + */ + if (afterComma.range[0] === tokenAfterDeclarator.range[1]) { + return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind} `); + } + + /* + * `var x, + * tokenAfterDeclarator ^ + * y` + * ^ afterComma + */ + if ( + afterComma.loc.start.line > tokenAfterDeclarator.loc.end.line || + afterComma.type === "Line" || + afterComma.type === "Block" + ) { + let lastComment = afterComma; + + while (lastComment.type === "Line" || lastComment.type === "Block") { + lastComment = sourceCode.getTokenAfter(lastComment, { includeComments: true }); + } + + return fixer.replaceTextRange( + [tokenAfterDeclarator.range[0], lastComment.range[0]], + `;${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}${exportPlacement}${declaration.kind} ` + ); + } + + return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind}`); + }).filter(x => x); + } + + /** + * Checks a given VariableDeclaration node for errors. + * @param {ASTNode} node The VariableDeclaration node to check + * @returns {void} + * @private + */ + function checkVariableDeclaration(node) { + const parent = node.parent; + const type = node.kind; + + if (!options[type]) { + return; + } + + const declarations = node.declarations; + const declarationCounts = countDeclarations(declarations); + const mixedRequires = declarations.some(isRequire) && !declarations.every(isRequire); + + if (options[type].initialized === MODE_ALWAYS) { + if (options.separateRequires && mixedRequires) { + context.report({ + node, + messageId: "splitRequires" + }); + } + } + + // consecutive + const nodeIndex = (parent.body && parent.body.length > 0 && parent.body.indexOf(node)) || 0; + + if (nodeIndex > 0) { + const previousNode = parent.body[nodeIndex - 1]; + const isPreviousNodeDeclaration = previousNode.type === "VariableDeclaration"; + const declarationsWithPrevious = declarations.concat(previousNode.declarations || []); + + if ( + isPreviousNodeDeclaration && + previousNode.kind === type && + !(declarationsWithPrevious.some(isRequire) && !declarationsWithPrevious.every(isRequire)) + ) { + const previousDeclCounts = countDeclarations(previousNode.declarations); + + if (options[type].initialized === MODE_CONSECUTIVE && options[type].uninitialized === MODE_CONSECUTIVE) { + context.report({ + node, + messageId: "combine", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } else if (options[type].initialized === MODE_CONSECUTIVE && declarationCounts.initialized > 0 && previousDeclCounts.initialized > 0) { + context.report({ + node, + messageId: "combineInitialized", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } else if (options[type].uninitialized === MODE_CONSECUTIVE && + declarationCounts.uninitialized > 0 && + previousDeclCounts.uninitialized > 0) { + context.report({ + node, + messageId: "combineUninitialized", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } + } + } + + // always + if (!hasOnlyOneStatement(type, declarations)) { + if (options[type].initialized === MODE_ALWAYS && options[type].uninitialized === MODE_ALWAYS) { + context.report({ + node, + messageId: "combine", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } else { + if (options[type].initialized === MODE_ALWAYS && declarationCounts.initialized > 0) { + context.report({ + node, + messageId: "combineInitialized", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } + if (options[type].uninitialized === MODE_ALWAYS && declarationCounts.uninitialized > 0) { + if (node.parent.left === node && (node.parent.type === "ForInStatement" || node.parent.type === "ForOfStatement")) { + return; + } + context.report({ + node, + messageId: "combineUninitialized", + data: { + type + }, + fix: joinDeclarations(declarations) + }); + } + } + } + + // never + if (parent.type !== "ForStatement" || parent.init !== node) { + const totalDeclarations = declarationCounts.uninitialized + declarationCounts.initialized; + + if (totalDeclarations > 1) { + if (options[type].initialized === MODE_NEVER && options[type].uninitialized === MODE_NEVER) { + + // both initialized and uninitialized + context.report({ + node, + messageId: "split", + data: { + type + }, + fix: splitDeclarations(node) + }); + } else if (options[type].initialized === MODE_NEVER && declarationCounts.initialized > 0) { + + // initialized + context.report({ + node, + messageId: "splitInitialized", + data: { + type + }, + fix: splitDeclarations(node) + }); + } else if (options[type].uninitialized === MODE_NEVER && declarationCounts.uninitialized > 0) { + + // uninitialized + context.report({ + node, + messageId: "splitUninitialized", + data: { + type + }, + fix: splitDeclarations(node) + }); + } + } + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + Program: startFunction, + FunctionDeclaration: startFunction, + FunctionExpression: startFunction, + ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, // StaticBlock creates a new scope for `var` variables + + BlockStatement: startBlock, + ForStatement: startBlock, + ForInStatement: startBlock, + ForOfStatement: startBlock, + SwitchStatement: startBlock, + VariableDeclaration: checkVariableDeclaration, + "ForStatement:exit": endBlock, + "ForOfStatement:exit": endBlock, + "ForInStatement:exit": endBlock, + "SwitchStatement:exit": endBlock, + "BlockStatement:exit": endBlock, + + "Program:exit": endFunction, + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/operator-assignment.js b/node_modules/eslint/lib/rules/operator-assignment.js new file mode 100644 index 0000000..8b9fb5b --- /dev/null +++ b/node_modules/eslint/lib/rules/operator-assignment.js @@ -0,0 +1,209 @@ +/** + * @fileoverview Rule to replace assignment expressions with operator assignment + * @author Brandon Mills + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether an operator is commutative and has an operator assignment + * shorthand form. + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is commutative and has a + * shorthand form. + */ +function isCommutativeOperatorWithShorthand(operator) { + return ["*", "&", "^", "|"].includes(operator); +} + +/** + * Checks whether an operator is not commutative and has an operator assignment + * shorthand form. + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is not commutative and has + * a shorthand form. + */ +function isNonCommutativeOperatorWithShorthand(operator) { + return ["+", "-", "/", "%", "<<", ">>", ">>>", "**"].includes(operator); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and) + * toString calls regardless of whether assignment shorthand is used) + * @param {ASTNode} node The node on the left side of the expression + * @returns {boolean} `true` if the node can be fixed + */ +function canBeFixed(node) { + return ( + node.type === "Identifier" || + ( + node.type === "MemberExpression" && + (node.object.type === "Identifier" || node.object.type === "ThisExpression") && + (!node.computed || node.property.type === "Literal") + ) + ); +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow assignment operator shorthand where possible", + recommended: false, + url: "https://eslint.org/docs/rules/operator-assignment" + }, + + schema: [ + { + enum: ["always", "never"] + } + ], + + fixable: "code", + messages: { + replaced: "Assignment (=) can be replaced with operator assignment ({{operator}}).", + unexpected: "Unexpected operator assignment ({{operator}}) shorthand." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + + /** + * Returns the operator token of an AssignmentExpression or BinaryExpression + * @param {ASTNode} node An AssignmentExpression or BinaryExpression node + * @returns {Token} The operator token in the node + */ + function getOperatorToken(node) { + return sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); + } + + /** + * Ensures that an assignment uses the shorthand form where possible. + * @param {ASTNode} node An AssignmentExpression node. + * @returns {void} + */ + function verify(node) { + if (node.operator !== "=" || node.right.type !== "BinaryExpression") { + return; + } + + const left = node.left; + const expr = node.right; + const operator = expr.operator; + + if (isCommutativeOperatorWithShorthand(operator) || isNonCommutativeOperatorWithShorthand(operator)) { + const replacementOperator = `${operator}=`; + + if (astUtils.isSameReference(left, expr.left, true)) { + context.report({ + node, + messageId: "replaced", + data: { operator: replacementOperator }, + fix(fixer) { + if (canBeFixed(left) && canBeFixed(expr.left)) { + const equalsToken = getOperatorToken(node); + const operatorToken = getOperatorToken(expr); + const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]); + const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]); + + // Check for comments that would be removed. + if (sourceCode.commentsExistBetween(equalsToken, operatorToken)) { + return null; + } + + return fixer.replaceText(node, `${leftText}${replacementOperator}${rightText}`); + } + return null; + } + }); + } else if (astUtils.isSameReference(left, expr.right, true) && isCommutativeOperatorWithShorthand(operator)) { + + /* + * This case can't be fixed safely. + * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would + * change the execution order of the valueOf() functions. + */ + context.report({ + node, + messageId: "replaced", + data: { operator: replacementOperator } + }); + } + } + } + + /** + * Warns if an assignment expression uses operator assignment shorthand. + * @param {ASTNode} node An AssignmentExpression node. + * @returns {void} + */ + function prohibit(node) { + if (node.operator !== "=" && !astUtils.isLogicalAssignmentOperator(node.operator)) { + context.report({ + node, + messageId: "unexpected", + data: { operator: node.operator }, + fix(fixer) { + if (canBeFixed(node.left)) { + const firstToken = sourceCode.getFirstToken(node); + const operatorToken = getOperatorToken(node); + const leftText = sourceCode.getText().slice(node.range[0], operatorToken.range[0]); + const newOperator = node.operator.slice(0, -1); + let rightText; + + // Check for comments that would be duplicated. + if (sourceCode.commentsExistBetween(firstToken, operatorToken)) { + return null; + } + + // If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side. + if ( + astUtils.getPrecedence(node.right) <= astUtils.getPrecedence({ type: "BinaryExpression", operator: newOperator }) && + !astUtils.isParenthesised(sourceCode, node.right) + ) { + rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`; + } else { + const tokenAfterOperator = sourceCode.getTokenAfter(operatorToken, { includeComments: true }); + let rightTextPrefix = ""; + + if ( + operatorToken.range[1] === tokenAfterOperator.range[0] && + !astUtils.canTokensBeAdjacent({ type: "Punctuator", value: newOperator }, tokenAfterOperator) + ) { + rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar + } + + rightText = `${rightTextPrefix}${sourceCode.text.slice(operatorToken.range[1], node.range[1])}`; + } + + return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`); + } + return null; + } + }); + } + } + + return { + AssignmentExpression: context.options[0] !== "never" ? verify : prohibit + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/operator-linebreak.js b/node_modules/eslint/lib/rules/operator-linebreak.js new file mode 100644 index 0000000..a04f85b --- /dev/null +++ b/node_modules/eslint/lib/rules/operator-linebreak.js @@ -0,0 +1,250 @@ +/** + * @fileoverview Operator linebreak - enforces operator linebreak style of two types: after and before + * @author Benoît Zugmeyer + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent linebreak style for operators", + recommended: false, + url: "https://eslint.org/docs/rules/operator-linebreak" + }, + + schema: [ + { + enum: ["after", "before", "none", null] + }, + { + type: "object", + properties: { + overrides: { + type: "object", + additionalProperties: { + enum: ["after", "before", "none", "ignore"] + } + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + operatorAtBeginning: "'{{operator}}' should be placed at the beginning of the line.", + operatorAtEnd: "'{{operator}}' should be placed at the end of the line.", + badLinebreak: "Bad line breaking before and after '{{operator}}'.", + noLinebreak: "There should be no line break before or after '{{operator}}'." + } + }, + + create(context) { + + const usedDefaultGlobal = !context.options[0]; + const globalStyle = context.options[0] || "after"; + const options = context.options[1] || {}; + const styleOverrides = options.overrides ? Object.assign({}, options.overrides) : {}; + + if (usedDefaultGlobal && !styleOverrides["?"]) { + styleOverrides["?"] = "before"; + } + + if (usedDefaultGlobal && !styleOverrides[":"]) { + styleOverrides[":"] = "before"; + } + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Gets a fixer function to fix rule issues + * @param {Token} operatorToken The operator token of an expression + * @param {string} desiredStyle The style for the rule. One of 'before', 'after', 'none' + * @returns {Function} A fixer function + */ + function getFixer(operatorToken, desiredStyle) { + return fixer => { + const tokenBefore = sourceCode.getTokenBefore(operatorToken); + const tokenAfter = sourceCode.getTokenAfter(operatorToken); + const textBefore = sourceCode.text.slice(tokenBefore.range[1], operatorToken.range[0]); + const textAfter = sourceCode.text.slice(operatorToken.range[1], tokenAfter.range[0]); + const hasLinebreakBefore = !astUtils.isTokenOnSameLine(tokenBefore, operatorToken); + const hasLinebreakAfter = !astUtils.isTokenOnSameLine(operatorToken, tokenAfter); + let newTextBefore, newTextAfter; + + if (hasLinebreakBefore !== hasLinebreakAfter && desiredStyle !== "none") { + + // If there is a comment before and after the operator, don't do a fix. + if (sourceCode.getTokenBefore(operatorToken, { includeComments: true }) !== tokenBefore && + sourceCode.getTokenAfter(operatorToken, { includeComments: true }) !== tokenAfter) { + + return null; + } + + /* + * If there is only one linebreak and it's on the wrong side of the operator, swap the text before and after the operator. + * foo && + * bar + * would get fixed to + * foo + * && bar + */ + newTextBefore = textAfter; + newTextAfter = textBefore; + } else { + const LINEBREAK_REGEX = astUtils.createGlobalLinebreakMatcher(); + + // Otherwise, if no linebreak is desired and no comments interfere, replace the linebreaks with empty strings. + newTextBefore = desiredStyle === "before" || textBefore.trim() ? textBefore : textBefore.replace(LINEBREAK_REGEX, ""); + newTextAfter = desiredStyle === "after" || textAfter.trim() ? textAfter : textAfter.replace(LINEBREAK_REGEX, ""); + + // If there was no change (due to interfering comments), don't output a fix. + if (newTextBefore === textBefore && newTextAfter === textAfter) { + return null; + } + } + + if (newTextAfter === "" && tokenAfter.type === "Punctuator" && "+-".includes(operatorToken.value) && tokenAfter.value === operatorToken.value) { + + // To avoid accidentally creating a ++ or -- operator, insert a space if the operator is a +/- and the following token is a unary +/-. + newTextAfter += " "; + } + + return fixer.replaceTextRange([tokenBefore.range[1], tokenAfter.range[0]], newTextBefore + operatorToken.value + newTextAfter); + }; + } + + /** + * Checks the operator placement + * @param {ASTNode} node The node to check + * @param {ASTNode} rightSide The node that comes after the operator in `node` + * @param {string} operator The operator + * @private + * @returns {void} + */ + function validateNode(node, rightSide, operator) { + + /* + * Find the operator token by searching from the right side, because between the left side and the operator + * there could be additional tokens from type annotations. Search specifically for the token which + * value equals the operator, in order to skip possible opening parentheses before the right side node. + */ + const operatorToken = sourceCode.getTokenBefore(rightSide, token => token.value === operator); + const leftToken = sourceCode.getTokenBefore(operatorToken); + const rightToken = sourceCode.getTokenAfter(operatorToken); + const operatorStyleOverride = styleOverrides[operator]; + const style = operatorStyleOverride || globalStyle; + const fix = getFixer(operatorToken, style); + + // if single line + if (astUtils.isTokenOnSameLine(leftToken, operatorToken) && + astUtils.isTokenOnSameLine(operatorToken, rightToken)) { + + // do nothing. + + } else if (operatorStyleOverride !== "ignore" && !astUtils.isTokenOnSameLine(leftToken, operatorToken) && + !astUtils.isTokenOnSameLine(operatorToken, rightToken)) { + + // lone operator + context.report({ + node, + loc: operatorToken.loc, + messageId: "badLinebreak", + data: { + operator + }, + fix + }); + + } else if (style === "before" && astUtils.isTokenOnSameLine(leftToken, operatorToken)) { + + context.report({ + node, + loc: operatorToken.loc, + messageId: "operatorAtBeginning", + data: { + operator + }, + fix + }); + + } else if (style === "after" && astUtils.isTokenOnSameLine(operatorToken, rightToken)) { + + context.report({ + node, + loc: operatorToken.loc, + messageId: "operatorAtEnd", + data: { + operator + }, + fix + }); + + } else if (style === "none") { + + context.report({ + node, + loc: operatorToken.loc, + messageId: "noLinebreak", + data: { + operator + }, + fix + }); + + } + } + + /** + * Validates a binary expression using `validateNode` + * @param {BinaryExpression|LogicalExpression|AssignmentExpression} node node to be validated + * @returns {void} + */ + function validateBinaryExpression(node) { + validateNode(node, node.right, node.operator); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + BinaryExpression: validateBinaryExpression, + LogicalExpression: validateBinaryExpression, + AssignmentExpression: validateBinaryExpression, + VariableDeclarator(node) { + if (node.init) { + validateNode(node, node.init, "="); + } + }, + PropertyDefinition(node) { + if (node.value) { + validateNode(node, node.value, "="); + } + }, + ConditionalExpression(node) { + validateNode(node, node.consequent, "?"); + validateNode(node, node.alternate, ":"); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/padded-blocks.js b/node_modules/eslint/lib/rules/padded-blocks.js new file mode 100644 index 0000000..336adac --- /dev/null +++ b/node_modules/eslint/lib/rules/padded-blocks.js @@ -0,0 +1,307 @@ +/** + * @fileoverview A rule to ensure blank lines within blocks. + * @author Mathias Schreck + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow padding within blocks", + recommended: false, + url: "https://eslint.org/docs/rules/padded-blocks" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + blocks: { + enum: ["always", "never"] + }, + switches: { + enum: ["always", "never"] + }, + classes: { + enum: ["always", "never"] + } + }, + additionalProperties: false, + minProperties: 1 + } + ] + }, + { + type: "object", + properties: { + allowSingleLineBlocks: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + + messages: { + alwaysPadBlock: "Block must be padded by blank lines.", + neverPadBlock: "Block must not be padded by blank lines." + } + }, + + create(context) { + const options = {}; + const typeOptions = context.options[0] || "always"; + const exceptOptions = context.options[1] || {}; + + if (typeof typeOptions === "string") { + const shouldHavePadding = typeOptions === "always"; + + options.blocks = shouldHavePadding; + options.switches = shouldHavePadding; + options.classes = shouldHavePadding; + } else { + if (Object.prototype.hasOwnProperty.call(typeOptions, "blocks")) { + options.blocks = typeOptions.blocks === "always"; + } + if (Object.prototype.hasOwnProperty.call(typeOptions, "switches")) { + options.switches = typeOptions.switches === "always"; + } + if (Object.prototype.hasOwnProperty.call(typeOptions, "classes")) { + options.classes = typeOptions.classes === "always"; + } + } + + if (Object.prototype.hasOwnProperty.call(exceptOptions, "allowSingleLineBlocks")) { + options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true; + } + + const sourceCode = context.getSourceCode(); + + /** + * Gets the open brace token from a given node. + * @param {ASTNode} node A BlockStatement or SwitchStatement node from which to get the open brace. + * @returns {Token} The token of the open brace. + */ + function getOpenBrace(node) { + if (node.type === "SwitchStatement") { + return sourceCode.getTokenBefore(node.cases[0]); + } + + if (node.type === "StaticBlock") { + return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token + } + + // `BlockStatement` or `ClassBody` + return sourceCode.getFirstToken(node); + } + + /** + * Checks if the given parameter is a comment node + * @param {ASTNode|Token} node An AST node or token + * @returns {boolean} True if node is a comment + */ + function isComment(node) { + return node.type === "Line" || node.type === "Block"; + } + + /** + * Checks if there is padding between two tokens + * @param {Token} first The first token + * @param {Token} second The second token + * @returns {boolean} True if there is at least a line between the tokens + */ + function isPaddingBetweenTokens(first, second) { + return second.loc.start.line - first.loc.end.line >= 2; + } + + + /** + * Checks if the given token has a blank line after it. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the token is followed by a blank line. + */ + function getFirstBlockToken(token) { + let prev, + first = token; + + do { + prev = first; + first = sourceCode.getTokenAfter(first, { includeComments: true }); + } while (isComment(first) && first.loc.start.line === prev.loc.end.line); + + return first; + } + + /** + * Checks if the given token is preceded by a blank line. + * @param {Token} token The token to check + * @returns {boolean} Whether or not the token is preceded by a blank line + */ + function getLastBlockToken(token) { + let last = token, + next; + + do { + next = last; + last = sourceCode.getTokenBefore(last, { includeComments: true }); + } while (isComment(last) && last.loc.end.line === next.loc.start.line); + + return last; + } + + /** + * Checks if a node should be padded, according to the rule config. + * @param {ASTNode} node The AST node to check. + * @throws {Error} (Unreachable) + * @returns {boolean} True if the node should be padded, false otherwise. + */ + function requirePaddingFor(node) { + switch (node.type) { + case "BlockStatement": + case "StaticBlock": + return options.blocks; + case "SwitchStatement": + return options.switches; + case "ClassBody": + return options.classes; + + /* istanbul ignore next */ + default: + throw new Error("unreachable"); + } + } + + /** + * Checks the given BlockStatement node to be padded if the block is not empty. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {void} undefined. + */ + function checkPadding(node) { + const openBrace = getOpenBrace(node), + firstBlockToken = getFirstBlockToken(openBrace), + tokenBeforeFirst = sourceCode.getTokenBefore(firstBlockToken, { includeComments: true }), + closeBrace = sourceCode.getLastToken(node), + lastBlockToken = getLastBlockToken(closeBrace), + tokenAfterLast = sourceCode.getTokenAfter(lastBlockToken, { includeComments: true }), + blockHasTopPadding = isPaddingBetweenTokens(tokenBeforeFirst, firstBlockToken), + blockHasBottomPadding = isPaddingBetweenTokens(lastBlockToken, tokenAfterLast); + + if (options.allowSingleLineBlocks && astUtils.isTokenOnSameLine(tokenBeforeFirst, tokenAfterLast)) { + return; + } + + if (requirePaddingFor(node)) { + + if (!blockHasTopPadding) { + context.report({ + node, + loc: { + start: tokenBeforeFirst.loc.start, + end: firstBlockToken.loc.start + }, + fix(fixer) { + return fixer.insertTextAfter(tokenBeforeFirst, "\n"); + }, + messageId: "alwaysPadBlock" + }); + } + if (!blockHasBottomPadding) { + context.report({ + node, + loc: { + end: tokenAfterLast.loc.start, + start: lastBlockToken.loc.end + }, + fix(fixer) { + return fixer.insertTextBefore(tokenAfterLast, "\n"); + }, + messageId: "alwaysPadBlock" + }); + } + } else { + if (blockHasTopPadding) { + + context.report({ + node, + loc: { + start: tokenBeforeFirst.loc.start, + end: firstBlockToken.loc.start + }, + fix(fixer) { + return fixer.replaceTextRange([tokenBeforeFirst.range[1], firstBlockToken.range[0] - firstBlockToken.loc.start.column], "\n"); + }, + messageId: "neverPadBlock" + }); + } + + if (blockHasBottomPadding) { + + context.report({ + node, + loc: { + end: tokenAfterLast.loc.start, + start: lastBlockToken.loc.end + }, + messageId: "neverPadBlock", + fix(fixer) { + return fixer.replaceTextRange([lastBlockToken.range[1], tokenAfterLast.range[0] - tokenAfterLast.loc.start.column], "\n"); + } + }); + } + } + } + + const rule = {}; + + if (Object.prototype.hasOwnProperty.call(options, "switches")) { + rule.SwitchStatement = function(node) { + if (node.cases.length === 0) { + return; + } + checkPadding(node); + }; + } + + if (Object.prototype.hasOwnProperty.call(options, "blocks")) { + rule.BlockStatement = function(node) { + if (node.body.length === 0) { + return; + } + checkPadding(node); + }; + rule.StaticBlock = rule.BlockStatement; + } + + if (Object.prototype.hasOwnProperty.call(options, "classes")) { + rule.ClassBody = function(node) { + if (node.body.length === 0) { + return; + } + checkPadding(node); + }; + } + + return rule; + } +}; diff --git a/node_modules/eslint/lib/rules/padding-line-between-statements.js b/node_modules/eslint/lib/rules/padding-line-between-statements.js new file mode 100644 index 0000000..7b442bf --- /dev/null +++ b/node_modules/eslint/lib/rules/padding-line-between-statements.js @@ -0,0 +1,632 @@ +/** + * @fileoverview Rule to require or disallow newlines between statements + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const LT = `[${Array.from(astUtils.LINEBREAKS).join("")}]`; +const PADDING_LINE_SEQUENCE = new RegExp( + String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`, + "u" +); +const CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/u; +const CJS_IMPORT = /^require\(/u; + +/** + * Creates tester which check if a node starts with specific keyword. + * @param {string} keyword The keyword to test. + * @returns {Object} the created tester. + * @private + */ +function newKeywordTester(keyword) { + return { + test: (node, sourceCode) => + sourceCode.getFirstToken(node).value === keyword + }; +} + +/** + * Creates tester which check if a node starts with specific keyword and spans a single line. + * @param {string} keyword The keyword to test. + * @returns {Object} the created tester. + * @private + */ +function newSinglelineKeywordTester(keyword) { + return { + test: (node, sourceCode) => + node.loc.start.line === node.loc.end.line && + sourceCode.getFirstToken(node).value === keyword + }; +} + +/** + * Creates tester which check if a node starts with specific keyword and spans multiple lines. + * @param {string} keyword The keyword to test. + * @returns {Object} the created tester. + * @private + */ +function newMultilineKeywordTester(keyword) { + return { + test: (node, sourceCode) => + node.loc.start.line !== node.loc.end.line && + sourceCode.getFirstToken(node).value === keyword + }; +} + +/** + * Creates tester which check if a node is specific type. + * @param {string} type The node type to test. + * @returns {Object} the created tester. + * @private + */ +function newNodeTypeTester(type) { + return { + test: node => + node.type === type + }; +} + +/** + * Checks the given node is an expression statement of IIFE. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is an expression statement of IIFE. + * @private + */ +function isIIFEStatement(node) { + if (node.type === "ExpressionStatement") { + let call = astUtils.skipChainExpression(node.expression); + + if (call.type === "UnaryExpression") { + call = astUtils.skipChainExpression(call.argument); + } + return call.type === "CallExpression" && astUtils.isFunction(call.callee); + } + return false; +} + +/** + * Checks whether the given node is a block-like statement. + * This checks the last token of the node is the closing brace of a block. + * @param {SourceCode} sourceCode The source code to get tokens. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a block-like statement. + * @private + */ +function isBlockLikeStatement(sourceCode, node) { + + // do-while with a block is a block-like statement. + if (node.type === "DoWhileStatement" && node.body.type === "BlockStatement") { + return true; + } + + /* + * IIFE is a block-like statement specially from + * JSCS#disallowPaddingNewLinesAfterBlocks. + */ + if (isIIFEStatement(node)) { + return true; + } + + // Checks the last token is a closing brace of blocks. + const lastToken = sourceCode.getLastToken(node, astUtils.isNotSemicolonToken); + const belongingNode = lastToken && astUtils.isClosingBraceToken(lastToken) + ? sourceCode.getNodeByRangeIndex(lastToken.range[0]) + : null; + + return Boolean(belongingNode) && ( + belongingNode.type === "BlockStatement" || + belongingNode.type === "SwitchStatement" + ); +} + +/** + * Check whether the given node is a directive or not. + * @param {ASTNode} node The node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is a directive. + */ +function isDirective(node, sourceCode) { + return ( + node.type === "ExpressionStatement" && + ( + node.parent.type === "Program" || + ( + node.parent.type === "BlockStatement" && + astUtils.isFunction(node.parent.parent) + ) + ) && + node.expression.type === "Literal" && + typeof node.expression.value === "string" && + !astUtils.isParenthesised(sourceCode, node.expression) + ); +} + +/** + * Check whether the given node is a part of directive prologue or not. + * @param {ASTNode} node The node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is a part of directive prologue. + */ +function isDirectivePrologue(node, sourceCode) { + if (isDirective(node, sourceCode)) { + for (const sibling of node.parent.body) { + if (sibling === node) { + break; + } + if (!isDirective(sibling, sourceCode)) { + return false; + } + } + return true; + } + return false; +} + +/** + * Gets the actual last token. + * + * If a semicolon is semicolon-less style's semicolon, this ignores it. + * For example: + * + * foo() + * ;[1, 2, 3].forEach(bar) + * @param {SourceCode} sourceCode The source code to get tokens. + * @param {ASTNode} node The node to get. + * @returns {Token} The actual last token. + * @private + */ +function getActualLastToken(sourceCode, node) { + const semiToken = sourceCode.getLastToken(node); + const prevToken = sourceCode.getTokenBefore(semiToken); + const nextToken = sourceCode.getTokenAfter(semiToken); + const isSemicolonLessStyle = Boolean( + prevToken && + nextToken && + prevToken.range[0] >= node.range[0] && + astUtils.isSemicolonToken(semiToken) && + semiToken.loc.start.line !== prevToken.loc.end.line && + semiToken.loc.end.line === nextToken.loc.start.line + ); + + return isSemicolonLessStyle ? prevToken : semiToken; +} + +/** + * This returns the concatenation of the first 2 captured strings. + * @param {string} _ Unused. Whole matched string. + * @param {string} trailingSpaces The trailing spaces of the first line. + * @param {string} indentSpaces The indentation spaces of the last line. + * @returns {string} The concatenation of trailingSpaces and indentSpaces. + * @private + */ +function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) { + return trailingSpaces + indentSpaces; +} + +/** + * Check and report statements for `any` configuration. + * It does nothing. + * @returns {void} + * @private + */ +function verifyForAny() { +} + +/** + * Check and report statements for `never` configuration. + * This autofix removes blank lines between the given 2 statements. + * However, if comments exist between 2 blank lines, it does not remove those + * blank lines automatically. + * @param {RuleContext} context The rule context to report. + * @param {ASTNode} _ Unused. The previous node to check. + * @param {ASTNode} nextNode The next node to check. + * @param {Array} paddingLines The array of token pairs that blank + * lines exist between the pair. + * @returns {void} + * @private + */ +function verifyForNever(context, _, nextNode, paddingLines) { + if (paddingLines.length === 0) { + return; + } + + context.report({ + node: nextNode, + messageId: "unexpectedBlankLine", + fix(fixer) { + if (paddingLines.length >= 2) { + return null; + } + + const prevToken = paddingLines[0][0]; + const nextToken = paddingLines[0][1]; + const start = prevToken.range[1]; + const end = nextToken.range[0]; + const text = context.getSourceCode().text + .slice(start, end) + .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines); + + return fixer.replaceTextRange([start, end], text); + } + }); +} + +/** + * Check and report statements for `always` configuration. + * This autofix inserts a blank line between the given 2 statements. + * If the `prevNode` has trailing comments, it inserts a blank line after the + * trailing comments. + * @param {RuleContext} context The rule context to report. + * @param {ASTNode} prevNode The previous node to check. + * @param {ASTNode} nextNode The next node to check. + * @param {Array} paddingLines The array of token pairs that blank + * lines exist between the pair. + * @returns {void} + * @private + */ +function verifyForAlways(context, prevNode, nextNode, paddingLines) { + if (paddingLines.length > 0) { + return; + } + + context.report({ + node: nextNode, + messageId: "expectedBlankLine", + fix(fixer) { + const sourceCode = context.getSourceCode(); + let prevToken = getActualLastToken(sourceCode, prevNode); + const nextToken = sourceCode.getFirstTokenBetween( + prevToken, + nextNode, + { + includeComments: true, + + /** + * Skip the trailing comments of the previous node. + * This inserts a blank line after the last trailing comment. + * + * For example: + * + * foo(); // trailing comment. + * // comment. + * bar(); + * + * Get fixed to: + * + * foo(); // trailing comment. + * + * // comment. + * bar(); + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is not a trailing comment. + * @private + */ + filter(token) { + if (astUtils.isTokenOnSameLine(prevToken, token)) { + prevToken = token; + return false; + } + return true; + } + } + ) || nextNode; + const insertText = astUtils.isTokenOnSameLine(prevToken, nextToken) + ? "\n\n" + : "\n"; + + return fixer.insertTextAfter(prevToken, insertText); + } + }); +} + +/** + * Types of blank lines. + * `any`, `never`, and `always` are defined. + * Those have `verify` method to check and report statements. + * @private + */ +const PaddingTypes = { + any: { verify: verifyForAny }, + never: { verify: verifyForNever }, + always: { verify: verifyForAlways } +}; + +/** + * Types of statements. + * Those have `test` method to check it matches to the given statement. + * @private + */ +const StatementTypes = { + "*": { test: () => true }, + "block-like": { + test: (node, sourceCode) => isBlockLikeStatement(sourceCode, node) + }, + "cjs-export": { + test: (node, sourceCode) => + node.type === "ExpressionStatement" && + node.expression.type === "AssignmentExpression" && + CJS_EXPORT.test(sourceCode.getText(node.expression.left)) + }, + "cjs-import": { + test: (node, sourceCode) => + node.type === "VariableDeclaration" && + node.declarations.length > 0 && + Boolean(node.declarations[0].init) && + CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init)) + }, + directive: { + test: isDirectivePrologue + }, + expression: { + test: (node, sourceCode) => + node.type === "ExpressionStatement" && + !isDirectivePrologue(node, sourceCode) + }, + iife: { + test: isIIFEStatement + }, + "multiline-block-like": { + test: (node, sourceCode) => + node.loc.start.line !== node.loc.end.line && + isBlockLikeStatement(sourceCode, node) + }, + "multiline-expression": { + test: (node, sourceCode) => + node.loc.start.line !== node.loc.end.line && + node.type === "ExpressionStatement" && + !isDirectivePrologue(node, sourceCode) + }, + + "multiline-const": newMultilineKeywordTester("const"), + "multiline-let": newMultilineKeywordTester("let"), + "multiline-var": newMultilineKeywordTester("var"), + "singleline-const": newSinglelineKeywordTester("const"), + "singleline-let": newSinglelineKeywordTester("let"), + "singleline-var": newSinglelineKeywordTester("var"), + + block: newNodeTypeTester("BlockStatement"), + empty: newNodeTypeTester("EmptyStatement"), + function: newNodeTypeTester("FunctionDeclaration"), + + break: newKeywordTester("break"), + case: newKeywordTester("case"), + class: newKeywordTester("class"), + const: newKeywordTester("const"), + continue: newKeywordTester("continue"), + debugger: newKeywordTester("debugger"), + default: newKeywordTester("default"), + do: newKeywordTester("do"), + export: newKeywordTester("export"), + for: newKeywordTester("for"), + if: newKeywordTester("if"), + import: newKeywordTester("import"), + let: newKeywordTester("let"), + return: newKeywordTester("return"), + switch: newKeywordTester("switch"), + throw: newKeywordTester("throw"), + try: newKeywordTester("try"), + var: newKeywordTester("var"), + while: newKeywordTester("while"), + with: newKeywordTester("with") +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow padding lines between statements", + recommended: false, + url: "https://eslint.org/docs/rules/padding-line-between-statements" + }, + + fixable: "whitespace", + + schema: { + definitions: { + paddingType: { + enum: Object.keys(PaddingTypes) + }, + statementType: { + anyOf: [ + { enum: Object.keys(StatementTypes) }, + { + type: "array", + items: { enum: Object.keys(StatementTypes) }, + minItems: 1, + uniqueItems: true + } + ] + } + }, + type: "array", + items: { + type: "object", + properties: { + blankLine: { $ref: "#/definitions/paddingType" }, + prev: { $ref: "#/definitions/statementType" }, + next: { $ref: "#/definitions/statementType" } + }, + additionalProperties: false, + required: ["blankLine", "prev", "next"] + } + }, + + messages: { + unexpectedBlankLine: "Unexpected blank line before this statement.", + expectedBlankLine: "Expected blank line before this statement." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const configureList = context.options || []; + let scopeInfo = null; + + /** + * Processes to enter to new scope. + * This manages the current previous statement. + * @returns {void} + * @private + */ + function enterScope() { + scopeInfo = { + upper: scopeInfo, + prevNode: null + }; + } + + /** + * Processes to exit from the current scope. + * @returns {void} + * @private + */ + function exitScope() { + scopeInfo = scopeInfo.upper; + } + + /** + * Checks whether the given node matches the given type. + * @param {ASTNode} node The statement node to check. + * @param {string|string[]} type The statement type to check. + * @returns {boolean} `true` if the statement node matched the type. + * @private + */ + function match(node, type) { + let innerStatementNode = node; + + while (innerStatementNode.type === "LabeledStatement") { + innerStatementNode = innerStatementNode.body; + } + if (Array.isArray(type)) { + return type.some(match.bind(null, innerStatementNode)); + } + return StatementTypes[type].test(innerStatementNode, sourceCode); + } + + /** + * Finds the last matched configure from configureList. + * @param {ASTNode} prevNode The previous statement to match. + * @param {ASTNode} nextNode The current statement to match. + * @returns {Object} The tester of the last matched configure. + * @private + */ + function getPaddingType(prevNode, nextNode) { + for (let i = configureList.length - 1; i >= 0; --i) { + const configure = configureList[i]; + const matched = + match(prevNode, configure.prev) && + match(nextNode, configure.next); + + if (matched) { + return PaddingTypes[configure.blankLine]; + } + } + return PaddingTypes.any; + } + + /** + * Gets padding line sequences between the given 2 statements. + * Comments are separators of the padding line sequences. + * @param {ASTNode} prevNode The previous statement to count. + * @param {ASTNode} nextNode The current statement to count. + * @returns {Array} The array of token pairs. + * @private + */ + function getPaddingLineSequences(prevNode, nextNode) { + const pairs = []; + let prevToken = getActualLastToken(sourceCode, prevNode); + + if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) { + do { + const token = sourceCode.getTokenAfter( + prevToken, + { includeComments: true } + ); + + if (token.loc.start.line - prevToken.loc.end.line >= 2) { + pairs.push([prevToken, token]); + } + prevToken = token; + + } while (prevToken.range[0] < nextNode.range[0]); + } + + return pairs; + } + + /** + * Verify padding lines between the given node and the previous node. + * @param {ASTNode} node The node to verify. + * @returns {void} + * @private + */ + function verify(node) { + const parentType = node.parent.type; + const validParent = + astUtils.STATEMENT_LIST_PARENTS.has(parentType) || + parentType === "SwitchStatement"; + + if (!validParent) { + return; + } + + // Save this node as the current previous statement. + const prevNode = scopeInfo.prevNode; + + // Verify. + if (prevNode) { + const type = getPaddingType(prevNode, node); + const paddingLines = getPaddingLineSequences(prevNode, node); + + type.verify(context, prevNode, node, paddingLines); + } + + scopeInfo.prevNode = node; + } + + /** + * Verify padding lines between the given node and the previous node. + * Then process to enter to new scope. + * @param {ASTNode} node The node to verify. + * @returns {void} + * @private + */ + function verifyThenEnterScope(node) { + verify(node); + enterScope(); + } + + return { + Program: enterScope, + BlockStatement: enterScope, + SwitchStatement: enterScope, + StaticBlock: enterScope, + "Program:exit": exitScope, + "BlockStatement:exit": exitScope, + "SwitchStatement:exit": exitScope, + "StaticBlock:exit": exitScope, + + ":statement": verify, + + SwitchCase: verifyThenEnterScope, + "SwitchCase:exit": exitScope + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-arrow-callback.js b/node_modules/eslint/lib/rules/prefer-arrow-callback.js new file mode 100644 index 0000000..55a098a --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-arrow-callback.js @@ -0,0 +1,380 @@ +/** + * @fileoverview A rule to suggest using arrow functions as callbacks. + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given variable is a function name. + * @param {eslint-scope.Variable} variable A variable to check. + * @returns {boolean} `true` if the variable is a function name. + */ +function isFunctionName(variable) { + return variable && variable.defs[0].type === "FunctionName"; +} + +/** + * Checks whether or not a given MetaProperty node equals to a given value. + * @param {ASTNode} node A MetaProperty node to check. + * @param {string} metaName The name of `MetaProperty.meta`. + * @param {string} propertyName The name of `MetaProperty.property`. + * @returns {boolean} `true` if the node is the specific value. + */ +function checkMetaProperty(node, metaName, propertyName) { + return node.meta.name === metaName && node.property.name === propertyName; +} + +/** + * Gets the variable object of `arguments` which is defined implicitly. + * @param {eslint-scope.Scope} scope A scope to get. + * @returns {eslint-scope.Variable} The found variable object. + */ +function getVariableOfArguments(scope) { + const variables = scope.variables; + + for (let i = 0; i < variables.length; ++i) { + const variable = variables[i]; + + if (variable.name === "arguments") { + + /* + * If there was a parameter which is named "arguments", the + * implicit "arguments" is not defined. + * So does fast return with null. + */ + return (variable.identifiers.length === 0) ? variable : null; + } + } + + /* istanbul ignore next */ + return null; +} + +/** + * Checks whether or not a given node is a callback. + * @param {ASTNode} node A node to check. + * @throws {Error} (Unreachable.) + * @returns {Object} + * {boolean} retv.isCallback - `true` if the node is a callback. + * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. + */ +function getCallbackInfo(node) { + const retv = { isCallback: false, isLexicalThis: false }; + let currentNode = node; + let parent = node.parent; + let bound = false; + + while (currentNode) { + switch (parent.type) { + + // Checks parents recursively. + + case "LogicalExpression": + case "ChainExpression": + case "ConditionalExpression": + break; + + // Checks whether the parent node is `.bind(this)` call. + case "MemberExpression": + if ( + parent.object === currentNode && + !parent.property.computed && + parent.property.type === "Identifier" && + parent.property.name === "bind" + ) { + const maybeCallee = parent.parent.type === "ChainExpression" + ? parent.parent + : parent; + + if (astUtils.isCallee(maybeCallee)) { + if (!bound) { + bound = true; // Use only the first `.bind()` to make `isLexicalThis` value. + retv.isLexicalThis = ( + maybeCallee.parent.arguments.length === 1 && + maybeCallee.parent.arguments[0].type === "ThisExpression" + ); + } + parent = maybeCallee.parent; + } else { + return retv; + } + } else { + return retv; + } + break; + + // Checks whether the node is a callback. + case "CallExpression": + case "NewExpression": + if (parent.callee !== currentNode) { + retv.isCallback = true; + } + return retv; + + default: + return retv; + } + + currentNode = parent; + parent = parent.parent; + } + + /* istanbul ignore next */ + throw new Error("unreachable"); +} + +/** + * Checks whether a simple list of parameters contains any duplicates. This does not handle complex + * parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate + * parameter names anyway. Instead, it always returns `false` for complex parameter lists. + * @param {ASTNode[]} paramsList The list of parameters for a function + * @returns {boolean} `true` if the list of parameters contains any duplicates + */ +function hasDuplicateParams(paramsList) { + return paramsList.every(param => param.type === "Identifier") && paramsList.length !== new Set(paramsList.map(param => param.name)).size; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require using arrow functions for callbacks", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-arrow-callback" + }, + + schema: [ + { + type: "object", + properties: { + allowNamedFunctions: { + type: "boolean", + default: false + }, + allowUnboundThis: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + preferArrowCallback: "Unexpected function expression." + } + }, + + create(context) { + const options = context.options[0] || {}; + + const allowUnboundThis = options.allowUnboundThis !== false; // default to true + const allowNamedFunctions = options.allowNamedFunctions; + const sourceCode = context.getSourceCode(); + + /* + * {Array<{this: boolean, super: boolean, meta: boolean}>} + * - this - A flag which shows there are one or more ThisExpression. + * - super - A flag which shows there are one or more Super. + * - meta - A flag which shows there are one or more MethProperty. + */ + let stack = []; + + /** + * Pushes new function scope with all `false` flags. + * @returns {void} + */ + function enterScope() { + stack.push({ this: false, super: false, meta: false }); + } + + /** + * Pops a function scope from the stack. + * @returns {{this: boolean, super: boolean, meta: boolean}} The information of the last scope. + */ + function exitScope() { + return stack.pop(); + } + + return { + + // Reset internal state. + Program() { + stack = []; + }, + + // If there are below, it cannot replace with arrow functions merely. + ThisExpression() { + const info = stack[stack.length - 1]; + + if (info) { + info.this = true; + } + }, + + Super() { + const info = stack[stack.length - 1]; + + if (info) { + info.super = true; + } + }, + + MetaProperty(node) { + const info = stack[stack.length - 1]; + + if (info && checkMetaProperty(node, "new", "target")) { + info.meta = true; + } + }, + + // To skip nested scopes. + FunctionDeclaration: enterScope, + "FunctionDeclaration:exit": exitScope, + + // Main. + FunctionExpression: enterScope, + "FunctionExpression:exit"(node) { + const scopeInfo = exitScope(); + + // Skip named function expressions + if (allowNamedFunctions && node.id && node.id.name) { + return; + } + + // Skip generators. + if (node.generator) { + return; + } + + // Skip recursive functions. + const nameVar = context.getDeclaredVariables(node)[0]; + + if (isFunctionName(nameVar) && nameVar.references.length > 0) { + return; + } + + // Skip if it's using arguments. + const variable = getVariableOfArguments(context.getScope()); + + if (variable && variable.references.length > 0) { + return; + } + + // Reports if it's a callback which can replace with arrows. + const callbackInfo = getCallbackInfo(node); + + if (callbackInfo.isCallback && + (!allowUnboundThis || !scopeInfo.this || callbackInfo.isLexicalThis) && + !scopeInfo.super && + !scopeInfo.meta + ) { + context.report({ + node, + messageId: "preferArrowCallback", + *fix(fixer) { + if ((!callbackInfo.isLexicalThis && scopeInfo.this) || hasDuplicateParams(node.params)) { + + /* + * If the callback function does not have .bind(this) and contains a reference to `this`, there + * is no way to determine what `this` should be, so don't perform any fixes. + * If the callback function has duplicates in its list of parameters (possible in sloppy mode), + * don't replace it with an arrow function, because this is a SyntaxError with arrow functions. + */ + return; + } + + // Remove `.bind(this)` if exists. + if (callbackInfo.isLexicalThis) { + const memberNode = node.parent; + + /* + * If `.bind(this)` exists but the parent is not `.bind(this)`, don't remove it automatically. + * E.g. `(foo || function(){}).bind(this)` + */ + if (memberNode.type !== "MemberExpression") { + return; + } + + const callNode = memberNode.parent; + const firstTokenToRemove = sourceCode.getTokenAfter(memberNode.object, astUtils.isNotClosingParenToken); + const lastTokenToRemove = sourceCode.getLastToken(callNode); + + /* + * If the member expression is parenthesized, don't remove the right paren. + * E.g. `(function(){}.bind)(this)` + * ^^^^^^^^^^^^ + */ + if (astUtils.isParenthesised(sourceCode, memberNode)) { + return; + } + + // If comments exist in the `.bind(this)`, don't remove those. + if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { + return; + } + + yield fixer.removeRange([firstTokenToRemove.range[0], lastTokenToRemove.range[1]]); + } + + // Convert the function expression to an arrow function. + const functionToken = sourceCode.getFirstToken(node, node.async ? 1 : 0); + const leftParenToken = sourceCode.getTokenAfter(functionToken, astUtils.isOpeningParenToken); + + if (sourceCode.commentsExistBetween(functionToken, leftParenToken)) { + + // Remove only extra tokens to keep comments. + yield fixer.remove(functionToken); + if (node.id) { + yield fixer.remove(node.id); + } + } else { + + // Remove extra tokens and spaces. + yield fixer.removeRange([functionToken.range[0], leftParenToken.range[0]]); + } + yield fixer.insertTextBefore(node.body, "=> "); + + // Get the node that will become the new arrow function. + let replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node; + + if (replacedNode.type === "ChainExpression") { + replacedNode = replacedNode.parent; + } + + /* + * If the replaced node is part of a BinaryExpression, LogicalExpression, or MemberExpression, then + * the arrow function needs to be parenthesized, because `foo || () => {}` is invalid syntax even + * though `foo || function() {}` is valid. + */ + if ( + replacedNode.parent.type !== "CallExpression" && + replacedNode.parent.type !== "ConditionalExpression" && + !astUtils.isParenthesised(sourceCode, replacedNode) && + !astUtils.isParenthesised(sourceCode, node) + ) { + yield fixer.insertTextBefore(replacedNode, "("); + yield fixer.insertTextAfter(replacedNode, ")"); + } + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-const.js b/node_modules/eslint/lib/rules/prefer-const.js new file mode 100644 index 0000000..cf07d6c --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-const.js @@ -0,0 +1,489 @@ +/** + * @fileoverview A rule to suggest using of const declaration for variables that are never reassigned after declared. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const FixTracker = require("./utils/fix-tracker"); +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u; +const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u; +const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u; + +/** + * Checks whether a given node is located at `ForStatement.init` or not. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is located at `ForStatement.init`. + */ +function isInitOfForStatement(node) { + return node.parent.type === "ForStatement" && node.parent.init === node; +} + +/** + * Checks whether a given Identifier node becomes a VariableDeclaration or not. + * @param {ASTNode} identifier An Identifier node to check. + * @returns {boolean} `true` if the node can become a VariableDeclaration. + */ +function canBecomeVariableDeclaration(identifier) { + let node = identifier.parent; + + while (PATTERN_TYPE.test(node.type)) { + node = node.parent; + } + + return ( + node.type === "VariableDeclarator" || + ( + node.type === "AssignmentExpression" && + node.parent.type === "ExpressionStatement" && + DECLARATION_HOST_TYPE.test(node.parent.parent.type) + ) + ); +} + +/** + * Checks if an property or element is from outer scope or function parameters + * in destructing pattern. + * @param {string} name A variable name to be checked. + * @param {eslint-scope.Scope} initScope A scope to start find. + * @returns {boolean} Indicates if the variable is from outer scope or function parameters. + */ +function isOuterVariableInDestructing(name, initScope) { + + if (initScope.through.some(ref => ref.resolved && ref.resolved.name === name)) { + return true; + } + + const variable = astUtils.getVariableByName(initScope, name); + + if (variable !== null) { + return variable.defs.some(def => def.type === "Parameter"); + } + + return false; +} + +/** + * Gets the VariableDeclarator/AssignmentExpression node that a given reference + * belongs to. + * This is used to detect a mix of reassigned and never reassigned in a + * destructuring. + * @param {eslint-scope.Reference} reference A reference to get. + * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or + * null. + */ +function getDestructuringHost(reference) { + if (!reference.isWrite()) { + return null; + } + let node = reference.identifier.parent; + + while (PATTERN_TYPE.test(node.type)) { + node = node.parent; + } + + if (!DESTRUCTURING_HOST_TYPE.test(node.type)) { + return null; + } + return node; +} + +/** + * Determines if a destructuring assignment node contains + * any MemberExpression nodes. This is used to determine if a + * variable that is only written once using destructuring can be + * safely converted into a const declaration. + * @param {ASTNode} node The ObjectPattern or ArrayPattern node to check. + * @returns {boolean} True if the destructuring pattern contains + * a MemberExpression, false if not. + */ +function hasMemberExpressionAssignment(node) { + switch (node.type) { + case "ObjectPattern": + return node.properties.some(prop => { + if (prop) { + + /* + * Spread elements have an argument property while + * others have a value property. Because different + * parsers use different node types for spread elements, + * we just check if there is an argument property. + */ + return hasMemberExpressionAssignment(prop.argument || prop.value); + } + + return false; + }); + + case "ArrayPattern": + return node.elements.some(element => { + if (element) { + return hasMemberExpressionAssignment(element); + } + + return false; + }); + + case "AssignmentPattern": + return hasMemberExpressionAssignment(node.left); + + case "MemberExpression": + return true; + + // no default + } + + return false; +} + +/** + * Gets an identifier node of a given variable. + * + * If the initialization exists or one or more reading references exist before + * the first assignment, the identifier node is the node of the declaration. + * Otherwise, the identifier node is the node of the first assignment. + * + * If the variable should not change to const, this function returns null. + * - If the variable is reassigned. + * - If the variable is never initialized nor assigned. + * - If the variable is initialized in a different scope from the declaration. + * - If the unique assignment of the variable cannot change to a declaration. + * e.g. `if (a) b = 1` / `return (b = 1)` + * - If the variable is declared in the global scope and `eslintUsed` is `true`. + * `/*exported foo` directive comment makes such variables. This rule does not + * warn such variables because this rule cannot distinguish whether the + * exported variables are reassigned or not. + * @param {eslint-scope.Variable} variable A variable to get. + * @param {boolean} ignoreReadBeforeAssign + * The value of `ignoreReadBeforeAssign` option. + * @returns {ASTNode|null} + * An Identifier node if the variable should change to const. + * Otherwise, null. + */ +function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { + if (variable.eslintUsed && variable.scope.type === "global") { + return null; + } + + // Finds the unique WriteReference. + let writer = null; + let isReadBeforeInit = false; + const references = variable.references; + + for (let i = 0; i < references.length; ++i) { + const reference = references[i]; + + if (reference.isWrite()) { + const isReassigned = ( + writer !== null && + writer.identifier !== reference.identifier + ); + + if (isReassigned) { + return null; + } + + const destructuringHost = getDestructuringHost(reference); + + if (destructuringHost !== null && destructuringHost.left !== void 0) { + const leftNode = destructuringHost.left; + let hasOuterVariables = false, + hasNonIdentifiers = false; + + if (leftNode.type === "ObjectPattern") { + const properties = leftNode.properties; + + hasOuterVariables = properties + .filter(prop => prop.value) + .map(prop => prop.value.name) + .some(name => isOuterVariableInDestructing(name, variable.scope)); + + hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); + + } else if (leftNode.type === "ArrayPattern") { + const elements = leftNode.elements; + + hasOuterVariables = elements + .map(element => element && element.name) + .some(name => isOuterVariableInDestructing(name, variable.scope)); + + hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); + } + + if (hasOuterVariables || hasNonIdentifiers) { + return null; + } + + } + + writer = reference; + + } else if (reference.isRead() && writer === null) { + if (ignoreReadBeforeAssign) { + return null; + } + isReadBeforeInit = true; + } + } + + /* + * If the assignment is from a different scope, ignore it. + * If the assignment cannot change to a declaration, ignore it. + */ + const shouldBeConst = ( + writer !== null && + writer.from === variable.scope && + canBecomeVariableDeclaration(writer.identifier) + ); + + if (!shouldBeConst) { + return null; + } + + if (isReadBeforeInit) { + return variable.defs[0].name; + } + + return writer.identifier; +} + +/** + * Groups by the VariableDeclarator/AssignmentExpression node that each + * reference of given variables belongs to. + * This is used to detect a mix of reassigned and never reassigned in a + * destructuring. + * @param {eslint-scope.Variable[]} variables Variables to group by destructuring. + * @param {boolean} ignoreReadBeforeAssign + * The value of `ignoreReadBeforeAssign` option. + * @returns {Map} Grouped identifier nodes. + */ +function groupByDestructuring(variables, ignoreReadBeforeAssign) { + const identifierMap = new Map(); + + for (let i = 0; i < variables.length; ++i) { + const variable = variables[i]; + const references = variable.references; + const identifier = getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign); + let prevId = null; + + for (let j = 0; j < references.length; ++j) { + const reference = references[j]; + const id = reference.identifier; + + /* + * Avoid counting a reference twice or more for default values of + * destructuring. + */ + if (id === prevId) { + continue; + } + prevId = id; + + // Add the identifier node into the destructuring group. + const group = getDestructuringHost(reference); + + if (group) { + if (identifierMap.has(group)) { + identifierMap.get(group).push(identifier); + } else { + identifierMap.set(group, [identifier]); + } + } + } + } + + return identifierMap; +} + +/** + * Finds the nearest parent of node with a given type. + * @param {ASTNode} node The node to search from. + * @param {string} type The type field of the parent node. + * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise. + * @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists. + */ +function findUp(node, type, shouldStop) { + if (!node || shouldStop(node)) { + return null; + } + if (node.type === type) { + return node; + } + return findUp(node.parent, type, shouldStop); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `const` declarations for variables that are never reassigned after declared", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-const" + }, + + fixable: "code", + + schema: [ + { + type: "object", + properties: { + destructuring: { enum: ["any", "all"], default: "any" }, + ignoreReadBeforeAssign: { type: "boolean", default: false } + }, + additionalProperties: false + } + ], + messages: { + useConst: "'{{name}}' is never reassigned. Use 'const' instead." + } + }, + + create(context) { + const options = context.options[0] || {}; + const sourceCode = context.getSourceCode(); + const shouldMatchAnyDestructuredVariable = options.destructuring !== "all"; + const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true; + const variables = []; + let reportCount = 0; + let checkedId = null; + let checkedName = ""; + + + /** + * Reports given identifier nodes if all of the nodes should be declared + * as const. + * + * The argument 'nodes' is an array of Identifier nodes. + * This node is the result of 'getIdentifierIfShouldBeConst()', so it's + * nullable. In simple declaration or assignment cases, the length of + * the array is 1. In destructuring cases, the length of the array can + * be 2 or more. + * @param {(eslint-scope.Reference|null)[]} nodes + * References which are grouped by destructuring to report. + * @returns {void} + */ + function checkGroup(nodes) { + const nodesToReport = nodes.filter(Boolean); + + if (nodes.length && (shouldMatchAnyDestructuredVariable || nodesToReport.length === nodes.length)) { + const varDeclParent = findUp(nodes[0], "VariableDeclaration", parentNode => parentNode.type.endsWith("Statement")); + const isVarDecParentNull = varDeclParent === null; + + if (!isVarDecParentNull && varDeclParent.declarations.length > 0) { + const firstDeclaration = varDeclParent.declarations[0]; + + if (firstDeclaration.init) { + const firstDecParent = firstDeclaration.init.parent; + + /* + * First we check the declaration type and then depending on + * if the type is a "VariableDeclarator" or its an "ObjectPattern" + * we compare the name and id from the first identifier, if the names are different + * we assign the new name, id and reset the count of reportCount and nodeCount in + * order to check each block for the number of reported errors and base our fix + * based on comparing nodes.length and nodesToReport.length. + */ + + if (firstDecParent.type === "VariableDeclarator") { + + if (firstDecParent.id.name !== checkedName) { + checkedName = firstDecParent.id.name; + reportCount = 0; + } + + if (firstDecParent.id.type === "ObjectPattern") { + if (firstDecParent.init.name !== checkedName) { + checkedName = firstDecParent.init.name; + reportCount = 0; + } + } + + if (firstDecParent.id !== checkedId) { + checkedId = firstDecParent.id; + reportCount = 0; + } + } + } + } + + let shouldFix = varDeclParent && + + // Don't do a fix unless all variables in the declarations are initialized (or it's in a for-in or for-of loop) + (varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || + varDeclParent.declarations.every(declaration => declaration.init)) && + + /* + * If options.destructuring is "all", then this warning will not occur unless + * every assignment in the destructuring should be const. In that case, it's safe + * to apply the fix. + */ + nodesToReport.length === nodes.length; + + if (!isVarDecParentNull && varDeclParent.declarations && varDeclParent.declarations.length !== 1) { + + if (varDeclParent && varDeclParent.declarations && varDeclParent.declarations.length >= 1) { + + /* + * Add nodesToReport.length to a count, then comparing the count to the length + * of the declarations in the current block. + */ + + reportCount += nodesToReport.length; + + shouldFix = shouldFix && (reportCount === varDeclParent.declarations.length); + } + } + + nodesToReport.forEach(node => { + context.report({ + node, + messageId: "useConst", + data: node, + fix: shouldFix + ? fixer => { + const letKeywordToken = sourceCode.getFirstToken(varDeclParent, t => t.value === varDeclParent.kind); + + /** + * Extend the replacement range to the whole declaration, + * in order to prevent other fixes in the same pass + * https://github.com/eslint/eslint/issues/13899 + */ + return new FixTracker(fixer, sourceCode) + .retainRange(varDeclParent.range) + .replaceTextRange(letKeywordToken.range, "const"); + } + : null + }); + }); + } + } + + return { + "Program:exit"() { + groupByDestructuring(variables, ignoreReadBeforeAssign).forEach(checkGroup); + }, + + VariableDeclaration(node) { + if (node.kind === "let" && !isInitOfForStatement(node)) { + variables.push(...context.getDeclaredVariables(node)); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-destructuring.js b/node_modules/eslint/lib/rules/prefer-destructuring.js new file mode 100644 index 0000000..1f68313 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -0,0 +1,301 @@ +/** + * @fileoverview Prefer destructuring from arrays and objects + * @author Alex LaFroscia + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({ type: "AssignmentExpression" }); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require destructuring from arrays and/or objects", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-destructuring" + }, + + fixable: "code", + + schema: [ + { + + /* + * old support {array: Boolean, object: Boolean} + * new support {VariableDeclarator: {}, AssignmentExpression: {}} + */ + oneOf: [ + { + type: "object", + properties: { + VariableDeclarator: { + type: "object", + properties: { + array: { + type: "boolean" + }, + object: { + type: "boolean" + } + }, + additionalProperties: false + }, + AssignmentExpression: { + type: "object", + properties: { + array: { + type: "boolean" + }, + object: { + type: "boolean" + } + }, + additionalProperties: false + } + }, + additionalProperties: false + }, + { + type: "object", + properties: { + array: { + type: "boolean" + }, + object: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + }, + { + type: "object", + properties: { + enforceForRenamedProperties: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + + messages: { + preferDestructuring: "Use {{type}} destructuring." + } + }, + create(context) { + + const enabledTypes = context.options[0]; + const enforceForRenamedProperties = context.options[1] && context.options[1].enforceForRenamedProperties; + let normalizedOptions = { + VariableDeclarator: { array: true, object: true }, + AssignmentExpression: { array: true, object: true } + }; + + if (enabledTypes) { + normalizedOptions = typeof enabledTypes.array !== "undefined" || typeof enabledTypes.object !== "undefined" + ? { VariableDeclarator: enabledTypes, AssignmentExpression: enabledTypes } + : enabledTypes; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks if destructuring type should be checked. + * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator" + * @param {string} destructuringType "array" or "object" + * @returns {boolean} `true` if the destructuring type should be checked for the given node + */ + function shouldCheck(nodeType, destructuringType) { + return normalizedOptions && + normalizedOptions[nodeType] && + normalizedOptions[nodeType][destructuringType]; + } + + /** + * Determines if the given node is accessing an array index + * + * This is used to differentiate array index access from object property + * access. + * @param {ASTNode} node the node to evaluate + * @returns {boolean} whether or not the node is an integer + */ + function isArrayIndexAccess(node) { + return Number.isInteger(node.property.value); + } + + /** + * Report that the given node should use destructuring + * @param {ASTNode} reportNode the node to report + * @param {string} type the type of destructuring that should have been done + * @param {Function|null} fix the fix function or null to pass to context.report + * @returns {void} + */ + function report(reportNode, type, fix) { + context.report({ + node: reportNode, + messageId: "preferDestructuring", + data: { type }, + fix + }); + } + + /** + * Determines if a node should be fixed into object destructuring + * + * The fixer only fixes the simplest case of object destructuring, + * like: `let x = a.x`; + * + * Assignment expression is not fixed. + * Array destructuring is not fixed. + * Renamed property is not fixed. + * @param {ASTNode} node the node to evaluate + * @returns {boolean} whether or not the node should be fixed + */ + function shouldFix(node) { + return node.type === "VariableDeclarator" && + node.id.type === "Identifier" && + node.init.type === "MemberExpression" && + !node.init.computed && + node.init.property.type === "Identifier" && + node.id.name === node.init.property.name; + } + + /** + * Fix a node into object destructuring. + * This function only handles the simplest case of object destructuring, + * see {@link shouldFix}. + * @param {SourceCodeFixer} fixer the fixer object + * @param {ASTNode} node the node to be fixed. + * @returns {Object} a fix for the node + */ + function fixIntoObjectDestructuring(fixer, node) { + const rightNode = node.init; + const sourceCode = context.getSourceCode(); + + // Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved. + if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) { + return null; + } + + let objectText = sourceCode.getText(rightNode.object); + + if (astUtils.getPrecedence(rightNode.object) < PRECEDENCE_OF_ASSIGNMENT_EXPR) { + objectText = `(${objectText})`; + } + + return fixer.replaceText( + node, + `{${rightNode.property.name}} = ${objectText}` + ); + } + + /** + * Check that the `prefer-destructuring` rules are followed based on the + * given left- and right-hand side of the assignment. + * + * Pulled out into a separate method so that VariableDeclarators and + * AssignmentExpressions can share the same verification logic. + * @param {ASTNode} leftNode the left-hand side of the assignment + * @param {ASTNode} rightNode the right-hand side of the assignment + * @param {ASTNode} reportNode the node to report the error on + * @returns {void} + */ + function performCheck(leftNode, rightNode, reportNode) { + if ( + rightNode.type !== "MemberExpression" || + rightNode.object.type === "Super" || + rightNode.property.type === "PrivateIdentifier" + ) { + return; + } + + if (isArrayIndexAccess(rightNode)) { + if (shouldCheck(reportNode.type, "array")) { + report(reportNode, "array", null); + } + return; + } + + const fix = shouldFix(reportNode) + ? fixer => fixIntoObjectDestructuring(fixer, reportNode) + : null; + + if (shouldCheck(reportNode.type, "object") && enforceForRenamedProperties) { + report(reportNode, "object", fix); + return; + } + + if (shouldCheck(reportNode.type, "object")) { + const property = rightNode.property; + + if ( + (property.type === "Literal" && leftNode.name === property.value) || + (property.type === "Identifier" && leftNode.name === property.name && !rightNode.computed) + ) { + report(reportNode, "object", fix); + } + } + } + + /** + * Check if a given variable declarator is coming from an property access + * that should be using destructuring instead + * @param {ASTNode} node the variable declarator to check + * @returns {void} + */ + function checkVariableDeclarator(node) { + + // Skip if variable is declared without assignment + if (!node.init) { + return; + } + + // We only care about member expressions past this point + if (node.init.type !== "MemberExpression") { + return; + } + + performCheck(node.id, node.init, node); + } + + /** + * Run the `prefer-destructuring` check on an AssignmentExpression + * @param {ASTNode} node the AssignmentExpression node + * @returns {void} + */ + function checkAssignmentExpression(node) { + if (node.operator === "=") { + performCheck(node.left, node.right, node); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + VariableDeclarator: checkVariableDeclarator, + AssignmentExpression: checkAssignmentExpression + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js b/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js new file mode 100644 index 0000000..a291e8d --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js @@ -0,0 +1,190 @@ +/** + * @fileoverview Rule to disallow Math.pow in favor of the ** operator + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { CALL, ReferenceTracker } = require("eslint-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const PRECEDENCE_OF_EXPONENTIATION_EXPR = astUtils.getPrecedence({ type: "BinaryExpression", operator: "**" }); + +/** + * Determines whether the given node needs parens if used as the base in an exponentiation binary expression. + * @param {ASTNode} base The node to check. + * @returns {boolean} `true` if the node needs to be parenthesised. + */ +function doesBaseNeedParens(base) { + return ( + + // '**' is right-associative, parens are needed when Math.pow(a ** b, c) is converted to (a ** b) ** c + astUtils.getPrecedence(base) <= PRECEDENCE_OF_EXPONENTIATION_EXPR || + + // An unary operator cannot be used immediately before an exponentiation expression + base.type === "AwaitExpression" || + base.type === "UnaryExpression" + ); +} + +/** + * Determines whether the given node needs parens if used as the exponent in an exponentiation binary expression. + * @param {ASTNode} exponent The node to check. + * @returns {boolean} `true` if the node needs to be parenthesised. + */ +function doesExponentNeedParens(exponent) { + + // '**' is right-associative, there is no need for parens when Math.pow(a, b ** c) is converted to a ** b ** c + return astUtils.getPrecedence(exponent) < PRECEDENCE_OF_EXPONENTIATION_EXPR; +} + +/** + * Determines whether an exponentiation binary expression at the place of the given node would need parens. + * @param {ASTNode} node A node that would be replaced by an exponentiation binary expression. + * @param {SourceCode} sourceCode A SourceCode object. + * @returns {boolean} `true` if the expression needs to be parenthesised. + */ +function doesExponentiationExpressionNeedParens(node, sourceCode) { + const parent = node.parent.type === "ChainExpression" ? node.parent.parent : node.parent; + + const needsParens = ( + parent.type === "ClassDeclaration" || + ( + parent.type.endsWith("Expression") && + astUtils.getPrecedence(parent) >= PRECEDENCE_OF_EXPONENTIATION_EXPR && + !(parent.type === "BinaryExpression" && parent.operator === "**" && parent.right === node) && + !((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node)) && + !(parent.type === "MemberExpression" && parent.computed && parent.property === node) && + !(parent.type === "ArrayExpression") + ) + ); + + return needsParens && !astUtils.isParenthesised(sourceCode, node); +} + +/** + * Optionally parenthesizes given text. + * @param {string} text The text to parenthesize. + * @param {boolean} shouldParenthesize If `true`, the text will be parenthesised. + * @returns {string} parenthesised or unchanged text. + */ +function parenthesizeIfShould(text, shouldParenthesize) { + return shouldParenthesize ? `(${text})` : text; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow the use of `Math.pow` in favor of the `**` operator", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-exponentiation-operator" + }, + + schema: [], + fixable: "code", + + messages: { + useExponentiation: "Use the '**' operator instead of 'Math.pow'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Reports the given node. + * @param {ASTNode} node 'Math.pow()' node to report. + * @returns {void} + */ + function report(node) { + context.report({ + node, + messageId: "useExponentiation", + fix(fixer) { + if ( + node.arguments.length !== 2 || + node.arguments.some(arg => arg.type === "SpreadElement") || + sourceCode.getCommentsInside(node).length > 0 + ) { + return null; + } + + const base = node.arguments[0], + exponent = node.arguments[1], + baseText = sourceCode.getText(base), + exponentText = sourceCode.getText(exponent), + shouldParenthesizeBase = doesBaseNeedParens(base), + shouldParenthesizeExponent = doesExponentNeedParens(exponent), + shouldParenthesizeAll = doesExponentiationExpressionNeedParens(node, sourceCode); + + let prefix = "", + suffix = ""; + + if (!shouldParenthesizeAll) { + if (!shouldParenthesizeBase) { + const firstReplacementToken = sourceCode.getFirstToken(base), + tokenBefore = sourceCode.getTokenBefore(node); + + if ( + tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken) + ) { + prefix = " "; // a+Math.pow(++b, c) -> a+ ++b**c + } + } + if (!shouldParenthesizeExponent) { + const lastReplacementToken = sourceCode.getLastToken(exponent), + tokenAfter = sourceCode.getTokenAfter(node); + + if ( + tokenAfter && + node.range[1] === tokenAfter.range[0] && + !astUtils.canTokensBeAdjacent(lastReplacementToken, tokenAfter) + ) { + suffix = " "; // Math.pow(a, b)in c -> a**b in c + } + } + } + + const baseReplacement = parenthesizeIfShould(baseText, shouldParenthesizeBase), + exponentReplacement = parenthesizeIfShould(exponentText, shouldParenthesizeExponent), + replacement = parenthesizeIfShould(`${baseReplacement}**${exponentReplacement}`, shouldParenthesizeAll); + + return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); + } + }); + } + + return { + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const trackMap = { + Math: { + pow: { [CALL]: true } + } + }; + + for (const { node } of tracker.iterateGlobalReferences(trackMap)) { + report(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/node_modules/eslint/lib/rules/prefer-named-capture-group.js new file mode 100644 index 0000000..cff2d8f --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-named-capture-group.js @@ -0,0 +1,110 @@ +/** + * @fileoverview Rule to enforce requiring named capture groups in regular expression. + * @author Pig Fang + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { + CALL, + CONSTRUCT, + ReferenceTracker, + getStringIfConstant +} = require("eslint-utils"); +const regexpp = require("regexpp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const parser = new regexpp.RegExpParser(); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce using named capture group in regular expression", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-named-capture-group" + }, + + schema: [], + + messages: { + required: "Capture group '{{group}}' should be converted to a named or non-capturing group." + } + }, + + create(context) { + + /** + * Function to check regular expression. + * @param {string} pattern The regular expression pattern to be check. + * @param {ASTNode} node AST node which contains regular expression. + * @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. + * @returns {void} + */ + function checkRegex(pattern, node, uFlag) { + let ast; + + try { + ast = parser.parsePattern(pattern, 0, pattern.length, uFlag); + } catch { + + // ignore regex syntax errors + return; + } + + regexpp.visitRegExpAST(ast, { + onCapturingGroupEnter(group) { + if (!group.name) { + context.report({ + node, + messageId: "required", + data: { + group: group.raw + } + }); + } + } + }); + } + + return { + Literal(node) { + if (node.regex) { + checkRegex(node.regex.pattern, node, node.regex.flags.includes("u")); + } + }, + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const traceMap = { + RegExp: { + [CALL]: true, + [CONSTRUCT]: true + } + }; + + for (const { node } of tracker.iterateGlobalReferences(traceMap)) { + const regex = getStringIfConstant(node.arguments[0]); + const flags = getStringIfConstant(node.arguments[1]); + + if (regex) { + checkRegex(regex, node, flags && flags.includes("u")); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/node_modules/eslint/lib/rules/prefer-numeric-literals.js new file mode 100644 index 0000000..53a5153 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -0,0 +1,148 @@ +/** + * @fileoverview Rule to disallow `parseInt()` in favor of binary, octal, and hexadecimal literals + * @author Annie Zhang, Henry Zhu + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const radixMap = new Map([ + [2, { system: "binary", literalPrefix: "0b" }], + [8, { system: "octal", literalPrefix: "0o" }], + [16, { system: "hexadecimal", literalPrefix: "0x" }] +]); + +/** + * Checks to see if a CallExpression's callee node is `parseInt` or + * `Number.parseInt`. + * @param {ASTNode} calleeNode The callee node to evaluate. + * @returns {boolean} True if the callee is `parseInt` or `Number.parseInt`, + * false otherwise. + */ +function isParseInt(calleeNode) { + return ( + astUtils.isSpecificId(calleeNode, "parseInt") || + astUtils.isSpecificMemberAccess(calleeNode, "Number", "parseInt") + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-numeric-literals" + }, + + schema: [], + + messages: { + useLiteral: "Use {{system}} literals instead of {{functionName}}()." + }, + + fixable: "code" + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + + "CallExpression[arguments.length=2]"(node) { + const [strNode, radixNode] = node.arguments, + str = astUtils.getStaticStringValue(strNode), + radix = radixNode.value; + + if ( + str !== null && + astUtils.isStringLiteral(strNode) && + radixNode.type === "Literal" && + typeof radix === "number" && + radixMap.has(radix) && + isParseInt(node.callee) + ) { + + const { system, literalPrefix } = radixMap.get(radix); + + context.report({ + node, + messageId: "useLiteral", + data: { + system, + functionName: sourceCode.getText(node.callee) + }, + fix(fixer) { + if (sourceCode.getCommentsInside(node).length) { + return null; + } + + const replacement = `${literalPrefix}${str}`; + + if (+replacement !== parseInt(str, radix)) { + + /* + * If the newly-produced literal would be invalid, (e.g. 0b1234), + * or it would yield an incorrect parseInt result for some other reason, don't make a fix. + * + * If `str` had numeric separators, `+replacement` will evaluate to `NaN` because unary `+` + * per the specification doesn't support numeric separators. Thus, the above condition will be `true` + * (`NaN !== anything` is always `true`) regardless of the `parseInt(str, radix)` value. + * Consequently, no autofixes will be made. This is correct behavior because `parseInt` also + * doesn't support numeric separators, but it does parse part of the string before the first `_`, + * so the autofix would be invalid: + * + * parseInt("1_1", 2) // === 1 + * 0b1_1 // === 3 + */ + return null; + } + + const tokenBefore = sourceCode.getTokenBefore(node), + tokenAfter = sourceCode.getTokenAfter(node); + let prefix = "", + suffix = ""; + + if ( + tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, replacement) + ) { + prefix = " "; + } + + if ( + tokenAfter && + node.range[1] === tokenAfter.range[0] && + !astUtils.canTokensBeAdjacent(replacement, tokenAfter) + ) { + suffix = " "; + } + + return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-object-has-own.js b/node_modules/eslint/lib/rules/prefer-object-has-own.js new file mode 100644 index 0000000..19abdb3 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-object-has-own.js @@ -0,0 +1,112 @@ +/** + * @fileoverview Prefers Object.hasOwn() instead of Object.prototype.hasOwnProperty.call() + * @author Nitin Kumar + * @author Gautam Arora + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks if the given node is considered to be an access to a property of `Object.prototype`. + * @param {ASTNode} node `MemberExpression` node to evaluate. + * @returns {boolean} `true` if `node.object` is `Object`, `Object.prototype`, or `{}` (empty 'ObjectExpression' node). + */ +function hasLeftHandObject(node) { + + /* + * ({}).hasOwnProperty.call(obj, prop) - `true` + * ({ foo }.hasOwnProperty.call(obj, prop)) - `false`, object literal should be empty + */ + if (node.object.type === "ObjectExpression" && node.object.properties.length === 0) { + return true; + } + + const objectNodeToCheck = node.object.type === "MemberExpression" && astUtils.getStaticPropertyName(node.object) === "prototype" ? node.object.object : node.object; + + if (objectNodeToCheck.type === "Identifier" && objectNodeToCheck.name === "Object") { + return true; + } + + return false; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + docs: { + description: + "disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-object-has-own" + }, + schema: [], + messages: { + useHasOwn: "Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'." + }, + fixable: "code" + }, + create(context) { + return { + CallExpression(node) { + if (!(node.callee.type === "MemberExpression" && node.callee.object.type === "MemberExpression")) { + return; + } + + const calleePropertyName = astUtils.getStaticPropertyName(node.callee); + const objectPropertyName = astUtils.getStaticPropertyName(node.callee.object); + const isObject = hasLeftHandObject(node.callee.object); + + // check `Object` scope + const scope = context.getScope(); + const variable = astUtils.getVariableByName(scope, "Object"); + + if ( + calleePropertyName === "call" && + objectPropertyName === "hasOwnProperty" && + isObject && + variable && variable.scope.type === "global" + ) { + context.report({ + node, + messageId: "useHasOwn", + fix(fixer) { + const sourceCode = context.getSourceCode(); + + if (sourceCode.getCommentsInside(node.callee).length > 0) { + return null; + } + + const tokenJustBeforeNode = sourceCode.getTokenBefore(node.callee, { includeComments: true }); + + // for https://github.com/eslint/eslint/pull/15346#issuecomment-991417335 + if ( + tokenJustBeforeNode && + tokenJustBeforeNode.range[1] === node.callee.range[0] && + !astUtils.canTokensBeAdjacent(tokenJustBeforeNode, "Object.hasOwn") + ) { + return fixer.replaceText(node.callee, " Object.hasOwn"); + } + + return fixer.replaceText(node.callee, "Object.hasOwn"); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-object-spread.js b/node_modules/eslint/lib/rules/prefer-object-spread.js new file mode 100644 index 0000000..b63474e --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-object-spread.js @@ -0,0 +1,299 @@ +/** + * @fileoverview Prefers object spread property over Object.assign + * @author Sharmila Jesupaul + * See LICENSE file in root directory for full license. + */ + +"use strict"; + +const { CALL, ReferenceTracker } = require("eslint-utils"); +const { + isCommaToken, + isOpeningParenToken, + isClosingParenToken, + isParenthesised +} = require("./utils/ast-utils"); + +const ANY_SPACE = /\s/u; + +/** + * Helper that checks if the Object.assign call has array spread + * @param {ASTNode} node The node that the rule warns on + * @returns {boolean} - Returns true if the Object.assign call has array spread + */ +function hasArraySpread(node) { + return node.arguments.some(arg => arg.type === "SpreadElement"); +} + +/** + * Determines whether the given node is an accessor property (getter/setter). + * @param {ASTNode} node Node to check. + * @returns {boolean} `true` if the node is a getter or a setter. + */ +function isAccessorProperty(node) { + return node.type === "Property" && + (node.kind === "get" || node.kind === "set"); +} + +/** + * Determines whether the given object expression node has accessor properties (getters/setters). + * @param {ASTNode} node `ObjectExpression` node to check. + * @returns {boolean} `true` if the node has at least one getter/setter. + */ +function hasAccessors(node) { + return node.properties.some(isAccessorProperty); +} + +/** + * Determines whether the given call expression node has object expression arguments with accessor properties (getters/setters). + * @param {ASTNode} node `CallExpression` node to check. + * @returns {boolean} `true` if the node has at least one argument that is an object expression with at least one getter/setter. + */ +function hasArgumentsWithAccessors(node) { + return node.arguments + .filter(arg => arg.type === "ObjectExpression") + .some(hasAccessors); +} + +/** + * Helper that checks if the node needs parentheses to be valid JS. + * The default is to wrap the node in parentheses to avoid parsing errors. + * @param {ASTNode} node The node that the rule warns on + * @param {Object} sourceCode in context sourcecode object + * @returns {boolean} - Returns true if the node needs parentheses + */ +function needsParens(node, sourceCode) { + const parent = node.parent; + + switch (parent.type) { + case "VariableDeclarator": + case "ArrayExpression": + case "ReturnStatement": + case "CallExpression": + case "Property": + return false; + case "AssignmentExpression": + return parent.left === node && !isParenthesised(sourceCode, node); + default: + return !isParenthesised(sourceCode, node); + } +} + +/** + * Determines if an argument needs parentheses. The default is to not add parens. + * @param {ASTNode} node The node to be checked. + * @param {Object} sourceCode in context sourcecode object + * @returns {boolean} True if the node needs parentheses + */ +function argNeedsParens(node, sourceCode) { + switch (node.type) { + case "AssignmentExpression": + case "ArrowFunctionExpression": + case "ConditionalExpression": + return !isParenthesised(sourceCode, node); + default: + return false; + } +} + +/** + * Get the parenthesis tokens of a given ObjectExpression node. + * This includes the braces of the object literal and enclosing parentheses. + * @param {ASTNode} node The node to get. + * @param {Token} leftArgumentListParen The opening paren token of the argument list. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token[]} The parenthesis tokens of the node. This is sorted by the location. + */ +function getParenTokens(node, leftArgumentListParen, sourceCode) { + const parens = [sourceCode.getFirstToken(node), sourceCode.getLastToken(node)]; + let leftNext = sourceCode.getTokenBefore(node); + let rightNext = sourceCode.getTokenAfter(node); + + // Note: don't include the parens of the argument list. + while ( + leftNext && + rightNext && + leftNext.range[0] > leftArgumentListParen.range[0] && + isOpeningParenToken(leftNext) && + isClosingParenToken(rightNext) + ) { + parens.push(leftNext, rightNext); + leftNext = sourceCode.getTokenBefore(leftNext); + rightNext = sourceCode.getTokenAfter(rightNext); + } + + return parens.sort((a, b) => a.range[0] - b.range[0]); +} + +/** + * Get the range of a given token and around whitespaces. + * @param {Token} token The token to get range. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {number} The end of the range of the token and around whitespaces. + */ +function getStartWithSpaces(token, sourceCode) { + const text = sourceCode.text; + let start = token.range[0]; + + // If the previous token is a line comment then skip this step to avoid commenting this token out. + { + const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }); + + if (prevToken && prevToken.type === "Line") { + return start; + } + } + + // Detect spaces before the token. + while (ANY_SPACE.test(text[start - 1] || "")) { + start -= 1; + } + + return start; +} + +/** + * Get the range of a given token and around whitespaces. + * @param {Token} token The token to get range. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {number} The start of the range of the token and around whitespaces. + */ +function getEndWithSpaces(token, sourceCode) { + const text = sourceCode.text; + let end = token.range[1]; + + // Detect spaces after the token. + while (ANY_SPACE.test(text[end] || "")) { + end += 1; + } + + return end; +} + +/** + * Autofixes the Object.assign call to use an object spread instead. + * @param {ASTNode|null} node The node that the rule warns on, i.e. the Object.assign call + * @param {string} sourceCode sourceCode of the Object.assign call + * @returns {Function} autofixer - replaces the Object.assign with a spread object. + */ +function defineFixer(node, sourceCode) { + return function *(fixer) { + const leftParen = sourceCode.getTokenAfter(node.callee, isOpeningParenToken); + const rightParen = sourceCode.getLastToken(node); + + // Remove everything before the opening paren: callee `Object.assign`, type arguments, and whitespace between the callee and the paren. + yield fixer.removeRange([node.range[0], leftParen.range[0]]); + + // Replace the parens of argument list to braces. + if (needsParens(node, sourceCode)) { + yield fixer.replaceText(leftParen, "({"); + yield fixer.replaceText(rightParen, "})"); + } else { + yield fixer.replaceText(leftParen, "{"); + yield fixer.replaceText(rightParen, "}"); + } + + // Process arguments. + for (const argNode of node.arguments) { + const innerParens = getParenTokens(argNode, leftParen, sourceCode); + const left = innerParens.shift(); + const right = innerParens.pop(); + + if (argNode.type === "ObjectExpression") { + const maybeTrailingComma = sourceCode.getLastToken(argNode, 1); + const maybeArgumentComma = sourceCode.getTokenAfter(right); + + /* + * Make bare this object literal. + * And remove spaces inside of the braces for better formatting. + */ + for (const innerParen of innerParens) { + yield fixer.remove(innerParen); + } + const leftRange = [left.range[0], getEndWithSpaces(left, sourceCode)]; + const rightRange = [ + Math.max(getStartWithSpaces(right, sourceCode), leftRange[1]), // Ensure ranges don't overlap + right.range[1] + ]; + + yield fixer.removeRange(leftRange); + yield fixer.removeRange(rightRange); + + // Remove the comma of this argument if it's duplication. + if ( + (argNode.properties.length === 0 || isCommaToken(maybeTrailingComma)) && + isCommaToken(maybeArgumentComma) + ) { + yield fixer.remove(maybeArgumentComma); + } + } else { + + // Make spread. + if (argNeedsParens(argNode, sourceCode)) { + yield fixer.insertTextBefore(left, "...("); + yield fixer.insertTextAfter(right, ")"); + } else { + yield fixer.insertTextBefore(left, "..."); + } + } + } + }; +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: + "disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-object-spread" + }, + + schema: [], + fixable: "code", + + messages: { + useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`.", + useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const trackMap = { + Object: { + assign: { [CALL]: true } + } + }; + + // Iterate all calls of `Object.assign` (only of the global variable `Object`). + for (const { node } of tracker.iterateGlobalReferences(trackMap)) { + if ( + node.arguments.length >= 1 && + node.arguments[0].type === "ObjectExpression" && + !hasArraySpread(node) && + !( + node.arguments.length > 1 && + hasArgumentsWithAccessors(node) + ) + ) { + const messageId = node.arguments.length === 1 + ? "useLiteralMessage" + : "useSpreadMessage"; + const fix = defineFixer(node, sourceCode); + + context.report({ node, messageId, fix }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js b/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js new file mode 100644 index 0000000..60e72f4 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js @@ -0,0 +1,131 @@ +/** + * @fileoverview restrict values that can be used as Promise rejection reasons + * @author Teddy Katz + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require using Error objects as Promise rejection reasons", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-promise-reject-errors" + }, + + fixable: null, + + schema: [ + { + type: "object", + properties: { + allowEmptyReject: { type: "boolean", default: false } + }, + additionalProperties: false + } + ], + + messages: { + rejectAnError: "Expected the Promise rejection reason to be an Error." + } + }, + + create(context) { + + const ALLOW_EMPTY_REJECT = context.options.length && context.options[0].allowEmptyReject; + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + /** + * Checks the argument of a reject() or Promise.reject() CallExpression, and reports it if it can't be an Error + * @param {ASTNode} callExpression A CallExpression node which is used to reject a Promise + * @returns {void} + */ + function checkRejectCall(callExpression) { + if (!callExpression.arguments.length && ALLOW_EMPTY_REJECT) { + return; + } + if ( + !callExpression.arguments.length || + !astUtils.couldBeError(callExpression.arguments[0]) || + callExpression.arguments[0].type === "Identifier" && callExpression.arguments[0].name === "undefined" + ) { + context.report({ + node: callExpression, + messageId: "rejectAnError" + }); + } + } + + /** + * Determines whether a function call is a Promise.reject() call + * @param {ASTNode} node A CallExpression node + * @returns {boolean} `true` if the call is a Promise.reject() call + */ + function isPromiseRejectCall(node) { + return astUtils.isSpecificMemberAccess(node.callee, "Promise", "reject"); + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + return { + + // Check `Promise.reject(value)` calls. + CallExpression(node) { + if (isPromiseRejectCall(node)) { + checkRejectCall(node); + } + }, + + /* + * Check for `new Promise((resolve, reject) => {})`, and check for reject() calls. + * This function is run on "NewExpression:exit" instead of "NewExpression" to ensure that + * the nodes in the expression already have the `parent` property. + */ + "NewExpression:exit"(node) { + if ( + node.callee.type === "Identifier" && node.callee.name === "Promise" && + node.arguments.length && astUtils.isFunction(node.arguments[0]) && + node.arguments[0].params.length > 1 && node.arguments[0].params[1].type === "Identifier" + ) { + context.getDeclaredVariables(node.arguments[0]) + + /* + * Find the first variable that matches the second parameter's name. + * If the first parameter has the same name as the second parameter, then the variable will actually + * be "declared" when the first parameter is evaluated, but then it will be immediately overwritten + * by the second parameter. It's not possible for an expression with the variable to be evaluated before + * the variable is overwritten, because functions with duplicate parameters cannot have destructuring or + * default assignments in their parameter lists. Therefore, it's not necessary to explicitly account for + * this case. + */ + .find(variable => variable.name === node.arguments[0].params[1].name) + + // Get the references to that variable. + .references + + // Only check the references that read the parameter's value. + .filter(ref => ref.isRead()) + + // Only check the references that are used as the callee in a function call, e.g. `reject(foo)`. + .filter(ref => ref.identifier.parent.type === "CallExpression" && ref.identifier === ref.identifier.parent.callee) + + // Check the argument of the function call to determine whether it's an Error. + .forEach(ref => checkRejectCall(ref.identifier.parent)); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-reflect.js b/node_modules/eslint/lib/rules/prefer-reflect.js new file mode 100644 index 0000000..3772689 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-reflect.js @@ -0,0 +1,127 @@ +/** + * @fileoverview Rule to suggest using "Reflect" api over Function/Object methods + * @author Keith Cirkel + * @deprecated in ESLint v3.9.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `Reflect` methods where applicable", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-reflect" + }, + + deprecated: true, + + replacedBy: [], + + schema: [ + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + enum: [ + "apply", + "call", + "delete", + "defineProperty", + "getOwnPropertyDescriptor", + "getPrototypeOf", + "setPrototypeOf", + "isExtensible", + "getOwnPropertyNames", + "preventExtensions" + ] + }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + preferReflect: "Avoid using {{existing}}, instead use {{substitute}}." + } + }, + + create(context) { + const existingNames = { + apply: "Function.prototype.apply", + call: "Function.prototype.call", + defineProperty: "Object.defineProperty", + getOwnPropertyDescriptor: "Object.getOwnPropertyDescriptor", + getPrototypeOf: "Object.getPrototypeOf", + setPrototypeOf: "Object.setPrototypeOf", + isExtensible: "Object.isExtensible", + getOwnPropertyNames: "Object.getOwnPropertyNames", + preventExtensions: "Object.preventExtensions" + }; + + const reflectSubstitutes = { + apply: "Reflect.apply", + call: "Reflect.apply", + defineProperty: "Reflect.defineProperty", + getOwnPropertyDescriptor: "Reflect.getOwnPropertyDescriptor", + getPrototypeOf: "Reflect.getPrototypeOf", + setPrototypeOf: "Reflect.setPrototypeOf", + isExtensible: "Reflect.isExtensible", + getOwnPropertyNames: "Reflect.getOwnPropertyNames", + preventExtensions: "Reflect.preventExtensions" + }; + + const exceptions = (context.options[0] || {}).exceptions || []; + + /** + * Reports the Reflect violation based on the `existing` and `substitute` + * @param {Object} node The node that violates the rule. + * @param {string} existing The existing method name that has been used. + * @param {string} substitute The Reflect substitute that should be used. + * @returns {void} + */ + function report(node, existing, substitute) { + context.report({ + node, + messageId: "preferReflect", + data: { + existing, + substitute + } + }); + } + + return { + CallExpression(node) { + const methodName = (node.callee.property || {}).name; + const isReflectCall = (node.callee.object || {}).name === "Reflect"; + const hasReflectSubstitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName); + const userConfiguredException = exceptions.includes(methodName); + + if (hasReflectSubstitute && !isReflectCall && !userConfiguredException) { + report(node, existingNames[methodName], reflectSubstitutes[methodName]); + } + }, + UnaryExpression(node) { + const isDeleteOperator = node.operator === "delete"; + const targetsIdentifier = node.argument.type === "Identifier"; + const userConfiguredException = exceptions.includes("delete"); + + if (isDeleteOperator && !targetsIdentifier && !userConfiguredException) { + report(node, "the delete keyword", "Reflect.deleteProperty"); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-regex-literals.js b/node_modules/eslint/lib/rules/prefer-regex-literals.js new file mode 100644 index 0000000..aa72589 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-regex-literals.js @@ -0,0 +1,396 @@ +/** + * @fileoverview Rule to disallow use of the `RegExp` constructor in favor of regular expression literals + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { CALL, CONSTRUCT, ReferenceTracker, findVariable } = require("eslint-utils"); +const { RegExpValidator, visitRegExpAST, RegExpParser } = require("regexpp"); +const { canTokensBeAdjacent } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const REGEXPP_LATEST_ECMA_VERSION = 2022; + +/** + * Determines whether the given node is a string literal. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is a string literal. + */ +function isStringLiteral(node) { + return node.type === "Literal" && typeof node.value === "string"; +} + +/** + * Determines whether the given node is a regex literal. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is a regex literal. + */ +function isRegexLiteral(node) { + return node.type === "Literal" && Object.prototype.hasOwnProperty.call(node, "regex"); +} + +/** + * Determines whether the given node is a template literal without expressions. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is a template literal without expressions. + */ +function isStaticTemplateLiteral(node) { + return node.type === "TemplateLiteral" && node.expressions.length === 0; +} + +const validPrecedingTokens = new Set([ + "(", + ";", + "[", + ",", + "=", + "+", + "*", + "-", + "?", + "~", + "%", + "**", + "!", + "typeof", + "instanceof", + "&&", + "||", + "??", + "return", + "...", + "delete", + "void", + "in", + "<", + ">", + "<=", + ">=", + "==", + "===", + "!=", + "!==", + "<<", + ">>", + ">>>", + "&", + "|", + "^", + ":", + "{", + "=>", + "*=", + "<<=", + ">>=", + ">>>=", + "^=", + "|=", + "&=", + "??=", + "||=", + "&&=", + "**=", + "+=", + "-=", + "/=", + "%=", + "/", + "do", + "break", + "continue", + "debugger", + "case", + "throw" +]); + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow use of the `RegExp` constructor in favor of regular expression literals", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-regex-literals" + }, + + hasSuggestions: true, + + schema: [ + { + type: "object", + properties: { + disallowRedundantWrapping: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedRegExp: "Use a regular expression literal instead of the 'RegExp' constructor.", + replaceWithLiteral: "Replace with an equivalent regular expression literal.", + unexpectedRedundantRegExp: "Regular expression literal is unnecessarily wrapped within a 'RegExp' constructor.", + unexpectedRedundantRegExpWithFlags: "Use regular expression literal with flags instead of the 'RegExp' constructor." + } + }, + + create(context) { + const [{ disallowRedundantWrapping = false } = {}] = context.options; + const sourceCode = context.getSourceCode(); + + /** + * Determines whether the given identifier node is a reference to a global variable. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} True if the identifier is a reference to a global variable. + */ + function isGlobalReference(node) { + const scope = context.getScope(); + const variable = findVariable(scope, node); + + return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; + } + + /** + * Determines whether the given node is a String.raw`` tagged template expression + * with a static template literal. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is String.raw`` with a static template. + */ + function isStringRawTaggedStaticTemplateLiteral(node) { + return node.type === "TaggedTemplateExpression" && + astUtils.isSpecificMemberAccess(node.tag, "String", "raw") && + isGlobalReference(astUtils.skipChainExpression(node.tag).object) && + isStaticTemplateLiteral(node.quasi); + } + + /** + * Gets the value of a string + * @param {ASTNode} node The node to get the string of. + * @returns {string|null} The value of the node. + */ + function getStringValue(node) { + if (isStringLiteral(node)) { + return node.value; + } + + if (isStaticTemplateLiteral(node)) { + return node.quasis[0].value.cooked; + } + + if (isStringRawTaggedStaticTemplateLiteral(node)) { + return node.quasi.quasis[0].value.raw; + } + + return null; + } + + /** + * Determines whether the given node is considered to be a static string by the logic of this rule. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node is a static string. + */ + function isStaticString(node) { + return isStringLiteral(node) || + isStaticTemplateLiteral(node) || + isStringRawTaggedStaticTemplateLiteral(node); + } + + /** + * Determines whether the relevant arguments of the given are all static string literals. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if all arguments are static strings. + */ + function hasOnlyStaticStringArguments(node) { + const args = node.arguments; + + if ((args.length === 1 || args.length === 2) && args.every(isStaticString)) { + return true; + } + + return false; + } + + /** + * Determines whether the arguments of the given node indicate that a regex literal is unnecessarily wrapped. + * @param {ASTNode} node Node to check. + * @returns {boolean} True if the node already contains a regex literal argument. + */ + function isUnnecessarilyWrappedRegexLiteral(node) { + const args = node.arguments; + + if (args.length === 1 && isRegexLiteral(args[0])) { + return true; + } + + if (args.length === 2 && isRegexLiteral(args[0]) && isStaticString(args[1])) { + return true; + } + + return false; + } + + /** + * Returns a ecmaVersion compatible for regexpp. + * @param {any} ecmaVersion The ecmaVersion to convert. + * @returns {import("regexpp/ecma-versions").EcmaVersion} The resulting ecmaVersion compatible for regexpp. + */ + function getRegexppEcmaVersion(ecmaVersion) { + if (typeof ecmaVersion !== "number" || ecmaVersion <= 5) { + return 5; + } + return Math.min(ecmaVersion + 2009, REGEXPP_LATEST_ECMA_VERSION); + } + + /** + * Makes a character escaped or else returns null. + * @param {string} character The character to escape. + * @returns {string} The resulting escaped character. + */ + function resolveEscapes(character) { + switch (character) { + case "\n": + case "\\\n": + return "\\n"; + + case "\r": + case "\\\r": + return "\\r"; + + case "\t": + case "\\\t": + return "\\t"; + + case "\v": + case "\\\v": + return "\\v"; + + case "\f": + case "\\\f": + return "\\f"; + + case "/": + return "\\/"; + + default: + return null; + } + } + + return { + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const traceMap = { + RegExp: { + [CALL]: true, + [CONSTRUCT]: true + } + }; + + for (const { node } of tracker.iterateGlobalReferences(traceMap)) { + if (disallowRedundantWrapping && isUnnecessarilyWrappedRegexLiteral(node)) { + if (node.arguments.length === 2) { + context.report({ node, messageId: "unexpectedRedundantRegExpWithFlags" }); + } else { + context.report({ node, messageId: "unexpectedRedundantRegExp" }); + } + } else if (hasOnlyStaticStringArguments(node)) { + let regexContent = getStringValue(node.arguments[0]); + let noFix = false; + let flags; + + if (node.arguments[1]) { + flags = getStringValue(node.arguments[1]); + } + + const regexppEcmaVersion = getRegexppEcmaVersion(context.parserOptions.ecmaVersion); + const RegExpValidatorInstance = new RegExpValidator({ ecmaVersion: regexppEcmaVersion }); + + try { + RegExpValidatorInstance.validatePattern(regexContent, 0, regexContent.length, flags ? flags.includes("u") : false); + if (flags) { + RegExpValidatorInstance.validateFlags(flags); + } + } catch { + noFix = true; + } + + const tokenBefore = sourceCode.getTokenBefore(node); + + if (tokenBefore && !validPrecedingTokens.has(tokenBefore.value)) { + noFix = true; + } + + if (!/^[-a-zA-Z0-9\\[\](){} \t\r\n\v\f!@#$%^&*+^_=/~`.> 0) { + noFix = true; + } + + if (regexContent && !noFix) { + let charIncrease = 0; + + const ast = new RegExpParser({ ecmaVersion: regexppEcmaVersion }).parsePattern(regexContent, 0, regexContent.length, flags ? flags.includes("u") : false); + + visitRegExpAST(ast, { + onCharacterEnter(characterNode) { + const escaped = resolveEscapes(characterNode.raw); + + if (escaped) { + regexContent = + regexContent.slice(0, characterNode.start + charIncrease) + + escaped + + regexContent.slice(characterNode.end + charIncrease); + + if (characterNode.raw.length === 1) { + charIncrease += 1; + } + } + } + }); + } + + const newRegExpValue = `/${regexContent || "(?:)"}/${flags || ""}`; + + context.report({ + node, + messageId: "unexpectedRegExp", + suggest: noFix ? [] : [{ + messageId: "replaceWithLiteral", + fix(fixer) { + const tokenAfter = sourceCode.getTokenAfter(node); + + return fixer.replaceText( + node, + (tokenBefore && !canTokensBeAdjacent(tokenBefore, newRegExpValue) && tokenBefore.range[1] === node.range[0] ? " " : "") + + newRegExpValue + + (tokenAfter && !canTokensBeAdjacent(newRegExpValue, tokenAfter) && node.range[1] === tokenAfter.range[0] ? " " : "") + ); + } + }] + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-rest-params.js b/node_modules/eslint/lib/rules/prefer-rest-params.js new file mode 100644 index 0000000..371a289 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-rest-params.js @@ -0,0 +1,115 @@ +/** + * @fileoverview Rule to + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets the variable object of `arguments` which is defined implicitly. + * @param {eslint-scope.Scope} scope A scope to get. + * @returns {eslint-scope.Variable} The found variable object. + */ +function getVariableOfArguments(scope) { + const variables = scope.variables; + + for (let i = 0; i < variables.length; ++i) { + const variable = variables[i]; + + if (variable.name === "arguments") { + + /* + * If there was a parameter which is named "arguments", the implicit "arguments" is not defined. + * So does fast return with null. + */ + return (variable.identifiers.length === 0) ? variable : null; + } + } + + /* istanbul ignore next : unreachable */ + return null; +} + +/** + * Checks if the given reference is not normal member access. + * + * - arguments .... true // not member access + * - arguments[i] .... true // computed member access + * - arguments[0] .... true // computed member access + * - arguments.length .... false // normal member access + * @param {eslint-scope.Reference} reference The reference to check. + * @returns {boolean} `true` if the reference is not normal member access. + */ +function isNotNormalMemberAccess(reference) { + const id = reference.identifier; + const parent = id.parent; + + return !( + parent.type === "MemberExpression" && + parent.object === id && + !parent.computed + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require rest parameters instead of `arguments`", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-rest-params" + }, + + schema: [], + + messages: { + preferRestParams: "Use the rest parameters instead of 'arguments'." + } + }, + + create(context) { + + /** + * Reports a given reference. + * @param {eslint-scope.Reference} reference A reference to report. + * @returns {void} + */ + function report(reference) { + context.report({ + node: reference.identifier, + loc: reference.identifier.loc, + messageId: "preferRestParams" + }); + } + + /** + * Reports references of the implicit `arguments` variable if exist. + * @returns {void} + */ + function checkForArguments() { + const argumentsVar = getVariableOfArguments(context.getScope()); + + if (argumentsVar) { + argumentsVar + .references + .filter(isNotNormalMemberAccess) + .forEach(report); + } + } + + return { + "FunctionDeclaration:exit": checkForArguments, + "FunctionExpression:exit": checkForArguments + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-spread.js b/node_modules/eslint/lib/rules/prefer-spread.js new file mode 100644 index 0000000..c5f9e1e --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-spread.js @@ -0,0 +1,87 @@ +/** + * @fileoverview A rule to suggest using of the spread operator instead of `.apply()`. + * @author Toru Nagashima + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a node is a `.apply()` for variadic. + * @param {ASTNode} node A CallExpression node to check. + * @returns {boolean} Whether or not the node is a `.apply()` for variadic. + */ +function isVariadicApplyCalling(node) { + return ( + astUtils.isSpecificMemberAccess(node.callee, null, "apply") && + node.arguments.length === 2 && + node.arguments[1].type !== "ArrayExpression" && + node.arguments[1].type !== "SpreadElement" + ); +} + +/** + * Checks whether or not `thisArg` is not changed by `.apply()`. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.apply()`. + * @param {RuleContext} context The ESLint rule context object. + * @returns {boolean} Whether or not `thisArg` is not changed by `.apply()`. + */ +function isValidThisArg(expectedThis, thisArg, context) { + if (!expectedThis) { + return astUtils.isNullOrUndefined(thisArg); + } + return astUtils.equalTokens(expectedThis, thisArg, context); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require spread operators instead of `.apply()`", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-spread" + }, + + schema: [], + fixable: null, + + messages: { + preferSpread: "Use the spread operator instead of '.apply()'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + CallExpression(node) { + if (!isVariadicApplyCalling(node)) { + return; + } + + const applied = astUtils.skipChainExpression(astUtils.skipChainExpression(node.callee).object); + const expectedThis = (applied.type === "MemberExpression") ? applied.object : null; + const thisArg = node.arguments[0]; + + if (isValidThisArg(expectedThis, thisArg, sourceCode)) { + context.report({ + node, + messageId: "preferSpread" + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/prefer-template.js b/node_modules/eslint/lib/rules/prefer-template.js new file mode 100644 index 0000000..e61eac1 --- /dev/null +++ b/node_modules/eslint/lib/rules/prefer-template.js @@ -0,0 +1,275 @@ +/** + * @fileoverview A rule to suggest using template literals instead of string concatenation. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether or not a given node is a concatenation. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a concatenation. + */ +function isConcatenation(node) { + return node.type === "BinaryExpression" && node.operator === "+"; +} + +/** + * Gets the top binary expression node for concatenation in parents of a given node. + * @param {ASTNode} node A node to get. + * @returns {ASTNode} the top binary expression node in parents of a given node. + */ +function getTopConcatBinaryExpression(node) { + let currentNode = node; + + while (isConcatenation(currentNode.parent)) { + currentNode = currentNode.parent; + } + return currentNode; +} + +/** + * Checks whether or not a node contains a string literal with an octal or non-octal decimal escape sequence + * @param {ASTNode} node A node to check + * @returns {boolean} `true` if at least one string literal within the node contains + * an octal or non-octal decimal escape sequence + */ +function hasOctalOrNonOctalDecimalEscapeSequence(node) { + if (isConcatenation(node)) { + return ( + hasOctalOrNonOctalDecimalEscapeSequence(node.left) || + hasOctalOrNonOctalDecimalEscapeSequence(node.right) + ); + } + + // No need to check TemplateLiterals – would throw parsing error + if (node.type === "Literal" && typeof node.value === "string") { + return astUtils.hasOctalOrNonOctalDecimalEscapeSequence(node.raw); + } + + return false; +} + +/** + * Checks whether or not a given binary expression has string literals. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node has string literals. + */ +function hasStringLiteral(node) { + if (isConcatenation(node)) { + + // `left` is deeper than `right` normally. + return hasStringLiteral(node.right) || hasStringLiteral(node.left); + } + return astUtils.isStringLiteral(node); +} + +/** + * Checks whether or not a given binary expression has non string literals. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node has non string literals. + */ +function hasNonStringLiteral(node) { + if (isConcatenation(node)) { + + // `left` is deeper than `right` normally. + return hasNonStringLiteral(node.right) || hasNonStringLiteral(node.left); + } + return !astUtils.isStringLiteral(node); +} + +/** + * Determines whether a given node will start with a template curly expression (`${}`) when being converted to a template literal. + * @param {ASTNode} node The node that will be fixed to a template literal + * @returns {boolean} `true` if the node will start with a template curly. + */ +function startsWithTemplateCurly(node) { + if (node.type === "BinaryExpression") { + return startsWithTemplateCurly(node.left); + } + if (node.type === "TemplateLiteral") { + return node.expressions.length && node.quasis.length && node.quasis[0].range[0] === node.quasis[0].range[1]; + } + return node.type !== "Literal" || typeof node.value !== "string"; +} + +/** + * Determines whether a given node end with a template curly expression (`${}`) when being converted to a template literal. + * @param {ASTNode} node The node that will be fixed to a template literal + * @returns {boolean} `true` if the node will end with a template curly. + */ +function endsWithTemplateCurly(node) { + if (node.type === "BinaryExpression") { + return startsWithTemplateCurly(node.right); + } + if (node.type === "TemplateLiteral") { + return node.expressions.length && node.quasis.length && node.quasis[node.quasis.length - 1].range[0] === node.quasis[node.quasis.length - 1].range[1]; + } + return node.type !== "Literal" || typeof node.value !== "string"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require template literals instead of string concatenation", + recommended: false, + url: "https://eslint.org/docs/rules/prefer-template" + }, + + schema: [], + fixable: "code", + + messages: { + unexpectedStringConcatenation: "Unexpected string concatenation." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let done = Object.create(null); + + /** + * Gets the non-token text between two nodes, ignoring any other tokens that appear between the two tokens. + * @param {ASTNode} node1 The first node + * @param {ASTNode} node2 The second node + * @returns {string} The text between the nodes, excluding other tokens + */ + function getTextBetween(node1, node2) { + const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2); + const sourceText = sourceCode.getText(); + + return allTokens.slice(0, -1).reduce((accumulator, token, index) => accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), ""); + } + + /** + * Returns a template literal form of the given node. + * @param {ASTNode} currentNode A node that should be converted to a template literal + * @param {string} textBeforeNode Text that should appear before the node + * @param {string} textAfterNode Text that should appear after the node + * @returns {string} A string form of this node, represented as a template literal + */ + function getTemplateLiteral(currentNode, textBeforeNode, textAfterNode) { + if (currentNode.type === "Literal" && typeof currentNode.value === "string") { + + /* + * If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted + * as a template placeholder. However, if the code already contains a backslash before the ${ or ` + * for some reason, don't add another backslash, because that would change the meaning of the code (it would cause + * an actual backslash character to appear before the dollar sign). + */ + return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => { + if (matched.lastIndexOf("\\") % 2) { + return `\\${matched}`; + } + return matched; + + // Unescape any quotes that appear in the original Literal that no longer need to be escaped. + }).replace(new RegExp(`\\\\${currentNode.raw[0]}`, "gu"), currentNode.raw[0])}\``; + } + + if (currentNode.type === "TemplateLiteral") { + return sourceCode.getText(currentNode); + } + + if (isConcatenation(currentNode) && hasStringLiteral(currentNode)) { + const plusSign = sourceCode.getFirstTokenBetween(currentNode.left, currentNode.right, token => token.value === "+"); + const textBeforePlus = getTextBetween(currentNode.left, plusSign); + const textAfterPlus = getTextBetween(plusSign, currentNode.right); + const leftEndsWithCurly = endsWithTemplateCurly(currentNode.left); + const rightStartsWithCurly = startsWithTemplateCurly(currentNode.right); + + if (leftEndsWithCurly) { + + // If the left side of the expression ends with a template curly, add the extra text to the end of the curly bracket. + // `foo${bar}` /* comment */ + 'baz' --> `foo${bar /* comment */ }${baz}` + return getTemplateLiteral(currentNode.left, textBeforeNode, textBeforePlus + textAfterPlus).slice(0, -1) + + getTemplateLiteral(currentNode.right, null, textAfterNode).slice(1); + } + if (rightStartsWithCurly) { + + // Otherwise, if the right side of the expression starts with a template curly, add the text there. + // 'foo' /* comment */ + `${bar}baz` --> `foo${ /* comment */ bar}baz` + return getTemplateLiteral(currentNode.left, textBeforeNode, null).slice(0, -1) + + getTemplateLiteral(currentNode.right, textBeforePlus + textAfterPlus, textAfterNode).slice(1); + } + + /* + * Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put + * the text between them. + */ + return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`; + } + + return `\`\${${textBeforeNode || ""}${sourceCode.getText(currentNode)}${textAfterNode || ""}}\``; + } + + /** + * Returns a fixer object that converts a non-string binary expression to a template literal + * @param {SourceCodeFixer} fixer The fixer object + * @param {ASTNode} node A node that should be converted to a template literal + * @returns {Object} A fix for this binary expression + */ + function fixNonStringBinaryExpression(fixer, node) { + const topBinaryExpr = getTopConcatBinaryExpression(node.parent); + + if (hasOctalOrNonOctalDecimalEscapeSequence(topBinaryExpr)) { + return null; + } + + return fixer.replaceText(topBinaryExpr, getTemplateLiteral(topBinaryExpr, null, null)); + } + + /** + * Reports if a given node is string concatenation with non string literals. + * @param {ASTNode} node A node to check. + * @returns {void} + */ + function checkForStringConcat(node) { + if (!astUtils.isStringLiteral(node) || !isConcatenation(node.parent)) { + return; + } + + const topBinaryExpr = getTopConcatBinaryExpression(node.parent); + + // Checks whether or not this node had been checked already. + if (done[topBinaryExpr.range[0]]) { + return; + } + done[topBinaryExpr.range[0]] = true; + + if (hasNonStringLiteral(topBinaryExpr)) { + context.report({ + node: topBinaryExpr, + messageId: "unexpectedStringConcatenation", + fix: fixer => fixNonStringBinaryExpression(fixer, node) + }); + } + } + + return { + Program() { + done = Object.create(null); + }, + + Literal: checkForStringConcat, + TemplateLiteral: checkForStringConcat + }; + } +}; diff --git a/node_modules/eslint/lib/rules/quote-props.js b/node_modules/eslint/lib/rules/quote-props.js new file mode 100644 index 0000000..0b66d76 --- /dev/null +++ b/node_modules/eslint/lib/rules/quote-props.js @@ -0,0 +1,307 @@ +/** + * @fileoverview Rule to flag non-quoted property names in object literals. + * @author Mathias Bynens + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const espree = require("espree"); +const astUtils = require("./utils/ast-utils"); +const keywords = require("./utils/keywords"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require quotes around object literal property names", + recommended: false, + url: "https://eslint.org/docs/rules/quote-props" + }, + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["always", "as-needed", "consistent", "consistent-as-needed"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["always", "as-needed", "consistent", "consistent-as-needed"] + }, + { + type: "object", + properties: { + keywords: { + type: "boolean" + }, + unnecessary: { + type: "boolean" + }, + numbers: { + type: "boolean" + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + fixable: "code", + messages: { + requireQuotesDueToReservedWord: "Properties should be quoted as '{{property}}' is a reserved word.", + inconsistentlyQuotedProperty: "Inconsistently quoted property '{{key}}' found.", + unnecessarilyQuotedProperty: "Unnecessarily quoted property '{{property}}' found.", + unquotedReservedProperty: "Unquoted reserved word '{{property}}' used as key.", + unquotedNumericProperty: "Unquoted number literal '{{property}}' used as key.", + unquotedPropertyFound: "Unquoted property '{{property}}' found.", + redundantQuoting: "Properties shouldn't be quoted as all quotes are redundant." + } + }, + + create(context) { + + const MODE = context.options[0], + KEYWORDS = context.options[1] && context.options[1].keywords, + CHECK_UNNECESSARY = !context.options[1] || context.options[1].unnecessary !== false, + NUMBERS = context.options[1] && context.options[1].numbers, + + sourceCode = context.getSourceCode(); + + + /** + * Checks whether a certain string constitutes an ES3 token + * @param {string} tokenStr The string to be checked. + * @returns {boolean} `true` if it is an ES3 token. + */ + function isKeyword(tokenStr) { + return keywords.includes(tokenStr); + } + + /** + * Checks if an espree-tokenized key has redundant quotes (i.e. whether quotes are unnecessary) + * @param {string} rawKey The raw key value from the source + * @param {espreeTokens} tokens The espree-tokenized node key + * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked + * @returns {boolean} Whether or not a key has redundant quotes. + * @private + */ + function areQuotesRedundant(rawKey, tokens, skipNumberLiterals) { + return tokens.length === 1 && tokens[0].start === 0 && tokens[0].end === rawKey.length && + (["Identifier", "Keyword", "Null", "Boolean"].includes(tokens[0].type) || + (tokens[0].type === "Numeric" && !skipNumberLiterals && String(+tokens[0].value) === tokens[0].value)); + } + + /** + * Returns a string representation of a property node with quotes removed + * @param {ASTNode} key Key AST Node, which may or may not be quoted + * @returns {string} A replacement string for this property + */ + function getUnquotedKey(key) { + return key.type === "Identifier" ? key.name : key.value; + } + + /** + * Returns a string representation of a property node with quotes added + * @param {ASTNode} key Key AST Node, which may or may not be quoted + * @returns {string} A replacement string for this property + */ + function getQuotedKey(key) { + if (key.type === "Literal" && typeof key.value === "string") { + + // If the key is already a string literal, don't replace the quotes with double quotes. + return sourceCode.getText(key); + } + + // Otherwise, the key is either an identifier or a number literal. + return `"${key.type === "Identifier" ? key.name : key.value}"`; + } + + /** + * Ensures that a property's key is quoted only when necessary + * @param {ASTNode} node Property AST node + * @returns {void} + */ + function checkUnnecessaryQuotes(node) { + const key = node.key; + + if (node.method || node.computed || node.shorthand) { + return; + } + + if (key.type === "Literal" && typeof key.value === "string") { + let tokens; + + try { + tokens = espree.tokenize(key.value); + } catch { + return; + } + + if (tokens.length !== 1) { + return; + } + + const isKeywordToken = isKeyword(tokens[0].value); + + if (isKeywordToken && KEYWORDS) { + return; + } + + if (CHECK_UNNECESSARY && areQuotesRedundant(key.value, tokens, NUMBERS)) { + context.report({ + node, + messageId: "unnecessarilyQuotedProperty", + data: { property: key.value }, + fix: fixer => fixer.replaceText(key, getUnquotedKey(key)) + }); + } + } else if (KEYWORDS && key.type === "Identifier" && isKeyword(key.name)) { + context.report({ + node, + messageId: "unquotedReservedProperty", + data: { property: key.name }, + fix: fixer => fixer.replaceText(key, getQuotedKey(key)) + }); + } else if (NUMBERS && key.type === "Literal" && astUtils.isNumericLiteral(key)) { + context.report({ + node, + messageId: "unquotedNumericProperty", + data: { property: key.value }, + fix: fixer => fixer.replaceText(key, getQuotedKey(key)) + }); + } + } + + /** + * Ensures that a property's key is quoted + * @param {ASTNode} node Property AST node + * @returns {void} + */ + function checkOmittedQuotes(node) { + const key = node.key; + + if (!node.method && !node.computed && !node.shorthand && !(key.type === "Literal" && typeof key.value === "string")) { + context.report({ + node, + messageId: "unquotedPropertyFound", + data: { property: key.name || key.value }, + fix: fixer => fixer.replaceText(key, getQuotedKey(key)) + }); + } + } + + /** + * Ensures that an object's keys are consistently quoted, optionally checks for redundancy of quotes + * @param {ASTNode} node Property AST node + * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy + * @returns {void} + */ + function checkConsistency(node, checkQuotesRedundancy) { + const quotedProps = [], + unquotedProps = []; + let keywordKeyName = null, + necessaryQuotes = false; + + node.properties.forEach(property => { + const key = property.key; + + if (!key || property.method || property.computed || property.shorthand) { + return; + } + + if (key.type === "Literal" && typeof key.value === "string") { + + quotedProps.push(property); + + if (checkQuotesRedundancy) { + let tokens; + + try { + tokens = espree.tokenize(key.value); + } catch { + necessaryQuotes = true; + return; + } + + necessaryQuotes = necessaryQuotes || !areQuotesRedundant(key.value, tokens) || KEYWORDS && isKeyword(tokens[0].value); + } + } else if (KEYWORDS && checkQuotesRedundancy && key.type === "Identifier" && isKeyword(key.name)) { + unquotedProps.push(property); + necessaryQuotes = true; + keywordKeyName = key.name; + } else { + unquotedProps.push(property); + } + }); + + if (checkQuotesRedundancy && quotedProps.length && !necessaryQuotes) { + quotedProps.forEach(property => { + context.report({ + node: property, + messageId: "redundantQuoting", + fix: fixer => fixer.replaceText(property.key, getUnquotedKey(property.key)) + }); + }); + } else if (unquotedProps.length && keywordKeyName) { + unquotedProps.forEach(property => { + context.report({ + node: property, + messageId: "requireQuotesDueToReservedWord", + data: { property: keywordKeyName }, + fix: fixer => fixer.replaceText(property.key, getQuotedKey(property.key)) + }); + }); + } else if (quotedProps.length && unquotedProps.length) { + unquotedProps.forEach(property => { + context.report({ + node: property, + messageId: "inconsistentlyQuotedProperty", + data: { key: property.key.name || property.key.value }, + fix: fixer => fixer.replaceText(property.key, getQuotedKey(property.key)) + }); + }); + } + } + + return { + Property(node) { + if (MODE === "always" || !MODE) { + checkOmittedQuotes(node); + } + if (MODE === "as-needed") { + checkUnnecessaryQuotes(node); + } + }, + ObjectExpression(node) { + if (MODE === "consistent") { + checkConsistency(node, false); + } + if (MODE === "consistent-as-needed") { + checkConsistency(node, true); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/quotes.js b/node_modules/eslint/lib/rules/quotes.js new file mode 100644 index 0000000..f1d30a0 --- /dev/null +++ b/node_modules/eslint/lib/rules/quotes.js @@ -0,0 +1,347 @@ +/** + * @fileoverview A rule to choose between single and double quote marks + * @author Matt DuVall , Brandon Payton + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +const QUOTE_SETTINGS = { + double: { + quote: "\"", + alternateQuote: "'", + description: "doublequote" + }, + single: { + quote: "'", + alternateQuote: "\"", + description: "singlequote" + }, + backtick: { + quote: "`", + alternateQuote: "\"", + description: "backtick" + } +}; + +// An unescaped newline is a newline preceded by an even number of backslashes. +const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw`(^|[^\\])(\\\\)*[${Array.from(astUtils.LINEBREAKS).join("")}]`, "u"); + +/** + * Switches quoting of javascript string between ' " and ` + * escaping and unescaping as necessary. + * Only escaping of the minimal set of characters is changed. + * Note: escaping of newlines when switching from backtick to other quotes is not handled. + * @param {string} str A string to convert. + * @returns {string} The string with changed quotes. + * @private + */ +QUOTE_SETTINGS.double.convert = +QUOTE_SETTINGS.single.convert = +QUOTE_SETTINGS.backtick.convert = function(str) { + const newQuote = this.quote; + const oldQuote = str[0]; + + if (newQuote === oldQuote) { + return str; + } + return newQuote + str.slice(1, -1).replace(/\\(\$\{|\r\n?|\n|.)|["'`]|\$\{|(\r\n?|\n)/gu, (match, escaped, newline) => { + if (escaped === oldQuote || oldQuote === "`" && escaped === "${") { + return escaped; // unescape + } + if (match === newQuote || newQuote === "`" && match === "${") { + return `\\${match}`; // escape + } + if (newline && oldQuote === "`") { + return "\\n"; // escape newlines + } + return match; + }) + newQuote; +}; + +const AVOID_ESCAPE = "avoid-escape"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce the consistent use of either backticks, double, or single quotes", + recommended: false, + url: "https://eslint.org/docs/rules/quotes" + }, + + fixable: "code", + + schema: [ + { + enum: ["single", "double", "backtick"] + }, + { + anyOf: [ + { + enum: ["avoid-escape"] + }, + { + type: "object", + properties: { + avoidEscape: { + type: "boolean" + }, + allowTemplateLiterals: { + type: "boolean" + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + wrongQuotes: "Strings must use {{description}}." + } + }, + + create(context) { + + const quoteOption = context.options[0], + settings = QUOTE_SETTINGS[quoteOption || "double"], + options = context.options[1], + allowTemplateLiterals = options && options.allowTemplateLiterals === true, + sourceCode = context.getSourceCode(); + let avoidEscape = options && options.avoidEscape === true; + + // deprecated + if (options === AVOID_ESCAPE) { + avoidEscape = true; + } + + /** + * Determines if a given node is part of JSX syntax. + * + * This function returns `true` in the following cases: + * + * - `
` ... If the literal is an attribute value, the parent of the literal is `JSXAttribute`. + * - `
foo
` ... If the literal is a text content, the parent of the literal is `JSXElement`. + * - `<>foo` ... If the literal is a text content, the parent of the literal is `JSXFragment`. + * + * In particular, this function returns `false` in the following cases: + * + * - `
` + * - `
{"foo"}
` + * + * In both cases, inside of the braces is handled as normal JavaScript. + * The braces are `JSXExpressionContainer` nodes. + * @param {ASTNode} node The Literal node to check. + * @returns {boolean} True if the node is a part of JSX, false if not. + * @private + */ + function isJSXLiteral(node) { + return node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment"; + } + + /** + * Checks whether or not a given node is a directive. + * The directive is a `ExpressionStatement` which has only a string literal. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a directive. + * @private + */ + function isDirective(node) { + return ( + node.type === "ExpressionStatement" && + node.expression.type === "Literal" && + typeof node.expression.value === "string" + ); + } + + /** + * Checks whether or not a given node is a part of directive prologues. + * See also: http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a part of directive prologues. + * @private + */ + function isPartOfDirectivePrologue(node) { + const block = node.parent.parent; + + if (block.type !== "Program" && (block.type !== "BlockStatement" || !astUtils.isFunction(block.parent))) { + return false; + } + + // Check the node is at a prologue. + for (let i = 0; i < block.body.length; ++i) { + const statement = block.body[i]; + + if (statement === node.parent) { + return true; + } + if (!isDirective(statement)) { + break; + } + } + + return false; + } + + /** + * Checks whether or not a given node is allowed as non backtick. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is allowed as non backtick. + * @private + */ + function isAllowedAsNonBacktick(node) { + const parent = node.parent; + + switch (parent.type) { + + // Directive Prologues. + case "ExpressionStatement": + return isPartOfDirectivePrologue(node); + + // LiteralPropertyName. + case "Property": + case "PropertyDefinition": + case "MethodDefinition": + return parent.key === node && !parent.computed; + + // ModuleSpecifier. + case "ImportDeclaration": + case "ExportNamedDeclaration": + return parent.source === node; + + // ModuleExportName or ModuleSpecifier. + case "ExportAllDeclaration": + return parent.exported === node || parent.source === node; + + // ModuleExportName. + case "ImportSpecifier": + return parent.imported === node; + + // ModuleExportName. + case "ExportSpecifier": + return parent.local === node || parent.exported === node; + + // Others don't allow. + default: + return false; + } + } + + /** + * Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings. + * @param {ASTNode} node A TemplateLiteral node to check. + * @returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings. + * @private + */ + function isUsingFeatureOfTemplateLiteral(node) { + const hasTag = node.parent.type === "TaggedTemplateExpression" && node === node.parent.quasi; + + if (hasTag) { + return true; + } + + const hasStringInterpolation = node.expressions.length > 0; + + if (hasStringInterpolation) { + return true; + } + + const isMultilineString = node.quasis.length >= 1 && UNESCAPED_LINEBREAK_PATTERN.test(node.quasis[0].value.raw); + + if (isMultilineString) { + return true; + } + + return false; + } + + return { + + Literal(node) { + const val = node.value, + rawVal = node.raw; + + if (settings && typeof val === "string") { + let isValid = (quoteOption === "backtick" && isAllowedAsNonBacktick(node)) || + isJSXLiteral(node) || + astUtils.isSurroundedBy(rawVal, settings.quote); + + if (!isValid && avoidEscape) { + isValid = astUtils.isSurroundedBy(rawVal, settings.alternateQuote) && rawVal.includes(settings.quote); + } + + if (!isValid) { + context.report({ + node, + messageId: "wrongQuotes", + data: { + description: settings.description + }, + fix(fixer) { + if (quoteOption === "backtick" && astUtils.hasOctalOrNonOctalDecimalEscapeSequence(rawVal)) { + + /* + * An octal or non-octal decimal escape sequence in a template literal would + * produce syntax error, even in non-strict mode. + */ + return null; + } + + return fixer.replaceText(node, settings.convert(node.raw)); + } + }); + } + } + }, + + TemplateLiteral(node) { + + // Don't throw an error if backticks are expected or a template literal feature is in use. + if ( + allowTemplateLiterals || + quoteOption === "backtick" || + isUsingFeatureOfTemplateLiteral(node) + ) { + return; + } + + context.report({ + node, + messageId: "wrongQuotes", + data: { + description: settings.description + }, + fix(fixer) { + if (isPartOfDirectivePrologue(node)) { + + /* + * TemplateLiterals in a directive prologue aren't actually directives, but if they're + * in the directive prologue, then fixing them might turn them into directives and change + * the behavior of the code. + */ + return null; + } + return fixer.replaceText(node, settings.convert(sourceCode.getText(node))); + } + }); + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/radix.js b/node_modules/eslint/lib/rules/radix.js new file mode 100644 index 0000000..f83c762 --- /dev/null +++ b/node_modules/eslint/lib/rules/radix.js @@ -0,0 +1,198 @@ +/** + * @fileoverview Rule to flag use of parseInt without a radix argument + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const MODE_ALWAYS = "always", + MODE_AS_NEEDED = "as-needed"; + +const validRadixValues = new Set(Array.from({ length: 37 - 2 }, (_, index) => index + 2)); + +/** + * Checks whether a given variable is shadowed or not. + * @param {eslint-scope.Variable} variable A variable to check. + * @returns {boolean} `true` if the variable is shadowed. + */ +function isShadowed(variable) { + return variable.defs.length >= 1; +} + +/** + * Checks whether a given node is a MemberExpression of `parseInt` method or not. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a MemberExpression of `parseInt` + * method. + */ +function isParseIntMethod(node) { + return ( + node.type === "MemberExpression" && + !node.computed && + node.property.type === "Identifier" && + node.property.name === "parseInt" + ); +} + +/** + * Checks whether a given node is a valid value of radix or not. + * + * The following values are invalid. + * + * - A literal except integers between 2 and 36. + * - undefined. + * @param {ASTNode} radix A node of radix to check. + * @returns {boolean} `true` if the node is valid. + */ +function isValidRadix(radix) { + return !( + (radix.type === "Literal" && !validRadixValues.has(radix.value)) || + (radix.type === "Identifier" && radix.name === "undefined") + ); +} + +/** + * Checks whether a given node is a default value of radix or not. + * @param {ASTNode} radix A node of radix to check. + * @returns {boolean} `true` if the node is the literal node of `10`. + */ +function isDefaultRadix(radix) { + return radix.type === "Literal" && radix.value === 10; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce the consistent use of the radix argument when using `parseInt()`", + recommended: false, + url: "https://eslint.org/docs/rules/radix" + }, + + hasSuggestions: true, + + schema: [ + { + enum: ["always", "as-needed"] + } + ], + + messages: { + missingParameters: "Missing parameters.", + redundantRadix: "Redundant radix parameter.", + missingRadix: "Missing radix parameter.", + invalidRadix: "Invalid radix parameter, must be an integer between 2 and 36.", + addRadixParameter10: "Add radix parameter `10` for parsing decimal numbers." + } + }, + + create(context) { + const mode = context.options[0] || MODE_ALWAYS; + + /** + * Checks the arguments of a given CallExpression node and reports it if it + * offends this rule. + * @param {ASTNode} node A CallExpression node to check. + * @returns {void} + */ + function checkArguments(node) { + const args = node.arguments; + + switch (args.length) { + case 0: + context.report({ + node, + messageId: "missingParameters" + }); + break; + + case 1: + if (mode === MODE_ALWAYS) { + context.report({ + node, + messageId: "missingRadix", + suggest: [ + { + messageId: "addRadixParameter10", + fix(fixer) { + const sourceCode = context.getSourceCode(); + const tokens = sourceCode.getTokens(node); + const lastToken = tokens[tokens.length - 1]; // Parenthesis. + const secondToLastToken = tokens[tokens.length - 2]; // May or may not be a comma. + const hasTrailingComma = secondToLastToken.type === "Punctuator" && secondToLastToken.value === ","; + + return fixer.insertTextBefore(lastToken, hasTrailingComma ? " 10," : ", 10"); + } + } + ] + }); + } + break; + + default: + if (mode === MODE_AS_NEEDED && isDefaultRadix(args[1])) { + context.report({ + node, + messageId: "redundantRadix" + }); + } else if (!isValidRadix(args[1])) { + context.report({ + node, + messageId: "invalidRadix" + }); + } + break; + } + } + + return { + "Program:exit"() { + const scope = context.getScope(); + let variable; + + // Check `parseInt()` + variable = astUtils.getVariableByName(scope, "parseInt"); + if (variable && !isShadowed(variable)) { + variable.references.forEach(reference => { + const node = reference.identifier; + + if (astUtils.isCallee(node)) { + checkArguments(node.parent); + } + }); + } + + // Check `Number.parseInt()` + variable = astUtils.getVariableByName(scope, "Number"); + if (variable && !isShadowed(variable)) { + variable.references.forEach(reference => { + const node = reference.identifier.parent; + const maybeCallee = node.parent.type === "ChainExpression" + ? node.parent + : node; + + if (isParseIntMethod(node) && astUtils.isCallee(maybeCallee)) { + checkArguments(maybeCallee.parent); + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/require-atomic-updates.js b/node_modules/eslint/lib/rules/require-atomic-updates.js new file mode 100644 index 0000000..4dbd48d --- /dev/null +++ b/node_modules/eslint/lib/rules/require-atomic-updates.js @@ -0,0 +1,317 @@ +/** + * @fileoverview disallow assignments that can lead to race conditions due to usage of `await` or `yield` + * @author Teddy Katz + * @author Toru Nagashima + */ +"use strict"; + +/** + * Make the map from identifiers to each reference. + * @param {escope.Scope} scope The scope to get references. + * @param {Map} [outReferenceMap] The map from identifier nodes to each reference object. + * @returns {Map} `referenceMap`. + */ +function createReferenceMap(scope, outReferenceMap = new Map()) { + for (const reference of scope.references) { + if (reference.resolved === null) { + continue; + } + + outReferenceMap.set(reference.identifier, reference); + } + for (const childScope of scope.childScopes) { + if (childScope.type !== "function") { + createReferenceMap(childScope, outReferenceMap); + } + } + + return outReferenceMap; +} + +/** + * Get `reference.writeExpr` of a given reference. + * If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a` + * @param {escope.Reference} reference The reference to get. + * @returns {Expression|null} The `reference.writeExpr`. + */ +function getWriteExpr(reference) { + if (reference.writeExpr) { + return reference.writeExpr; + } + let node = reference.identifier; + + while (node) { + const t = node.parent.type; + + if (t === "AssignmentExpression" && node.parent.left === node) { + return node.parent.right; + } + if (t === "MemberExpression" && node.parent.object === node) { + node = node.parent; + continue; + } + + break; + } + + return null; +} + +/** + * Checks if an expression is a variable that can only be observed within the given function. + * @param {Variable|null} variable The variable to check + * @param {boolean} isMemberAccess If `true` then this is a member access. + * @returns {boolean} `true` if the variable is local to the given function, and is never referenced in a closure. + */ +function isLocalVariableWithoutEscape(variable, isMemberAccess) { + if (!variable) { + return false; // A global variable which was not defined. + } + + // If the reference is a property access and the variable is a parameter, it handles the variable is not local. + if (isMemberAccess && variable.defs.some(d => d.type === "Parameter")) { + return false; + } + + const functionScope = variable.scope.variableScope; + + return variable.references.every(reference => + reference.from.variableScope === functionScope); +} + +/** + * Represents segment information. + */ +class SegmentInfo { + constructor() { + this.info = new WeakMap(); + } + + /** + * Initialize the segment information. + * @param {PathSegment} segment The segment to initialize. + * @returns {void} + */ + initialize(segment) { + const outdatedReadVariables = new Set(); + const freshReadVariables = new Set(); + + for (const prevSegment of segment.prevSegments) { + const info = this.info.get(prevSegment); + + if (info) { + info.outdatedReadVariables.forEach(Set.prototype.add, outdatedReadVariables); + info.freshReadVariables.forEach(Set.prototype.add, freshReadVariables); + } + } + + this.info.set(segment, { outdatedReadVariables, freshReadVariables }); + } + + /** + * Mark a given variable as read on given segments. + * @param {PathSegment[]} segments The segments that it read the variable on. + * @param {Variable} variable The variable to be read. + * @returns {void} + */ + markAsRead(segments, variable) { + for (const segment of segments) { + const info = this.info.get(segment); + + if (info) { + info.freshReadVariables.add(variable); + + // If a variable is freshly read again, then it's no more out-dated. + info.outdatedReadVariables.delete(variable); + } + } + } + + /** + * Move `freshReadVariables` to `outdatedReadVariables`. + * @param {PathSegment[]} segments The segments to process. + * @returns {void} + */ + makeOutdated(segments) { + for (const segment of segments) { + const info = this.info.get(segment); + + if (info) { + info.freshReadVariables.forEach(Set.prototype.add, info.outdatedReadVariables); + info.freshReadVariables.clear(); + } + } + } + + /** + * Check if a given variable is outdated on the current segments. + * @param {PathSegment[]} segments The current segments. + * @param {Variable} variable The variable to check. + * @returns {boolean} `true` if the variable is outdated on the segments. + */ + isOutdated(segments, variable) { + for (const segment of segments) { + const info = this.info.get(segment); + + if (info && info.outdatedReadVariables.has(variable)) { + return true; + } + } + return false; + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`", + recommended: false, + url: "https://eslint.org/docs/rules/require-atomic-updates" + }, + + fixable: null, + + schema: [{ + type: "object", + properties: { + allowProperties: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], + + messages: { + nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.", + nonAtomicObjectUpdate: "Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`." + } + }, + + create(context) { + const allowProperties = !!context.options[0] && context.options[0].allowProperties; + + const sourceCode = context.getSourceCode(); + const assignmentReferences = new Map(); + const segmentInfo = new SegmentInfo(); + let stack = null; + + return { + onCodePathStart(codePath) { + const scope = context.getScope(); + const shouldVerify = + scope.type === "function" && + (scope.block.async || scope.block.generator); + + stack = { + upper: stack, + codePath, + referenceMap: shouldVerify ? createReferenceMap(scope) : null + }; + }, + onCodePathEnd() { + stack = stack.upper; + }, + + // Initialize the segment information. + onCodePathSegmentStart(segment) { + segmentInfo.initialize(segment); + }, + + // Handle references to prepare verification. + Identifier(node) { + const { codePath, referenceMap } = stack; + const reference = referenceMap && referenceMap.get(node); + + // Ignore if this is not a valid variable reference. + if (!reference) { + return; + } + const variable = reference.resolved; + const writeExpr = getWriteExpr(reference); + const isMemberAccess = reference.identifier.parent.type === "MemberExpression"; + + // Add a fresh read variable. + if (reference.isRead() && !(writeExpr && writeExpr.parent.operator === "=")) { + segmentInfo.markAsRead(codePath.currentSegments, variable); + } + + /* + * Register the variable to verify after ESLint traversed the `writeExpr` node + * if this reference is an assignment to a variable which is referred from other closure. + */ + if (writeExpr && + writeExpr.parent.right === writeExpr && // ← exclude variable declarations. + !isLocalVariableWithoutEscape(variable, isMemberAccess) + ) { + let refs = assignmentReferences.get(writeExpr); + + if (!refs) { + refs = []; + assignmentReferences.set(writeExpr, refs); + } + + refs.push(reference); + } + }, + + /* + * Verify assignments. + * If the reference exists in `outdatedReadVariables` list, report it. + */ + ":expression:exit"(node) { + const { codePath, referenceMap } = stack; + + // referenceMap exists if this is in a resumable function scope. + if (!referenceMap) { + return; + } + + // Mark the read variables on this code path as outdated. + if (node.type === "AwaitExpression" || node.type === "YieldExpression") { + segmentInfo.makeOutdated(codePath.currentSegments); + } + + // Verify. + const references = assignmentReferences.get(node); + + if (references) { + assignmentReferences.delete(node); + + for (const reference of references) { + const variable = reference.resolved; + + if (segmentInfo.isOutdated(codePath.currentSegments, variable)) { + if (node.parent.left === reference.identifier) { + context.report({ + node: node.parent, + messageId: "nonAtomicUpdate", + data: { + value: variable.name + } + }); + } else if (!allowProperties) { + context.report({ + node: node.parent, + messageId: "nonAtomicObjectUpdate", + data: { + value: sourceCode.getText(node.parent.left), + object: variable.name + } + }); + } + + } + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/require-await.js b/node_modules/eslint/lib/rules/require-await.js new file mode 100644 index 0000000..1b17de0 --- /dev/null +++ b/node_modules/eslint/lib/rules/require-await.js @@ -0,0 +1,113 @@ +/** + * @fileoverview Rule to disallow async functions which have no `await` expression. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Capitalize the 1st letter of the given text. + * @param {string} text The text to capitalize. + * @returns {string} The text that the 1st letter was capitalized. + */ +function capitalizeFirstLetter(text) { + return text[0].toUpperCase() + text.slice(1); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow async functions which have no `await` expression", + recommended: false, + url: "https://eslint.org/docs/rules/require-await" + }, + + schema: [], + + messages: { + missingAwait: "{{name}} has no 'await' expression." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + let scopeInfo = null; + + /** + * Push the scope info object to the stack. + * @returns {void} + */ + function enterFunction() { + scopeInfo = { + upper: scopeInfo, + hasAwait: false + }; + } + + /** + * Pop the top scope info object from the stack. + * Also, it reports the function if needed. + * @param {ASTNode} node The node to report. + * @returns {void} + */ + function exitFunction(node) { + if (!node.generator && node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) { + context.report({ + node, + loc: astUtils.getFunctionHeadLoc(node, sourceCode), + messageId: "missingAwait", + data: { + name: capitalizeFirstLetter( + astUtils.getFunctionNameWithKind(node) + ) + } + }); + } + + scopeInfo = scopeInfo.upper; + } + + return { + FunctionDeclaration: enterFunction, + FunctionExpression: enterFunction, + ArrowFunctionExpression: enterFunction, + "FunctionDeclaration:exit": exitFunction, + "FunctionExpression:exit": exitFunction, + "ArrowFunctionExpression:exit": exitFunction, + + AwaitExpression() { + if (!scopeInfo) { + return; + } + + scopeInfo.hasAwait = true; + }, + ForOfStatement(node) { + if (!scopeInfo) { + return; + } + + if (node.await) { + scopeInfo.hasAwait = true; + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/require-jsdoc.js b/node_modules/eslint/lib/rules/require-jsdoc.js new file mode 100644 index 0000000..169b6f5 --- /dev/null +++ b/node_modules/eslint/lib/rules/require-jsdoc.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Rule to check for jsdoc presence. + * @author Gyandeep Singh + * @deprecated in ESLint v5.10.0 + */ +"use strict"; + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require JSDoc comments", + recommended: false, + url: "https://eslint.org/docs/rules/require-jsdoc" + }, + + schema: [ + { + type: "object", + properties: { + require: { + type: "object", + properties: { + ClassDeclaration: { + type: "boolean", + default: false + }, + MethodDefinition: { + type: "boolean", + default: false + }, + FunctionDeclaration: { + type: "boolean", + default: true + }, + ArrowFunctionExpression: { + type: "boolean", + default: false + }, + FunctionExpression: { + type: "boolean", + default: false + } + }, + additionalProperties: false, + default: {} + } + }, + additionalProperties: false + } + ], + + deprecated: true, + replacedBy: [], + + messages: { + missingJSDocComment: "Missing JSDoc comment." + } + }, + + create(context) { + const source = context.getSourceCode(); + const DEFAULT_OPTIONS = { + FunctionDeclaration: true, + MethodDefinition: false, + ClassDeclaration: false, + ArrowFunctionExpression: false, + FunctionExpression: false + }; + const options = Object.assign(DEFAULT_OPTIONS, context.options[0] && context.options[0].require); + + /** + * Report the error message + * @param {ASTNode} node node to report + * @returns {void} + */ + function report(node) { + context.report({ node, messageId: "missingJSDocComment" }); + } + + /** + * Check if the jsdoc comment is present or not. + * @param {ASTNode} node node to examine + * @returns {void} + */ + function checkJsDoc(node) { + const jsdocComment = source.getJSDocComment(node); + + if (!jsdocComment) { + report(node); + } + } + + return { + FunctionDeclaration(node) { + if (options.FunctionDeclaration) { + checkJsDoc(node); + } + }, + FunctionExpression(node) { + if ( + (options.MethodDefinition && node.parent.type === "MethodDefinition") || + (options.FunctionExpression && (node.parent.type === "VariableDeclarator" || (node.parent.type === "Property" && node === node.parent.value))) + ) { + checkJsDoc(node); + } + }, + ClassDeclaration(node) { + if (options.ClassDeclaration) { + checkJsDoc(node); + } + }, + ArrowFunctionExpression(node) { + if (options.ArrowFunctionExpression && node.parent.type === "VariableDeclarator") { + checkJsDoc(node); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/require-unicode-regexp.js b/node_modules/eslint/lib/rules/require-unicode-regexp.js new file mode 100644 index 0000000..577ae6c --- /dev/null +++ b/node_modules/eslint/lib/rules/require-unicode-regexp.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Rule to enforce the use of `u` flag on RegExp. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const { + CALL, + CONSTRUCT, + ReferenceTracker, + getStringIfConstant +} = require("eslint-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce the use of `u` flag on RegExp", + recommended: false, + url: "https://eslint.org/docs/rules/require-unicode-regexp" + }, + + messages: { + requireUFlag: "Use the 'u' flag." + }, + + schema: [] + }, + + create(context) { + return { + "Literal[regex]"(node) { + const flags = node.regex.flags || ""; + + if (!flags.includes("u")) { + context.report({ node, messageId: "requireUFlag" }); + } + }, + + Program() { + const scope = context.getScope(); + const tracker = new ReferenceTracker(scope); + const trackMap = { + RegExp: { [CALL]: true, [CONSTRUCT]: true } + }; + + for (const { node } of tracker.iterateGlobalReferences(trackMap)) { + const flagsNode = node.arguments[1]; + const flags = getStringIfConstant(flagsNode, scope); + + if (!flagsNode || (typeof flags === "string" && !flags.includes("u"))) { + context.report({ node, messageId: "requireUFlag" }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/require-yield.js b/node_modules/eslint/lib/rules/require-yield.js new file mode 100644 index 0000000..aba0614 --- /dev/null +++ b/node_modules/eslint/lib/rules/require-yield.js @@ -0,0 +1,78 @@ +/** + * @fileoverview Rule to flag the generator functions that does not have yield. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require generator functions to contain `yield`", + recommended: true, + url: "https://eslint.org/docs/rules/require-yield" + }, + + schema: [], + + messages: { + missingYield: "This generator function does not have 'yield'." + } + }, + + create(context) { + const stack = []; + + /** + * If the node is a generator function, start counting `yield` keywords. + * @param {Node} node A function node to check. + * @returns {void} + */ + function beginChecking(node) { + if (node.generator) { + stack.push(0); + } + } + + /** + * If the node is a generator function, end counting `yield` keywords, then + * reports result. + * @param {Node} node A function node to check. + * @returns {void} + */ + function endChecking(node) { + if (!node.generator) { + return; + } + + const countYield = stack.pop(); + + if (countYield === 0 && node.body.body.length > 0) { + context.report({ node, messageId: "missingYield" }); + } + } + + return { + FunctionDeclaration: beginChecking, + "FunctionDeclaration:exit": endChecking, + FunctionExpression: beginChecking, + "FunctionExpression:exit": endChecking, + + // Increases the count of `yield` keyword. + YieldExpression() { + + /* istanbul ignore else */ + if (stack.length > 0) { + stack[stack.length - 1] += 1; + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/rest-spread-spacing.js b/node_modules/eslint/lib/rules/rest-spread-spacing.js new file mode 100644 index 0000000..ace1ec5 --- /dev/null +++ b/node_modules/eslint/lib/rules/rest-spread-spacing.js @@ -0,0 +1,120 @@ +/** + * @fileoverview Enforce spacing between rest and spread operators and their expressions. + * @author Kai Cataldo + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce spacing between rest and spread operators and their expressions", + recommended: false, + url: "https://eslint.org/docs/rules/rest-spread-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + } + ], + + messages: { + unexpectedWhitespace: "Unexpected whitespace after {{type}} operator.", + expectedWhitespace: "Expected whitespace after {{type}} operator." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(), + alwaysSpace = context.options[0] === "always"; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks whitespace between rest/spread operators and their expressions + * @param {ASTNode} node The node to check + * @returns {void} + */ + function checkWhiteSpace(node) { + const operator = sourceCode.getFirstToken(node), + nextToken = sourceCode.getTokenAfter(operator), + hasWhitespace = sourceCode.isSpaceBetweenTokens(operator, nextToken); + let type; + + switch (node.type) { + case "SpreadElement": + type = "spread"; + if (node.parent.type === "ObjectExpression") { + type += " property"; + } + break; + case "RestElement": + type = "rest"; + if (node.parent.type === "ObjectPattern") { + type += " property"; + } + break; + case "ExperimentalSpreadProperty": + type = "spread property"; + break; + case "ExperimentalRestProperty": + type = "rest property"; + break; + default: + return; + } + + if (alwaysSpace && !hasWhitespace) { + context.report({ + node, + loc: operator.loc, + messageId: "expectedWhitespace", + data: { + type + }, + fix(fixer) { + return fixer.replaceTextRange([operator.range[1], nextToken.range[0]], " "); + } + }); + } else if (!alwaysSpace && hasWhitespace) { + context.report({ + node, + loc: { + start: operator.loc.end, + end: nextToken.loc.start + }, + messageId: "unexpectedWhitespace", + data: { + type + }, + fix(fixer) { + return fixer.removeRange([operator.range[1], nextToken.range[0]]); + } + }); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + SpreadElement: checkWhiteSpace, + RestElement: checkWhiteSpace, + ExperimentalSpreadProperty: checkWhiteSpace, + ExperimentalRestProperty: checkWhiteSpace + }; + } +}; diff --git a/node_modules/eslint/lib/rules/semi-spacing.js b/node_modules/eslint/lib/rules/semi-spacing.js new file mode 100644 index 0000000..4f0afbb --- /dev/null +++ b/node_modules/eslint/lib/rules/semi-spacing.js @@ -0,0 +1,245 @@ +/** + * @fileoverview Validates spacing before and after semicolon + * @author Mathias Schreck + */ + +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before and after semicolons", + recommended: false, + url: "https://eslint.org/docs/rules/semi-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + before: { + type: "boolean", + default: false + }, + after: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedWhitespaceBefore: "Unexpected whitespace before semicolon.", + unexpectedWhitespaceAfter: "Unexpected whitespace after semicolon.", + missingWhitespaceBefore: "Missing whitespace before semicolon.", + missingWhitespaceAfter: "Missing whitespace after semicolon." + } + }, + + create(context) { + + const config = context.options[0], + sourceCode = context.getSourceCode(); + let requireSpaceBefore = false, + requireSpaceAfter = true; + + if (typeof config === "object") { + requireSpaceBefore = config.before; + requireSpaceAfter = config.after; + } + + /** + * Checks if a given token has leading whitespace. + * @param {Object} token The token to check. + * @returns {boolean} True if the given token has leading space, false if not. + */ + function hasLeadingSpace(token) { + const tokenBefore = sourceCode.getTokenBefore(token); + + return tokenBefore && astUtils.isTokenOnSameLine(tokenBefore, token) && sourceCode.isSpaceBetweenTokens(tokenBefore, token); + } + + /** + * Checks if a given token has trailing whitespace. + * @param {Object} token The token to check. + * @returns {boolean} True if the given token has trailing space, false if not. + */ + function hasTrailingSpace(token) { + const tokenAfter = sourceCode.getTokenAfter(token); + + return tokenAfter && astUtils.isTokenOnSameLine(token, tokenAfter) && sourceCode.isSpaceBetweenTokens(token, tokenAfter); + } + + /** + * Checks if the given token is the last token in its line. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the token is the last in its line. + */ + function isLastTokenInCurrentLine(token) { + const tokenAfter = sourceCode.getTokenAfter(token); + + return !(tokenAfter && astUtils.isTokenOnSameLine(token, tokenAfter)); + } + + /** + * Checks if the given token is the first token in its line + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the token is the first in its line. + */ + function isFirstTokenInCurrentLine(token) { + const tokenBefore = sourceCode.getTokenBefore(token); + + return !(tokenBefore && astUtils.isTokenOnSameLine(token, tokenBefore)); + } + + /** + * Checks if the next token of a given token is a closing parenthesis. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the next token of a given token is a closing parenthesis. + */ + function isBeforeClosingParen(token) { + const nextToken = sourceCode.getTokenAfter(token); + + return (nextToken && astUtils.isClosingBraceToken(nextToken) || astUtils.isClosingParenToken(nextToken)); + } + + /** + * Report location example : + * + * for unexpected space `before` + * + * var a = 'b' ; + * ^^^ + * + * for unexpected space `after` + * + * var a = 'b'; c = 10; + * ^^ + * + * Reports if the given token has invalid spacing. + * @param {Token} token The semicolon token to check. + * @param {ASTNode} node The corresponding node of the token. + * @returns {void} + */ + function checkSemicolonSpacing(token, node) { + if (astUtils.isSemicolonToken(token)) { + if (hasLeadingSpace(token)) { + if (!requireSpaceBefore) { + const tokenBefore = sourceCode.getTokenBefore(token); + const loc = { + start: tokenBefore.loc.end, + end: token.loc.start + }; + + context.report({ + node, + loc, + messageId: "unexpectedWhitespaceBefore", + fix(fixer) { + + return fixer.removeRange([tokenBefore.range[1], token.range[0]]); + } + }); + } + } else { + if (requireSpaceBefore) { + const loc = token.loc; + + context.report({ + node, + loc, + messageId: "missingWhitespaceBefore", + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + } + + if (!isFirstTokenInCurrentLine(token) && !isLastTokenInCurrentLine(token) && !isBeforeClosingParen(token)) { + if (hasTrailingSpace(token)) { + if (!requireSpaceAfter) { + const tokenAfter = sourceCode.getTokenAfter(token); + const loc = { + start: token.loc.end, + end: tokenAfter.loc.start + }; + + context.report({ + node, + loc, + messageId: "unexpectedWhitespaceAfter", + fix(fixer) { + + return fixer.removeRange([token.range[1], tokenAfter.range[0]]); + } + }); + } + } else { + if (requireSpaceAfter) { + const loc = token.loc; + + context.report({ + node, + loc, + messageId: "missingWhitespaceAfter", + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + } + } + } + } + + /** + * Checks the spacing of the semicolon with the assumption that the last token is the semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNode(node) { + const token = sourceCode.getLastToken(node); + + checkSemicolonSpacing(token, node); + } + + return { + VariableDeclaration: checkNode, + ExpressionStatement: checkNode, + BreakStatement: checkNode, + ContinueStatement: checkNode, + DebuggerStatement: checkNode, + DoWhileStatement: checkNode, + ReturnStatement: checkNode, + ThrowStatement: checkNode, + ImportDeclaration: checkNode, + ExportNamedDeclaration: checkNode, + ExportAllDeclaration: checkNode, + ExportDefaultDeclaration: checkNode, + ForStatement(node) { + if (node.init) { + checkSemicolonSpacing(sourceCode.getTokenAfter(node.init), node); + } + + if (node.test) { + checkSemicolonSpacing(sourceCode.getTokenAfter(node.test), node); + } + }, + PropertyDefinition: checkNode + }; + } +}; diff --git a/node_modules/eslint/lib/rules/semi-style.js b/node_modules/eslint/lib/rules/semi-style.js new file mode 100644 index 0000000..7952a9a --- /dev/null +++ b/node_modules/eslint/lib/rules/semi-style.js @@ -0,0 +1,155 @@ +/** + * @fileoverview Rule to enforce location of semicolons. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const SELECTOR = [ + "BreakStatement", "ContinueStatement", "DebuggerStatement", + "DoWhileStatement", "ExportAllDeclaration", + "ExportDefaultDeclaration", "ExportNamedDeclaration", + "ExpressionStatement", "ImportDeclaration", "ReturnStatement", + "ThrowStatement", "VariableDeclaration", "PropertyDefinition" +].join(","); + +/** + * Get the child node list of a given node. + * This returns `BlockStatement#body`, `StaticBlock#body`, `Program#body`, + * `ClassBody#body`, or `SwitchCase#consequent`. + * This is used to check whether a node is the first/last child. + * @param {Node} node A node to get child node list. + * @returns {Node[]|null} The child node list. + */ +function getChildren(node) { + const t = node.type; + + if ( + t === "BlockStatement" || + t === "StaticBlock" || + t === "Program" || + t === "ClassBody" + ) { + return node.body; + } + if (t === "SwitchCase") { + return node.consequent; + } + return null; +} + +/** + * Check whether a given node is the last statement in the parent block. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is the last statement in the parent block. + */ +function isLastChild(node) { + const t = node.parent.type; + + if (t === "IfStatement" && node.parent.consequent === node && node.parent.alternate) { // before `else` keyword. + return true; + } + if (t === "DoWhileStatement") { // before `while` keyword. + return true; + } + const nodeList = getChildren(node.parent); + + return nodeList !== null && nodeList[nodeList.length - 1] === node; // before `}` or etc. +} + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce location of semicolons", + recommended: false, + url: "https://eslint.org/docs/rules/semi-style" + }, + + schema: [{ enum: ["last", "first"] }], + fixable: "whitespace", + + messages: { + expectedSemiColon: "Expected this semicolon to be at {{pos}}." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const option = context.options[0] || "last"; + + /** + * Check the given semicolon token. + * @param {Token} semiToken The semicolon token to check. + * @param {"first"|"last"} expected The expected location to check. + * @returns {void} + */ + function check(semiToken, expected) { + const prevToken = sourceCode.getTokenBefore(semiToken); + const nextToken = sourceCode.getTokenAfter(semiToken); + const prevIsSameLine = !prevToken || astUtils.isTokenOnSameLine(prevToken, semiToken); + const nextIsSameLine = !nextToken || astUtils.isTokenOnSameLine(semiToken, nextToken); + + if ((expected === "last" && !prevIsSameLine) || (expected === "first" && !nextIsSameLine)) { + context.report({ + loc: semiToken.loc, + messageId: "expectedSemiColon", + data: { + pos: (expected === "last") + ? "the end of the previous line" + : "the beginning of the next line" + }, + fix(fixer) { + if (prevToken && nextToken && sourceCode.commentsExistBetween(prevToken, nextToken)) { + return null; + } + + const start = prevToken ? prevToken.range[1] : semiToken.range[0]; + const end = nextToken ? nextToken.range[0] : semiToken.range[1]; + const text = (expected === "last") ? ";\n" : "\n;"; + + return fixer.replaceTextRange([start, end], text); + } + }); + } + } + + return { + [SELECTOR](node) { + if (option === "first" && isLastChild(node)) { + return; + } + + const lastToken = sourceCode.getLastToken(node); + + if (astUtils.isSemicolonToken(lastToken)) { + check(lastToken, option); + } + }, + + ForStatement(node) { + const firstSemi = node.init && sourceCode.getTokenAfter(node.init, astUtils.isSemicolonToken); + const secondSemi = node.test && sourceCode.getTokenAfter(node.test, astUtils.isSemicolonToken); + + if (firstSemi) { + check(firstSemi, "last"); + } + if (secondSemi) { + check(secondSemi, "last"); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/semi.js b/node_modules/eslint/lib/rules/semi.js new file mode 100644 index 0000000..86ff8d7 --- /dev/null +++ b/node_modules/eslint/lib/rules/semi.js @@ -0,0 +1,410 @@ +/** + * @fileoverview Rule to flag missing semicolons. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const FixTracker = require("./utils/fix-tracker"); +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow semicolons instead of ASI", + recommended: false, + url: "https://eslint.org/docs/rules/semi" + }, + + fixable: "code", + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["never"] + }, + { + type: "object", + properties: { + beforeStatementContinuationChars: { + enum: ["always", "any", "never"] + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + }, + { + type: "array", + items: [ + { + enum: ["always"] + }, + { + type: "object", + properties: { + omitLastInOneLineBlock: { type: "boolean" } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + + messages: { + missingSemi: "Missing semicolon.", + extraSemi: "Extra semicolon." + } + }, + + create(context) { + + const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-` + const unsafeClassFieldNames = new Set(["get", "set", "static"]); + const unsafeClassFieldFollowers = new Set(["*", "in", "instanceof"]); + const options = context.options[1]; + const never = context.options[0] === "never"; + const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); + const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars || "any"; + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports a semicolon error with appropriate location and message. + * @param {ASTNode} node The node with an extra or missing semicolon. + * @param {boolean} missing True if the semicolon is missing. + * @returns {void} + */ + function report(node, missing) { + const lastToken = sourceCode.getLastToken(node); + let messageId, + fix, + loc; + + if (!missing) { + messageId = "missingSemi"; + loc = { + start: lastToken.loc.end, + end: astUtils.getNextLocation(sourceCode, lastToken.loc.end) + }; + fix = function(fixer) { + return fixer.insertTextAfter(lastToken, ";"); + }; + } else { + messageId = "extraSemi"; + loc = lastToken.loc; + fix = function(fixer) { + + /* + * Expand the replacement range to include the surrounding + * tokens to avoid conflicting with no-extra-semi. + * https://github.com/eslint/eslint/issues/7928 + */ + return new FixTracker(fixer, sourceCode) + .retainSurroundingTokens(lastToken) + .remove(lastToken); + }; + } + + context.report({ + node, + loc, + messageId, + fix + }); + + } + + /** + * Check whether a given semicolon token is redundant. + * @param {Token} semiToken A semicolon token to check. + * @returns {boolean} `true` if the next token is `;` or `}`. + */ + function isRedundantSemi(semiToken) { + const nextToken = sourceCode.getTokenAfter(semiToken); + + return ( + !nextToken || + astUtils.isClosingBraceToken(nextToken) || + astUtils.isSemicolonToken(nextToken) + ); + } + + /** + * Check whether a given token is the closing brace of an arrow function. + * @param {Token} lastToken A token to check. + * @returns {boolean} `true` if the token is the closing brace of an arrow function. + */ + function isEndOfArrowBlock(lastToken) { + if (!astUtils.isClosingBraceToken(lastToken)) { + return false; + } + const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]); + + return ( + node.type === "BlockStatement" && + node.parent.type === "ArrowFunctionExpression" + ); + } + + /** + * Checks if a given PropertyDefinition node followed by a semicolon + * can safely remove that semicolon. It is not to safe to remove if + * the class field name is "get", "set", or "static", or if + * followed by a generator method. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node cannot have the semicolon + * removed. + */ + function maybeClassFieldAsiHazard(node) { + + if (node.type !== "PropertyDefinition") { + return false; + } + + /* + * Computed property names and non-identifiers are always safe + * as they can be distinguished from keywords easily. + */ + const needsNameCheck = !node.computed && node.key.type === "Identifier"; + + /* + * Certain names are problematic unless they also have a + * a way to distinguish between keywords and property + * names. + */ + if (needsNameCheck && unsafeClassFieldNames.has(node.key.name)) { + + /* + * Special case: If the field name is `static`, + * it is only valid if the field is marked as static, + * so "static static" is okay but "static" is not. + */ + const isStaticStatic = node.static && node.key.name === "static"; + + /* + * For other unsafe names, we only care if there is no + * initializer. No initializer = hazard. + */ + if (!isStaticStatic && !node.value) { + return true; + } + } + + const followingToken = sourceCode.getTokenAfter(node); + + return unsafeClassFieldFollowers.has(followingToken.value); + } + + /** + * Check whether a given node is on the same line with the next token. + * @param {Node} node A statement node to check. + * @returns {boolean} `true` if the node is on the same line with the next token. + */ + function isOnSameLineWithNextToken(node) { + const prevToken = sourceCode.getLastToken(node, 1); + const nextToken = sourceCode.getTokenAfter(node); + + return !!nextToken && astUtils.isTokenOnSameLine(prevToken, nextToken); + } + + /** + * Check whether a given node can connect the next line if the next line is unreliable. + * @param {Node} node A statement node to check. + * @returns {boolean} `true` if the node can connect the next line. + */ + function maybeAsiHazardAfter(node) { + const t = node.type; + + if (t === "DoWhileStatement" || + t === "BreakStatement" || + t === "ContinueStatement" || + t === "DebuggerStatement" || + t === "ImportDeclaration" || + t === "ExportAllDeclaration" + ) { + return false; + } + if (t === "ReturnStatement") { + return Boolean(node.argument); + } + if (t === "ExportNamedDeclaration") { + return Boolean(node.declaration); + } + if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) { + return false; + } + + return true; + } + + /** + * Check whether a given token can connect the previous statement. + * @param {Token} token A token to check. + * @returns {boolean} `true` if the token is one of `[`, `(`, `/`, `+`, `-`, ```, `++`, and `--`. + */ + function maybeAsiHazardBefore(token) { + return ( + Boolean(token) && + OPT_OUT_PATTERN.test(token.value) && + token.value !== "++" && + token.value !== "--" + ); + } + + /** + * Check if the semicolon of a given node is unnecessary, only true if: + * - next token is a valid statement divider (`;` or `}`). + * - next token is on a new line and the node is not connectable to the new line. + * @param {Node} node A statement node to check. + * @returns {boolean} whether the semicolon is unnecessary. + */ + function canRemoveSemicolon(node) { + if (isRedundantSemi(sourceCode.getLastToken(node))) { + return true; // `;;` or `;}` + } + if (maybeClassFieldAsiHazard(node)) { + return false; + } + if (isOnSameLineWithNextToken(node)) { + return false; // One liner. + } + + // continuation characters should not apply to class fields + if ( + node.type !== "PropertyDefinition" && + beforeStatementContinuationChars === "never" && + !maybeAsiHazardAfter(node) + ) { + return true; // ASI works. This statement doesn't connect to the next. + } + if (!maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { + return true; // ASI works. The next token doesn't connect to this statement. + } + + return false; + } + + /** + * Checks a node to see if it's the last item in a one-liner block. + * Block is any `BlockStatement` or `StaticBlock` node. Block is a one-liner if its + * braces (and consequently everything between them) are on the same line. + * @param {ASTNode} node The node to check. + * @returns {boolean} whether the node is the last item in a one-liner block. + */ + function isLastInOneLinerBlock(node) { + const parent = node.parent; + const nextToken = sourceCode.getTokenAfter(node); + + if (!nextToken || nextToken.value !== "}") { + return false; + } + + if (parent.type === "BlockStatement") { + return parent.loc.start.line === parent.loc.end.line; + } + + if (parent.type === "StaticBlock") { + const openingBrace = sourceCode.getFirstToken(parent, { skip: 1 }); // skip the `static` token + + return openingBrace.loc.start.line === parent.loc.end.line; + } + + return false; + } + + /** + * Checks a node to see if it's followed by a semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolon(node) { + const isSemi = astUtils.isSemicolonToken(sourceCode.getLastToken(node)); + + if (never) { + if (isSemi && canRemoveSemicolon(node)) { + report(node, true); + } else if ( + !isSemi && beforeStatementContinuationChars === "always" && + node.type !== "PropertyDefinition" && + maybeAsiHazardBefore(sourceCode.getTokenAfter(node)) + ) { + report(node); + } + } else { + const oneLinerBlock = (exceptOneLine && isLastInOneLinerBlock(node)); + + if (isSemi && oneLinerBlock) { + report(node, true); + } else if (!isSemi && !oneLinerBlock) { + report(node); + } + } + } + + /** + * Checks to see if there's a semicolon after a variable declaration. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolonForVariableDeclaration(node) { + const parent = node.parent; + + if ((parent.type !== "ForStatement" || parent.init !== node) && + (!/^For(?:In|Of)Statement/u.test(parent.type) || parent.left !== node) + ) { + checkForSemicolon(node); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + VariableDeclaration: checkForSemicolonForVariableDeclaration, + ExpressionStatement: checkForSemicolon, + ReturnStatement: checkForSemicolon, + ThrowStatement: checkForSemicolon, + DoWhileStatement: checkForSemicolon, + DebuggerStatement: checkForSemicolon, + BreakStatement: checkForSemicolon, + ContinueStatement: checkForSemicolon, + ImportDeclaration: checkForSemicolon, + ExportAllDeclaration: checkForSemicolon, + ExportNamedDeclaration(node) { + if (!node.declaration) { + checkForSemicolon(node); + } + }, + ExportDefaultDeclaration(node) { + if (!/(?:Class|Function)Declaration/u.test(node.declaration.type)) { + checkForSemicolon(node); + } + }, + PropertyDefinition: checkForSemicolon + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/sort-imports.js b/node_modules/eslint/lib/rules/sort-imports.js new file mode 100644 index 0000000..13cb636 --- /dev/null +++ b/node_modules/eslint/lib/rules/sort-imports.js @@ -0,0 +1,241 @@ +/** + * @fileoverview Rule to require sorting of import declarations + * @author Christian Schuller + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce sorted import declarations within modules", + recommended: false, + url: "https://eslint.org/docs/rules/sort-imports" + }, + + schema: [ + { + type: "object", + properties: { + ignoreCase: { + type: "boolean", + default: false + }, + memberSyntaxSortOrder: { + type: "array", + items: { + enum: ["none", "all", "multiple", "single"] + }, + uniqueItems: true, + minItems: 4, + maxItems: 4 + }, + ignoreDeclarationSort: { + type: "boolean", + default: false + }, + ignoreMemberSort: { + type: "boolean", + default: false + }, + allowSeparatedGroups: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + sortImportsAlphabetically: "Imports should be sorted alphabetically.", + sortMembersAlphabetically: "Member '{{memberName}}' of the import declaration should be sorted alphabetically.", + unexpectedSyntaxOrder: "Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax." + } + }, + + create(context) { + + const configuration = context.options[0] || {}, + ignoreCase = configuration.ignoreCase || false, + ignoreDeclarationSort = configuration.ignoreDeclarationSort || false, + ignoreMemberSort = configuration.ignoreMemberSort || false, + memberSyntaxSortOrder = configuration.memberSyntaxSortOrder || ["none", "all", "multiple", "single"], + allowSeparatedGroups = configuration.allowSeparatedGroups || false, + sourceCode = context.getSourceCode(); + let previousDeclaration = null; + + /** + * Gets the used member syntax style. + * + * import "my-module.js" --> none + * import * as myModule from "my-module.js" --> all + * import {myMember} from "my-module.js" --> single + * import {foo, bar} from "my-module.js" --> multiple + * @param {ASTNode} node the ImportDeclaration node. + * @returns {string} used member parameter style, ["all", "multiple", "single"] + */ + function usedMemberSyntax(node) { + if (node.specifiers.length === 0) { + return "none"; + } + if (node.specifiers[0].type === "ImportNamespaceSpecifier") { + return "all"; + } + if (node.specifiers.length === 1) { + return "single"; + } + return "multiple"; + + } + + /** + * Gets the group by member parameter index for given declaration. + * @param {ASTNode} node the ImportDeclaration node. + * @returns {number} the declaration group by member index. + */ + function getMemberParameterGroupIndex(node) { + return memberSyntaxSortOrder.indexOf(usedMemberSyntax(node)); + } + + /** + * Gets the local name of the first imported module. + * @param {ASTNode} node the ImportDeclaration node. + * @returns {?string} the local name of the first imported module. + */ + function getFirstLocalMemberName(node) { + if (node.specifiers[0]) { + return node.specifiers[0].local.name; + } + return null; + + } + + /** + * Calculates number of lines between two nodes. It is assumed that the given `left` node appears before + * the given `right` node in the source code. Lines are counted from the end of the `left` node till the + * start of the `right` node. If the given nodes are on the same line, it returns `0`, same as if they were + * on two consecutive lines. + * @param {ASTNode} left node that appears before the given `right` node. + * @param {ASTNode} right node that appears after the given `left` node. + * @returns {number} number of lines between nodes. + */ + function getNumberOfLinesBetween(left, right) { + return Math.max(right.loc.start.line - left.loc.end.line - 1, 0); + } + + return { + ImportDeclaration(node) { + if (!ignoreDeclarationSort) { + if ( + previousDeclaration && + allowSeparatedGroups && + getNumberOfLinesBetween(previousDeclaration, node) > 0 + ) { + + // reset declaration sort + previousDeclaration = null; + } + + if (previousDeclaration) { + const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node), + previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration); + let currentLocalMemberName = getFirstLocalMemberName(node), + previousLocalMemberName = getFirstLocalMemberName(previousDeclaration); + + if (ignoreCase) { + previousLocalMemberName = previousLocalMemberName && previousLocalMemberName.toLowerCase(); + currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase(); + } + + /* + * When the current declaration uses a different member syntax, + * then check if the ordering is correct. + * Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name. + */ + if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) { + if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) { + context.report({ + node, + messageId: "unexpectedSyntaxOrder", + data: { + syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex], + syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex] + } + }); + } + } else { + if (previousLocalMemberName && + currentLocalMemberName && + currentLocalMemberName < previousLocalMemberName + ) { + context.report({ + node, + messageId: "sortImportsAlphabetically" + }); + } + } + } + + previousDeclaration = node; + } + + if (!ignoreMemberSort) { + const importSpecifiers = node.specifiers.filter(specifier => specifier.type === "ImportSpecifier"); + const getSortableName = ignoreCase ? specifier => specifier.local.name.toLowerCase() : specifier => specifier.local.name; + const firstUnsortedIndex = importSpecifiers.map(getSortableName).findIndex((name, index, array) => array[index - 1] > name); + + if (firstUnsortedIndex !== -1) { + context.report({ + node: importSpecifiers[firstUnsortedIndex], + messageId: "sortMembersAlphabetically", + data: { memberName: importSpecifiers[firstUnsortedIndex].local.name }, + fix(fixer) { + if (importSpecifiers.some(specifier => + sourceCode.getCommentsBefore(specifier).length || sourceCode.getCommentsAfter(specifier).length)) { + + // If there are comments in the ImportSpecifier list, don't rearrange the specifiers. + return null; + } + + return fixer.replaceTextRange( + [importSpecifiers[0].range[0], importSpecifiers[importSpecifiers.length - 1].range[1]], + importSpecifiers + + // Clone the importSpecifiers array to avoid mutating it + .slice() + + // Sort the array into the desired order + .sort((specifierA, specifierB) => { + const aName = getSortableName(specifierA); + const bName = getSortableName(specifierB); + + return aName > bName ? 1 : -1; + }) + + // Build a string out of the sorted list of import specifiers and the text between the originals + .reduce((sourceText, specifier, index) => { + const textAfterSpecifier = index === importSpecifiers.length - 1 + ? "" + : sourceCode.getText().slice(importSpecifiers[index].range[1], importSpecifiers[index + 1].range[0]); + + return sourceText + sourceCode.getText(specifier) + textAfterSpecifier; + }, "") + ); + } + }); + } + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/sort-keys.js b/node_modules/eslint/lib/rules/sort-keys.js new file mode 100644 index 0000000..2fc1963 --- /dev/null +++ b/node_modules/eslint/lib/rules/sort-keys.js @@ -0,0 +1,187 @@ +/** + * @fileoverview Rule to require object keys to be sorted + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"), + naturalCompare = require("natural-compare"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets the property name of the given `Property` node. + * + * - If the property's key is an `Identifier` node, this returns the key's name + * whether it's a computed property or not. + * - If the property has a static name, this returns the static name. + * - Otherwise, this returns null. + * @param {ASTNode} node The `Property` node to get. + * @returns {string|null} The property name or null. + * @private + */ +function getPropertyName(node) { + const staticName = astUtils.getStaticPropertyName(node); + + if (staticName !== null) { + return staticName; + } + + return node.key.name || null; +} + +/** + * Functions which check that the given 2 names are in specific order. + * + * Postfix `I` is meant insensitive. + * Postfix `N` is meant natural. + * @private + */ +const isValidOrders = { + asc(a, b) { + return a <= b; + }, + ascI(a, b) { + return a.toLowerCase() <= b.toLowerCase(); + }, + ascN(a, b) { + return naturalCompare(a, b) <= 0; + }, + ascIN(a, b) { + return naturalCompare(a.toLowerCase(), b.toLowerCase()) <= 0; + }, + desc(a, b) { + return isValidOrders.asc(b, a); + }, + descI(a, b) { + return isValidOrders.ascI(b, a); + }, + descN(a, b) { + return isValidOrders.ascN(b, a); + }, + descIN(a, b) { + return isValidOrders.ascIN(b, a); + } +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require object keys to be sorted", + recommended: false, + url: "https://eslint.org/docs/rules/sort-keys" + }, + + schema: [ + { + enum: ["asc", "desc"] + }, + { + type: "object", + properties: { + caseSensitive: { + type: "boolean", + default: true + }, + natural: { + type: "boolean", + default: false + }, + minKeys: { + type: "integer", + minimum: 2, + default: 2 + } + }, + additionalProperties: false + } + ], + + messages: { + sortKeys: "Expected object keys to be in {{natural}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'." + } + }, + + create(context) { + + // Parse options. + const order = context.options[0] || "asc"; + const options = context.options[1]; + const insensitive = options && options.caseSensitive === false; + const natural = options && options.natural; + const minKeys = options && options.minKeys; + const isValidOrder = isValidOrders[ + order + (insensitive ? "I" : "") + (natural ? "N" : "") + ]; + + // The stack to save the previous property's name for each object literals. + let stack = null; + + return { + ObjectExpression(node) { + stack = { + upper: stack, + prevName: null, + numKeys: node.properties.length + }; + }, + + "ObjectExpression:exit"() { + stack = stack.upper; + }, + + SpreadElement(node) { + if (node.parent.type === "ObjectExpression") { + stack.prevName = null; + } + }, + + Property(node) { + if (node.parent.type === "ObjectPattern") { + return; + } + + const prevName = stack.prevName; + const numKeys = stack.numKeys; + const thisName = getPropertyName(node); + + if (thisName !== null) { + stack.prevName = thisName; + } + + if (prevName === null || thisName === null || numKeys < minKeys) { + return; + } + + if (!isValidOrder(prevName, thisName)) { + context.report({ + node, + loc: node.key.loc, + messageId: "sortKeys", + data: { + thisName, + prevName, + order, + insensitive: insensitive ? "insensitive " : "", + natural: natural ? "natural " : "" + } + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/sort-vars.js b/node_modules/eslint/lib/rules/sort-vars.js new file mode 100644 index 0000000..8246558 --- /dev/null +++ b/node_modules/eslint/lib/rules/sort-vars.js @@ -0,0 +1,104 @@ +/** + * @fileoverview Rule to require sorting of variables within a single Variable Declaration block + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require variables within the same declaration block to be sorted", + recommended: false, + url: "https://eslint.org/docs/rules/sort-vars" + }, + + schema: [ + { + type: "object", + properties: { + ignoreCase: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "code", + + messages: { + sortVars: "Variables within the same declaration block should be sorted alphabetically." + } + }, + + create(context) { + + const configuration = context.options[0] || {}, + ignoreCase = configuration.ignoreCase || false, + sourceCode = context.getSourceCode(); + + return { + VariableDeclaration(node) { + const idDeclarations = node.declarations.filter(decl => decl.id.type === "Identifier"); + const getSortableName = ignoreCase ? decl => decl.id.name.toLowerCase() : decl => decl.id.name; + const unfixable = idDeclarations.some(decl => decl.init !== null && decl.init.type !== "Literal"); + let fixed = false; + + idDeclarations.slice(1).reduce((memo, decl) => { + const lastVariableName = getSortableName(memo), + currentVariableName = getSortableName(decl); + + if (currentVariableName < lastVariableName) { + context.report({ + node: decl, + messageId: "sortVars", + fix(fixer) { + if (unfixable || fixed) { + return null; + } + return fixer.replaceTextRange( + [idDeclarations[0].range[0], idDeclarations[idDeclarations.length - 1].range[1]], + idDeclarations + + // Clone the idDeclarations array to avoid mutating it + .slice() + + // Sort the array into the desired order + .sort((declA, declB) => { + const aName = getSortableName(declA); + const bName = getSortableName(declB); + + return aName > bName ? 1 : -1; + }) + + // Build a string out of the sorted list of identifier declarations and the text between the originals + .reduce((sourceText, identifier, index) => { + const textAfterIdentifier = index === idDeclarations.length - 1 + ? "" + : sourceCode.getText().slice(idDeclarations[index].range[1], idDeclarations[index + 1].range[0]); + + return sourceText + sourceCode.getText(identifier) + textAfterIdentifier; + }, "") + + ); + } + }); + fixed = true; + return memo; + } + return decl; + + }, idDeclarations[0]); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/space-before-blocks.js b/node_modules/eslint/lib/rules/space-before-blocks.js new file mode 100644 index 0000000..5cc7266 --- /dev/null +++ b/node_modules/eslint/lib/rules/space-before-blocks.js @@ -0,0 +1,201 @@ +/** + * @fileoverview A rule to ensure whitespace before blocks. + * @author Mathias Schreck + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given node represents the body of a function. + * @param {ASTNode} node the node to check. + * @returns {boolean} `true` if the node is function body. + */ +function isFunctionBody(node) { + const parent = node.parent; + + return ( + node.type === "BlockStatement" && + astUtils.isFunction(parent) && + parent.body === node + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before blocks", + recommended: false, + url: "https://eslint.org/docs/rules/space-before-blocks" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + keywords: { + enum: ["always", "never", "off"] + }, + functions: { + enum: ["always", "never", "off"] + }, + classes: { + enum: ["always", "never", "off"] + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + unexpectedSpace: "Unexpected space before opening brace.", + missingSpace: "Missing space before opening brace." + } + }, + + create(context) { + const config = context.options[0], + sourceCode = context.getSourceCode(); + let alwaysFunctions = true, + alwaysKeywords = true, + alwaysClasses = true, + neverFunctions = false, + neverKeywords = false, + neverClasses = false; + + if (typeof config === "object") { + alwaysFunctions = config.functions === "always"; + alwaysKeywords = config.keywords === "always"; + alwaysClasses = config.classes === "always"; + neverFunctions = config.functions === "never"; + neverKeywords = config.keywords === "never"; + neverClasses = config.classes === "never"; + } else if (config === "never") { + alwaysFunctions = false; + alwaysKeywords = false; + alwaysClasses = false; + neverFunctions = true; + neverKeywords = true; + neverClasses = true; + } + + /** + * Checks whether the spacing before the given block is already controlled by another rule: + * - `arrow-spacing` checks spaces after `=>`. + * - `keyword-spacing` checks spaces after keywords in certain contexts. + * - `switch-colon-spacing` checks spaces after `:` of switch cases. + * @param {Token} precedingToken first token before the block. + * @param {ASTNode|Token} node `BlockStatement` node or `{` token of a `SwitchStatement` node. + * @returns {boolean} `true` if requiring or disallowing spaces before the given block could produce conflicts with other rules. + */ + function isConflicted(precedingToken, node) { + return ( + astUtils.isArrowToken(precedingToken) || + ( + astUtils.isKeywordToken(precedingToken) && + !isFunctionBody(node) + ) || + ( + astUtils.isColonToken(precedingToken) && + node.parent && + node.parent.type === "SwitchCase" && + precedingToken === astUtils.getSwitchCaseColonToken(node.parent, sourceCode) + ) + ); + } + + /** + * Checks the given BlockStatement node has a preceding space if it doesn’t start on a new line. + * @param {ASTNode|Token} node The AST node of a BlockStatement. + * @returns {void} undefined. + */ + function checkPrecedingSpace(node) { + const precedingToken = sourceCode.getTokenBefore(node); + + if (precedingToken && !isConflicted(precedingToken, node) && astUtils.isTokenOnSameLine(precedingToken, node)) { + const hasSpace = sourceCode.isSpaceBetweenTokens(precedingToken, node); + let requireSpace; + let requireNoSpace; + + if (isFunctionBody(node)) { + requireSpace = alwaysFunctions; + requireNoSpace = neverFunctions; + } else if (node.type === "ClassBody") { + requireSpace = alwaysClasses; + requireNoSpace = neverClasses; + } else { + requireSpace = alwaysKeywords; + requireNoSpace = neverKeywords; + } + + if (requireSpace && !hasSpace) { + context.report({ + node, + messageId: "missingSpace", + fix(fixer) { + return fixer.insertTextBefore(node, " "); + } + }); + } else if (requireNoSpace && hasSpace) { + context.report({ + node, + messageId: "unexpectedSpace", + fix(fixer) { + return fixer.removeRange([precedingToken.range[1], node.range[0]]); + } + }); + } + } + } + + /** + * Checks if the CaseBlock of an given SwitchStatement node has a preceding space. + * @param {ASTNode} node The node of a SwitchStatement. + * @returns {void} undefined. + */ + function checkSpaceBeforeCaseBlock(node) { + const cases = node.cases; + let openingBrace; + + if (cases.length > 0) { + openingBrace = sourceCode.getTokenBefore(cases[0]); + } else { + openingBrace = sourceCode.getLastToken(node, 1); + } + + checkPrecedingSpace(openingBrace); + } + + return { + BlockStatement: checkPrecedingSpace, + ClassBody: checkPrecedingSpace, + SwitchStatement: checkSpaceBeforeCaseBlock + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/space-before-function-paren.js b/node_modules/eslint/lib/rules/space-before-function-paren.js new file mode 100644 index 0000000..fdd45be --- /dev/null +++ b/node_modules/eslint/lib/rules/space-before-function-paren.js @@ -0,0 +1,164 @@ +/** + * @fileoverview Rule to validate spacing before function paren. + * @author Mathias Schreck + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before `function` definition opening parenthesis", + recommended: false, + url: "https://eslint.org/docs/rules/space-before-function-paren" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + anonymous: { + enum: ["always", "never", "ignore"] + }, + named: { + enum: ["always", "never", "ignore"] + }, + asyncArrow: { + enum: ["always", "never", "ignore"] + } + }, + additionalProperties: false + } + ] + } + ], + + messages: { + unexpectedSpace: "Unexpected space before function parentheses.", + missingSpace: "Missing space before function parentheses." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const baseConfig = typeof context.options[0] === "string" ? context.options[0] : "always"; + const overrideConfig = typeof context.options[0] === "object" ? context.options[0] : {}; + + /** + * Determines whether a function has a name. + * @param {ASTNode} node The function node. + * @returns {boolean} Whether the function has a name. + */ + function isNamedFunction(node) { + if (node.id) { + return true; + } + + const parent = node.parent; + + return parent.type === "MethodDefinition" || + (parent.type === "Property" && + ( + parent.kind === "get" || + parent.kind === "set" || + parent.method + ) + ); + } + + /** + * Gets the config for a given function + * @param {ASTNode} node The function node + * @returns {string} "always", "never", or "ignore" + */ + function getConfigForFunction(node) { + if (node.type === "ArrowFunctionExpression") { + + // Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar + if (node.async && astUtils.isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 }))) { + return overrideConfig.asyncArrow || baseConfig; + } + } else if (isNamedFunction(node)) { + return overrideConfig.named || baseConfig; + + // `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}` + } else if (!node.generator) { + return overrideConfig.anonymous || baseConfig; + } + + return "ignore"; + } + + /** + * Checks the parens of a function node + * @param {ASTNode} node A function node + * @returns {void} + */ + function checkFunction(node) { + const functionConfig = getConfigForFunction(node); + + if (functionConfig === "ignore") { + return; + } + + const rightToken = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); + const leftToken = sourceCode.getTokenBefore(rightToken); + const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken); + + if (hasSpacing && functionConfig === "never") { + context.report({ + node, + loc: { + start: leftToken.loc.end, + end: rightToken.loc.start + }, + messageId: "unexpectedSpace", + fix(fixer) { + const comments = sourceCode.getCommentsBefore(rightToken); + + // Don't fix anything if there's a single line comment between the left and the right token + if (comments.some(comment => comment.type === "Line")) { + return null; + } + return fixer.replaceTextRange( + [leftToken.range[1], rightToken.range[0]], + comments.reduce((text, comment) => text + sourceCode.getText(comment), "") + ); + } + }); + } else if (!hasSpacing && functionConfig === "always") { + context.report({ + node, + loc: rightToken.loc, + messageId: "missingSpace", + fix: fixer => fixer.insertTextAfter(leftToken, " ") + }); + } + } + + return { + ArrowFunctionExpression: checkFunction, + FunctionDeclaration: checkFunction, + FunctionExpression: checkFunction + }; + } +}; diff --git a/node_modules/eslint/lib/rules/space-in-parens.js b/node_modules/eslint/lib/rules/space-in-parens.js new file mode 100644 index 0000000..1509d60 --- /dev/null +++ b/node_modules/eslint/lib/rules/space-in-parens.js @@ -0,0 +1,282 @@ +/** + * @fileoverview Disallows or enforces spaces inside of parentheses. + * @author Jonathan Rajavuori + */ +"use strict"; + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing inside parentheses", + recommended: false, + url: "https://eslint.org/docs/rules/space-in-parens" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + enum: ["{}", "[]", "()", "empty"] + }, + uniqueItems: true + } + }, + additionalProperties: false + } + ], + + messages: { + missingOpeningSpace: "There must be a space after this paren.", + missingClosingSpace: "There must be a space before this paren.", + rejectedOpeningSpace: "There should be no space after this paren.", + rejectedClosingSpace: "There should be no space before this paren." + } + }, + + create(context) { + const ALWAYS = context.options[0] === "always", + exceptionsArrayOptions = (context.options[1] && context.options[1].exceptions) || [], + options = {}; + + let exceptions; + + if (exceptionsArrayOptions.length) { + options.braceException = exceptionsArrayOptions.includes("{}"); + options.bracketException = exceptionsArrayOptions.includes("[]"); + options.parenException = exceptionsArrayOptions.includes("()"); + options.empty = exceptionsArrayOptions.includes("empty"); + } + + /** + * Produces an object with the opener and closer exception values + * @returns {Object} `openers` and `closers` exception values + * @private + */ + function getExceptions() { + const openers = [], + closers = []; + + if (options.braceException) { + openers.push("{"); + closers.push("}"); + } + + if (options.bracketException) { + openers.push("["); + closers.push("]"); + } + + if (options.parenException) { + openers.push("("); + closers.push(")"); + } + + if (options.empty) { + openers.push(")"); + closers.push("("); + } + + return { + openers, + closers + }; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + const sourceCode = context.getSourceCode(); + + /** + * Determines if a token is one of the exceptions for the opener paren + * @param {Object} token The token to check + * @returns {boolean} True if the token is one of the exceptions for the opener paren + */ + function isOpenerException(token) { + return exceptions.openers.includes(token.value); + } + + /** + * Determines if a token is one of the exceptions for the closer paren + * @param {Object} token The token to check + * @returns {boolean} True if the token is one of the exceptions for the closer paren + */ + function isCloserException(token) { + return exceptions.closers.includes(token.value); + } + + /** + * Determines if an opening paren is immediately followed by a required space + * @param {Object} openingParenToken The paren token + * @param {Object} tokenAfterOpeningParen The token after it + * @returns {boolean} True if the opening paren is missing a required space + */ + function openerMissingSpace(openingParenToken, tokenAfterOpeningParen) { + if (sourceCode.isSpaceBetweenTokens(openingParenToken, tokenAfterOpeningParen)) { + return false; + } + + if (!options.empty && astUtils.isClosingParenToken(tokenAfterOpeningParen)) { + return false; + } + + if (ALWAYS) { + return !isOpenerException(tokenAfterOpeningParen); + } + return isOpenerException(tokenAfterOpeningParen); + } + + /** + * Determines if an opening paren is immediately followed by a disallowed space + * @param {Object} openingParenToken The paren token + * @param {Object} tokenAfterOpeningParen The token after it + * @returns {boolean} True if the opening paren has a disallowed space + */ + function openerRejectsSpace(openingParenToken, tokenAfterOpeningParen) { + if (!astUtils.isTokenOnSameLine(openingParenToken, tokenAfterOpeningParen)) { + return false; + } + + if (tokenAfterOpeningParen.type === "Line") { + return false; + } + + if (!sourceCode.isSpaceBetweenTokens(openingParenToken, tokenAfterOpeningParen)) { + return false; + } + + if (ALWAYS) { + return isOpenerException(tokenAfterOpeningParen); + } + return !isOpenerException(tokenAfterOpeningParen); + } + + /** + * Determines if a closing paren is immediately preceded by a required space + * @param {Object} tokenBeforeClosingParen The token before the paren + * @param {Object} closingParenToken The paren token + * @returns {boolean} True if the closing paren is missing a required space + */ + function closerMissingSpace(tokenBeforeClosingParen, closingParenToken) { + if (sourceCode.isSpaceBetweenTokens(tokenBeforeClosingParen, closingParenToken)) { + return false; + } + + if (!options.empty && astUtils.isOpeningParenToken(tokenBeforeClosingParen)) { + return false; + } + + if (ALWAYS) { + return !isCloserException(tokenBeforeClosingParen); + } + return isCloserException(tokenBeforeClosingParen); + } + + /** + * Determines if a closer paren is immediately preceded by a disallowed space + * @param {Object} tokenBeforeClosingParen The token before the paren + * @param {Object} closingParenToken The paren token + * @returns {boolean} True if the closing paren has a disallowed space + */ + function closerRejectsSpace(tokenBeforeClosingParen, closingParenToken) { + if (!astUtils.isTokenOnSameLine(tokenBeforeClosingParen, closingParenToken)) { + return false; + } + + if (!sourceCode.isSpaceBetweenTokens(tokenBeforeClosingParen, closingParenToken)) { + return false; + } + + if (ALWAYS) { + return isCloserException(tokenBeforeClosingParen); + } + return !isCloserException(tokenBeforeClosingParen); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + Program: function checkParenSpaces(node) { + exceptions = getExceptions(); + const tokens = sourceCode.tokensAndComments; + + tokens.forEach((token, i) => { + const prevToken = tokens[i - 1]; + const nextToken = tokens[i + 1]; + + // if token is not an opening or closing paren token, do nothing + if (!astUtils.isOpeningParenToken(token) && !astUtils.isClosingParenToken(token)) { + return; + } + + // if token is an opening paren and is not followed by a required space + if (token.value === "(" && openerMissingSpace(token, nextToken)) { + context.report({ + node, + loc: token.loc, + messageId: "missingOpeningSpace", + fix(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + + // if token is an opening paren and is followed by a disallowed space + if (token.value === "(" && openerRejectsSpace(token, nextToken)) { + context.report({ + node, + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "rejectedOpeningSpace", + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + + // if token is a closing paren and is not preceded by a required space + if (token.value === ")" && closerMissingSpace(prevToken, token)) { + context.report({ + node, + loc: token.loc, + messageId: "missingClosingSpace", + fix(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + + // if token is a closing paren and is preceded by a disallowed space + if (token.value === ")" && closerRejectsSpace(prevToken, token)) { + context.report({ + node, + loc: { start: prevToken.loc.end, end: token.loc.start }, + messageId: "rejectedClosingSpace", + fix(fixer) { + return fixer.removeRange([prevToken.range[1], token.range[0]]); + } + }); + } + }); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/space-infix-ops.js b/node_modules/eslint/lib/rules/space-infix-ops.js new file mode 100644 index 0000000..c526b7e --- /dev/null +++ b/node_modules/eslint/lib/rules/space-infix-ops.js @@ -0,0 +1,195 @@ +/** + * @fileoverview Require spaces around infix operators + * @author Michael Ficarra + */ +"use strict"; + +const { isEqToken } = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require spacing around infix operators", + recommended: false, + url: "https://eslint.org/docs/rules/space-infix-ops" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + int32Hint: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + missingSpace: "Operator '{{operator}}' must be spaced." + } + }, + + create(context) { + const int32Hint = context.options[0] ? context.options[0].int32Hint === true : false; + const sourceCode = context.getSourceCode(); + + /** + * Returns the first token which violates the rule + * @param {ASTNode} left The left node of the main node + * @param {ASTNode} right The right node of the main node + * @param {string} op The operator of the main node + * @returns {Object} The violator token or null + * @private + */ + function getFirstNonSpacedToken(left, right, op) { + const operator = sourceCode.getFirstTokenBetween(left, right, token => token.value === op); + const prev = sourceCode.getTokenBefore(operator); + const next = sourceCode.getTokenAfter(operator); + + if (!sourceCode.isSpaceBetweenTokens(prev, operator) || !sourceCode.isSpaceBetweenTokens(operator, next)) { + return operator; + } + + return null; + } + + /** + * Reports an AST node as a rule violation + * @param {ASTNode} mainNode The node to report + * @param {Object} culpritToken The token which has a problem + * @returns {void} + * @private + */ + function report(mainNode, culpritToken) { + context.report({ + node: mainNode, + loc: culpritToken.loc, + messageId: "missingSpace", + data: { + operator: culpritToken.value + }, + fix(fixer) { + const previousToken = sourceCode.getTokenBefore(culpritToken); + const afterToken = sourceCode.getTokenAfter(culpritToken); + let fixString = ""; + + if (culpritToken.range[0] - previousToken.range[1] === 0) { + fixString = " "; + } + + fixString += culpritToken.value; + + if (afterToken.range[0] - culpritToken.range[1] === 0) { + fixString += " "; + } + + return fixer.replaceText(culpritToken, fixString); + } + }); + } + + /** + * Check if the node is binary then report + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkBinary(node) { + const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left; + const rightNode = node.right; + + // search for = in AssignmentPattern nodes + const operator = node.operator || "="; + + const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator); + + if (nonSpacedNode) { + if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) { + report(node, nonSpacedNode); + } + } + } + + /** + * Check if the node is conditional + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkConditional(node) { + const nonSpacedConsequentNode = getFirstNonSpacedToken(node.test, node.consequent, "?"); + const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":"); + + if (nonSpacedConsequentNode) { + report(node, nonSpacedConsequentNode); + } + + if (nonSpacedAlternateNode) { + report(node, nonSpacedAlternateNode); + } + } + + /** + * Check if the node is a variable + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkVar(node) { + const leftNode = (node.id.typeAnnotation) ? node.id.typeAnnotation : node.id; + const rightNode = node.init; + + if (rightNode) { + const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, "="); + + if (nonSpacedNode) { + report(node, nonSpacedNode); + } + } + } + + return { + AssignmentExpression: checkBinary, + AssignmentPattern: checkBinary, + BinaryExpression: checkBinary, + LogicalExpression: checkBinary, + ConditionalExpression: checkConditional, + VariableDeclarator: checkVar, + + PropertyDefinition(node) { + if (!node.value) { + return; + } + + /* + * Because of computed properties and type annotations, some + * tokens may exist between `node.key` and `=`. + * Therefore, find the `=` from the right. + */ + const operatorToken = sourceCode.getTokenBefore(node.value, isEqToken); + const leftToken = sourceCode.getTokenBefore(operatorToken); + const rightToken = sourceCode.getTokenAfter(operatorToken); + + if ( + !sourceCode.isSpaceBetweenTokens(leftToken, operatorToken) || + !sourceCode.isSpaceBetweenTokens(operatorToken, rightToken) + ) { + report(node, operatorToken); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/space-unary-ops.js b/node_modules/eslint/lib/rules/space-unary-ops.js new file mode 100644 index 0000000..04487c4 --- /dev/null +++ b/node_modules/eslint/lib/rules/space-unary-ops.js @@ -0,0 +1,321 @@ +/** + * @fileoverview This rule should require or disallow spaces before or after unary operations. + * @author Marcin Kumorek + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce consistent spacing before or after unary operators", + recommended: false, + url: "https://eslint.org/docs/rules/space-unary-ops" + }, + + fixable: "whitespace", + + schema: [ + { + type: "object", + properties: { + words: { + type: "boolean", + default: true + }, + nonwords: { + type: "boolean", + default: false + }, + overrides: { + type: "object", + additionalProperties: { + type: "boolean" + } + } + }, + additionalProperties: false + } + ], + messages: { + unexpectedBefore: "Unexpected space before unary operator '{{operator}}'.", + unexpectedAfter: "Unexpected space after unary operator '{{operator}}'.", + unexpectedAfterWord: "Unexpected space after unary word operator '{{word}}'.", + wordOperator: "Unary word operator '{{word}}' must be followed by whitespace.", + operator: "Unary operator '{{operator}}' must be followed by whitespace.", + beforeUnaryExpressions: "Space is required before unary expressions '{{token}}'." + } + }, + + create(context) { + const options = context.options[0] || { words: true, nonwords: false }; + + const sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if the node is the first "!" in a "!!" convert to Boolean expression + * @param {ASTnode} node AST node + * @returns {boolean} Whether or not the node is first "!" in "!!" + */ + function isFirstBangInBangBangExpression(node) { + return node && node.type === "UnaryExpression" && node.argument.operator === "!" && + node.argument && node.argument.type === "UnaryExpression" && node.argument.operator === "!"; + } + + /** + * Checks if an override exists for a given operator. + * @param {string} operator Operator + * @returns {boolean} Whether or not an override has been provided for the operator + */ + function overrideExistsForOperator(operator) { + return options.overrides && Object.prototype.hasOwnProperty.call(options.overrides, operator); + } + + /** + * Gets the value that the override was set to for this operator + * @param {string} operator Operator + * @returns {boolean} Whether or not an override enforces a space with this operator + */ + function overrideEnforcesSpaces(operator) { + return options.overrides[operator]; + } + + /** + * Verify Unary Word Operator has spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ + function verifyWordHasSpaces(node, firstToken, secondToken, word) { + if (secondToken.range[0] === firstToken.range[1]) { + context.report({ + node, + messageId: "wordOperator", + data: { + word + }, + fix(fixer) { + return fixer.insertTextAfter(firstToken, " "); + } + }); + } + } + + /** + * Verify Unary Word Operator doesn't have spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ + function verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word) { + if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { + if (secondToken.range[0] > firstToken.range[1]) { + context.report({ + node, + messageId: "unexpectedAfterWord", + data: { + word + }, + fix(fixer) { + return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); + } + }); + } + } + } + + /** + * Check Unary Word Operators for spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ + function checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, word) { + if (overrideExistsForOperator(word)) { + if (overrideEnforcesSpaces(word)) { + verifyWordHasSpaces(node, firstToken, secondToken, word); + } else { + verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word); + } + } else if (options.words) { + verifyWordHasSpaces(node, firstToken, secondToken, word); + } else { + verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word); + } + } + + /** + * Verifies YieldExpressions satisfy spacing requirements + * @param {ASTnode} node AST node + * @returns {void} + */ + function checkForSpacesAfterYield(node) { + const tokens = sourceCode.getFirstTokens(node, 3), + word = "yield"; + + if (!node.argument || node.delegate) { + return; + } + + checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], word); + } + + /** + * Verifies AwaitExpressions satisfy spacing requirements + * @param {ASTNode} node AwaitExpression AST node + * @returns {void} + */ + function checkForSpacesAfterAwait(node) { + const tokens = sourceCode.getFirstTokens(node, 3); + + checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], "await"); + } + + /** + * Verifies UnaryExpression, UpdateExpression and NewExpression have spaces before or after the operator + * @param {ASTnode} node AST node + * @param {Object} firstToken First token in the expression + * @param {Object} secondToken Second token in the expression + * @returns {void} + */ + function verifyNonWordsHaveSpaces(node, firstToken, secondToken) { + if (node.prefix) { + if (isFirstBangInBangBangExpression(node)) { + return; + } + if (firstToken.range[1] === secondToken.range[0]) { + context.report({ + node, + messageId: "operator", + data: { + operator: firstToken.value + }, + fix(fixer) { + return fixer.insertTextAfter(firstToken, " "); + } + }); + } + } else { + if (firstToken.range[1] === secondToken.range[0]) { + context.report({ + node, + messageId: "beforeUnaryExpressions", + data: { + token: secondToken.value + }, + fix(fixer) { + return fixer.insertTextBefore(secondToken, " "); + } + }); + } + } + } + + /** + * Verifies UnaryExpression, UpdateExpression and NewExpression don't have spaces before or after the operator + * @param {ASTnode} node AST node + * @param {Object} firstToken First token in the expression + * @param {Object} secondToken Second token in the expression + * @returns {void} + */ + function verifyNonWordsDontHaveSpaces(node, firstToken, secondToken) { + if (node.prefix) { + if (secondToken.range[0] > firstToken.range[1]) { + context.report({ + node, + messageId: "unexpectedAfter", + data: { + operator: firstToken.value + }, + fix(fixer) { + if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { + return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); + } + return null; + } + }); + } + } else { + if (secondToken.range[0] > firstToken.range[1]) { + context.report({ + node, + messageId: "unexpectedBefore", + data: { + operator: secondToken.value + }, + fix(fixer) { + return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); + } + }); + } + } + } + + /** + * Verifies UnaryExpression, UpdateExpression and NewExpression satisfy spacing requirements + * @param {ASTnode} node AST node + * @returns {void} + */ + function checkForSpaces(node) { + const tokens = node.type === "UpdateExpression" && !node.prefix + ? sourceCode.getLastTokens(node, 2) + : sourceCode.getFirstTokens(node, 2); + const firstToken = tokens[0]; + const secondToken = tokens[1]; + + if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") { + checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, firstToken.value); + return; + } + + const operator = node.prefix ? tokens[0].value : tokens[1].value; + + if (overrideExistsForOperator(operator)) { + if (overrideEnforcesSpaces(operator)) { + verifyNonWordsHaveSpaces(node, firstToken, secondToken); + } else { + verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); + } + } else if (options.nonwords) { + verifyNonWordsHaveSpaces(node, firstToken, secondToken); + } else { + verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + UnaryExpression: checkForSpaces, + UpdateExpression: checkForSpaces, + NewExpression: checkForSpaces, + YieldExpression: checkForSpacesAfterYield, + AwaitExpression: checkForSpacesAfterAwait + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/spaced-comment.js b/node_modules/eslint/lib/rules/spaced-comment.js new file mode 100644 index 0000000..d858fc4 --- /dev/null +++ b/node_modules/eslint/lib/rules/spaced-comment.js @@ -0,0 +1,382 @@ +/** + * @fileoverview Source code for spaced-comments rule + * @author Gyandeep Singh + */ +"use strict"; + +const escapeRegExp = require("escape-string-regexp"); +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Escapes the control characters of a given string. + * @param {string} s A string to escape. + * @returns {string} An escaped string. + */ +function escape(s) { + return `(?:${escapeRegExp(s)})`; +} + +/** + * Escapes the control characters of a given string. + * And adds a repeat flag. + * @param {string} s A string to escape. + * @returns {string} An escaped string. + */ +function escapeAndRepeat(s) { + return `${escape(s)}+`; +} + +/** + * Parses `markers` option. + * If markers don't include `"*"`, this adds `"*"` to allow JSDoc comments. + * @param {string[]} [markers] A marker list. + * @returns {string[]} A marker list. + */ +function parseMarkersOption(markers) { + + // `*` is a marker for JSDoc comments. + if (!markers.includes("*")) { + return markers.concat("*"); + } + + return markers; +} + +/** + * Creates string pattern for exceptions. + * Generated pattern: + * + * 1. A space or an exception pattern sequence. + * @param {string[]} exceptions An exception pattern list. + * @returns {string} A regular expression string for exceptions. + */ +function createExceptionsPattern(exceptions) { + let pattern = ""; + + /* + * A space or an exception pattern sequence. + * [] ==> "\s" + * ["-"] ==> "(?:\s|\-+$)" + * ["-", "="] ==> "(?:\s|(?:\-+|=+)$)" + * ["-", "=", "--=="] ==> "(?:\s|(?:\-+|=+|(?:\-\-==)+)$)" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5Cs%7C(%3F%3A%5C-%2B%7C%3D%2B%7C(%3F%3A%5C-%5C-%3D%3D)%2B)%24) + */ + if (exceptions.length === 0) { + + // a space. + pattern += "\\s"; + } else { + + // a space or... + pattern += "(?:\\s|"; + + if (exceptions.length === 1) { + + // a sequence of the exception pattern. + pattern += escapeAndRepeat(exceptions[0]); + } else { + + // a sequence of one of the exception patterns. + pattern += "(?:"; + pattern += exceptions.map(escapeAndRepeat).join("|"); + pattern += ")"; + } + pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`; + } + + return pattern; +} + +/** + * Creates RegExp object for `always` mode. + * Generated pattern for beginning of comment: + * + * 1. First, a marker or nothing. + * 2. Next, a space or an exception pattern sequence. + * @param {string[]} markers A marker list. + * @param {string[]} exceptions An exception pattern list. + * @returns {RegExp} A RegExp object for the beginning of a comment in `always` mode. + */ +function createAlwaysStylePattern(markers, exceptions) { + let pattern = "^"; + + /* + * A marker or nothing. + * ["*"] ==> "\*?" + * ["*", "!"] ==> "(?:\*|!)?" + * ["*", "/", "!<"] ==> "(?:\*|\/|(?:!<))?" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5C*%7C%5C%2F%7C(%3F%3A!%3C))%3F + */ + if (markers.length === 1) { + + // the marker. + pattern += escape(markers[0]); + } else { + + // one of markers. + pattern += "(?:"; + pattern += markers.map(escape).join("|"); + pattern += ")"; + } + + pattern += "?"; // or nothing. + pattern += createExceptionsPattern(exceptions); + + return new RegExp(pattern, "u"); +} + +/** + * Creates RegExp object for `never` mode. + * Generated pattern for beginning of comment: + * + * 1. First, a marker or nothing (captured). + * 2. Next, a space or a tab. + * @param {string[]} markers A marker list. + * @returns {RegExp} A RegExp object for `never` mode. + */ +function createNeverStylePattern(markers) { + const pattern = `^(${markers.map(escape).join("|")})?[ \t]+`; + + return new RegExp(pattern, "u"); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce consistent spacing after the `//` or `/*` in a comment", + recommended: false, + url: "https://eslint.org/docs/rules/spaced-comment" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + type: "string" + } + }, + markers: { + type: "array", + items: { + type: "string" + } + }, + line: { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + type: "string" + } + }, + markers: { + type: "array", + items: { + type: "string" + } + } + }, + additionalProperties: false + }, + block: { + type: "object", + properties: { + exceptions: { + type: "array", + items: { + type: "string" + } + }, + markers: { + type: "array", + items: { + type: "string" + } + }, + balanced: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + }, + additionalProperties: false + } + ], + + messages: { + unexpectedSpaceAfterMarker: "Unexpected space or tab after marker ({{refChar}}) in comment.", + expectedExceptionAfter: "Expected exception block, space or tab after '{{refChar}}' in comment.", + unexpectedSpaceBefore: "Unexpected space or tab before '*/' in comment.", + unexpectedSpaceAfter: "Unexpected space or tab after '{{refChar}}' in comment.", + expectedSpaceBefore: "Expected space or tab before '*/' in comment.", + expectedSpaceAfter: "Expected space or tab after '{{refChar}}' in comment." + } + }, + + create(context) { + + const sourceCode = context.getSourceCode(); + + // Unless the first option is never, require a space + const requireSpace = context.options[0] !== "never"; + + /* + * Parse the second options. + * If markers don't include `"*"`, it's added automatically for JSDoc + * comments. + */ + const config = context.options[1] || {}; + const balanced = config.block && config.block.balanced; + + const styleRules = ["block", "line"].reduce((rule, type) => { + const markers = parseMarkersOption(config[type] && config[type].markers || config.markers || []); + const exceptions = config[type] && config[type].exceptions || config.exceptions || []; + const endNeverPattern = "[ \t]+$"; + + // Create RegExp object for valid patterns. + rule[type] = { + beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers), + endRegex: balanced && requireSpace ? new RegExp(`${createExceptionsPattern(exceptions)}$`, "u") : new RegExp(endNeverPattern, "u"), + hasExceptions: exceptions.length > 0, + captureMarker: new RegExp(`^(${markers.map(escape).join("|")})`, "u"), + markers: new Set(markers) + }; + + return rule; + }, {}); + + /** + * Reports a beginning spacing error with an appropriate message. + * @param {ASTNode} node A comment node to check. + * @param {string} messageId An error message to report. + * @param {Array} match An array of match results for markers. + * @param {string} refChar Character used for reference in the error message. + * @returns {void} + */ + function reportBegin(node, messageId, match, refChar) { + const type = node.type.toLowerCase(), + commentIdentifier = type === "block" ? "/*" : "//"; + + context.report({ + node, + fix(fixer) { + const start = node.range[0]; + let end = start + 2; + + if (requireSpace) { + if (match) { + end += match[0].length; + } + return fixer.insertTextAfterRange([start, end], " "); + } + end += match[0].length; + return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : "")); + + }, + messageId, + data: { refChar } + }); + } + + /** + * Reports an ending spacing error with an appropriate message. + * @param {ASTNode} node A comment node to check. + * @param {string} messageId An error message to report. + * @param {string} match An array of the matched whitespace characters. + * @returns {void} + */ + function reportEnd(node, messageId, match) { + context.report({ + node, + fix(fixer) { + if (requireSpace) { + return fixer.insertTextAfterRange([node.range[0], node.range[1] - 2], " "); + } + const end = node.range[1] - 2, + start = end - match[0].length; + + return fixer.replaceTextRange([start, end], ""); + + }, + messageId + }); + } + + /** + * Reports a given comment if it's invalid. + * @param {ASTNode} node a comment node to check. + * @returns {void} + */ + function checkCommentForSpace(node) { + const type = node.type.toLowerCase(), + rule = styleRules[type], + commentIdentifier = type === "block" ? "/*" : "//"; + + // Ignores empty comments and comments that consist only of a marker. + if (node.value.length === 0 || rule.markers.has(node.value)) { + return; + } + + const beginMatch = rule.beginRegex.exec(node.value); + const endMatch = rule.endRegex.exec(node.value); + + // Checks. + if (requireSpace) { + if (!beginMatch) { + const hasMarker = rule.captureMarker.exec(node.value); + const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier; + + if (rule.hasExceptions) { + reportBegin(node, "expectedExceptionAfter", hasMarker, marker); + } else { + reportBegin(node, "expectedSpaceAfter", hasMarker, marker); + } + } + + if (balanced && type === "block" && !endMatch) { + reportEnd(node, "expectedSpaceBefore"); + } + } else { + if (beginMatch) { + if (!beginMatch[1]) { + reportBegin(node, "unexpectedSpaceAfter", beginMatch, commentIdentifier); + } else { + reportBegin(node, "unexpectedSpaceAfterMarker", beginMatch, beginMatch[1]); + } + } + + if (balanced && type === "block" && endMatch) { + reportEnd(node, "unexpectedSpaceBefore", endMatch); + } + } + } + + return { + Program() { + const comments = sourceCode.getAllComments(); + + comments.filter(token => token.type !== "Shebang").forEach(checkCommentForSpace); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/strict.js b/node_modules/eslint/lib/rules/strict.js new file mode 100644 index 0000000..0ea1da5 --- /dev/null +++ b/node_modules/eslint/lib/rules/strict.js @@ -0,0 +1,277 @@ +/** + * @fileoverview Rule to control usage of strict mode directives. + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets all of the Use Strict Directives in the Directive Prologue of a group of + * statements. + * @param {ASTNode[]} statements Statements in the program or function body. + * @returns {ASTNode[]} All of the Use Strict Directives. + */ +function getUseStrictDirectives(statements) { + const directives = []; + + for (let i = 0; i < statements.length; i++) { + const statement = statements[i]; + + if ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" && + statement.expression.value === "use strict" + ) { + directives[i] = statement; + } else { + break; + } + } + + return directives; +} + +/** + * Checks whether a given parameter is a simple parameter. + * @param {ASTNode} node A pattern node to check. + * @returns {boolean} `true` if the node is an Identifier node. + */ +function isSimpleParameter(node) { + return node.type === "Identifier"; +} + +/** + * Checks whether a given parameter list is a simple parameter list. + * @param {ASTNode[]} params A parameter list to check. + * @returns {boolean} `true` if the every parameter is an Identifier node. + */ +function isSimpleParameterList(params) { + return params.every(isSimpleParameter); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require or disallow strict mode directives", + recommended: false, + url: "https://eslint.org/docs/rules/strict" + }, + + schema: [ + { + enum: ["never", "global", "function", "safe"] + } + ], + + fixable: "code", + messages: { + function: "Use the function form of 'use strict'.", + global: "Use the global form of 'use strict'.", + multiple: "Multiple 'use strict' directives.", + never: "Strict mode is not permitted.", + unnecessary: "Unnecessary 'use strict' directive.", + module: "'use strict' is unnecessary inside of modules.", + implied: "'use strict' is unnecessary when implied strict mode is enabled.", + unnecessaryInClasses: "'use strict' is unnecessary inside of classes.", + nonSimpleParameterList: "'use strict' directive inside a function with non-simple parameter list throws a syntax error since ES2016.", + wrap: "Wrap {{name}} in a function with 'use strict' directive." + } + }, + + create(context) { + + const ecmaFeatures = context.parserOptions.ecmaFeatures || {}, + scopes = [], + classScopes = []; + let mode = context.options[0] || "safe"; + + if (ecmaFeatures.impliedStrict) { + mode = "implied"; + } else if (mode === "safe") { + mode = ecmaFeatures.globalReturn ? "global" : "function"; + } + + /** + * Determines whether a reported error should be fixed, depending on the error type. + * @param {string} errorType The type of error + * @returns {boolean} `true` if the reported error should be fixed + */ + function shouldFix(errorType) { + return errorType === "multiple" || errorType === "unnecessary" || errorType === "module" || errorType === "implied" || errorType === "unnecessaryInClasses"; + } + + /** + * Gets a fixer function to remove a given 'use strict' directive. + * @param {ASTNode} node The directive that should be removed + * @returns {Function} A fixer function + */ + function getFixFunction(node) { + return fixer => fixer.remove(node); + } + + /** + * Report a slice of an array of nodes with a given message. + * @param {ASTNode[]} nodes Nodes. + * @param {string} start Index to start from. + * @param {string} end Index to end before. + * @param {string} messageId Message to display. + * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) + * @returns {void} + */ + function reportSlice(nodes, start, end, messageId, fix) { + nodes.slice(start, end).forEach(node => { + context.report({ node, messageId, fix: fix ? getFixFunction(node) : null }); + }); + } + + /** + * Report all nodes in an array with a given message. + * @param {ASTNode[]} nodes Nodes. + * @param {string} messageId Message id to display. + * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) + * @returns {void} + */ + function reportAll(nodes, messageId, fix) { + reportSlice(nodes, 0, nodes.length, messageId, fix); + } + + /** + * Report all nodes in an array, except the first, with a given message. + * @param {ASTNode[]} nodes Nodes. + * @param {string} messageId Message id to display. + * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) + * @returns {void} + */ + function reportAllExceptFirst(nodes, messageId, fix) { + reportSlice(nodes, 1, nodes.length, messageId, fix); + } + + /** + * Entering a function in 'function' mode pushes a new nested scope onto the + * stack. The new scope is true if the nested function is strict mode code. + * @param {ASTNode} node The function declaration or expression. + * @param {ASTNode[]} useStrictDirectives The Use Strict Directives of the node. + * @returns {void} + */ + function enterFunctionInFunctionMode(node, useStrictDirectives) { + const isInClass = classScopes.length > 0, + isParentGlobal = scopes.length === 0 && classScopes.length === 0, + isParentStrict = scopes.length > 0 && scopes[scopes.length - 1], + isStrict = useStrictDirectives.length > 0; + + if (isStrict) { + if (!isSimpleParameterList(node.params)) { + context.report({ node: useStrictDirectives[0], messageId: "nonSimpleParameterList" }); + } else if (isParentStrict) { + context.report({ node: useStrictDirectives[0], messageId: "unnecessary", fix: getFixFunction(useStrictDirectives[0]) }); + } else if (isInClass) { + context.report({ node: useStrictDirectives[0], messageId: "unnecessaryInClasses", fix: getFixFunction(useStrictDirectives[0]) }); + } + + reportAllExceptFirst(useStrictDirectives, "multiple", true); + } else if (isParentGlobal) { + if (isSimpleParameterList(node.params)) { + context.report({ node, messageId: "function" }); + } else { + context.report({ + node, + messageId: "wrap", + data: { name: astUtils.getFunctionNameWithKind(node) } + }); + } + } + + scopes.push(isParentStrict || isStrict); + } + + /** + * Exiting a function in 'function' mode pops its scope off the stack. + * @returns {void} + */ + function exitFunctionInFunctionMode() { + scopes.pop(); + } + + /** + * Enter a function and either: + * - Push a new nested scope onto the stack (in 'function' mode). + * - Report all the Use Strict Directives (in the other modes). + * @param {ASTNode} node The function declaration or expression. + * @returns {void} + */ + function enterFunction(node) { + const isBlock = node.body.type === "BlockStatement", + useStrictDirectives = isBlock + ? getUseStrictDirectives(node.body.body) : []; + + if (mode === "function") { + enterFunctionInFunctionMode(node, useStrictDirectives); + } else if (useStrictDirectives.length > 0) { + if (isSimpleParameterList(node.params)) { + reportAll(useStrictDirectives, mode, shouldFix(mode)); + } else { + context.report({ node: useStrictDirectives[0], messageId: "nonSimpleParameterList" }); + reportAllExceptFirst(useStrictDirectives, "multiple", true); + } + } + } + + const rule = { + Program(node) { + const useStrictDirectives = getUseStrictDirectives(node.body); + + if (node.sourceType === "module") { + mode = "module"; + } + + if (mode === "global") { + if (node.body.length > 0 && useStrictDirectives.length === 0) { + context.report({ node, messageId: "global" }); + } + reportAllExceptFirst(useStrictDirectives, "multiple", true); + } else { + reportAll(useStrictDirectives, mode, shouldFix(mode)); + } + }, + FunctionDeclaration: enterFunction, + FunctionExpression: enterFunction, + ArrowFunctionExpression: enterFunction + }; + + if (mode === "function") { + Object.assign(rule, { + + // Inside of class bodies are always strict mode. + ClassBody() { + classScopes.push(true); + }, + "ClassBody:exit"() { + classScopes.pop(); + }, + + "FunctionDeclaration:exit": exitFunctionInFunctionMode, + "FunctionExpression:exit": exitFunctionInFunctionMode, + "ArrowFunctionExpression:exit": exitFunctionInFunctionMode + }); + } + + return rule; + } +}; diff --git a/node_modules/eslint/lib/rules/switch-colon-spacing.js b/node_modules/eslint/lib/rules/switch-colon-spacing.js new file mode 100644 index 0000000..cd2ca70 --- /dev/null +++ b/node_modules/eslint/lib/rules/switch-colon-spacing.js @@ -0,0 +1,129 @@ +/** + * @fileoverview Rule to enforce spacing around colons of switch statements. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "enforce spacing around colons of switch statements", + recommended: false, + url: "https://eslint.org/docs/rules/switch-colon-spacing" + }, + + schema: [ + { + type: "object", + properties: { + before: { type: "boolean", default: false }, + after: { type: "boolean", default: true } + }, + additionalProperties: false + } + ], + fixable: "whitespace", + messages: { + expectedBefore: "Expected space(s) before this colon.", + expectedAfter: "Expected space(s) after this colon.", + unexpectedBefore: "Unexpected space(s) before this colon.", + unexpectedAfter: "Unexpected space(s) after this colon." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const options = context.options[0] || {}; + const beforeSpacing = options.before === true; // false by default + const afterSpacing = options.after !== false; // true by default + + /** + * Check whether the spacing between the given 2 tokens is valid or not. + * @param {Token} left The left token to check. + * @param {Token} right The right token to check. + * @param {boolean} expected The expected spacing to check. `true` if there should be a space. + * @returns {boolean} `true` if the spacing between the tokens is valid. + */ + function isValidSpacing(left, right, expected) { + return ( + astUtils.isClosingBraceToken(right) || + !astUtils.isTokenOnSameLine(left, right) || + sourceCode.isSpaceBetweenTokens(left, right) === expected + ); + } + + /** + * Check whether comments exist between the given 2 tokens. + * @param {Token} left The left token to check. + * @param {Token} right The right token to check. + * @returns {boolean} `true` if comments exist between the given 2 tokens. + */ + function commentsExistBetween(left, right) { + return sourceCode.getFirstTokenBetween( + left, + right, + { + includeComments: true, + filter: astUtils.isCommentToken + } + ) !== null; + } + + /** + * Fix the spacing between the given 2 tokens. + * @param {RuleFixer} fixer The fixer to fix. + * @param {Token} left The left token of fix range. + * @param {Token} right The right token of fix range. + * @param {boolean} spacing The spacing style. `true` if there should be a space. + * @returns {Fix|null} The fix object. + */ + function fix(fixer, left, right, spacing) { + if (commentsExistBetween(left, right)) { + return null; + } + if (spacing) { + return fixer.insertTextAfter(left, " "); + } + return fixer.removeRange([left.range[1], right.range[0]]); + } + + return { + SwitchCase(node) { + const colonToken = astUtils.getSwitchCaseColonToken(node, sourceCode); + const beforeToken = sourceCode.getTokenBefore(colonToken); + const afterToken = sourceCode.getTokenAfter(colonToken); + + if (!isValidSpacing(beforeToken, colonToken, beforeSpacing)) { + context.report({ + node, + loc: colonToken.loc, + messageId: beforeSpacing ? "expectedBefore" : "unexpectedBefore", + fix: fixer => fix(fixer, beforeToken, colonToken, beforeSpacing) + }); + } + if (!isValidSpacing(colonToken, afterToken, afterSpacing)) { + context.report({ + node, + loc: colonToken.loc, + messageId: afterSpacing ? "expectedAfter" : "unexpectedAfter", + fix: fixer => fix(fixer, colonToken, afterToken, afterSpacing) + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/symbol-description.js b/node_modules/eslint/lib/rules/symbol-description.js new file mode 100644 index 0000000..07bb8cd --- /dev/null +++ b/node_modules/eslint/lib/rules/symbol-description.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Rule to enforce description with the `Symbol` object + * @author Jarek Rencz + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require symbol descriptions", + recommended: false, + url: "https://eslint.org/docs/rules/symbol-description" + }, + fixable: null, + schema: [], + messages: { + expected: "Expected Symbol to have a description." + } + }, + + create(context) { + + /** + * Reports if node does not conform the rule in case rule is set to + * report missing description + * @param {ASTNode} node A CallExpression node to check. + * @returns {void} + */ + function checkArgument(node) { + if (node.arguments.length === 0) { + context.report({ + node, + messageId: "expected" + }); + } + } + + return { + "Program:exit"() { + const scope = context.getScope(); + const variable = astUtils.getVariableByName(scope, "Symbol"); + + if (variable && variable.defs.length === 0) { + variable.references.forEach(reference => { + const node = reference.identifier; + + if (astUtils.isCallee(node)) { + checkArgument(node.parent); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/template-curly-spacing.js b/node_modules/eslint/lib/rules/template-curly-spacing.js new file mode 100644 index 0000000..c842b76 --- /dev/null +++ b/node_modules/eslint/lib/rules/template-curly-spacing.js @@ -0,0 +1,141 @@ +/** + * @fileoverview Rule to enforce spacing around embedded expressions of template strings + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow spacing around embedded expressions of template strings", + recommended: false, + url: "https://eslint.org/docs/rules/template-curly-spacing" + }, + + fixable: "whitespace", + + schema: [ + { enum: ["always", "never"] } + ], + messages: { + expectedBefore: "Expected space(s) before '}'.", + expectedAfter: "Expected space(s) after '${'.", + unexpectedBefore: "Unexpected space(s) before '}'.", + unexpectedAfter: "Unexpected space(s) after '${'." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const always = context.options[0] === "always"; + + /** + * Checks spacing before `}` of a given token. + * @param {Token} token A token to check. This is a Template token. + * @returns {void} + */ + function checkSpacingBefore(token) { + if (!token.value.startsWith("}")) { + return; // starts with a backtick, this is the first template element in the template literal + } + + const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }), + hasSpace = sourceCode.isSpaceBetween(prevToken, token); + + if (!astUtils.isTokenOnSameLine(prevToken, token)) { + return; + } + + if (always && !hasSpace) { + context.report({ + loc: { + start: token.loc.start, + end: { + line: token.loc.start.line, + column: token.loc.start.column + 1 + } + }, + messageId: "expectedBefore", + fix: fixer => fixer.insertTextBefore(token, " ") + }); + } + + if (!always && hasSpace) { + context.report({ + loc: { + start: prevToken.loc.end, + end: token.loc.start + }, + messageId: "unexpectedBefore", + fix: fixer => fixer.removeRange([prevToken.range[1], token.range[0]]) + }); + } + } + + /** + * Checks spacing after `${` of a given token. + * @param {Token} token A token to check. This is a Template token. + * @returns {void} + */ + function checkSpacingAfter(token) { + if (!token.value.endsWith("${")) { + return; // ends with a backtick, this is the last template element in the template literal + } + + const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }), + hasSpace = sourceCode.isSpaceBetween(token, nextToken); + + if (!astUtils.isTokenOnSameLine(token, nextToken)) { + return; + } + + if (always && !hasSpace) { + context.report({ + loc: { + start: { + line: token.loc.end.line, + column: token.loc.end.column - 2 + }, + end: token.loc.end + }, + messageId: "expectedAfter", + fix: fixer => fixer.insertTextAfter(token, " ") + }); + } + + if (!always && hasSpace) { + context.report({ + loc: { + start: token.loc.end, + end: nextToken.loc.start + }, + messageId: "unexpectedAfter", + fix: fixer => fixer.removeRange([token.range[1], nextToken.range[0]]) + }); + } + } + + return { + TemplateElement(node) { + const token = sourceCode.getFirstToken(node); + + checkSpacingBefore(token); + checkSpacingAfter(token); + } + }; + } +}; diff --git a/node_modules/eslint/lib/rules/template-tag-spacing.js b/node_modules/eslint/lib/rules/template-tag-spacing.js new file mode 100644 index 0000000..fa1a613 --- /dev/null +++ b/node_modules/eslint/lib/rules/template-tag-spacing.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Rule to check spacing between template tags and their literals + * @author Jonathan Wilsson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow spacing between template tags and their literals", + recommended: false, + url: "https://eslint.org/docs/rules/template-tag-spacing" + }, + + fixable: "whitespace", + + schema: [ + { enum: ["always", "never"] } + ], + messages: { + unexpected: "Unexpected space between template tag and template literal.", + missing: "Missing space between template tag and template literal." + } + }, + + create(context) { + const never = context.options[0] !== "always"; + const sourceCode = context.getSourceCode(); + + /** + * Check if a space is present between a template tag and its literal + * @param {ASTNode} node node to evaluate + * @returns {void} + * @private + */ + function checkSpacing(node) { + const tagToken = sourceCode.getTokenBefore(node.quasi); + const literalToken = sourceCode.getFirstToken(node.quasi); + const hasWhitespace = sourceCode.isSpaceBetweenTokens(tagToken, literalToken); + + if (never && hasWhitespace) { + context.report({ + node, + loc: { + start: tagToken.loc.end, + end: literalToken.loc.start + }, + messageId: "unexpected", + fix(fixer) { + const comments = sourceCode.getCommentsBefore(node.quasi); + + // Don't fix anything if there's a single line comment after the template tag + if (comments.some(comment => comment.type === "Line")) { + return null; + } + + return fixer.replaceTextRange( + [tagToken.range[1], literalToken.range[0]], + comments.reduce((text, comment) => text + sourceCode.getText(comment), "") + ); + } + }); + } else if (!never && !hasWhitespace) { + context.report({ + node, + loc: { + start: node.loc.start, + end: literalToken.loc.start + }, + messageId: "missing", + fix(fixer) { + return fixer.insertTextAfter(tagToken, " "); + } + }); + } + } + + return { + TaggedTemplateExpression: checkSpacing + }; + } +}; diff --git a/node_modules/eslint/lib/rules/unicode-bom.js b/node_modules/eslint/lib/rules/unicode-bom.js new file mode 100644 index 0000000..d480f1b --- /dev/null +++ b/node_modules/eslint/lib/rules/unicode-bom.js @@ -0,0 +1,73 @@ +/** + * @fileoverview Require or disallow Unicode BOM + * @author Andrew Johnston + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow Unicode byte order mark (BOM)", + recommended: false, + url: "https://eslint.org/docs/rules/unicode-bom" + }, + + fixable: "whitespace", + + schema: [ + { + enum: ["always", "never"] + } + ], + messages: { + expected: "Expected Unicode BOM (Byte Order Mark).", + unexpected: "Unexpected Unicode BOM (Byte Order Mark)." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + Program: function checkUnicodeBOM(node) { + + const sourceCode = context.getSourceCode(), + location = { column: 0, line: 1 }, + requireBOM = context.options[0] || "never"; + + if (!sourceCode.hasBOM && (requireBOM === "always")) { + context.report({ + node, + loc: location, + messageId: "expected", + fix(fixer) { + return fixer.insertTextBeforeRange([0, 1], "\uFEFF"); + } + }); + } else if (sourceCode.hasBOM && (requireBOM === "never")) { + context.report({ + node, + loc: location, + messageId: "unexpected", + fix(fixer) { + return fixer.removeRange([-1, 0]); + } + }); + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/use-isnan.js b/node_modules/eslint/lib/rules/use-isnan.js new file mode 100644 index 0000000..9290350 --- /dev/null +++ b/node_modules/eslint/lib/rules/use-isnan.js @@ -0,0 +1,141 @@ +/** + * @fileoverview Rule to flag comparisons to the value NaN + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines if the given node is a NaN `Identifier` node. + * @param {ASTNode|null} node The node to check. + * @returns {boolean} `true` if the node is 'NaN' identifier. + */ +function isNaNIdentifier(node) { + return Boolean(node) && ( + astUtils.isSpecificId(node, "NaN") || + astUtils.isSpecificMemberAccess(node, "Number", "NaN") + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "require calls to `isNaN()` when checking for `NaN`", + recommended: true, + url: "https://eslint.org/docs/rules/use-isnan" + }, + + schema: [ + { + type: "object", + properties: { + enforceForSwitchCase: { + type: "boolean", + default: true + }, + enforceForIndexOf: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + messages: { + comparisonWithNaN: "Use the isNaN function to compare with NaN.", + switchNaN: "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.", + caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch.", + indexOfNaN: "Array prototype method '{{ methodName }}' cannot find NaN." + } + }, + + create(context) { + + const enforceForSwitchCase = !context.options[0] || context.options[0].enforceForSwitchCase; + const enforceForIndexOf = context.options[0] && context.options[0].enforceForIndexOf; + + /** + * Checks the given `BinaryExpression` node for `foo === NaN` and other comparisons. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkBinaryExpression(node) { + if ( + /^(?:[<>]|[!=]=)=?$/u.test(node.operator) && + (isNaNIdentifier(node.left) || isNaNIdentifier(node.right)) + ) { + context.report({ node, messageId: "comparisonWithNaN" }); + } + } + + /** + * Checks the discriminant and all case clauses of the given `SwitchStatement` node for `switch(NaN)` and `case NaN:` + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkSwitchStatement(node) { + if (isNaNIdentifier(node.discriminant)) { + context.report({ node, messageId: "switchNaN" }); + } + + for (const switchCase of node.cases) { + if (isNaNIdentifier(switchCase.test)) { + context.report({ node: switchCase, messageId: "caseNaN" }); + } + } + } + + /** + * Checks the given `CallExpression` node for `.indexOf(NaN)` and `.lastIndexOf(NaN)`. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkCallExpression(node) { + const callee = astUtils.skipChainExpression(node.callee); + + if (callee.type === "MemberExpression") { + const methodName = astUtils.getStaticPropertyName(callee); + + if ( + (methodName === "indexOf" || methodName === "lastIndexOf") && + node.arguments.length === 1 && + isNaNIdentifier(node.arguments[0]) + ) { + context.report({ node, messageId: "indexOfNaN", data: { methodName } }); + } + } + } + + const listeners = { + BinaryExpression: checkBinaryExpression + }; + + if (enforceForSwitchCase) { + listeners.SwitchStatement = checkSwitchStatement; + } + + if (enforceForIndexOf) { + listeners.CallExpression = checkCallExpression; + } + + return listeners; + } +}; diff --git a/node_modules/eslint/lib/rules/utils/ast-utils.js b/node_modules/eslint/lib/rules/utils/ast-utils.js new file mode 100644 index 0000000..f919f5a --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -0,0 +1,2118 @@ +/** + * @fileoverview Common utils for AST. + * @author Gyandeep Singh + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const esutils = require("esutils"); +const espree = require("espree"); +const escapeRegExp = require("escape-string-regexp"); +const { + breakableTypePattern, + createGlobalLinebreakMatcher, + lineBreakPattern, + shebangPattern +} = require("../../shared/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; +const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/u; +const arrayOrTypedArrayPattern = /Array$/u; +const arrayMethodPattern = /^(?:every|filter|find|findIndex|forEach|map|some)$/u; +const bindOrCallOrApplyPattern = /^(?:bind|call|apply)$/u; +const thisTagPattern = /^[\s*]*@this/mu; + + +const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u; +const ESLINT_DIRECTIVE_PATTERN = /^(?:eslint[- ]|(?:globals?|exported) )/u; +const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); + +// A set of node types that can contain a list of statements +const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]); + +const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; + +// Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string +const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0[0-9])/su; + +const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); + +/** + * Checks reference if is non initializer and writable. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. + * @returns {boolean} Success/Failure + * @private + */ +function isModifyingReference(reference, index, references) { + const identifier = reference.identifier; + + /* + * Destructuring assignments can have multiple default value, so + * possibly there are multiple writeable references for the same + * identifier. + */ + const modifyingDifferentIdentifier = index === 0 || + references[index - 1].identifier !== identifier; + + return (identifier && + reference.init === false && + reference.isWrite() && + modifyingDifferentIdentifier + ); +} + +/** + * Checks whether the given string starts with uppercase or not. + * @param {string} s The string to check. + * @returns {boolean} `true` if the string starts with uppercase. + */ +function startsWithUpperCase(s) { + return s[0] !== s[0].toLocaleLowerCase(); +} + +/** + * Checks whether or not a node is a constructor. + * @param {ASTNode} node A function node to check. + * @returns {boolean} Whether or not a node is a constructor. + */ +function isES5Constructor(node) { + return (node.id && startsWithUpperCase(node.id.name)); +} + +/** + * Finds a function node from ancestors of a node. + * @param {ASTNode} node A start node to find. + * @returns {Node|null} A found function node. + */ +function getUpperFunction(node) { + for (let currentNode = node; currentNode; currentNode = currentNode.parent) { + if (anyFunctionPattern.test(currentNode.type)) { + return currentNode; + } + } + return null; +} + +/** + * Checks whether a given node is a function node or not. + * The following types are function nodes: + * + * - ArrowFunctionExpression + * - FunctionDeclaration + * - FunctionExpression + * @param {ASTNode|null} node A node to check. + * @returns {boolean} `true` if the node is a function node. + */ +function isFunction(node) { + return Boolean(node && anyFunctionPattern.test(node.type)); +} + +/** + * Checks whether a given node is a loop node or not. + * The following types are loop nodes: + * + * - DoWhileStatement + * - ForInStatement + * - ForOfStatement + * - ForStatement + * - WhileStatement + * @param {ASTNode|null} node A node to check. + * @returns {boolean} `true` if the node is a loop node. + */ +function isLoop(node) { + return Boolean(node && anyLoopPattern.test(node.type)); +} + +/** + * Checks whether the given node is in a loop or not. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is in a loop. + */ +function isInLoop(node) { + for (let currentNode = node; currentNode && !isFunction(currentNode); currentNode = currentNode.parent) { + if (isLoop(currentNode)) { + return true; + } + } + + return false; +} + +/** + * Determines whether the given node is a `null` literal. + * @param {ASTNode} node The node to check + * @returns {boolean} `true` if the node is a `null` literal + */ +function isNullLiteral(node) { + + /* + * Checking `node.value === null` does not guarantee that a literal is a null literal. + * When parsing values that cannot be represented in the current environment (e.g. unicode + * regexes in Node 4), `node.value` is set to `null` because it wouldn't be possible to + * set `node.value` to a unicode regex. To make sure a literal is actually `null`, check + * `node.regex` instead. Also see: https://github.com/eslint/eslint/issues/8020 + */ + return node.type === "Literal" && node.value === null && !node.regex && !node.bigint; +} + +/** + * Checks whether or not a node is `null` or `undefined`. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a `null` or `undefined`. + * @public + */ +function isNullOrUndefined(node) { + return ( + isNullLiteral(node) || + (node.type === "Identifier" && node.name === "undefined") || + (node.type === "UnaryExpression" && node.operator === "void") + ); +} + +/** + * Checks whether or not a node is callee. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is callee. + */ +function isCallee(node) { + return node.parent.type === "CallExpression" && node.parent.callee === node; +} + +/** + * Returns the result of the string conversion applied to the evaluated value of the given expression node, + * if it can be determined statically. + * + * This function returns a `string` value for all `Literal` nodes and simple `TemplateLiteral` nodes only. + * In all other cases, this function returns `null`. + * @param {ASTNode} node Expression node. + * @returns {string|null} String value if it can be determined. Otherwise, `null`. + */ +function getStaticStringValue(node) { + switch (node.type) { + case "Literal": + if (node.value === null) { + if (isNullLiteral(node)) { + return String(node.value); // "null" + } + if (node.regex) { + return `/${node.regex.pattern}/${node.regex.flags}`; + } + if (node.bigint) { + return node.bigint; + } + + // Otherwise, this is an unknown literal. The function will return null. + + } else { + return String(node.value); + } + break; + case "TemplateLiteral": + if (node.expressions.length === 0 && node.quasis.length === 1) { + return node.quasis[0].value.cooked; + } + break; + + // no default + } + + return null; +} + +/** + * Gets the property name of a given node. + * The node can be a MemberExpression, a Property, or a MethodDefinition. + * + * If the name is dynamic, this returns `null`. + * + * For examples: + * + * a.b // => "b" + * a["b"] // => "b" + * a['b'] // => "b" + * a[`b`] // => "b" + * a[100] // => "100" + * a[b] // => null + * a["a" + "b"] // => null + * a[tag`b`] // => null + * a[`${b}`] // => null + * + * let a = {b: 1} // => "b" + * let a = {["b"]: 1} // => "b" + * let a = {['b']: 1} // => "b" + * let a = {[`b`]: 1} // => "b" + * let a = {[100]: 1} // => "100" + * let a = {[b]: 1} // => null + * let a = {["a" + "b"]: 1} // => null + * let a = {[tag`b`]: 1} // => null + * let a = {[`${b}`]: 1} // => null + * @param {ASTNode} node The node to get. + * @returns {string|null} The property name if static. Otherwise, null. + */ +function getStaticPropertyName(node) { + let prop; + + switch (node && node.type) { + case "ChainExpression": + return getStaticPropertyName(node.expression); + + case "Property": + case "PropertyDefinition": + case "MethodDefinition": + prop = node.key; + break; + + case "MemberExpression": + prop = node.property; + break; + + // no default + } + + if (prop) { + if (prop.type === "Identifier" && !node.computed) { + return prop.name; + } + + return getStaticStringValue(prop); + } + + return null; +} + +/** + * Retrieve `ChainExpression#expression` value if the given node a `ChainExpression` node. Otherwise, pass through it. + * @param {ASTNode} node The node to address. + * @returns {ASTNode} The `ChainExpression#expression` value if the node is a `ChainExpression` node. Otherwise, the node. + */ +function skipChainExpression(node) { + return node && node.type === "ChainExpression" ? node.expression : node; +} + +/** + * Check if the `actual` is an expected value. + * @param {string} actual The string value to check. + * @param {string | RegExp} expected The expected string value or pattern. + * @returns {boolean} `true` if the `actual` is an expected value. + */ +function checkText(actual, expected) { + return typeof expected === "string" + ? actual === expected + : expected.test(actual); +} + +/** + * Check if a given node is an Identifier node with a given name. + * @param {ASTNode} node The node to check. + * @param {string | RegExp} name The expected name or the expected pattern of the object name. + * @returns {boolean} `true` if the node is an Identifier node with the name. + */ +function isSpecificId(node, name) { + return node.type === "Identifier" && checkText(node.name, name); +} + +/** + * Check if a given node is member access with a given object name and property name pair. + * This is regardless of optional or not. + * @param {ASTNode} node The node to check. + * @param {string | RegExp | null} objectName The expected name or the expected pattern of the object name. If this is nullish, this method doesn't check object. + * @param {string | RegExp | null} propertyName The expected name or the expected pattern of the property name. If this is nullish, this method doesn't check property. + * @returns {boolean} `true` if the node is member access with the object name and property name pair. + * The node is a `MemberExpression` or `ChainExpression`. + */ +function isSpecificMemberAccess(node, objectName, propertyName) { + const checkNode = skipChainExpression(node); + + if (checkNode.type !== "MemberExpression") { + return false; + } + + if (objectName && !isSpecificId(checkNode.object, objectName)) { + return false; + } + + if (propertyName) { + const actualPropertyName = getStaticPropertyName(checkNode); + + if (typeof actualPropertyName !== "string" || !checkText(actualPropertyName, propertyName)) { + return false; + } + } + + return true; +} + +/** + * Check if two literal nodes are the same value. + * @param {ASTNode} left The Literal node to compare. + * @param {ASTNode} right The other Literal node to compare. + * @returns {boolean} `true` if the two literal nodes are the same value. + */ +function equalLiteralValue(left, right) { + + // RegExp literal. + if (left.regex || right.regex) { + return Boolean( + left.regex && + right.regex && + left.regex.pattern === right.regex.pattern && + left.regex.flags === right.regex.flags + ); + } + + // BigInt literal. + if (left.bigint || right.bigint) { + return left.bigint === right.bigint; + } + + return left.value === right.value; +} + +/** + * Check if two expressions reference the same value. For example: + * a = a + * a.b = a.b + * a[0] = a[0] + * a['b'] = a['b'] + * @param {ASTNode} left The left side of the comparison. + * @param {ASTNode} right The right side of the comparison. + * @param {boolean} [disableStaticComputedKey] Don't address `a.b` and `a["b"]` are the same if `true`. For backward compatibility. + * @returns {boolean} `true` if both sides match and reference the same value. + */ +function isSameReference(left, right, disableStaticComputedKey = false) { + if (left.type !== right.type) { + + // Handle `a.b` and `a?.b` are samely. + if (left.type === "ChainExpression") { + return isSameReference(left.expression, right, disableStaticComputedKey); + } + if (right.type === "ChainExpression") { + return isSameReference(left, right.expression, disableStaticComputedKey); + } + + return false; + } + + switch (left.type) { + case "Super": + case "ThisExpression": + return true; + + case "Identifier": + case "PrivateIdentifier": + return left.name === right.name; + case "Literal": + return equalLiteralValue(left, right); + + case "ChainExpression": + return isSameReference(left.expression, right.expression, disableStaticComputedKey); + + case "MemberExpression": { + if (!disableStaticComputedKey) { + const nameA = getStaticPropertyName(left); + + // x.y = x["y"] + if (nameA !== null) { + return ( + isSameReference(left.object, right.object, disableStaticComputedKey) && + nameA === getStaticPropertyName(right) + ); + } + } + + /* + * x[0] = x[0] + * x[y] = x[y] + * x.y = x.y + */ + return ( + left.computed === right.computed && + isSameReference(left.object, right.object, disableStaticComputedKey) && + isSameReference(left.property, right.property, disableStaticComputedKey) + ); + } + + default: + return false; + } +} + +/** + * Checks whether or not a node is `Reflect.apply`. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a `Reflect.apply`. + */ +function isReflectApply(node) { + return isSpecificMemberAccess(node, "Reflect", "apply"); +} + +/** + * Checks whether or not a node is `Array.from`. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a `Array.from`. + */ +function isArrayFromMethod(node) { + return isSpecificMemberAccess(node, arrayOrTypedArrayPattern, "from"); +} + +/** + * Checks whether or not a node is a method which has `thisArg`. + * @param {ASTNode} node A node to check. + * @returns {boolean} Whether or not the node is a method which has `thisArg`. + */ +function isMethodWhichHasThisArg(node) { + return isSpecificMemberAccess(node, null, arrayMethodPattern); +} + +/** + * Creates the negate function of the given function. + * @param {Function} f The function to negate. + * @returns {Function} Negated function. + */ +function negate(f) { + return token => !f(token); +} + +/** + * Checks whether or not a node has a `@this` tag in its comments. + * @param {ASTNode} node A node to check. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. + * @returns {boolean} Whether or not the node has a `@this` tag in its comments. + */ +function hasJSDocThisTag(node, sourceCode) { + const jsdocComment = sourceCode.getJSDocComment(node); + + if (jsdocComment && thisTagPattern.test(jsdocComment.value)) { + return true; + } + + // Checks `@this` in its leading comments for callbacks, + // because callbacks don't have its JSDoc comment. + // e.g. + // sinon.test(/* @this sinon.Sandbox */function() { this.spy(); }); + return sourceCode.getCommentsBefore(node).some(comment => thisTagPattern.test(comment.value)); +} + +/** + * Determines if a node is surrounded by parentheses. + * @param {SourceCode} sourceCode The ESLint source code object + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is parenthesised. + * @private + */ +function isParenthesised(sourceCode, node) { + const previousToken = sourceCode.getTokenBefore(node), + nextToken = sourceCode.getTokenAfter(node); + + return Boolean(previousToken && nextToken) && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; +} + +/** + * Checks if the given token is a `=` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a `=` token. + */ +function isEqToken(token) { + return token.value === "=" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is an arrow token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is an arrow token. + */ +function isArrowToken(token) { + return token.value === "=>" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a comma token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a comma token. + */ +function isCommaToken(token) { + return token.value === "," && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a dot token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a dot token. + */ +function isDotToken(token) { + return token.value === "." && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a `?.` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a `?.` token. + */ +function isQuestionDotToken(token) { + return token.value === "?." && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a semicolon token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a semicolon token. + */ +function isSemicolonToken(token) { + return token.value === ";" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a colon token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a colon token. + */ +function isColonToken(token) { + return token.value === ":" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is an opening parenthesis token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is an opening parenthesis token. + */ +function isOpeningParenToken(token) { + return token.value === "(" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a closing parenthesis token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a closing parenthesis token. + */ +function isClosingParenToken(token) { + return token.value === ")" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is an opening square bracket token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is an opening square bracket token. + */ +function isOpeningBracketToken(token) { + return token.value === "[" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a closing square bracket token. + */ +function isClosingBracketToken(token) { + return token.value === "]" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is an opening brace token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is an opening brace token. + */ +function isOpeningBraceToken(token) { + return token.value === "{" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a closing brace token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a closing brace token. + */ +function isClosingBraceToken(token) { + return token.value === "}" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a comment token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a comment token. + */ +function isCommentToken(token) { + return token.type === "Line" || token.type === "Block" || token.type === "Shebang"; +} + +/** + * Checks if the given token is a keyword token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a keyword token. + */ +function isKeywordToken(token) { + return token.type === "Keyword"; +} + +/** + * Gets the `(` token of the given function node. + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token} `(` token. + */ +function getOpeningParenOfParams(node, sourceCode) { + + // If the node is an arrow function and doesn't have parens, this returns the identifier of the first param. + if (node.type === "ArrowFunctionExpression" && node.params.length === 1) { + const argToken = sourceCode.getFirstToken(node.params[0]); + const maybeParenToken = sourceCode.getTokenBefore(argToken); + + return isOpeningParenToken(maybeParenToken) ? maybeParenToken : argToken; + } + + // Otherwise, returns paren. + return node.id + ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) + : sourceCode.getFirstToken(node, isOpeningParenToken); +} + +/** + * Checks whether or not the tokens of two given nodes are same. + * @param {ASTNode} left A node 1 to compare. + * @param {ASTNode} right A node 2 to compare. + * @param {SourceCode} sourceCode The ESLint source code object. + * @returns {boolean} the source code for the given node. + */ +function equalTokens(left, right, sourceCode) { + const tokensL = sourceCode.getTokens(left); + const tokensR = sourceCode.getTokens(right); + + if (tokensL.length !== tokensR.length) { + return false; + } + for (let i = 0; i < tokensL.length; ++i) { + if (tokensL[i].type !== tokensR[i].type || + tokensL[i].value !== tokensR[i].value + ) { + return false; + } + } + + return true; +} + +/** + * Check if the given node is a true logical expression or not. + * + * The three binary expressions logical-or (`||`), logical-and (`&&`), and + * coalesce (`??`) are known as `ShortCircuitExpression`. + * But ESTree represents those by `LogicalExpression` node. + * + * This function rejects coalesce expressions of `LogicalExpression` node. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is `&&` or `||`. + * @see https://tc39.es/ecma262/#prod-ShortCircuitExpression + */ +function isLogicalExpression(node) { + return ( + node.type === "LogicalExpression" && + (node.operator === "&&" || node.operator === "||") + ); +} + +/** + * Check if the given node is a nullish coalescing expression or not. + * + * The three binary expressions logical-or (`||`), logical-and (`&&`), and + * coalesce (`??`) are known as `ShortCircuitExpression`. + * But ESTree represents those by `LogicalExpression` node. + * + * This function finds only coalesce expressions of `LogicalExpression` node. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is `??`. + */ +function isCoalesceExpression(node) { + return node.type === "LogicalExpression" && node.operator === "??"; +} + +/** + * Check if given two nodes are the pair of a logical expression and a coalesce expression. + * @param {ASTNode} left A node to check. + * @param {ASTNode} right Another node to check. + * @returns {boolean} `true` if the two nodes are the pair of a logical expression and a coalesce expression. + */ +function isMixedLogicalAndCoalesceExpressions(left, right) { + return ( + (isLogicalExpression(left) && isCoalesceExpression(right)) || + (isCoalesceExpression(left) && isLogicalExpression(right)) + ); +} + +/** + * Checks if the given operator is a logical assignment operator. + * @param {string} operator The operator to check. + * @returns {boolean} `true` if the operator is a logical assignment operator. + */ +function isLogicalAssignmentOperator(operator) { + return LOGICAL_ASSIGNMENT_OPERATORS.has(operator); +} + +/** + * Get the colon token of the given SwitchCase node. + * @param {ASTNode} node The SwitchCase node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token} The colon token of the node. + */ +function getSwitchCaseColonToken(node, sourceCode) { + if (node.test) { + return sourceCode.getTokenAfter(node.test, isColonToken); + } + return sourceCode.getFirstToken(node, 1); +} + +/** + * Gets ESM module export name represented by the given node. + * @param {ASTNode} node `Identifier` or string `Literal` node in a position + * that represents a module export name: + * - `ImportSpecifier#imported` + * - `ExportSpecifier#local` (if it is a re-export from another module) + * - `ExportSpecifier#exported` + * - `ExportAllDeclaration#exported` + * @returns {string} The module export name. + */ +function getModuleExportName(node) { + if (node.type === "Identifier") { + return node.name; + } + + // string literal + return node.value; +} + +/** + * Returns literal's value converted to the Boolean type + * @param {ASTNode} node any `Literal` node + * @returns {boolean | null} `true` when node is truthy, `false` when node is falsy, + * `null` when it cannot be determined. + */ +function getBooleanValue(node) { + if (node.value === null) { + + /* + * it might be a null literal or bigint/regex literal in unsupported environments . + * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es5.md#regexpliteral + * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es2020.md#bigintliteral + */ + + if (node.raw === "null") { + return false; + } + + // regex is always truthy + if (typeof node.regex === "object") { + return true; + } + + return null; + } + + return !!node.value; +} + +/** + * Checks if a branch node of LogicalExpression short circuits the whole condition + * @param {ASTNode} node The branch of main condition which needs to be checked + * @param {string} operator The operator of the main LogicalExpression. + * @returns {boolean} true when condition short circuits whole condition + */ +function isLogicalIdentity(node, operator) { + switch (node.type) { + case "Literal": + return (operator === "||" && getBooleanValue(node) === true) || + (operator === "&&" && getBooleanValue(node) === false); + + case "UnaryExpression": + return (operator === "&&" && node.operator === "void"); + + case "LogicalExpression": + + /* + * handles `a && false || b` + * `false` is an identity element of `&&` but not `||` + */ + return operator === node.operator && + ( + isLogicalIdentity(node.left, operator) || + isLogicalIdentity(node.right, operator) + ); + + case "AssignmentExpression": + return ["||=", "&&="].includes(node.operator) && + operator === node.operator.slice(0, -1) && + isLogicalIdentity(node.right, operator); + + // no default + } + return false; +} + +/** + * Checks if an identifier is a reference to a global variable. + * @param {Scope} scope The scope in which the identifier is referenced. + * @param {ASTNode} node An identifier node to check. + * @returns {boolean} `true` if the identifier is a reference to a global variable. + */ +function isReferenceToGlobalVariable(scope, node) { + const reference = scope.references.find(ref => ref.identifier === node); + + return Boolean( + reference && + reference.resolved && + reference.resolved.scope.type === "global" && + reference.resolved.defs.length === 0 + ); +} + + +/** + * Checks if a node has a constant truthiness value. + * @param {Scope} scope Scope in which the node appears. + * @param {ASTNode} node The AST node to check. + * @param {boolean} inBooleanPosition `true` if checking the test of a + * condition. `false` in all other cases. When `false`, checks if -- for + * both string and number -- if coerced to that type, the value will + * be constant. + * @returns {boolean} true when node's truthiness is constant + * @private + */ +function isConstant(scope, node, inBooleanPosition) { + + // node.elements can return null values in the case of sparse arrays ex. [,] + if (!node) { + return true; + } + switch (node.type) { + case "Literal": + case "ArrowFunctionExpression": + case "FunctionExpression": + return true; + case "ClassExpression": + case "ObjectExpression": + + /** + * In theory objects like: + * + * `{toString: () => a}` + * `{valueOf: () => a}` + * + * Or a classes like: + * + * `class { static toString() { return a } }` + * `class { static valueOf() { return a } }` + * + * Are not constant verifiably when `inBooleanPosition` is + * false, but it's an edge case we've opted not to handle. + */ + return true; + case "TemplateLiteral": + return (inBooleanPosition && node.quasis.some(quasi => quasi.value.cooked.length)) || + node.expressions.every(exp => isConstant(scope, exp, false)); + + case "ArrayExpression": { + if (!inBooleanPosition) { + return node.elements.every(element => isConstant(scope, element, false)); + } + return true; + } + + case "UnaryExpression": + if ( + node.operator === "void" || + node.operator === "typeof" && inBooleanPosition + ) { + return true; + } + + if (node.operator === "!") { + return isConstant(scope, node.argument, true); + } + + return isConstant(scope, node.argument, false); + + case "BinaryExpression": + return isConstant(scope, node.left, false) && + isConstant(scope, node.right, false) && + node.operator !== "in"; + + case "LogicalExpression": { + const isLeftConstant = isConstant(scope, node.left, inBooleanPosition); + const isRightConstant = isConstant(scope, node.right, inBooleanPosition); + const isLeftShortCircuit = (isLeftConstant && isLogicalIdentity(node.left, node.operator)); + const isRightShortCircuit = (inBooleanPosition && isRightConstant && isLogicalIdentity(node.right, node.operator)); + + return (isLeftConstant && isRightConstant) || + isLeftShortCircuit || + isRightShortCircuit; + } + case "NewExpression": + return inBooleanPosition; + case "AssignmentExpression": + if (node.operator === "=") { + return isConstant(scope, node.right, inBooleanPosition); + } + + if (["||=", "&&="].includes(node.operator) && inBooleanPosition) { + return isLogicalIdentity(node.right, node.operator.slice(0, -1)); + } + + return false; + + case "SequenceExpression": + return isConstant(scope, node.expressions[node.expressions.length - 1], inBooleanPosition); + case "SpreadElement": + return isConstant(scope, node.argument, inBooleanPosition); + case "CallExpression": + if (node.callee.type === "Identifier" && node.callee.name === "Boolean") { + if (node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)) { + return isReferenceToGlobalVariable(scope, node.callee); + } + } + return false; + case "Identifier": + return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); + + // no default + } + return false; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + COMMENTS_IGNORE_PATTERN, + LINEBREAKS, + LINEBREAK_MATCHER: lineBreakPattern, + SHEBANG_MATCHER: shebangPattern, + STATEMENT_LIST_PARENTS, + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left The left token object. + * @param {Object} right The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + * @public + */ + isTokenOnSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + }, + + isNullOrUndefined, + isCallee, + isES5Constructor, + getUpperFunction, + isFunction, + isLoop, + isInLoop, + isArrayFromMethod, + isParenthesised, + createGlobalLinebreakMatcher, + equalTokens, + + isArrowToken, + isClosingBraceToken, + isClosingBracketToken, + isClosingParenToken, + isColonToken, + isCommaToken, + isCommentToken, + isDotToken, + isQuestionDotToken, + isKeywordToken, + isNotClosingBraceToken: negate(isClosingBraceToken), + isNotClosingBracketToken: negate(isClosingBracketToken), + isNotClosingParenToken: negate(isClosingParenToken), + isNotColonToken: negate(isColonToken), + isNotCommaToken: negate(isCommaToken), + isNotDotToken: negate(isDotToken), + isNotQuestionDotToken: negate(isQuestionDotToken), + isNotOpeningBraceToken: negate(isOpeningBraceToken), + isNotOpeningBracketToken: negate(isOpeningBracketToken), + isNotOpeningParenToken: negate(isOpeningParenToken), + isNotSemicolonToken: negate(isSemicolonToken), + isOpeningBraceToken, + isOpeningBracketToken, + isOpeningParenToken, + isSemicolonToken, + isEqToken, + + /** + * Checks whether or not a given node is a string literal. + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is a string literal. + */ + isStringLiteral(node) { + return ( + (node.type === "Literal" && typeof node.value === "string") || + node.type === "TemplateLiteral" + ); + }, + + /** + * Checks whether a given node is a breakable statement or not. + * The node is breakable if the node is one of the following type: + * + * - DoWhileStatement + * - ForInStatement + * - ForOfStatement + * - ForStatement + * - SwitchStatement + * - WhileStatement + * @param {ASTNode} node A node to check. + * @returns {boolean} `true` if the node is breakable. + */ + isBreakableStatement(node) { + return breakableTypePattern.test(node.type); + }, + + /** + * Gets references which are non initializer and writable. + * @param {Reference[]} references An array of references. + * @returns {Reference[]} An array of only references which are non initializer and writable. + * @public + */ + getModifyingReferences(references) { + return references.filter(isModifyingReference); + }, + + /** + * Validate that a string passed in is surrounded by the specified character + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. + * @returns {boolean} True if the text is surrounded by the character, false if not. + * @private + */ + isSurroundedBy(val, character) { + return val[0] === character && val[val.length - 1] === character; + }, + + /** + * Returns whether the provided node is an ESLint directive comment or not + * @param {Line|Block} node The comment token to be checked + * @returns {boolean} `true` if the node is an ESLint directive comment + */ + isDirectiveComment(node) { + const comment = node.value.trim(); + + return ( + node.type === "Line" && comment.startsWith("eslint-") || + node.type === "Block" && ESLINT_DIRECTIVE_PATTERN.test(comment) + ); + }, + + /** + * Gets the trailing statement of a given node. + * + * if (code) + * consequent; + * + * When taking this `IfStatement`, returns `consequent;` statement. + * @param {ASTNode} A node to get. + * @returns {ASTNode|null} The trailing statement's node. + */ + getTrailingStatement: esutils.ast.trailingStatement, + + /** + * Finds the variable by a given name in a given scope and its upper scopes. + * @param {eslint-scope.Scope} initScope A scope to start find. + * @param {string} name A variable name to find. + * @returns {eslint-scope.Variable|null} A found variable or `null`. + */ + getVariableByName(initScope, name) { + let scope = initScope; + + while (scope) { + const variable = scope.set.get(name); + + if (variable) { + return variable; + } + + scope = scope.upper; + } + + return null; + }, + + /** + * Checks whether or not a given function node is the default `this` binding. + * + * First, this checks the node: + * + * - The given node is not in `PropertyDefinition#value` position. + * - The given node is not `StaticBlock`. + * - The function name does not start with uppercase. It's a convention to capitalize the names + * of constructor functions. This check is not performed if `capIsConstructor` is set to `false`. + * - The function does not have a JSDoc comment that has a @this tag. + * + * Next, this checks the location of the node. + * If the location is below, this judges `this` is valid. + * + * - The location is not on an object literal. + * - The location is not assigned to a variable which starts with an uppercase letter. Applies to anonymous + * functions only, as the name of the variable is considered to be the name of the function in this case. + * This check is not performed if `capIsConstructor` is set to `false`. + * - The location is not on an ES2015 class. + * - Its `bind`/`call`/`apply` method is not called directly. + * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. + * @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock` + * or any expression that is `PropertyDefinition#value` node. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. + * @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts + * with an uppercase or are assigned to a variable which name starts with an uppercase are constructors. + * @returns {boolean} The function node is the default `this` binding. + */ + isDefaultThisBinding(node, sourceCode, { capIsConstructor = true } = {}) { + + /* + * Class field initializers are implicit functions, but ESTree doesn't have the AST node of field initializers. + * Therefore, A expression node at `PropertyDefinition#value` is a function. + * In this case, `this` is always not default binding. + */ + if (node.parent.type === "PropertyDefinition" && node.parent.value === node) { + return false; + } + + // Class static blocks are implicit functions. In this case, `this` is always not default binding. + if (node.type === "StaticBlock") { + return false; + } + + if ( + (capIsConstructor && isES5Constructor(node)) || + hasJSDocThisTag(node, sourceCode) + ) { + return false; + } + const isAnonymous = node.id === null; + let currentNode = node; + + while (currentNode) { + const parent = currentNode.parent; + + switch (parent.type) { + + /* + * Looks up the destination. + * e.g., obj.foo = nativeFoo || function foo() { ... }; + */ + case "LogicalExpression": + case "ConditionalExpression": + case "ChainExpression": + currentNode = parent; + break; + + /* + * If the upper function is IIFE, checks the destination of the return value. + * e.g. + * obj.foo = (function() { + * // setup... + * return function foo() { ... }; + * })(); + * obj.foo = (() => + * function foo() { ... } + * )(); + */ + case "ReturnStatement": { + const func = getUpperFunction(parent); + + if (func === null || !isCallee(func)) { + return true; + } + currentNode = func.parent; + break; + } + case "ArrowFunctionExpression": + if (currentNode !== parent.body || !isCallee(parent)) { + return true; + } + currentNode = parent.parent; + break; + + /* + * e.g. + * var obj = { foo() { ... } }; + * var obj = { foo: function() { ... } }; + * class A { constructor() { ... } } + * class A { foo() { ... } } + * class A { get foo() { ... } } + * class A { set foo() { ... } } + * class A { static foo() { ... } } + * class A { foo = function() { ... } } + */ + case "Property": + case "PropertyDefinition": + case "MethodDefinition": + return parent.value !== currentNode; + + /* + * e.g. + * obj.foo = function foo() { ... }; + * Foo = function() { ... }; + * [obj.foo = function foo() { ... }] = a; + * [Foo = function() { ... }] = a; + */ + case "AssignmentExpression": + case "AssignmentPattern": + if (parent.left.type === "MemberExpression") { + return false; + } + if ( + capIsConstructor && + isAnonymous && + parent.left.type === "Identifier" && + startsWithUpperCase(parent.left.name) + ) { + return false; + } + return true; + + /* + * e.g. + * var Foo = function() { ... }; + */ + case "VariableDeclarator": + return !( + capIsConstructor && + isAnonymous && + parent.init === currentNode && + parent.id.type === "Identifier" && + startsWithUpperCase(parent.id.name) + ); + + /* + * e.g. + * var foo = function foo() { ... }.bind(obj); + * (function foo() { ... }).call(obj); + * (function foo() { ... }).apply(obj, []); + */ + case "MemberExpression": + if ( + parent.object === currentNode && + isSpecificMemberAccess(parent, null, bindOrCallOrApplyPattern) + ) { + const maybeCalleeNode = parent.parent.type === "ChainExpression" + ? parent.parent + : parent; + + return !( + isCallee(maybeCalleeNode) && + maybeCalleeNode.parent.arguments.length >= 1 && + !isNullOrUndefined(maybeCalleeNode.parent.arguments[0]) + ); + } + return true; + + /* + * e.g. + * Reflect.apply(function() {}, obj, []); + * Array.from([], function() {}, obj); + * list.forEach(function() {}, obj); + */ + case "CallExpression": + if (isReflectApply(parent.callee)) { + return ( + parent.arguments.length !== 3 || + parent.arguments[0] !== currentNode || + isNullOrUndefined(parent.arguments[1]) + ); + } + if (isArrayFromMethod(parent.callee)) { + return ( + parent.arguments.length !== 3 || + parent.arguments[1] !== currentNode || + isNullOrUndefined(parent.arguments[2]) + ); + } + if (isMethodWhichHasThisArg(parent.callee)) { + return ( + parent.arguments.length !== 2 || + parent.arguments[0] !== currentNode || + isNullOrUndefined(parent.arguments[1]) + ); + } + return true; + + // Otherwise `this` is default. + default: + return true; + } + } + + /* istanbul ignore next */ + return true; + }, + + /** + * Get the precedence level based on the node type + * @param {ASTNode} node node to evaluate + * @returns {int} precedence level + * @private + */ + getPrecedence(node) { + switch (node.type) { + case "SequenceExpression": + return 0; + + case "AssignmentExpression": + case "ArrowFunctionExpression": + case "YieldExpression": + return 1; + + case "ConditionalExpression": + return 3; + + case "LogicalExpression": + switch (node.operator) { + case "||": + case "??": + return 4; + case "&&": + return 5; + + // no default + } + + /* falls through */ + + case "BinaryExpression": + + switch (node.operator) { + case "|": + return 6; + case "^": + return 7; + case "&": + return 8; + case "==": + case "!=": + case "===": + case "!==": + return 9; + case "<": + case "<=": + case ">": + case ">=": + case "in": + case "instanceof": + return 10; + case "<<": + case ">>": + case ">>>": + return 11; + case "+": + case "-": + return 12; + case "*": + case "/": + case "%": + return 13; + case "**": + return 15; + + // no default + } + + /* falls through */ + + case "UnaryExpression": + case "AwaitExpression": + return 16; + + case "UpdateExpression": + return 17; + + case "CallExpression": + case "ChainExpression": + case "ImportExpression": + return 18; + + case "NewExpression": + return 19; + + default: + return 20; + } + }, + + /** + * Checks whether the given node is an empty block node or not. + * @param {ASTNode|null} node The node to check. + * @returns {boolean} `true` if the node is an empty block. + */ + isEmptyBlock(node) { + return Boolean(node && node.type === "BlockStatement" && node.body.length === 0); + }, + + /** + * Checks whether the given node is an empty function node or not. + * @param {ASTNode|null} node The node to check. + * @returns {boolean} `true` if the node is an empty function. + */ + isEmptyFunction(node) { + return isFunction(node) && module.exports.isEmptyBlock(node.body); + }, + + /** + * Get directives from directive prologue of a Program or Function node. + * @param {ASTNode} node The node to check. + * @returns {ASTNode[]} The directives found in the directive prologue. + */ + getDirectivePrologue(node) { + const directives = []; + + // Directive prologues only occur at the top of files or functions. + if ( + node.type === "Program" || + node.type === "FunctionDeclaration" || + node.type === "FunctionExpression" || + + /* + * Do not check arrow functions with implicit return. + * `() => "use strict";` returns the string `"use strict"`. + */ + (node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") + ) { + const statements = node.type === "Program" ? node.body : node.body.body; + + for (const statement of statements) { + if ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" + ) { + directives.push(statement); + } else { + break; + } + } + } + + return directives; + }, + + + /** + * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added + * after the node will be parsed as a decimal point, rather than a property-access dot. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if this node is a decimal integer. + * @example + * + * 0 // true + * 5 // true + * 50 // true + * 5_000 // true + * 1_234_56 // true + * 08 // true + * 0192 // true + * 5. // false + * .5 // false + * 5.0 // false + * 5.00_00 // false + * 05 // false + * 0x5 // false + * 0b101 // false + * 0b11_01 // false + * 0o5 // false + * 5e0 // false + * 5e1_000 // false + * 5n // false + * 1_000n // false + * "5" // false + * + */ + isDecimalInteger(node) { + return node.type === "Literal" && typeof node.value === "number" && + DECIMAL_INTEGER_PATTERN.test(node.raw); + }, + + /** + * Determines whether this token is a decimal integer numeric token. + * This is similar to isDecimalInteger(), but for tokens. + * @param {Token} token The token to check. + * @returns {boolean} `true` if this token is a decimal integer. + */ + isDecimalIntegerNumericToken(token) { + return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value); + }, + + /** + * Gets the name and kind of the given function node. + * + * - `function foo() {}` .................... `function 'foo'` + * - `(function foo() {})` .................. `function 'foo'` + * - `(function() {})` ...................... `function` + * - `function* foo() {}` ................... `generator function 'foo'` + * - `(function* foo() {})` ................. `generator function 'foo'` + * - `(function*() {})` ..................... `generator function` + * - `() => {}` ............................. `arrow function` + * - `async () => {}` ....................... `async arrow function` + * - `({ foo: function foo() {} })` ......... `method 'foo'` + * - `({ foo: function() {} })` ............. `method 'foo'` + * - `({ ['foo']: function() {} })` ......... `method 'foo'` + * - `({ [foo]: function() {} })` ........... `method` + * - `({ foo() {} })` ....................... `method 'foo'` + * - `({ foo: function* foo() {} })` ........ `generator method 'foo'` + * - `({ foo: function*() {} })` ............ `generator method 'foo'` + * - `({ ['foo']: function*() {} })` ........ `generator method 'foo'` + * - `({ [foo]: function*() {} })` .......... `generator method` + * - `({ *foo() {} })` ...................... `generator method 'foo'` + * - `({ foo: async function foo() {} })` ... `async method 'foo'` + * - `({ foo: async function() {} })` ....... `async method 'foo'` + * - `({ ['foo']: async function() {} })` ... `async method 'foo'` + * - `({ [foo]: async function() {} })` ..... `async method` + * - `({ async foo() {} })` ................. `async method 'foo'` + * - `({ get foo() {} })` ................... `getter 'foo'` + * - `({ set foo(a) {} })` .................. `setter 'foo'` + * - `class A { constructor() {} }` ......... `constructor` + * - `class A { foo() {} }` ................. `method 'foo'` + * - `class A { *foo() {} }` ................ `generator method 'foo'` + * - `class A { async foo() {} }` ........... `async method 'foo'` + * - `class A { ['foo']() {} }` ............. `method 'foo'` + * - `class A { *['foo']() {} }` ............ `generator method 'foo'` + * - `class A { async ['foo']() {} }` ....... `async method 'foo'` + * - `class A { [foo]() {} }` ............... `method` + * - `class A { *[foo]() {} }` .............. `generator method` + * - `class A { async [foo]() {} }` ......... `async method` + * - `class A { get foo() {} }` ............. `getter 'foo'` + * - `class A { set foo(a) {} }` ............ `setter 'foo'` + * - `class A { static foo() {} }` .......... `static method 'foo'` + * - `class A { static *foo() {} }` ......... `static generator method 'foo'` + * - `class A { static async foo() {} }` .... `static async method 'foo'` + * - `class A { static get foo() {} }` ...... `static getter 'foo'` + * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` + * - `class A { foo = () => {}; }` .......... `method 'foo'` + * - `class A { foo = function() {}; }` ..... `method 'foo'` + * - `class A { foo = function bar() {}; }` . `method 'foo'` + * - `class A { static foo = () => {}; }` ... `static method 'foo'` + * - `class A { '#foo' = () => {}; }` ....... `method '#foo'` + * - `class A { #foo = () => {}; }` ......... `private method #foo` + * - `class A { static #foo = () => {}; }` .. `static private method #foo` + * - `class A { '#foo'() {} }` .............. `method '#foo'` + * - `class A { #foo() {} }` ................ `private method #foo` + * - `class A { static #foo() {} }` ......... `static private method #foo` + * @param {ASTNode} node The function node to get. + * @returns {string} The name and kind of the function node. + */ + getFunctionNameWithKind(node) { + const parent = node.parent; + const tokens = []; + + if (parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + + // The proposal uses `static` word consistently before visibility words: https://github.com/tc39/proposal-static-class-features + if (parent.static) { + tokens.push("static"); + } + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } + } + if (node.async) { + tokens.push("async"); + } + if (node.generator) { + tokens.push("generator"); + } + + if (parent.type === "Property" || parent.type === "MethodDefinition") { + if (parent.kind === "constructor") { + return "constructor"; + } + if (parent.kind === "get") { + tokens.push("getter"); + } else if (parent.kind === "set") { + tokens.push("setter"); + } else { + tokens.push("method"); + } + } else if (parent.type === "PropertyDefinition") { + tokens.push("method"); + } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); + } + + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getStaticPropertyName(parent); + + if (name !== null) { + tokens.push(`'${name}'`); + } else if (node.id) { + tokens.push(`'${node.id.name}'`); + } + } + } else if (node.id) { + tokens.push(`'${node.id.name}'`); + } + + return tokens.join(" "); + }, + + /** + * Gets the location of the given function node for reporting. + * + * - `function foo() {}` + * ^^^^^^^^^^^^ + * - `(function foo() {})` + * ^^^^^^^^^^^^ + * - `(function() {})` + * ^^^^^^^^ + * - `function* foo() {}` + * ^^^^^^^^^^^^^ + * - `(function* foo() {})` + * ^^^^^^^^^^^^^ + * - `(function*() {})` + * ^^^^^^^^^ + * - `() => {}` + * ^^ + * - `async () => {}` + * ^^ + * - `({ foo: function foo() {} })` + * ^^^^^^^^^^^^^^^^^ + * - `({ foo: function() {} })` + * ^^^^^^^^^^^^^ + * - `({ ['foo']: function() {} })` + * ^^^^^^^^^^^^^^^^^ + * - `({ [foo]: function() {} })` + * ^^^^^^^^^^^^^^^ + * - `({ foo() {} })` + * ^^^ + * - `({ foo: function* foo() {} })` + * ^^^^^^^^^^^^^^^^^^ + * - `({ foo: function*() {} })` + * ^^^^^^^^^^^^^^ + * - `({ ['foo']: function*() {} })` + * ^^^^^^^^^^^^^^^^^^ + * - `({ [foo]: function*() {} })` + * ^^^^^^^^^^^^^^^^ + * - `({ *foo() {} })` + * ^^^^ + * - `({ foo: async function foo() {} })` + * ^^^^^^^^^^^^^^^^^^^^^^^ + * - `({ foo: async function() {} })` + * ^^^^^^^^^^^^^^^^^^^ + * - `({ ['foo']: async function() {} })` + * ^^^^^^^^^^^^^^^^^^^^^^^ + * - `({ [foo]: async function() {} })` + * ^^^^^^^^^^^^^^^^^^^^^ + * - `({ async foo() {} })` + * ^^^^^^^^^ + * - `({ get foo() {} })` + * ^^^^^^^ + * - `({ set foo(a) {} })` + * ^^^^^^^ + * - `class A { constructor() {} }` + * ^^^^^^^^^^^ + * - `class A { foo() {} }` + * ^^^ + * - `class A { *foo() {} }` + * ^^^^ + * - `class A { async foo() {} }` + * ^^^^^^^^^ + * - `class A { ['foo']() {} }` + * ^^^^^^^ + * - `class A { *['foo']() {} }` + * ^^^^^^^^ + * - `class A { async ['foo']() {} }` + * ^^^^^^^^^^^^^ + * - `class A { [foo]() {} }` + * ^^^^^ + * - `class A { *[foo]() {} }` + * ^^^^^^ + * - `class A { async [foo]() {} }` + * ^^^^^^^^^^^ + * - `class A { get foo() {} }` + * ^^^^^^^ + * - `class A { set foo(a) {} }` + * ^^^^^^^ + * - `class A { static foo() {} }` + * ^^^^^^^^^^ + * - `class A { static *foo() {} }` + * ^^^^^^^^^^^ + * - `class A { static async foo() {} }` + * ^^^^^^^^^^^^^^^^ + * - `class A { static get foo() {} }` + * ^^^^^^^^^^^^^^ + * - `class A { static set foo(a) {} }` + * ^^^^^^^^^^^^^^ + * - `class A { foo = function() {} }` + * ^^^^^^^^^^^^^^ + * - `class A { static foo = function() {} }` + * ^^^^^^^^^^^^^^^^^^^^^ + * - `class A { foo = (a, b) => {} }` + * ^^^^^^ + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {string} The location of the function node for reporting. + */ + getFunctionHeadLoc(node, sourceCode) { + const parent = node.parent; + let start = null; + let end = null; + + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + start = parent.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else if (node.type === "ArrowFunctionExpression") { + const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); + + start = arrowToken.loc.start; + end = arrowToken.loc.end; + } else { + start = node.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } + + return { + start: Object.assign({}, start), + end: Object.assign({}, end) + }; + }, + + /** + * Gets next location when the result is not out of bound, otherwise returns null. + * + * Assumptions: + * + * - The given location represents a valid location in the given source code. + * - Columns are 0-based. + * - Lines are 1-based. + * - Column immediately after the last character in a line (not incl. linebreaks) is considered to be a valid location. + * - If the source code ends with a linebreak, `sourceCode.lines` array will have an extra element (empty string) at the end. + * The start (column 0) of that extra line is considered to be a valid location. + * + * Examples of successive locations (line, column): + * + * code: foo + * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> null + * + * code: foo + * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null + * + * code: foo + * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null + * + * code: ab + * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> null + * + * code: ab + * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null + * + * code: ab + * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null + * + * code: a + * locations: (1, 0) -> (1, 1) -> (2, 0) -> (3, 0) -> null + * + * code: + * locations: (1, 0) -> (2, 0) -> null + * + * code: + * locations: (1, 0) -> null + * @param {SourceCode} sourceCode The sourceCode + * @param {{line: number, column: number}} location The location + * @returns {{line: number, column: number} | null} Next location + */ + getNextLocation(sourceCode, { line, column }) { + if (column < sourceCode.lines[line - 1].length) { + return { + line, + column: column + 1 + }; + } + + if (line < sourceCode.lines.length) { + return { + line: line + 1, + column: 0 + }; + } + + return null; + }, + + /** + * Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses + * surrounding the node. + * @param {SourceCode} sourceCode The source code object + * @param {ASTNode} node An expression node + * @returns {string} The text representing the node, with all surrounding parentheses included + */ + getParenthesisedText(sourceCode, node) { + let leftToken = sourceCode.getFirstToken(node); + let rightToken = sourceCode.getLastToken(node); + + while ( + sourceCode.getTokenBefore(leftToken) && + sourceCode.getTokenBefore(leftToken).type === "Punctuator" && + sourceCode.getTokenBefore(leftToken).value === "(" && + sourceCode.getTokenAfter(rightToken) && + sourceCode.getTokenAfter(rightToken).type === "Punctuator" && + sourceCode.getTokenAfter(rightToken).value === ")" + ) { + leftToken = sourceCode.getTokenBefore(leftToken); + rightToken = sourceCode.getTokenAfter(rightToken); + } + + return sourceCode.getText().slice(leftToken.range[0], rightToken.range[1]); + }, + + /** + * Determine if a node has a possibility to be an Error object + * @param {ASTNode} node ASTNode to check + * @returns {boolean} True if there is a chance it contains an Error obj + */ + couldBeError(node) { + switch (node.type) { + case "Identifier": + case "CallExpression": + case "NewExpression": + case "MemberExpression": + case "TaggedTemplateExpression": + case "YieldExpression": + case "AwaitExpression": + case "ChainExpression": + return true; // possibly an error object. + + case "AssignmentExpression": + if (["=", "&&="].includes(node.operator)) { + return module.exports.couldBeError(node.right); + } + + if (["||=", "??="].includes(node.operator)) { + return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right); + } + + /** + * All other assignment operators are mathematical assignment operators (arithmetic or bitwise). + * An assignment expression with a mathematical operator can either evaluate to a primitive value, + * or throw, depending on the operands. Thus, it cannot evaluate to an `Error` object. + */ + return false; + + case "SequenceExpression": { + const exprs = node.expressions; + + return exprs.length !== 0 && module.exports.couldBeError(exprs[exprs.length - 1]); + } + + case "LogicalExpression": + + /* + * If the && operator short-circuits, the left side was falsy and therefore not an error, and if it + * doesn't short-circuit, it takes the value from the right side, so the right side must always be + * a plausible error. A future improvement could verify that the left side could be truthy by + * excluding falsy literals. + */ + if (node.operator === "&&") { + return module.exports.couldBeError(node.right); + } + + return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right); + + case "ConditionalExpression": + return module.exports.couldBeError(node.consequent) || module.exports.couldBeError(node.alternate); + + default: + return false; + } + }, + + /** + * Check if a given node is a numeric literal or not. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a number or bigint literal. + */ + isNumericLiteral(node) { + return ( + node.type === "Literal" && + (typeof node.value === "number" || Boolean(node.bigint)) + ); + }, + + /** + * Determines whether two tokens can safely be placed next to each other without merging into a single token + * @param {Token|string} leftValue The left token. If this is a string, it will be tokenized and the last token will be used. + * @param {Token|string} rightValue The right token. If this is a string, it will be tokenized and the first token will be used. + * @returns {boolean} If the tokens cannot be safely placed next to each other, returns `false`. If the tokens can be placed + * next to each other, behavior is undefined (although it should return `true` in most cases). + */ + canTokensBeAdjacent(leftValue, rightValue) { + const espreeOptions = { + ecmaVersion: espree.latestEcmaVersion, + comment: true, + range: true + }; + + let leftToken; + + if (typeof leftValue === "string") { + let tokens; + + try { + tokens = espree.tokenize(leftValue, espreeOptions); + } catch { + return false; + } + + const comments = tokens.comments; + + leftToken = tokens[tokens.length - 1]; + if (comments.length) { + const lastComment = comments[comments.length - 1]; + + if (lastComment.range[0] > leftToken.range[0]) { + leftToken = lastComment; + } + } + } else { + leftToken = leftValue; + } + + if (leftToken.type === "Shebang") { + return false; + } + + let rightToken; + + if (typeof rightValue === "string") { + let tokens; + + try { + tokens = espree.tokenize(rightValue, espreeOptions); + } catch { + return false; + } + + const comments = tokens.comments; + + rightToken = tokens[0]; + if (comments.length) { + const firstComment = comments[0]; + + if (firstComment.range[0] < rightToken.range[0]) { + rightToken = firstComment; + } + } + } else { + rightToken = rightValue; + } + + if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") { + if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") { + const PLUS_TOKENS = new Set(["+", "++"]); + const MINUS_TOKENS = new Set(["-", "--"]); + + return !( + PLUS_TOKENS.has(leftToken.value) && PLUS_TOKENS.has(rightToken.value) || + MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value) + ); + } + if (leftToken.type === "Punctuator" && leftToken.value === "/") { + return !["Block", "Line", "RegularExpression"].includes(rightToken.type); + } + return true; + } + + if ( + leftToken.type === "String" || rightToken.type === "String" || + leftToken.type === "Template" || rightToken.type === "Template" + ) { + return true; + } + + if (leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith(".")) { + return true; + } + + if (leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line") { + return true; + } + + if (rightToken.type === "PrivateIdentifier") { + return true; + } + + return false; + }, + + /** + * Get the `loc` object of a given name in a `/*globals` directive comment. + * @param {SourceCode} sourceCode The source code to convert index to loc. + * @param {Comment} comment The `/*globals` directive comment which include the name. + * @param {string} name The name to find. + * @returns {SourceLocation} The `loc` object. + */ + getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) { + const namePattern = new RegExp(`[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`, "gu"); + + // To ignore the first text "global". + namePattern.lastIndex = comment.value.indexOf("global") + 6; + + // Search a given variable name. + const match = namePattern.exec(comment.value); + + // Convert the index to loc. + const start = sourceCode.getLocFromIndex( + comment.range[0] + + "/*".length + + (match ? match.index + 1 : 0) + ); + const end = { + line: start.line, + column: start.column + (match ? name.length : 1) + }; + + return { start, end }; + }, + + /** + * Determines whether the given raw string contains an octal escape sequence + * or a non-octal decimal escape sequence ("\8", "\9"). + * + * "\1", "\2" ... "\7", "\8", "\9" + * "\00", "\01" ... "\07", "\08", "\09" + * + * "\0", when not followed by a digit, is not an octal escape sequence. + * @param {string} rawString A string in its raw representation. + * @returns {boolean} `true` if the string contains at least one octal escape sequence + * or at least one non-octal decimal escape sequence. + */ + hasOctalOrNonOctalDecimalEscapeSequence(rawString) { + return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString); + }, + + isReferenceToGlobalVariable, + isLogicalExpression, + isCoalesceExpression, + isMixedLogicalAndCoalesceExpressions, + isNullLiteral, + getStaticStringValue, + getStaticPropertyName, + skipChainExpression, + isSpecificId, + isSpecificMemberAccess, + equalLiteralValue, + isSameReference, + isLogicalAssignmentOperator, + getSwitchCaseColonToken, + getModuleExportName, + isConstant +}; diff --git a/node_modules/eslint/lib/rules/utils/fix-tracker.js b/node_modules/eslint/lib/rules/utils/fix-tracker.js new file mode 100644 index 0000000..589870b --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/fix-tracker.js @@ -0,0 +1,114 @@ +/** + * @fileoverview Helper class to aid in constructing fix commands. + * @author Alan Pierce + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./ast-utils"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * A helper class to combine fix options into a fix command. Currently, it + * exposes some "retain" methods that extend the range of the text being + * replaced so that other fixes won't touch that region in the same pass. + */ +class FixTracker { + + /** + * Create a new FixTracker. + * @param {ruleFixer} fixer A ruleFixer instance. + * @param {SourceCode} sourceCode A SourceCode object for the current code. + */ + constructor(fixer, sourceCode) { + this.fixer = fixer; + this.sourceCode = sourceCode; + this.retainedRange = null; + } + + /** + * Mark the given range as "retained", meaning that other fixes may not + * may not modify this region in the same pass. + * @param {int[]} range The range to retain. + * @returns {FixTracker} The same RuleFixer, for chained calls. + */ + retainRange(range) { + this.retainedRange = range; + return this; + } + + /** + * Given a node, find the function containing it (or the entire program) and + * mark it as retained, meaning that other fixes may not modify it in this + * pass. This is useful for avoiding conflicts in fixes that modify control + * flow. + * @param {ASTNode} node The node to use as a starting point. + * @returns {FixTracker} The same RuleFixer, for chained calls. + */ + retainEnclosingFunction(node) { + const functionNode = astUtils.getUpperFunction(node); + + return this.retainRange(functionNode ? functionNode.range : this.sourceCode.ast.range); + } + + /** + * Given a node or token, find the token before and afterward, and mark that + * range as retained, meaning that other fixes may not modify it in this + * pass. This is useful for avoiding conflicts in fixes that make a small + * change to the code where the AST should not be changed. + * @param {ASTNode|Token} nodeOrToken The node or token to use as a starting + * point. The token to the left and right are use in the range. + * @returns {FixTracker} The same RuleFixer, for chained calls. + */ + retainSurroundingTokens(nodeOrToken) { + const tokenBefore = this.sourceCode.getTokenBefore(nodeOrToken) || nodeOrToken; + const tokenAfter = this.sourceCode.getTokenAfter(nodeOrToken) || nodeOrToken; + + return this.retainRange([tokenBefore.range[0], tokenAfter.range[1]]); + } + + /** + * Create a fix command that replaces the given range with the given text, + * accounting for any retained ranges. + * @param {int[]} range The range to remove in the fix. + * @param {string} text The text to insert in place of the range. + * @returns {Object} The fix command. + */ + replaceTextRange(range, text) { + let actualRange; + + if (this.retainedRange) { + actualRange = [ + Math.min(this.retainedRange[0], range[0]), + Math.max(this.retainedRange[1], range[1]) + ]; + } else { + actualRange = range; + } + + return this.fixer.replaceTextRange( + actualRange, + this.sourceCode.text.slice(actualRange[0], range[0]) + + text + + this.sourceCode.text.slice(range[1], actualRange[1]) + ); + } + + /** + * Create a fix command that removes the given node or token, accounting for + * any retained ranges. + * @param {ASTNode|Token} nodeOrToken The node or token to remove. + * @returns {Object} The fix command. + */ + remove(nodeOrToken) { + return this.replaceTextRange(nodeOrToken.range, ""); + } +} + +module.exports = FixTracker; diff --git a/node_modules/eslint/lib/rules/utils/keywords.js b/node_modules/eslint/lib/rules/utils/keywords.js new file mode 100644 index 0000000..3fbb777 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/keywords.js @@ -0,0 +1,67 @@ +/** + * @fileoverview A shared list of ES3 keywords. + * @author Josh Perez + */ +"use strict"; + +module.exports = [ + "abstract", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "double", + "else", + "enum", + "export", + "extends", + "false", + "final", + "finally", + "float", + "for", + "function", + "goto", + "if", + "implements", + "import", + "in", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "true", + "try", + "typeof", + "var", + "void", + "volatile", + "while", + "with" +]; diff --git a/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js b/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js new file mode 100644 index 0000000..7f116a2 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js @@ -0,0 +1,115 @@ +/** + * @fileoverview `Map` to load rules lazily. + * @author Toru Nagashima + */ +"use strict"; + +const debug = require("debug")("eslint:rules"); + +/** @typedef {import("./types").Rule} Rule */ + +/** + * The `Map` object that loads each rule when it's accessed. + * @example + * const rules = new LazyLoadingRuleMap([ + * ["eqeqeq", () => require("eqeqeq")], + * ["semi", () => require("semi")], + * ["no-unused-vars", () => require("no-unused-vars")] + * ]); + * + * rules.get("semi"); // call `() => require("semi")` here. + * + * @extends {Map Rule>} + */ +class LazyLoadingRuleMap extends Map { + + /** + * Initialize this map. + * @param {Array<[string, function(): Rule]>} loaders The rule loaders. + */ + constructor(loaders) { + let remaining = loaders.length; + + super( + debug.enabled + ? loaders.map(([ruleId, load]) => { + let cache = null; + + return [ + ruleId, + () => { + if (!cache) { + debug("Loading rule %o (remaining=%d)", ruleId, --remaining); + cache = load(); + } + return cache; + } + ]; + }) + : loaders + ); + + // `super(...iterable)` uses `this.set()`, so disable it here. + Object.defineProperty(LazyLoadingRuleMap.prototype, "set", { + configurable: true, + value: void 0 + }); + } + + /** + * Get a rule. + * Each rule will be loaded on the first access. + * @param {string} ruleId The rule ID to get. + * @returns {Rule|undefined} The rule. + */ + get(ruleId) { + const load = super.get(ruleId); + + return load && load(); + } + + /** + * Iterate rules. + * @returns {IterableIterator} Rules. + */ + *values() { + for (const load of super.values()) { + yield load(); + } + } + + /** + * Iterate rules. + * @returns {IterableIterator<[string, Rule]>} Rules. + */ + *entries() { + for (const [ruleId, load] of super.entries()) { + yield [ruleId, load()]; + } + } + + /** + * Call a function with each rule. + * @param {Function} callbackFn The callback function. + * @param {any} [thisArg] The object to pass to `this` of the callback function. + * @returns {void} + */ + forEach(callbackFn, thisArg) { + for (const [ruleId, load] of super.entries()) { + callbackFn.call(thisArg, load(), ruleId, this); + } + } +} + +// Forbid mutation. +Object.defineProperties(LazyLoadingRuleMap.prototype, { + clear: { configurable: true, value: void 0 }, + delete: { configurable: true, value: void 0 }, + [Symbol.iterator]: { + configurable: true, + writable: true, + value: LazyLoadingRuleMap.prototype.entries + } +}); + +module.exports = { LazyLoadingRuleMap }; diff --git a/node_modules/eslint/lib/rules/utils/patterns/letters.js b/node_modules/eslint/lib/rules/utils/patterns/letters.js new file mode 100644 index 0000000..9bb2de3 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/patterns/letters.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Pattern for detecting any letter (even letters outside of ASCII). + * NOTE: This file was generated using this script in JSCS based on the Unicode 7.0.0 standard: https://github.com/jscs-dev/node-jscs/blob/f5ed14427deb7e7aac84f3056a5aab2d9f3e563e/publish/helpers/generate-patterns.js + * Do not edit this file by hand-- please use https://github.com/mathiasbynens/regenerate to regenerate the regular expression exported from this file. + * @author Kevin Partington + * @license MIT License (from JSCS). See below. + */ + +/* + * The MIT License (MIT) + * + * Copyright 2013-2016 Dulin Marat and other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +"use strict"; + +module.exports = /[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\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\u16F1-\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\u2183\u2184\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\u3006\u3031-\u3035\u303B\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-\uA6E5\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-\u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-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/u; diff --git a/node_modules/eslint/lib/rules/utils/unicode/index.js b/node_modules/eslint/lib/rules/utils/unicode/index.js new file mode 100644 index 0000000..02eea50 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/unicode/index.js @@ -0,0 +1,11 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +module.exports = { + isCombiningCharacter: require("./is-combining-character"), + isEmojiModifier: require("./is-emoji-modifier"), + isRegionalIndicatorSymbol: require("./is-regional-indicator-symbol"), + isSurrogatePair: require("./is-surrogate-pair") +}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js b/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js new file mode 100644 index 0000000..0498b99 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js @@ -0,0 +1,13 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +/** + * Check whether a given character is a combining mark or not. + * @param {number} codePoint The character code to check. + * @returns {boolean} `true` if the character belongs to the category, any of `Mc`, `Me`, and `Mn`. + */ +module.exports = function isCombiningCharacter(codePoint) { + return /^[\p{Mc}\p{Me}\p{Mn}]$/u.test(String.fromCodePoint(codePoint)); +}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js b/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js new file mode 100644 index 0000000..1bd5f55 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js @@ -0,0 +1,13 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +/** + * Check whether a given character is an emoji modifier. + * @param {number} code The character code to check. + * @returns {boolean} `true` if the character is an emoji modifier. + */ +module.exports = function isEmojiModifier(code) { + return code >= 0x1F3FB && code <= 0x1F3FF; +}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js b/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js new file mode 100644 index 0000000..c48ed46 --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js @@ -0,0 +1,13 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +/** + * Check whether a given character is a regional indicator symbol. + * @param {number} code The character code to check. + * @returns {boolean} `true` if the character is a regional indicator symbol. + */ +module.exports = function isRegionalIndicatorSymbol(code) { + return code >= 0x1F1E6 && code <= 0x1F1FF; +}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js b/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js new file mode 100644 index 0000000..b8e5c1c --- /dev/null +++ b/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js @@ -0,0 +1,14 @@ +/** + * @author Toru Nagashima + */ +"use strict"; + +/** + * Check whether given two characters are a surrogate pair. + * @param {number} lead The code of the lead character. + * @param {number} tail The code of the tail character. + * @returns {boolean} `true` if the character pair is a surrogate pair. + */ +module.exports = function isSurrogatePair(lead, tail) { + return lead >= 0xD800 && lead < 0xDC00 && tail >= 0xDC00 && tail < 0xE000; +}; diff --git a/node_modules/eslint/lib/rules/valid-jsdoc.js b/node_modules/eslint/lib/rules/valid-jsdoc.js new file mode 100644 index 0000000..8662bf0 --- /dev/null +++ b/node_modules/eslint/lib/rules/valid-jsdoc.js @@ -0,0 +1,516 @@ +/** + * @fileoverview Validates JSDoc comments are syntactically correct + * @author Nicholas C. Zakas + * @deprecated in ESLint v5.10.0 + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const doctrine = require("doctrine"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "enforce valid JSDoc comments", + recommended: false, + url: "https://eslint.org/docs/rules/valid-jsdoc" + }, + + schema: [ + { + type: "object", + properties: { + prefer: { + type: "object", + additionalProperties: { + type: "string" + } + }, + preferType: { + type: "object", + additionalProperties: { + type: "string" + } + }, + requireReturn: { + type: "boolean", + default: true + }, + requireParamDescription: { + type: "boolean", + default: true + }, + requireReturnDescription: { + type: "boolean", + default: true + }, + matchDescription: { + type: "string" + }, + requireReturnType: { + type: "boolean", + default: true + }, + requireParamType: { + type: "boolean", + default: true + } + }, + additionalProperties: false + } + ], + + fixable: "code", + messages: { + unexpectedTag: "Unexpected @{{title}} tag; function has no return statement.", + expected: "Expected JSDoc for '{{name}}' but found '{{jsdocName}}'.", + use: "Use @{{name}} instead.", + useType: "Use '{{expectedTypeName}}' instead of '{{currentTypeName}}'.", + syntaxError: "JSDoc syntax error.", + missingBrace: "JSDoc type missing brace.", + missingParamDesc: "Missing JSDoc parameter description for '{{name}}'.", + missingParamType: "Missing JSDoc parameter type for '{{name}}'.", + missingReturnType: "Missing JSDoc return type.", + missingReturnDesc: "Missing JSDoc return description.", + missingReturn: "Missing JSDoc @{{returns}} for function.", + missingParam: "Missing JSDoc for parameter '{{name}}'.", + duplicateParam: "Duplicate JSDoc parameter '{{name}}'.", + unsatisfiedDesc: "JSDoc description does not satisfy the regex pattern." + }, + + deprecated: true, + replacedBy: [] + }, + + create(context) { + + const options = context.options[0] || {}, + prefer = options.prefer || {}, + sourceCode = context.getSourceCode(), + + // these both default to true, so you have to explicitly make them false + requireReturn = options.requireReturn !== false, + requireParamDescription = options.requireParamDescription !== false, + requireReturnDescription = options.requireReturnDescription !== false, + requireReturnType = options.requireReturnType !== false, + requireParamType = options.requireParamType !== false, + preferType = options.preferType || {}, + checkPreferType = Object.keys(preferType).length !== 0; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // Using a stack to store if a function returns or not (handling nested functions) + const fns = []; + + /** + * Check if node type is a Class + * @param {ASTNode} node node to check. + * @returns {boolean} True is its a class + * @private + */ + function isTypeClass(node) { + return node.type === "ClassExpression" || node.type === "ClassDeclaration"; + } + + /** + * When parsing a new function, store it in our function stack. + * @param {ASTNode} node A function node to check. + * @returns {void} + * @private + */ + function startFunction(node) { + fns.push({ + returnPresent: (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") || + isTypeClass(node) || node.async + }); + } + + /** + * Indicate that return has been found in the current function. + * @param {ASTNode} node The return node. + * @returns {void} + * @private + */ + function addReturn(node) { + const functionState = fns[fns.length - 1]; + + if (functionState && node.argument !== null) { + functionState.returnPresent = true; + } + } + + /** + * Check if return tag type is void or undefined + * @param {Object} tag JSDoc tag + * @returns {boolean} True if its of type void or undefined + * @private + */ + function isValidReturnType(tag) { + return tag.type === null || tag.type.name === "void" || tag.type.type === "UndefinedLiteral"; + } + + /** + * Check if type should be validated based on some exceptions + * @param {Object} type JSDoc tag + * @returns {boolean} True if it can be validated + * @private + */ + function canTypeBeValidated(type) { + return type !== "UndefinedLiteral" && // {undefined} as there is no name property available. + type !== "NullLiteral" && // {null} + type !== "NullableLiteral" && // {?} + type !== "FunctionType" && // {function(a)} + type !== "AllLiteral"; // {*} + } + + /** + * Extract the current and expected type based on the input type object + * @param {Object} type JSDoc tag + * @returns {{currentType: Doctrine.Type, expectedTypeName: string}} The current type annotation and + * the expected name of the annotation + * @private + */ + function getCurrentExpectedTypes(type) { + let currentType; + + if (type.name) { + currentType = type; + } else if (type.expression) { + currentType = type.expression; + } + + return { + currentType, + expectedTypeName: currentType && preferType[currentType.name] + }; + } + + /** + * Gets the location of a JSDoc node in a file + * @param {Token} jsdocComment The comment that this node is parsed from + * @param {{range: number[]}} parsedJsdocNode A tag or other node which was parsed from this comment + * @returns {{start: SourceLocation, end: SourceLocation}} The 0-based source location for the tag + */ + function getAbsoluteRange(jsdocComment, parsedJsdocNode) { + return { + start: sourceCode.getLocFromIndex(jsdocComment.range[0] + 2 + parsedJsdocNode.range[0]), + end: sourceCode.getLocFromIndex(jsdocComment.range[0] + 2 + parsedJsdocNode.range[1]) + }; + } + + /** + * Validate type for a given JSDoc node + * @param {Object} jsdocNode JSDoc node + * @param {Object} type JSDoc tag + * @returns {void} + * @private + */ + function validateType(jsdocNode, type) { + if (!type || !canTypeBeValidated(type.type)) { + return; + } + + const typesToCheck = []; + let elements = []; + + switch (type.type) { + case "TypeApplication": // {Array.} + elements = type.applications[0].type === "UnionType" ? type.applications[0].elements : type.applications; + typesToCheck.push(getCurrentExpectedTypes(type)); + break; + case "RecordType": // {{20:String}} + elements = type.fields; + break; + case "UnionType": // {String|number|Test} + case "ArrayType": // {[String, number, Test]} + elements = type.elements; + break; + case "FieldType": // Array.<{count: number, votes: number}> + if (type.value) { + typesToCheck.push(getCurrentExpectedTypes(type.value)); + } + break; + default: + typesToCheck.push(getCurrentExpectedTypes(type)); + } + + elements.forEach(validateType.bind(null, jsdocNode)); + + typesToCheck.forEach(typeToCheck => { + if (typeToCheck.expectedTypeName && + typeToCheck.expectedTypeName !== typeToCheck.currentType.name) { + context.report({ + node: jsdocNode, + messageId: "useType", + loc: getAbsoluteRange(jsdocNode, typeToCheck.currentType), + data: { + currentTypeName: typeToCheck.currentType.name, + expectedTypeName: typeToCheck.expectedTypeName + }, + fix(fixer) { + return fixer.replaceTextRange( + typeToCheck.currentType.range.map(indexInComment => jsdocNode.range[0] + 2 + indexInComment), + typeToCheck.expectedTypeName + ); + } + }); + } + }); + } + + /** + * Validate the JSDoc node and output warnings if anything is wrong. + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function checkJSDoc(node) { + const jsdocNode = sourceCode.getJSDocComment(node), + functionData = fns.pop(), + paramTagsByName = Object.create(null), + paramTags = []; + let hasReturns = false, + returnsTag, + hasConstructor = false, + isInterface = false, + isOverride = false, + isAbstract = false; + + // make sure only to validate JSDoc comments + if (jsdocNode) { + let jsdoc; + + try { + jsdoc = doctrine.parse(jsdocNode.value, { + strict: true, + unwrap: true, + sloppy: true, + range: true + }); + } catch (ex) { + + if (/braces/iu.test(ex.message)) { + context.report({ node: jsdocNode, messageId: "missingBrace" }); + } else { + context.report({ node: jsdocNode, messageId: "syntaxError" }); + } + + return; + } + + jsdoc.tags.forEach(tag => { + + switch (tag.title.toLowerCase()) { + + case "param": + case "arg": + case "argument": + paramTags.push(tag); + break; + + case "return": + case "returns": + hasReturns = true; + returnsTag = tag; + break; + + case "constructor": + case "class": + hasConstructor = true; + break; + + case "override": + case "inheritdoc": + isOverride = true; + break; + + case "abstract": + case "virtual": + isAbstract = true; + break; + + case "interface": + isInterface = true; + break; + + // no default + } + + // check tag preferences + if (Object.prototype.hasOwnProperty.call(prefer, tag.title) && tag.title !== prefer[tag.title]) { + const entireTagRange = getAbsoluteRange(jsdocNode, tag); + + context.report({ + node: jsdocNode, + messageId: "use", + loc: { + start: entireTagRange.start, + end: { + line: entireTagRange.start.line, + column: entireTagRange.start.column + `@${tag.title}`.length + } + }, + data: { name: prefer[tag.title] }, + fix(fixer) { + return fixer.replaceTextRange( + [ + jsdocNode.range[0] + tag.range[0] + 3, + jsdocNode.range[0] + tag.range[0] + tag.title.length + 3 + ], + prefer[tag.title] + ); + } + }); + } + + // validate the types + if (checkPreferType && tag.type) { + validateType(jsdocNode, tag.type); + } + }); + + paramTags.forEach(param => { + if (requireParamType && !param.type) { + context.report({ + node: jsdocNode, + messageId: "missingParamType", + loc: getAbsoluteRange(jsdocNode, param), + data: { name: param.name } + }); + } + if (!param.description && requireParamDescription) { + context.report({ + node: jsdocNode, + messageId: "missingParamDesc", + loc: getAbsoluteRange(jsdocNode, param), + data: { name: param.name } + }); + } + if (paramTagsByName[param.name]) { + context.report({ + node: jsdocNode, + messageId: "duplicateParam", + loc: getAbsoluteRange(jsdocNode, param), + data: { name: param.name } + }); + } else if (!param.name.includes(".")) { + paramTagsByName[param.name] = param; + } + }); + + if (hasReturns) { + if (!requireReturn && !functionData.returnPresent && (returnsTag.type === null || !isValidReturnType(returnsTag)) && !isAbstract) { + context.report({ + node: jsdocNode, + messageId: "unexpectedTag", + loc: getAbsoluteRange(jsdocNode, returnsTag), + data: { + title: returnsTag.title + } + }); + } else { + if (requireReturnType && !returnsTag.type) { + context.report({ node: jsdocNode, messageId: "missingReturnType" }); + } + + if (!isValidReturnType(returnsTag) && !returnsTag.description && requireReturnDescription) { + context.report({ node: jsdocNode, messageId: "missingReturnDesc" }); + } + } + } + + // check for functions missing @returns + if (!isOverride && !hasReturns && !hasConstructor && !isInterface && + node.parent.kind !== "get" && node.parent.kind !== "constructor" && + node.parent.kind !== "set" && !isTypeClass(node)) { + if (requireReturn || (functionData.returnPresent && !node.async)) { + context.report({ + node: jsdocNode, + messageId: "missingReturn", + data: { + returns: prefer.returns || "returns" + } + }); + } + } + + // check the parameters + const jsdocParamNames = Object.keys(paramTagsByName); + + if (node.params) { + node.params.forEach((param, paramsIndex) => { + const bindingParam = param.type === "AssignmentPattern" + ? param.left + : param; + + // TODO(nzakas): Figure out logical things to do with destructured, default, rest params + if (bindingParam.type === "Identifier") { + const name = bindingParam.name; + + if (jsdocParamNames[paramsIndex] && (name !== jsdocParamNames[paramsIndex])) { + context.report({ + node: jsdocNode, + messageId: "expected", + loc: getAbsoluteRange(jsdocNode, paramTagsByName[jsdocParamNames[paramsIndex]]), + data: { + name, + jsdocName: jsdocParamNames[paramsIndex] + } + }); + } else if (!paramTagsByName[name] && !isOverride) { + context.report({ + node: jsdocNode, + messageId: "missingParam", + data: { + name + } + }); + } + } + }); + } + + if (options.matchDescription) { + const regex = new RegExp(options.matchDescription, "u"); + + if (!regex.test(jsdoc.description)) { + context.report({ node: jsdocNode, messageId: "unsatisfiedDesc" }); + } + } + + } + + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ArrowFunctionExpression: startFunction, + FunctionExpression: startFunction, + FunctionDeclaration: startFunction, + ClassExpression: startFunction, + ClassDeclaration: startFunction, + "ArrowFunctionExpression:exit": checkJSDoc, + "FunctionExpression:exit": checkJSDoc, + "FunctionDeclaration:exit": checkJSDoc, + "ClassExpression:exit": checkJSDoc, + "ClassDeclaration:exit": checkJSDoc, + ReturnStatement: addReturn + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/valid-typeof.js b/node_modules/eslint/lib/rules/valid-typeof.js new file mode 100644 index 0000000..2286d89 --- /dev/null +++ b/node_modules/eslint/lib/rules/valid-typeof.js @@ -0,0 +1,121 @@ +/** + * @fileoverview Ensures that the results of typeof are compared against a valid string + * @author Ian Christian Myers + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "problem", + + docs: { + description: "enforce comparing `typeof` expressions against valid strings", + recommended: true, + url: "https://eslint.org/docs/rules/valid-typeof" + }, + + hasSuggestions: true, + + schema: [ + { + type: "object", + properties: { + requireStringLiterals: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { + invalidValue: "Invalid typeof comparison value.", + notString: "Typeof comparisons should be to string literals.", + suggestString: 'Use `"{{type}}"` instead of `{{type}}`.' + } + }, + + create(context) { + + const VALID_TYPES = new Set(["symbol", "undefined", "object", "boolean", "number", "string", "function", "bigint"]), + OPERATORS = new Set(["==", "===", "!=", "!=="]); + + const requireStringLiterals = context.options[0] && context.options[0].requireStringLiterals; + + let globalScope; + + /** + * Checks whether the given node represents a reference to a global variable that is not declared in the source code. + * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a reference to a global variable. + */ + function isReferenceToGlobalVariable(node) { + const variable = globalScope.set.get(node.name); + + return variable && variable.defs.length === 0 && + variable.references.some(ref => ref.identifier === node); + } + + /** + * Determines whether a node is a typeof expression. + * @param {ASTNode} node The node + * @returns {boolean} `true` if the node is a typeof expression + */ + function isTypeofExpression(node) { + return node.type === "UnaryExpression" && node.operator === "typeof"; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + Program() { + globalScope = context.getScope(); + }, + + UnaryExpression(node) { + if (isTypeofExpression(node)) { + const parent = context.getAncestors().pop(); + + if (parent.type === "BinaryExpression" && OPERATORS.has(parent.operator)) { + const sibling = parent.left === node ? parent.right : parent.left; + + if (sibling.type === "Literal" || sibling.type === "TemplateLiteral" && !sibling.expressions.length) { + const value = sibling.type === "Literal" ? sibling.value : sibling.quasis[0].value.cooked; + + if (!VALID_TYPES.has(value)) { + context.report({ node: sibling, messageId: "invalidValue" }); + } + } else if (sibling.type === "Identifier" && sibling.name === "undefined" && isReferenceToGlobalVariable(sibling)) { + context.report({ + node: sibling, + messageId: requireStringLiterals ? "notString" : "invalidValue", + suggest: [ + { + messageId: "suggestString", + data: { type: "undefined" }, + fix(fixer) { + return fixer.replaceText(sibling, '"undefined"'); + } + } + ] + }); + } else if (requireStringLiterals && !isTypeofExpression(sibling)) { + context.report({ node: sibling, messageId: "notString" }); + } + } + } + } + + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/vars-on-top.js b/node_modules/eslint/lib/rules/vars-on-top.js new file mode 100644 index 0000000..09e9932 --- /dev/null +++ b/node_modules/eslint/lib/rules/vars-on-top.js @@ -0,0 +1,157 @@ +/** + * @fileoverview Rule to enforce var declarations are only at the top of a function. + * @author Danny Fritz + * @author Gyandeep Singh + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "require `var` declarations be placed at the top of their containing scope", + recommended: false, + url: "https://eslint.org/docs/rules/vars-on-top" + }, + + schema: [], + messages: { + top: "All 'var' declarations must be at the top of the function scope." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Has AST suggesting a directive. + * @param {ASTNode} node any node + * @returns {boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === "ExpressionStatement" && + node.expression.type === "Literal" && typeof node.expression.value === "string"; + } + + /** + * Check to see if its a ES6 import declaration + * @param {ASTNode} node any node + * @returns {boolean} whether the given node represents a import declaration + */ + function looksLikeImport(node) { + return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" || + node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier"; + } + + /** + * Checks whether a given node is a variable declaration or not. + * @param {ASTNode} node any node + * @returns {boolean} `true` if the node is a variable declaration. + */ + function isVariableDeclaration(node) { + return ( + node.type === "VariableDeclaration" || + ( + node.type === "ExportNamedDeclaration" && + node.declaration && + node.declaration.type === "VariableDeclaration" + ) + ); + } + + /** + * Checks whether this variable is on top of the block body + * @param {ASTNode} node The node to check + * @param {ASTNode[]} statements collection of ASTNodes for the parent node block + * @returns {boolean} True if var is on top otherwise false + */ + function isVarOnTop(node, statements) { + const l = statements.length; + let i = 0; + + // Skip over directives and imports. Static blocks don't have either. + if (node.parent.type !== "StaticBlock") { + for (; i < l; ++i) { + if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) { + break; + } + } + } + + for (; i < l; ++i) { + if (!isVariableDeclaration(statements[i])) { + return false; + } + if (statements[i] === node) { + return true; + } + } + + return false; + } + + /** + * Checks whether variable is on top at the global level + * @param {ASTNode} node The node to check + * @param {ASTNode} parent Parent of the node + * @returns {void} + */ + function globalVarCheck(node, parent) { + if (!isVarOnTop(node, parent.body)) { + context.report({ node, messageId: "top" }); + } + } + + /** + * Checks whether variable is on top at functional block scope level + * @param {ASTNode} node The node to check + * @returns {void} + */ + function blockScopeVarCheck(node) { + const { parent } = node; + + if ( + parent.type === "BlockStatement" && + /Function/u.test(parent.parent.type) && + isVarOnTop(node, parent.body) + ) { + return; + } + + if ( + parent.type === "StaticBlock" && + isVarOnTop(node, parent.body) + ) { + return; + } + + context.report({ node, messageId: "top" }); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "VariableDeclaration[kind='var']"(node) { + if (node.parent.type === "ExportNamedDeclaration") { + globalVarCheck(node.parent, node.parent.parent); + } else if (node.parent.type === "Program") { + globalVarCheck(node, node.parent); + } else { + blockScopeVarCheck(node); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/wrap-iife.js b/node_modules/eslint/lib/rules/wrap-iife.js new file mode 100644 index 0000000..8523796 --- /dev/null +++ b/node_modules/eslint/lib/rules/wrap-iife.js @@ -0,0 +1,204 @@ +/** + * @fileoverview Rule to flag when IIFE is not wrapped in parens + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const eslintUtils = require("eslint-utils"); + +//---------------------------------------------------------------------- +// Helpers +//---------------------------------------------------------------------- + +/** + * Check if the given node is callee of a `NewExpression` node + * @param {ASTNode} node node to check + * @returns {boolean} True if the node is callee of a `NewExpression` node + * @private + */ +function isCalleeOfNewExpression(node) { + const maybeCallee = node.parent.type === "ChainExpression" + ? node.parent + : node; + + return ( + maybeCallee.parent.type === "NewExpression" && + maybeCallee.parent.callee === maybeCallee + ); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require parentheses around immediate `function` invocations", + recommended: false, + url: "https://eslint.org/docs/rules/wrap-iife" + }, + + schema: [ + { + enum: ["outside", "inside", "any"] + }, + { + type: "object", + properties: { + functionPrototypeMethods: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "code", + messages: { + wrapInvocation: "Wrap an immediate function invocation in parentheses.", + wrapExpression: "Wrap only the function expression in parens.", + moveInvocation: "Move the invocation into the parens that contain the function." + } + }, + + create(context) { + + const style = context.options[0] || "outside"; + const includeFunctionPrototypeMethods = context.options[1] && context.options[1].functionPrototypeMethods; + + const sourceCode = context.getSourceCode(); + + /** + * Check if the node is wrapped in any (). All parens count: grouping parens and parens for constructs such as if() + * @param {ASTNode} node node to evaluate + * @returns {boolean} True if it is wrapped in any parens + * @private + */ + function isWrappedInAnyParens(node) { + return astUtils.isParenthesised(sourceCode, node); + } + + /** + * Check if the node is wrapped in grouping (). Parens for constructs such as if() don't count + * @param {ASTNode} node node to evaluate + * @returns {boolean} True if it is wrapped in grouping parens + * @private + */ + function isWrappedInGroupingParens(node) { + return eslintUtils.isParenthesized(1, node, sourceCode); + } + + /** + * Get the function node from an IIFE + * @param {ASTNode} node node to evaluate + * @returns {ASTNode} node that is the function expression of the given IIFE, or null if none exist + */ + function getFunctionNodeFromIIFE(node) { + const callee = astUtils.skipChainExpression(node.callee); + + if (callee.type === "FunctionExpression") { + return callee; + } + + if (includeFunctionPrototypeMethods && + callee.type === "MemberExpression" && + callee.object.type === "FunctionExpression" && + (astUtils.getStaticPropertyName(callee) === "call" || astUtils.getStaticPropertyName(callee) === "apply") + ) { + return callee.object; + } + + return null; + } + + + return { + CallExpression(node) { + const innerNode = getFunctionNodeFromIIFE(node); + + if (!innerNode) { + return; + } + + const isCallExpressionWrapped = isWrappedInAnyParens(node), + isFunctionExpressionWrapped = isWrappedInAnyParens(innerNode); + + if (!isCallExpressionWrapped && !isFunctionExpressionWrapped) { + context.report({ + node, + messageId: "wrapInvocation", + fix(fixer) { + const nodeToSurround = style === "inside" ? innerNode : node; + + return fixer.replaceText(nodeToSurround, `(${sourceCode.getText(nodeToSurround)})`); + } + }); + } else if (style === "inside" && !isFunctionExpressionWrapped) { + context.report({ + node, + messageId: "wrapExpression", + fix(fixer) { + + // The outer call expression will always be wrapped at this point. + + if (isWrappedInGroupingParens(node) && !isCalleeOfNewExpression(node)) { + + /* + * Parenthesize the function expression and remove unnecessary grouping parens around the call expression. + * Replace the range between the end of the function expression and the end of the call expression. + * for example, in `(function(foo) {}(bar))`, the range `(bar))` should get replaced with `)(bar)`. + */ + + const parenAfter = sourceCode.getTokenAfter(node); + + return fixer.replaceTextRange( + [innerNode.range[1], parenAfter.range[1]], + `)${sourceCode.getText().slice(innerNode.range[1], parenAfter.range[0])}` + ); + } + + /* + * Call expression is wrapped in mandatory parens such as if(), or in necessary grouping parens. + * These parens cannot be removed, so just parenthesize the function expression. + */ + + return fixer.replaceText(innerNode, `(${sourceCode.getText(innerNode)})`); + } + }); + } else if (style === "outside" && !isCallExpressionWrapped) { + context.report({ + node, + messageId: "moveInvocation", + fix(fixer) { + + /* + * The inner function expression will always be wrapped at this point. + * It's only necessary to replace the range between the end of the function expression + * and the call expression. For example, in `(function(foo) {})(bar)`, the range `)(bar)` + * should get replaced with `(bar))`. + */ + const parenAfter = sourceCode.getTokenAfter(innerNode); + + return fixer.replaceTextRange( + [parenAfter.range[0], node.range[1]], + `${sourceCode.getText().slice(parenAfter.range[1], node.range[1])})` + ); + } + }); + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/wrap-regex.js b/node_modules/eslint/lib/rules/wrap-regex.js new file mode 100644 index 0000000..b10f2ec --- /dev/null +++ b/node_modules/eslint/lib/rules/wrap-regex.js @@ -0,0 +1,59 @@ +/** + * @fileoverview Rule to flag when regex literals are not wrapped in parens + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require parenthesis around regex literals", + recommended: false, + url: "https://eslint.org/docs/rules/wrap-regex" + }, + + schema: [], + fixable: "code", + + messages: { + requireParens: "Wrap the regexp literal in parens to disambiguate the slash." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + return { + + Literal(node) { + const token = sourceCode.getFirstToken(node), + nodeType = token.type; + + if (nodeType === "RegularExpression") { + const beforeToken = sourceCode.getTokenBefore(node); + const afterToken = sourceCode.getTokenAfter(node); + const ancestors = context.getAncestors(); + const grandparent = ancestors[ancestors.length - 1]; + + if (grandparent.type === "MemberExpression" && grandparent.object === node && + !(beforeToken && beforeToken.value === "(" && afterToken && afterToken.value === ")")) { + context.report({ + node, + messageId: "requireParens", + fix: fixer => fixer.replaceText(node, `(${sourceCode.getText(node)})`) + }); + } + } + } + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/yield-star-spacing.js b/node_modules/eslint/lib/rules/yield-star-spacing.js new file mode 100644 index 0000000..884a3a4 --- /dev/null +++ b/node_modules/eslint/lib/rules/yield-star-spacing.js @@ -0,0 +1,127 @@ +/** + * @fileoverview Rule to check the spacing around the * in yield* expressions. + * @author Bryan Smith + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "layout", + + docs: { + description: "require or disallow spacing around the `*` in `yield*` expressions", + recommended: false, + url: "https://eslint.org/docs/rules/yield-star-spacing" + }, + + fixable: "whitespace", + + schema: [ + { + oneOf: [ + { + enum: ["before", "after", "both", "neither"] + }, + { + type: "object", + properties: { + before: { type: "boolean" }, + after: { type: "boolean" } + }, + additionalProperties: false + } + ] + } + ], + messages: { + missingBefore: "Missing space before *.", + missingAfter: "Missing space after *.", + unexpectedBefore: "Unexpected space before *.", + unexpectedAfter: "Unexpected space after *." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const mode = (function(option) { + if (!option || typeof option === "string") { + return { + before: { before: true, after: false }, + after: { before: false, after: true }, + both: { before: true, after: true }, + neither: { before: false, after: false } + }[option || "after"]; + } + return option; + }(context.options[0])); + + /** + * Checks the spacing between two tokens before or after the star token. + * @param {string} side Either "before" or "after". + * @param {Token} leftToken `function` keyword token if side is "before", or + * star token if side is "after". + * @param {Token} rightToken Star token if side is "before", or identifier + * token if side is "after". + * @returns {void} + */ + function checkSpacing(side, leftToken, rightToken) { + if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken) !== mode[side]) { + const after = leftToken.value === "*"; + const spaceRequired = mode[side]; + const node = after ? leftToken : rightToken; + let messageId = ""; + + if (spaceRequired) { + messageId = side === "before" ? "missingBefore" : "missingAfter"; + } else { + messageId = side === "before" ? "unexpectedBefore" : "unexpectedAfter"; + } + + context.report({ + node, + messageId, + fix(fixer) { + if (spaceRequired) { + if (after) { + return fixer.insertTextAfter(node, " "); + } + return fixer.insertTextBefore(node, " "); + } + return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); + } + }); + } + } + + /** + * Enforces the spacing around the star if node is a yield* expression. + * @param {ASTNode} node A yield expression node. + * @returns {void} + */ + function checkExpression(node) { + if (!node.delegate) { + return; + } + + const tokens = sourceCode.getFirstTokens(node, 3); + const yieldToken = tokens[0]; + const starToken = tokens[1]; + const nextToken = tokens[2]; + + checkSpacing("before", yieldToken, starToken); + checkSpacing("after", starToken, nextToken); + } + + return { + YieldExpression: checkExpression + }; + + } +}; diff --git a/node_modules/eslint/lib/rules/yoda.js b/node_modules/eslint/lib/rules/yoda.js new file mode 100644 index 0000000..5b64287 --- /dev/null +++ b/node_modules/eslint/lib/rules/yoda.js @@ -0,0 +1,362 @@ +/** + * @fileoverview Rule to require or disallow yoda comparisons + * @author Nicholas C. Zakas + */ +"use strict"; + +//-------------------------------------------------------------------------- +// Requirements +//-------------------------------------------------------------------------- + +const astUtils = require("./utils/ast-utils"); + +//-------------------------------------------------------------------------- +// Helpers +//-------------------------------------------------------------------------- + +/** + * Determines whether an operator is a comparison operator. + * @param {string} operator The operator to check. + * @returns {boolean} Whether or not it is a comparison operator. + */ +function isComparisonOperator(operator) { + return /^(==|===|!=|!==|<|>|<=|>=)$/u.test(operator); +} + +/** + * Determines whether an operator is an equality operator. + * @param {string} operator The operator to check. + * @returns {boolean} Whether or not it is an equality operator. + */ +function isEqualityOperator(operator) { + return /^(==|===)$/u.test(operator); +} + +/** + * Determines whether an operator is one used in a range test. + * Allowed operators are `<` and `<=`. + * @param {string} operator The operator to check. + * @returns {boolean} Whether the operator is used in range tests. + */ +function isRangeTestOperator(operator) { + return ["<", "<="].includes(operator); +} + +/** + * Determines whether a non-Literal node is a negative number that should be + * treated as if it were a single Literal node. + * @param {ASTNode} node Node to test. + * @returns {boolean} True if the node is a negative number that looks like a + * real literal and should be treated as such. + */ +function isNegativeNumericLiteral(node) { + return ( + node.type === "UnaryExpression" && + node.operator === "-" && + node.prefix && + astUtils.isNumericLiteral(node.argument) + ); +} + +/** + * Determines whether a node is a Template Literal which can be determined statically. + * @param {ASTNode} node Node to test + * @returns {boolean} True if the node is a Template Literal without expression. + */ +function isStaticTemplateLiteral(node) { + return node.type === "TemplateLiteral" && node.expressions.length === 0; +} + +/** + * Determines whether a non-Literal node should be treated as a single Literal node. + * @param {ASTNode} node Node to test + * @returns {boolean} True if the node should be treated as a single Literal node. + */ +function looksLikeLiteral(node) { + return isNegativeNumericLiteral(node) || isStaticTemplateLiteral(node); +} + +/** + * Attempts to derive a Literal node from nodes that are treated like literals. + * @param {ASTNode} node Node to normalize. + * @returns {ASTNode} One of the following options. + * 1. The original node if the node is already a Literal + * 2. A normalized Literal node with the negative number as the value if the + * node represents a negative number literal. + * 3. A normalized Literal node with the string as the value if the node is + * a Template Literal without expression. + * 4. Otherwise `null`. + */ +function getNormalizedLiteral(node) { + if (node.type === "Literal") { + return node; + } + + if (isNegativeNumericLiteral(node)) { + return { + type: "Literal", + value: -node.argument.value, + raw: `-${node.argument.value}` + }; + } + + if (isStaticTemplateLiteral(node)) { + return { + type: "Literal", + value: node.quasis[0].value.cooked, + raw: node.quasis[0].value.raw + }; + } + + return null; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** @type {import('../shared/types').Rule} */ +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: 'require or disallow "Yoda" conditions', + recommended: false, + url: "https://eslint.org/docs/rules/yoda" + }, + + schema: [ + { + enum: ["always", "never"] + }, + { + type: "object", + properties: { + exceptRange: { + type: "boolean", + default: false + }, + onlyEquality: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + + fixable: "code", + messages: { + expected: + "Expected literal to be on the {{expectedSide}} side of {{operator}}." + } + }, + + create(context) { + + // Default to "never" (!always) if no option + const always = context.options[0] === "always"; + const exceptRange = + context.options[1] && context.options[1].exceptRange; + const onlyEquality = + context.options[1] && context.options[1].onlyEquality; + + const sourceCode = context.getSourceCode(); + + /** + * Determines whether node represents a range test. + * A range test is a "between" test like `(0 <= x && x < 1)` or an "outside" + * test like `(x < 0 || 1 <= x)`. It must be wrapped in parentheses, and + * both operators must be `<` or `<=`. Finally, the literal on the left side + * must be less than or equal to the literal on the right side so that the + * test makes any sense. + * @param {ASTNode} node LogicalExpression node to test. + * @returns {boolean} Whether node is a range test. + */ + function isRangeTest(node) { + const left = node.left, + right = node.right; + + /** + * Determines whether node is of the form `0 <= x && x < 1`. + * @returns {boolean} Whether node is a "between" range test. + */ + function isBetweenTest() { + if (node.operator === "&&" && astUtils.isSameReference(left.right, right.left)) { + const leftLiteral = getNormalizedLiteral(left.left); + const rightLiteral = getNormalizedLiteral(right.right); + + if (leftLiteral === null && rightLiteral === null) { + return false; + } + + if (rightLiteral === null || leftLiteral === null) { + return true; + } + + if (leftLiteral.value <= rightLiteral.value) { + return true; + } + } + return false; + } + + /** + * Determines whether node is of the form `x < 0 || 1 <= x`. + * @returns {boolean} Whether node is an "outside" range test. + */ + function isOutsideTest() { + if (node.operator === "||" && astUtils.isSameReference(left.left, right.right)) { + const leftLiteral = getNormalizedLiteral(left.right); + const rightLiteral = getNormalizedLiteral(right.left); + + if (leftLiteral === null && rightLiteral === null) { + return false; + } + + if (rightLiteral === null || leftLiteral === null) { + return true; + } + + if (leftLiteral.value <= rightLiteral.value) { + return true; + } + } + + return false; + } + + /** + * Determines whether node is wrapped in parentheses. + * @returns {boolean} Whether node is preceded immediately by an open + * paren token and followed immediately by a close + * paren token. + */ + function isParenWrapped() { + return astUtils.isParenthesised(sourceCode, node); + } + + return ( + node.type === "LogicalExpression" && + left.type === "BinaryExpression" && + right.type === "BinaryExpression" && + isRangeTestOperator(left.operator) && + isRangeTestOperator(right.operator) && + (isBetweenTest() || isOutsideTest()) && + isParenWrapped() + ); + } + + const OPERATOR_FLIP_MAP = { + "===": "===", + "!==": "!==", + "==": "==", + "!=": "!=", + "<": ">", + ">": "<", + "<=": ">=", + ">=": "<=" + }; + + /** + * Returns a string representation of a BinaryExpression node with its sides/operator flipped around. + * @param {ASTNode} node The BinaryExpression node + * @returns {string} A string representation of the node with the sides and operator flipped + */ + function getFlippedString(node) { + const operatorToken = sourceCode.getFirstTokenBetween( + node.left, + node.right, + token => token.value === node.operator + ); + const lastLeftToken = sourceCode.getTokenBefore(operatorToken); + const firstRightToken = sourceCode.getTokenAfter(operatorToken); + + const source = sourceCode.getText(); + + const leftText = source.slice( + node.range[0], + lastLeftToken.range[1] + ); + const textBeforeOperator = source.slice( + lastLeftToken.range[1], + operatorToken.range[0] + ); + const textAfterOperator = source.slice( + operatorToken.range[1], + firstRightToken.range[0] + ); + const rightText = source.slice( + firstRightToken.range[0], + node.range[1] + ); + + const tokenBefore = sourceCode.getTokenBefore(node); + const tokenAfter = sourceCode.getTokenAfter(node); + let prefix = ""; + let suffix = ""; + + if ( + tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, firstRightToken) + ) { + prefix = " "; + } + + if ( + tokenAfter && + node.range[1] === tokenAfter.range[0] && + !astUtils.canTokensBeAdjacent(lastLeftToken, tokenAfter) + ) { + suffix = " "; + } + + return ( + prefix + + rightText + + textBeforeOperator + + OPERATOR_FLIP_MAP[operatorToken.value] + + textAfterOperator + + leftText + + suffix + ); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + BinaryExpression(node) { + const expectedLiteral = always ? node.left : node.right; + const expectedNonLiteral = always ? node.right : node.left; + + // If `expectedLiteral` is not a literal, and `expectedNonLiteral` is a literal, raise an error. + if ( + (expectedNonLiteral.type === "Literal" || + looksLikeLiteral(expectedNonLiteral)) && + !( + expectedLiteral.type === "Literal" || + looksLikeLiteral(expectedLiteral) + ) && + !(!isEqualityOperator(node.operator) && onlyEquality) && + isComparisonOperator(node.operator) && + !(exceptRange && isRangeTest(context.getAncestors().pop())) + ) { + context.report({ + node, + messageId: "expected", + data: { + operator: node.operator, + expectedSide: always ? "left" : "right" + }, + fix: fixer => + fixer.replaceText(node, getFlippedString(node)) + }); + } + } + }; + } +}; diff --git a/node_modules/eslint/lib/shared/ajv.js b/node_modules/eslint/lib/shared/ajv.js new file mode 100644 index 0000000..f4f6a62 --- /dev/null +++ b/node_modules/eslint/lib/shared/ajv.js @@ -0,0 +1,34 @@ +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Ajv = require("ajv"), + metaSchema = require("ajv/lib/refs/json-schema-draft-04.json"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = (additionalOptions = {}) => { + const ajv = new Ajv({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); + + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle -- Ajv's API + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +}; diff --git a/node_modules/eslint/lib/shared/ast-utils.js b/node_modules/eslint/lib/shared/ast-utils.js new file mode 100644 index 0000000..4ebd49c --- /dev/null +++ b/node_modules/eslint/lib/shared/ast-utils.js @@ -0,0 +1,29 @@ +/** + * @fileoverview Common utils for AST. + * + * This file contains only shared items for core and rules. + * If you make a utility for rules, please see `../rules/utils/ast-utils.js`. + * + * @author Toru Nagashima + */ +"use strict"; + +const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u; +const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u; +const shebangPattern = /^#!([^\r\n]+)/u; + +/** + * Creates a version of the `lineBreakPattern` regex with the global flag. + * Global regexes are mutable, so this needs to be a function instead of a constant. + * @returns {RegExp} A global regular expression that matches line terminators + */ +function createGlobalLinebreakMatcher() { + return new RegExp(lineBreakPattern.source, "gu"); +} + +module.exports = { + breakableTypePattern, + lineBreakPattern, + createGlobalLinebreakMatcher, + shebangPattern +}; diff --git a/node_modules/eslint/lib/shared/config-validator.js b/node_modules/eslint/lib/shared/config-validator.js new file mode 100644 index 0000000..47353ac --- /dev/null +++ b/node_modules/eslint/lib/shared/config-validator.js @@ -0,0 +1,347 @@ +/* + * STOP!!! DO NOT MODIFY. + * + * This file is part of the ongoing work to move the eslintrc-style config + * system into the @eslint/eslintrc package. This file needs to remain + * unchanged in order for this work to proceed. + * + * If you think you need to change this file, please contact @nzakas first. + * + * Thanks in advance for your cooperation. + */ + +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const + util = require("util"), + configSchema = require("../../conf/config-schema"), + BuiltInRules = require("../rules"), + { + Legacy: { + ConfigOps, + environments: BuiltInEnvironments + } + } = require("@eslint/eslintrc"), + { emitDeprecationWarning } = require("./deprecation-warnings"); + +const ajv = require("./ajv")(); +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +/** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ +function getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; +} + +/** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @throws {Error} Wrong severity value. + * @returns {number|string} The rule's severity value + */ +function validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + +} + +/** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @throws {Error} Any rule validation errors. + * @returns {void} + */ +function validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } +} + +/** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @throws {Error} Upon any bad rule configuration. + * @returns {void} + */ +function validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = validateRuleSeverity(options); + + if (severity !== 0) { + validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } +} + +/** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ +function validateEnvironment( + environment, + source, + getAdditionalEnv = noop +) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); +} + +/** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ +function validateRules( + rulesConfig, + source, + getAdditionalRule = noop +) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || BuiltInRules.get(id) || null; + + validateRuleOptions(rule, id, rulesConfig[id], source); + }); +} + +/** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ +function validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + ConfigOps.normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); +} + +/** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {(id:string) => Processor} getProcessor The getter of defined processors. + * @throws {Error} For invalid processor configuration. + * @returns {void} + */ +function validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } +} + +/** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ +function formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); +} + +/** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @throws {Error} For any config invalid per the schema. + * @returns {void} + */ +function validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } +} + +/** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ +function validate(config, source, getAdditionalRule, getAdditionalEnv) { + validateConfigSchema(config, source); + validateRules(config.rules, source, getAdditionalRule); + validateEnvironment(config.env, source, getAdditionalEnv); + validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + validateRules(override.rules, source, getAdditionalRule); + validateEnvironment(override.env, source, getAdditionalEnv); + validateGlobals(config.globals, source); + } +} + +const validated = new WeakSet(); + +/** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ +function validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + validateEnvironment(element.env, element.name, getPluginEnv); + validateGlobals(element.globals, element.name); + validateProcessor(element.processor, element.name, getPluginProcessor); + validateRules(element.rules, element.name, getPluginRule); + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + getRuleOptionsSchema, + validate, + validateConfigArray, + validateConfigSchema, + validateRuleOptions +}; diff --git a/node_modules/eslint/lib/shared/deprecation-warnings.js b/node_modules/eslint/lib/shared/deprecation-warnings.js new file mode 100644 index 0000000..d09cafb --- /dev/null +++ b/node_modules/eslint/lib/shared/deprecation-warnings.js @@ -0,0 +1,58 @@ +/** + * @fileoverview Provide the function that emits deprecation warnings. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const path = require("path"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// Definitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect." +}; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param {string} source The name of the configuration source to report the warning for. + * @param {string} errorCode The warning message to show. + * @returns {void} + */ +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + + sourceFileErrorCache.add(cacheKey); + + const rel = path.relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + emitDeprecationWarning +}; diff --git a/node_modules/eslint/lib/shared/logging.js b/node_modules/eslint/lib/shared/logging.js new file mode 100644 index 0000000..7f06a74 --- /dev/null +++ b/node_modules/eslint/lib/shared/logging.js @@ -0,0 +1,30 @@ +/** + * @fileoverview Handle logging for ESLint + * @author Gyandeep Singh + */ + +"use strict"; + +/* eslint no-console: "off" -- Logging util */ + +/* istanbul ignore next */ +module.exports = { + + /** + * Cover for console.log + * @param {...any} args The elements to log. + * @returns {void} + */ + info(...args) { + console.log(...args); + }, + + /** + * Cover for console.error + * @param {...any} args The elements to log. + * @returns {void} + */ + error(...args) { + console.error(...args); + } +}; diff --git a/node_modules/eslint/lib/shared/relative-module-resolver.js b/node_modules/eslint/lib/shared/relative-module-resolver.js new file mode 100644 index 0000000..18a6949 --- /dev/null +++ b/node_modules/eslint/lib/shared/relative-module-resolver.js @@ -0,0 +1,50 @@ +/* + * STOP!!! DO NOT MODIFY. + * + * This file is part of the ongoing work to move the eslintrc-style config + * system into the @eslint/eslintrc package. This file needs to remain + * unchanged in order for this work to proceed. + * + * If you think you need to change this file, please contact @nzakas first. + * + * Thanks in advance for your cooperation. + */ + +/** + * Utility for resolving a module relative to another module + * @author Teddy Katz + */ + +"use strict"; + +const { createRequire } = require("module"); + +module.exports = { + + /** + * Resolves a Node module relative to another module + * @param {string} moduleName The name of a Node module, or a path to a Node module. + * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be + * a file rather than a directory, but the file need not actually exist. + * @throws {Error} Any error from `module.createRequire` or its `resolve`. + * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` + */ + resolve(moduleName, relativeToPath) { + try { + return createRequire(relativeToPath).resolve(moduleName); + } catch (error) { + + // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. + if ( + typeof error === "object" && + error !== null && + error.code === "MODULE_NOT_FOUND" && + !error.requireStack && + error.message.includes(moduleName) + ) { + error.message += `\nRequire stack:\n- ${relativeToPath}`; + } + throw error; + } + } +}; diff --git a/node_modules/eslint/lib/shared/runtime-info.js b/node_modules/eslint/lib/shared/runtime-info.js new file mode 100644 index 0000000..56c0898 --- /dev/null +++ b/node_modules/eslint/lib/shared/runtime-info.js @@ -0,0 +1,167 @@ +/** + * @fileoverview Utility to get information about the execution environment. + * @author Kai Cataldo + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const path = require("path"); +const spawn = require("cross-spawn"); +const os = require("os"); +const log = require("../shared/logging"); +const packageJson = require("../../package.json"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Generates and returns execution environment information. + * @returns {string} A string that contains execution environment information. + */ +function environment() { + const cache = new Map(); + + /** + * Checks if a path is a child of a directory. + * @param {string} parentPath The parent path to check. + * @param {string} childPath The path to check. + * @returns {boolean} Whether or not the given path is a child of a directory. + */ + function isChildOfDirectory(parentPath, childPath) { + return !path.relative(parentPath, childPath).startsWith(".."); + } + + /** + * Synchronously executes a shell command and formats the result. + * @param {string} cmd The command to execute. + * @param {Array} args The arguments to be executed with the command. + * @throws {Error} As may be collected by `cross-spawn.sync`. + * @returns {string} The version returned by the command. + */ + function execCommand(cmd, args) { + const key = [cmd, ...args].join(" "); + + if (cache.has(key)) { + return cache.get(key); + } + + const process = spawn.sync(cmd, args, { encoding: "utf8" }); + + if (process.error) { + throw process.error; + } + + const result = process.stdout.trim(); + + cache.set(key, result); + return result; + } + + /** + * Normalizes a version number. + * @param {string} versionStr The string to normalize. + * @returns {string} The normalized version number. + */ + function normalizeVersionStr(versionStr) { + return versionStr.startsWith("v") ? versionStr : `v${versionStr}`; + } + + /** + * Gets bin version. + * @param {string} bin The bin to check. + * @throws {Error} As may be collected by `cross-spawn.sync`. + * @returns {string} The normalized version returned by the command. + */ + function getBinVersion(bin) { + const binArgs = ["--version"]; + + try { + return normalizeVersionStr(execCommand(bin, binArgs)); + } catch (e) { + log.error(`Error finding ${bin} version running the command \`${bin} ${binArgs.join(" ")}\``); + throw e; + } + } + + /** + * Gets installed npm package version. + * @param {string} pkg The package to check. + * @param {boolean} global Whether to check globally or not. + * @throws {Error} As may be collected by `cross-spawn.sync`. + * @returns {string} The normalized version returned by the command. + */ + function getNpmPackageVersion(pkg, { global = false } = {}) { + const npmBinArgs = ["bin", "-g"]; + const npmLsArgs = ["ls", "--depth=0", "--json", "eslint"]; + + if (global) { + npmLsArgs.push("-g"); + } + + try { + const parsedStdout = JSON.parse(execCommand("npm", npmLsArgs)); + + /* + * Checking globally returns an empty JSON object, while local checks + * include the name and version of the local project. + */ + if (Object.keys(parsedStdout).length === 0 || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) { + return "Not found"; + } + + const [, processBinPath] = process.argv; + let npmBinPath; + + try { + npmBinPath = execCommand("npm", npmBinArgs); + } catch (e) { + log.error(`Error finding npm binary path when running command \`npm ${npmBinArgs.join(" ")}\``); + throw e; + } + + const isGlobal = isChildOfDirectory(npmBinPath, processBinPath); + let pkgVersion = parsedStdout.dependencies.eslint.version; + + if ((global && isGlobal) || (!global && !isGlobal)) { + pkgVersion += " (Currently used)"; + } + + return normalizeVersionStr(pkgVersion); + } catch (e) { + log.error(`Error finding ${pkg} version running the command \`npm ${npmLsArgs.join(" ")}\``); + throw e; + } + } + + return [ + "Environment Info:", + "", + `Node version: ${getBinVersion("node")}`, + `npm version: ${getBinVersion("npm")}`, + `Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`, + `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`, + `Operating System: ${os.platform()} ${os.release()}` + ].join("\n"); +} + +/** + * Returns version of currently executing ESLint. + * @returns {string} The version from the currently executing ESLint's package.json. + */ +function version() { + return `v${packageJson.version}`; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + environment, + version +}; diff --git a/node_modules/eslint/lib/shared/string-utils.js b/node_modules/eslint/lib/shared/string-utils.js new file mode 100644 index 0000000..e4a55d7 --- /dev/null +++ b/node_modules/eslint/lib/shared/string-utils.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Utilities to operate on strings. + * @author Stephen Wade + */ + +"use strict"; + +/** + * Converts the first letter of a string to uppercase. + * @param {string} string The string to operate on + * @returns {string} The converted string + */ +function upperCaseFirst(string) { + if (string.length <= 1) { + return string.toUpperCase(); + } + return string[0].toUpperCase() + string.slice(1); +} + +module.exports = { + upperCaseFirst +}; diff --git a/node_modules/eslint/lib/shared/traverser.js b/node_modules/eslint/lib/shared/traverser.js new file mode 100644 index 0000000..be0ed59 --- /dev/null +++ b/node_modules/eslint/lib/shared/traverser.js @@ -0,0 +1,195 @@ +/** + * @fileoverview Traverser to traverse AST trees. + * @author Nicholas C. Zakas + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const vk = require("eslint-visitor-keys"); +const debug = require("debug")("eslint:traverser"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Do nothing. + * @returns {void} + */ +function noop() { + + // do nothing. +} + +/** + * Check whether the given value is an ASTNode or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ +function isNode(x) { + return x !== null && typeof x === "object" && typeof x.type === "string"; +} + +/** + * Get the visitor keys of a given node. + * @param {Object} visitorKeys The map of visitor keys. + * @param {ASTNode} node The node to get their visitor keys. + * @returns {string[]} The visitor keys of the node. + */ +function getVisitorKeys(visitorKeys, node) { + let keys = visitorKeys[node.type]; + + if (!keys) { + keys = vk.getKeys(node); + debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys); + } + + return keys; +} + +/** + * The traverser class to traverse AST trees. + */ +class Traverser { + constructor() { + this._current = null; + this._parents = []; + this._skipped = false; + this._broken = false; + this._visitorKeys = null; + this._enter = null; + this._leave = null; + } + + /** + * Gives current node. + * @returns {ASTNode} The current node. + */ + current() { + return this._current; + } + + /** + * Gives a a copy of the ancestor nodes. + * @returns {ASTNode[]} The ancestor nodes. + */ + parents() { + return this._parents.slice(0); + } + + /** + * Break the current traversal. + * @returns {void} + */ + break() { + this._broken = true; + } + + /** + * Skip child nodes for the current traversal. + * @returns {void} + */ + skip() { + this._skipped = true; + } + + /** + * Traverse the given AST tree. + * @param {ASTNode} node The root node to traverse. + * @param {Object} options The option object. + * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. + * @param {Function} [options.enter=noop] The callback function which is called on entering each node. + * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. + * @returns {void} + */ + traverse(node, options) { + this._current = null; + this._parents = []; + this._skipped = false; + this._broken = false; + this._visitorKeys = options.visitorKeys || vk.KEYS; + this._enter = options.enter || noop; + this._leave = options.leave || noop; + this._traverse(node, null); + } + + /** + * Traverse the given AST tree recursively. + * @param {ASTNode} node The current node. + * @param {ASTNode|null} parent The parent node. + * @returns {void} + * @private + */ + _traverse(node, parent) { + if (!isNode(node)) { + return; + } + + this._current = node; + this._skipped = false; + this._enter(node, parent); + + if (!this._skipped && !this._broken) { + const keys = getVisitorKeys(this._visitorKeys, node); + + if (keys.length >= 1) { + this._parents.push(node); + for (let i = 0; i < keys.length && !this._broken; ++i) { + const child = node[keys[i]]; + + if (Array.isArray(child)) { + for (let j = 0; j < child.length && !this._broken; ++j) { + this._traverse(child[j], node); + } + } else { + this._traverse(child, node); + } + } + this._parents.pop(); + } + } + + if (!this._broken) { + this._leave(node, parent); + } + + this._current = parent; + } + + /** + * Calculates the keys to use for traversal. + * @param {ASTNode} node The node to read keys from. + * @returns {string[]} An array of keys to visit on the node. + * @private + */ + static getKeys(node) { + return vk.getKeys(node); + } + + /** + * Traverse the given AST tree. + * @param {ASTNode} node The root node to traverse. + * @param {Object} options The option object. + * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. + * @param {Function} [options.enter=noop] The callback function which is called on entering each node. + * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. + * @returns {void} + */ + static traverse(node, options) { + new Traverser().traverse(node, options); + } + + /** + * The default visitor keys. + * @type {Object} + */ + static get DEFAULT_VISITOR_KEYS() { + return vk.KEYS; + } +} + +module.exports = Traverser; diff --git a/node_modules/eslint/lib/shared/types.js b/node_modules/eslint/lib/shared/types.js new file mode 100644 index 0000000..5d9a4e6 --- /dev/null +++ b/node_modules/eslint/lib/shared/types.js @@ -0,0 +1,199 @@ +/** + * @fileoverview Define common types for input completion. + * @author Toru Nagashima + */ +"use strict"; + +/** @type {any} */ +module.exports = {}; + +/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */ +/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */ +/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */ + +/** + * @typedef {Object} EcmaFeatures + * @property {boolean} [globalReturn] Enabling `return` statements at the top-level. + * @property {boolean} [jsx] Enabling JSX syntax. + * @property {boolean} [impliedStrict] Enabling strict mode always. + */ + +/** + * @typedef {Object} ParserOptions + * @property {EcmaFeatures} [ecmaFeatures] The optional features. + * @property {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022} [ecmaVersion] The ECMAScript version (or revision number). + * @property {"script"|"module"} [sourceType] The source code type. + * @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3. + */ + +/** + * @typedef {Object} LanguageOptions + * @property {number|"latest"} [ecmaVersion] The ECMAScript version (or revision number). + * @property {Record} [globals] The global variable settings. + * @property {"script"|"module"|"commonjs"} [sourceType] The source code type. + * @property {string|Object} [parser] The parser to use. + * @property {Object} [parserOptions] The parser options to use. + */ + +/** + * @typedef {Object} ConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {Record} [globals] The global variable settings. + * @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {boolean} [root] The root flag. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} OverrideConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [excludedFiles] The glob patterns for excluded files. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {string | string[]} files The glob patterns for target files. + * @property {Record} [globals] The global variable settings. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} ParseResult + * @property {Object} ast The AST. + * @property {ScopeManager} [scopeManager] The scope manager of the AST. + * @property {Record} [services] The services that the parser provides. + * @property {Record} [visitorKeys] The visitor keys of the AST. + */ + +/** + * @typedef {Object} Parser + * @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables. + * @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} Environment + * @property {Record} [globals] The definition of global variables. + * @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} LintMessage + * @property {number|undefined} column The 1-based column number. + * @property {number} [endColumn] The 1-based column number of the end location. + * @property {number} [endLine] The 1-based line number of the end location. + * @property {boolean} fatal If `true` then this is a fatal error. + * @property {{range:[number,number], text:string}} [fix] Information for autofix. + * @property {number|undefined} line The 1-based line number. + * @property {string} message The error message. + * @property {string|null} ruleId The ID of the rule which makes this message. + * @property {0|1|2} severity The severity of this message. + * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. + */ + +/** + * @typedef {Object} SuppressedLintMessage + * @property {number|undefined} column The 1-based column number. + * @property {number} [endColumn] The 1-based column number of the end location. + * @property {number} [endLine] The 1-based line number of the end location. + * @property {boolean} fatal If `true` then this is a fatal error. + * @property {{range:[number,number], text:string}} [fix] Information for autofix. + * @property {number|undefined} line The 1-based line number. + * @property {string} message The error message. + * @property {string|null} ruleId The ID of the rule which makes this message. + * @property {0|1|2} severity The severity of this message. + * @property {Array<{kind: string, justification: string}>} suppressions The suppression info. + * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. + */ + +/** + * @typedef {Object} SuggestionResult + * @property {string} desc A short description. + * @property {string} [messageId] Id referencing a message for the description. + * @property {{ text: string, range: number[] }} fix fix result info + */ + +/** + * @typedef {Object} Processor + * @property {(text:string, filename:string) => Array} [preprocess] The function to extract code blocks. + * @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages. + * @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix. + */ + +/** + * @typedef {Object} RuleMetaDocs + * @property {string} description The description of the rule. + * @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset. + * @property {string} url The URL of the rule documentation. + */ + +/** + * @typedef {Object} RuleMeta + * @property {boolean} [deprecated] If `true` then the rule has been deprecated. + * @property {RuleMetaDocs} docs The document information of the rule. + * @property {"code"|"whitespace"} [fixable] The autofix type. + * @property {boolean} [hasSuggestions] If `true` then the rule provides suggestions. + * @property {Record} [messages] The messages the rule reports. + * @property {string[]} [replacedBy] The IDs of the alternative rules. + * @property {Array|Object} schema The option schema of the rule. + * @property {"problem"|"suggestion"|"layout"} type The rule type. + */ + +/** + * @typedef {Object} Rule + * @property {Function} create The factory of the rule. + * @property {RuleMeta} meta The meta data of the rule. + */ + +/** + * @typedef {Object} Plugin + * @property {Record} [configs] The definition of plugin configs. + * @property {Record} [environments] The definition of plugin environments. + * @property {Record} [processors] The definition of plugin processors. + * @property {Record} [rules] The definition of plugin rules. + */ + +/** + * Information of deprecated rules. + * @typedef {Object} DeprecatedRuleInfo + * @property {string} ruleId The rule ID. + * @property {string[]} replacedBy The rule IDs that replace this deprecated rule. + */ + +/** + * A linting result. + * @typedef {Object} LintResult + * @property {string} filePath The path to the file that was linted. + * @property {LintMessage[]} messages All of the messages for the result. + * @property {SuppressedLintMessage[]} suppressedMessages All of the suppressed messages for the result. + * @property {number} errorCount Number of errors for the result. + * @property {number} fatalErrorCount Number of fatal errors for the result. + * @property {number} warningCount Number of warnings for the result. + * @property {number} fixableErrorCount Number of fixable errors for the result. + * @property {number} fixableWarningCount Number of fixable warnings for the result. + * @property {string} [source] The source code of the file that was linted. + * @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible. + * @property {DeprecatedRuleInfo[]} usedDeprecatedRules The list of used deprecated rules. + */ + +/** + * A formatter function. + * @callback FormatterFunction + * @param {LintResult[]} results The list of linting results. + * @param {{cwd: string, rulesMeta: Record}} [context] A context object. + * @returns {string | Promise} Formatted text. + */ diff --git a/node_modules/eslint/lib/source-code/index.js b/node_modules/eslint/lib/source-code/index.js new file mode 100644 index 0000000..76e2786 --- /dev/null +++ b/node_modules/eslint/lib/source-code/index.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + SourceCode: require("./source-code") +}; diff --git a/node_modules/eslint/lib/source-code/source-code.js b/node_modules/eslint/lib/source-code/source-code.js new file mode 100644 index 0000000..49b2820 --- /dev/null +++ b/node_modules/eslint/lib/source-code/source-code.js @@ -0,0 +1,593 @@ +/** + * @fileoverview Abstraction of JavaScript source code. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const + { isCommentToken } = require("eslint-utils"), + TokenStore = require("./token-store"), + astUtils = require("../shared/ast-utils"), + Traverser = require("../shared/traverser"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +/** + * Validates that the given AST has the required information. + * @param {ASTNode} ast The Program node of the AST to check. + * @throws {Error} If the AST doesn't contain the correct information. + * @returns {void} + * @private + */ +function validate(ast) { + if (!ast.tokens) { + throw new Error("AST is missing the tokens array."); + } + + if (!ast.comments) { + throw new Error("AST is missing the comments array."); + } + + if (!ast.loc) { + throw new Error("AST is missing location information."); + } + + if (!ast.range) { + throw new Error("AST is missing range information"); + } +} + +/** + * Check to see if its a ES6 export declaration. + * @param {ASTNode} astNode An AST node. + * @returns {boolean} whether the given node represents an export declaration. + * @private + */ +function looksLikeExport(astNode) { + return astNode.type === "ExportDefaultDeclaration" || astNode.type === "ExportNamedDeclaration" || + astNode.type === "ExportAllDeclaration" || astNode.type === "ExportSpecifier"; +} + +/** + * Merges two sorted lists into a larger sorted list in O(n) time. + * @param {Token[]} tokens The list of tokens. + * @param {Token[]} comments The list of comments. + * @returns {Token[]} A sorted list of tokens and comments. + * @private + */ +function sortedMerge(tokens, comments) { + const result = []; + let tokenIndex = 0; + let commentIndex = 0; + + while (tokenIndex < tokens.length || commentIndex < comments.length) { + if (commentIndex >= comments.length || tokenIndex < tokens.length && tokens[tokenIndex].range[0] < comments[commentIndex].range[0]) { + result.push(tokens[tokenIndex++]); + } else { + result.push(comments[commentIndex++]); + } + } + + return result; +} + +/** + * Determines if two nodes or tokens overlap. + * @param {ASTNode|Token} first The first node or token to check. + * @param {ASTNode|Token} second The second node or token to check. + * @returns {boolean} True if the two nodes or tokens overlap. + * @private + */ +function nodesOrTokensOverlap(first, second) { + return (first.range[0] <= second.range[0] && first.range[1] >= second.range[0]) || + (second.range[0] <= first.range[0] && second.range[1] >= first.range[0]); +} + +/** + * Determines if two nodes or tokens have at least one whitespace character + * between them. Order does not matter. Returns false if the given nodes or + * tokens overlap. + * @param {SourceCode} sourceCode The source code object. + * @param {ASTNode|Token} first The first node or token to check between. + * @param {ASTNode|Token} second The second node or token to check between. + * @param {boolean} checkInsideOfJSXText If `true` is present, check inside of JSXText tokens for backward compatibility. + * @returns {boolean} True if there is a whitespace character between + * any of the tokens found between the two given nodes or tokens. + * @public + */ +function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { + if (nodesOrTokensOverlap(first, second)) { + return false; + } + + const [startingNodeOrToken, endingNodeOrToken] = first.range[1] <= second.range[0] + ? [first, second] + : [second, first]; + const firstToken = sourceCode.getLastToken(startingNodeOrToken) || startingNodeOrToken; + const finalToken = sourceCode.getFirstToken(endingNodeOrToken) || endingNodeOrToken; + let currentToken = firstToken; + + while (currentToken !== finalToken) { + const nextToken = sourceCode.getTokenAfter(currentToken, { includeComments: true }); + + if ( + currentToken.range[1] !== nextToken.range[0] || + + /* + * For backward compatibility, check spaces in JSXText. + * https://github.com/eslint/eslint/issues/12614 + */ + ( + checkInsideOfJSXText && + nextToken !== finalToken && + nextToken.type === "JSXText" && + /\s/u.test(nextToken.value) + ) + ) { + return true; + } + + currentToken = nextToken; + } + + return false; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Represents parsed source code. + */ +class SourceCode extends TokenStore { + + /** + * @param {string|Object} textOrConfig The source code text or config object. + * @param {string} textOrConfig.text The source code text. + * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + * @param {Object|null} textOrConfig.parserServices The parser services. + * @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code. + * @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST. + * @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + */ + constructor(textOrConfig, astIfNoConfig) { + let text, ast, parserServices, scopeManager, visitorKeys; + + // Process overloading. + if (typeof textOrConfig === "string") { + text = textOrConfig; + ast = astIfNoConfig; + } else if (typeof textOrConfig === "object" && textOrConfig !== null) { + text = textOrConfig.text; + ast = textOrConfig.ast; + parserServices = textOrConfig.parserServices; + scopeManager = textOrConfig.scopeManager; + visitorKeys = textOrConfig.visitorKeys; + } + + validate(ast); + super(ast.tokens, ast.comments); + + /** + * The flag to indicate that the source code has Unicode BOM. + * @type {boolean} + */ + this.hasBOM = (text.charCodeAt(0) === 0xFEFF); + + /** + * The original text source code. + * BOM was stripped from this text. + * @type {string} + */ + this.text = (this.hasBOM ? text.slice(1) : text); + + /** + * The parsed AST for the source code. + * @type {ASTNode} + */ + this.ast = ast; + + /** + * The parser services of this source code. + * @type {Object} + */ + this.parserServices = parserServices || {}; + + /** + * The scope of this source code. + * @type {ScopeManager|null} + */ + this.scopeManager = scopeManager || null; + + /** + * The visitor keys to traverse AST. + * @type {Object} + */ + this.visitorKeys = visitorKeys || Traverser.DEFAULT_VISITOR_KEYS; + + // Check the source text for the presence of a shebang since it is parsed as a standard line comment. + const shebangMatched = this.text.match(astUtils.shebangPattern); + const hasShebang = shebangMatched && ast.comments.length && ast.comments[0].value === shebangMatched[1]; + + if (hasShebang) { + ast.comments[0].type = "Shebang"; + } + + this.tokensAndComments = sortedMerge(ast.tokens, ast.comments); + + /** + * The source code split into lines according to ECMA-262 specification. + * This is done to avoid each rule needing to do so separately. + * @type {string[]} + */ + this.lines = []; + this.lineStartIndices = [0]; + + const lineEndingPattern = astUtils.createGlobalLinebreakMatcher(); + let match; + + /* + * Previously, this was implemented using a regex that + * matched a sequence of non-linebreak characters followed by a + * linebreak, then adding the lengths of the matches. However, + * this caused a catastrophic backtracking issue when the end + * of a file contained a large number of non-newline characters. + * To avoid this, the current implementation just matches newlines + * and uses match.index to get the correct line start indices. + */ + while ((match = lineEndingPattern.exec(this.text))) { + this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1], match.index)); + this.lineStartIndices.push(match.index + match[0].length); + } + this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1])); + + // Cache for comments found using getComments(). + this._commentCache = new WeakMap(); + + // don't allow modification of this object + Object.freeze(this); + Object.freeze(this.lines); + } + + /** + * Split the source code into multiple lines based on the line delimiters. + * @param {string} text Source code as a string. + * @returns {string[]} Array of source code lines. + * @public + */ + static splitLines(text) { + return text.split(astUtils.createGlobalLinebreakMatcher()); + } + + /** + * Gets the source code for the given node. + * @param {ASTNode} [node] The AST node to get the text for. + * @param {int} [beforeCount] The number of characters before the node to retrieve. + * @param {int} [afterCount] The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + * @public + */ + getText(node, beforeCount, afterCount) { + if (node) { + return this.text.slice(Math.max(node.range[0] - (beforeCount || 0), 0), + node.range[1] + (afterCount || 0)); + } + return this.text; + } + + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + * @public + */ + getLines() { + return this.lines; + } + + /** + * Retrieves an array containing all comments in the source code. + * @returns {ASTNode[]} An array of comment nodes. + * @public + */ + getAllComments() { + return this.ast.comments; + } + + /** + * Gets all comments for the given node. + * @param {ASTNode} node The AST node to get the comments for. + * @returns {Object} An object containing a leading and trailing array + * of comments indexed by their position. + * @public + * @deprecated replaced by getCommentsBefore(), getCommentsAfter(), and getCommentsInside(). + */ + getComments(node) { + if (this._commentCache.has(node)) { + return this._commentCache.get(node); + } + + const comments = { + leading: [], + trailing: [] + }; + + /* + * Return all comments as leading comments of the Program node when + * there is no executable code. + */ + if (node.type === "Program") { + if (node.body.length === 0) { + comments.leading = node.comments; + } + } else { + + /* + * Return comments as trailing comments of nodes that only contain + * comments (to mimic the comment attachment behavior present in Espree). + */ + if ((node.type === "BlockStatement" || node.type === "ClassBody") && node.body.length === 0 || + node.type === "ObjectExpression" && node.properties.length === 0 || + node.type === "ArrayExpression" && node.elements.length === 0 || + node.type === "SwitchStatement" && node.cases.length === 0 + ) { + comments.trailing = this.getTokens(node, { + includeComments: true, + filter: isCommentToken + }); + } + + /* + * Iterate over tokens before and after node and collect comment tokens. + * Do not include comments that exist outside of the parent node + * to avoid duplication. + */ + let currentToken = this.getTokenBefore(node, { includeComments: true }); + + while (currentToken && isCommentToken(currentToken)) { + if (node.parent && node.parent.type !== "Program" && (currentToken.start < node.parent.start)) { + break; + } + comments.leading.push(currentToken); + currentToken = this.getTokenBefore(currentToken, { includeComments: true }); + } + + comments.leading.reverse(); + + currentToken = this.getTokenAfter(node, { includeComments: true }); + + while (currentToken && isCommentToken(currentToken)) { + if (node.parent && node.parent.type !== "Program" && (currentToken.end > node.parent.end)) { + break; + } + comments.trailing.push(currentToken); + currentToken = this.getTokenAfter(currentToken, { includeComments: true }); + } + } + + this._commentCache.set(node, comments); + return comments; + } + + /** + * Retrieves the JSDoc comment for a given node. + * @param {ASTNode} node The AST node to get the comment for. + * @returns {Token|null} The Block comment token containing the JSDoc comment + * for the given node or null if not found. + * @public + * @deprecated + */ + getJSDocComment(node) { + + /** + * Checks for the presence of a JSDoc comment for the given node and returns it. + * @param {ASTNode} astNode The AST node to get the comment for. + * @returns {Token|null} The Block comment token containing the JSDoc comment + * for the given node or null if not found. + * @private + */ + const findJSDocComment = astNode => { + const tokenBefore = this.getTokenBefore(astNode, { includeComments: true }); + + if ( + tokenBefore && + isCommentToken(tokenBefore) && + tokenBefore.type === "Block" && + tokenBefore.value.charAt(0) === "*" && + astNode.loc.start.line - tokenBefore.loc.end.line <= 1 + ) { + return tokenBefore; + } + + return null; + }; + let parent = node.parent; + + switch (node.type) { + case "ClassDeclaration": + case "FunctionDeclaration": + return findJSDocComment(looksLikeExport(parent) ? parent : node); + + case "ClassExpression": + return findJSDocComment(parent.parent); + + case "ArrowFunctionExpression": + case "FunctionExpression": + if (parent.type !== "CallExpression" && parent.type !== "NewExpression") { + while ( + !this.getCommentsBefore(parent).length && + !/Function/u.test(parent.type) && + parent.type !== "MethodDefinition" && + parent.type !== "Property" + ) { + parent = parent.parent; + + if (!parent) { + break; + } + } + + if (parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program") { + return findJSDocComment(parent); + } + } + + return findJSDocComment(node); + + // falls through + default: + return null; + } + } + + /** + * Gets the deepest node containing a range index. + * @param {int} index Range index of the desired node. + * @returns {ASTNode} The node if found or null if not found. + * @public + */ + getNodeByRangeIndex(index) { + let result = null; + + Traverser.traverse(this.ast, { + visitorKeys: this.visitorKeys, + enter(node) { + if (node.range[0] <= index && index < node.range[1]) { + result = node; + } else { + this.skip(); + } + }, + leave(node) { + if (node === result) { + this.break(); + } + } + }); + + return result; + } + + /** + * Determines if two nodes or tokens have at least one whitespace character + * between them. Order does not matter. Returns false if the given nodes or + * tokens overlap. + * @param {ASTNode|Token} first The first node or token to check between. + * @param {ASTNode|Token} second The second node or token to check between. + * @returns {boolean} True if there is a whitespace character between + * any of the tokens found between the two given nodes or tokens. + * @public + */ + isSpaceBetween(first, second) { + return isSpaceBetween(this, first, second, false); + } + + /** + * Determines if two nodes or tokens have at least one whitespace character + * between them. Order does not matter. Returns false if the given nodes or + * tokens overlap. + * For backward compatibility, this method returns true if there are + * `JSXText` tokens that contain whitespaces between the two. + * @param {ASTNode|Token} first The first node or token to check between. + * @param {ASTNode|Token} second The second node or token to check between. + * @returns {boolean} True if there is a whitespace character between + * any of the tokens found between the two given nodes or tokens. + * @deprecated in favor of isSpaceBetween(). + * @public + */ + isSpaceBetweenTokens(first, second) { + return isSpaceBetween(this, first, second, true); + } + + /** + * Converts a source text index into a (line, column) pair. + * @param {number} index The index of a character in a file + * @throws {TypeError} If non-numeric index or index out of range. + * @returns {Object} A {line, column} location object with a 0-indexed column + * @public + */ + getLocFromIndex(index) { + if (typeof index !== "number") { + throw new TypeError("Expected `index` to be a number."); + } + + if (index < 0 || index > this.text.length) { + throw new RangeError(`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`); + } + + /* + * For an argument of this.text.length, return the location one "spot" past the last character + * of the file. If the last character is a linebreak, the location will be column 0 of the next + * line; otherwise, the location will be in the next column on the same line. + * + * See getIndexFromLoc for the motivation for this special case. + */ + if (index === this.text.length) { + return { line: this.lines.length, column: this.lines[this.lines.length - 1].length }; + } + + /* + * To figure out which line index is on, determine the last place at which index could + * be inserted into lineStartIndices to keep the list sorted. + */ + const lineNumber = index >= this.lineStartIndices[this.lineStartIndices.length - 1] + ? this.lineStartIndices.length + : this.lineStartIndices.findIndex(el => index < el); + + return { line: lineNumber, column: index - this.lineStartIndices[lineNumber - 1] }; + } + + /** + * Converts a (line, column) pair into a range index. + * @param {Object} loc A line/column location + * @param {number} loc.line The line number of the location (1-indexed) + * @param {number} loc.column The column number of the location (0-indexed) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the line or column is out of the expected range. + * @returns {number} The range index of the location in the file. + * @public + */ + getIndexFromLoc(loc) { + if (typeof loc !== "object" || typeof loc.line !== "number" || typeof loc.column !== "number") { + throw new TypeError("Expected `loc` to be an object with numeric `line` and `column` properties."); + } + + if (loc.line <= 0) { + throw new RangeError(`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`); + } + + if (loc.line > this.lineStartIndices.length) { + throw new RangeError(`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`); + } + + const lineStartIndex = this.lineStartIndices[loc.line - 1]; + const lineEndIndex = loc.line === this.lineStartIndices.length ? this.text.length : this.lineStartIndices[loc.line]; + const positionIndex = lineStartIndex + loc.column; + + /* + * By design, getIndexFromLoc({ line: lineNum, column: 0 }) should return the start index of + * the given line, provided that the line number is valid element of this.lines. Since the + * last element of this.lines is an empty string for files with trailing newlines, add a + * special case where getting the index for the first location after the end of the file + * will return the length of the file, rather than throwing an error. This allows rules to + * use getIndexFromLoc consistently without worrying about edge cases at the end of a file. + */ + if ( + loc.line === this.lineStartIndices.length && positionIndex > lineEndIndex || + loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex + ) { + throw new RangeError(`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`); + } + + return positionIndex; + } +} + +module.exports = SourceCode; diff --git a/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js b/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js new file mode 100644 index 0000000..7255a62 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js @@ -0,0 +1,57 @@ +/** + * @fileoverview Define the cursor which iterates tokens and comments in reverse. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Cursor = require("./cursor"); +const utils = require("./utils"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The cursor which iterates tokens and comments in reverse. + */ +module.exports = class BackwardTokenCommentCursor extends Cursor { + + /** + * Initializes this cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + */ + constructor(tokens, comments, indexMap, startLoc, endLoc) { + super(); + this.tokens = tokens; + this.comments = comments; + this.tokenIndex = utils.getLastIndex(tokens, indexMap, endLoc); + this.commentIndex = utils.search(comments, endLoc) - 1; + this.border = startLoc; + } + + /** @inheritdoc */ + moveNext() { + const token = (this.tokenIndex >= 0) ? this.tokens[this.tokenIndex] : null; + const comment = (this.commentIndex >= 0) ? this.comments[this.commentIndex] : null; + + if (token && (!comment || token.range[1] > comment.range[1])) { + this.current = token; + this.tokenIndex -= 1; + } else if (comment) { + this.current = comment; + this.commentIndex -= 1; + } else { + this.current = null; + } + + return Boolean(this.current) && (this.border === -1 || this.current.range[0] >= this.border); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js new file mode 100644 index 0000000..454a244 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js @@ -0,0 +1,58 @@ +/** + * @fileoverview Define the cursor which iterates tokens only in reverse. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Cursor = require("./cursor"); +const utils = require("./utils"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The cursor which iterates tokens only in reverse. + */ +module.exports = class BackwardTokenCursor extends Cursor { + + /** + * Initializes this cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + */ + constructor(tokens, comments, indexMap, startLoc, endLoc) { + super(); + this.tokens = tokens; + this.index = utils.getLastIndex(tokens, indexMap, endLoc); + this.indexEnd = utils.getFirstIndex(tokens, indexMap, startLoc); + } + + /** @inheritdoc */ + moveNext() { + if (this.index >= this.indexEnd) { + this.current = this.tokens[this.index]; + this.index -= 1; + return true; + } + return false; + } + + /* + * + * Shorthand for performance. + * + */ + + /** @inheritdoc */ + getOneToken() { + return (this.index >= this.indexEnd) ? this.tokens[this.index] : null; + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/cursor.js b/node_modules/eslint/lib/source-code/token-store/cursor.js new file mode 100644 index 0000000..494762a --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/cursor.js @@ -0,0 +1,76 @@ +/** + * @fileoverview Define the abstract class about cursors which iterate tokens. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The abstract class about cursors which iterate tokens. + * + * This class has 2 abstract methods. + * + * - `current: Token | Comment | null` ... The current token. + * - `moveNext(): boolean` ... Moves this cursor to the next token. If the next token didn't exist, it returns `false`. + * + * This is similar to ES2015 Iterators. + * However, Iterators were slow (at 2017-01), so I created this class as similar to C# IEnumerable. + * + * There are the following known sub classes. + * + * - ForwardTokenCursor .......... The cursor which iterates tokens only. + * - BackwardTokenCursor ......... The cursor which iterates tokens only in reverse. + * - ForwardTokenCommentCursor ... The cursor which iterates tokens and comments. + * - BackwardTokenCommentCursor .. The cursor which iterates tokens and comments in reverse. + * - DecorativeCursor + * - FilterCursor ............ The cursor which ignores the specified tokens. + * - SkipCursor .............. The cursor which ignores the first few tokens. + * - LimitCursor ............. The cursor which limits the count of tokens. + * + */ +module.exports = class Cursor { + + /** + * Initializes this cursor. + */ + constructor() { + this.current = null; + } + + /** + * Gets the first token. + * This consumes this cursor. + * @returns {Token|Comment} The first token or null. + */ + getOneToken() { + return this.moveNext() ? this.current : null; + } + + /** + * Gets the first tokens. + * This consumes this cursor. + * @returns {(Token|Comment)[]} All tokens. + */ + getAllTokens() { + const tokens = []; + + while (this.moveNext()) { + tokens.push(this.current); + } + + return tokens; + } + + /** + * Moves this cursor to the next token. + * @returns {boolean} `true` if the next token exists. + * @abstract + */ + /* istanbul ignore next */ + moveNext() { // eslint-disable-line class-methods-use-this -- Unused + throw new Error("Not implemented."); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/cursors.js b/node_modules/eslint/lib/source-code/token-store/cursors.js new file mode 100644 index 0000000..30c72b6 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/cursors.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Define 2 token factories; forward and backward. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const BackwardTokenCommentCursor = require("./backward-token-comment-cursor"); +const BackwardTokenCursor = require("./backward-token-cursor"); +const FilterCursor = require("./filter-cursor"); +const ForwardTokenCommentCursor = require("./forward-token-comment-cursor"); +const ForwardTokenCursor = require("./forward-token-cursor"); +const LimitCursor = require("./limit-cursor"); +const SkipCursor = require("./skip-cursor"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * The cursor factory. + * @private + */ +class CursorFactory { + + /** + * Initializes this cursor. + * @param {Function} TokenCursor The class of the cursor which iterates tokens only. + * @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments. + */ + constructor(TokenCursor, TokenCommentCursor) { + this.TokenCursor = TokenCursor; + this.TokenCommentCursor = TokenCommentCursor; + } + + /** + * Creates a base cursor instance that can be decorated by createCursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. + * @returns {Cursor} The created base cursor. + */ + createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments) { + const Cursor = includeComments ? this.TokenCommentCursor : this.TokenCursor; + + return new Cursor(tokens, comments, indexMap, startLoc, endLoc); + } + + /** + * Creates a cursor that iterates tokens with normalized options. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. + * @param {Function|null} filter The predicate function to choose tokens. + * @param {number} skip The count of tokens the cursor skips. + * @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @returns {Cursor} The created cursor. + */ + createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, count) { + let cursor = this.createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments); + + if (filter) { + cursor = new FilterCursor(cursor, filter); + } + if (skip >= 1) { + cursor = new SkipCursor(cursor, skip); + } + if (count >= 0) { + cursor = new LimitCursor(cursor, count); + } + + return cursor; + } +} + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +exports.forward = new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor); +exports.backward = new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor); diff --git a/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js b/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js new file mode 100644 index 0000000..3ee7b0b --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Define the abstract class about cursors which manipulate another cursor. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Cursor = require("./cursor"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The abstract class about cursors which manipulate another cursor. + */ +module.exports = class DecorativeCursor extends Cursor { + + /** + * Initializes this cursor. + * @param {Cursor} cursor The cursor to be decorated. + */ + constructor(cursor) { + super(); + this.cursor = cursor; + } + + /** @inheritdoc */ + moveNext() { + const retv = this.cursor.moveNext(); + + this.current = this.cursor.current; + + return retv; + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/filter-cursor.js b/node_modules/eslint/lib/source-code/token-store/filter-cursor.js new file mode 100644 index 0000000..08c4f22 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/filter-cursor.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Define the cursor which ignores specified tokens. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const DecorativeCursor = require("./decorative-cursor"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The decorative cursor which ignores specified tokens. + */ +module.exports = class FilterCursor extends DecorativeCursor { + + /** + * Initializes this cursor. + * @param {Cursor} cursor The cursor to be decorated. + * @param {Function} predicate The predicate function to decide tokens this cursor iterates. + */ + constructor(cursor, predicate) { + super(cursor); + this.predicate = predicate; + } + + /** @inheritdoc */ + moveNext() { + const predicate = this.predicate; + + while (super.moveNext()) { + if (predicate(this.current)) { + return true; + } + } + return false; + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js b/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js new file mode 100644 index 0000000..50c7a39 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js @@ -0,0 +1,57 @@ +/** + * @fileoverview Define the cursor which iterates tokens and comments. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Cursor = require("./cursor"); +const utils = require("./utils"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The cursor which iterates tokens and comments. + */ +module.exports = class ForwardTokenCommentCursor extends Cursor { + + /** + * Initializes this cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + */ + constructor(tokens, comments, indexMap, startLoc, endLoc) { + super(); + this.tokens = tokens; + this.comments = comments; + this.tokenIndex = utils.getFirstIndex(tokens, indexMap, startLoc); + this.commentIndex = utils.search(comments, startLoc); + this.border = endLoc; + } + + /** @inheritdoc */ + moveNext() { + const token = (this.tokenIndex < this.tokens.length) ? this.tokens[this.tokenIndex] : null; + const comment = (this.commentIndex < this.comments.length) ? this.comments[this.commentIndex] : null; + + if (token && (!comment || token.range[0] < comment.range[0])) { + this.current = token; + this.tokenIndex += 1; + } else if (comment) { + this.current = comment; + this.commentIndex += 1; + } else { + this.current = null; + } + + return Boolean(this.current) && (this.border === -1 || this.current.range[1] <= this.border); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js new file mode 100644 index 0000000..e8c1860 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js @@ -0,0 +1,63 @@ +/** + * @fileoverview Define the cursor which iterates tokens only. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const Cursor = require("./cursor"); +const utils = require("./utils"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The cursor which iterates tokens only. + */ +module.exports = class ForwardTokenCursor extends Cursor { + + /** + * Initializes this cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + */ + constructor(tokens, comments, indexMap, startLoc, endLoc) { + super(); + this.tokens = tokens; + this.index = utils.getFirstIndex(tokens, indexMap, startLoc); + this.indexEnd = utils.getLastIndex(tokens, indexMap, endLoc); + } + + /** @inheritdoc */ + moveNext() { + if (this.index <= this.indexEnd) { + this.current = this.tokens[this.index]; + this.index += 1; + return true; + } + return false; + } + + /* + * + * Shorthand for performance. + * + */ + + /** @inheritdoc */ + getOneToken() { + return (this.index <= this.indexEnd) ? this.tokens[this.index] : null; + } + + /** @inheritdoc */ + getAllTokens() { + return this.tokens.slice(this.index, this.indexEnd + 1); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/index.js b/node_modules/eslint/lib/source-code/token-store/index.js new file mode 100644 index 0000000..25db8a4 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/index.js @@ -0,0 +1,627 @@ +/** + * @fileoverview Object to handle access and retrieval of tokens. + * @author Brandon Mills + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const assert = require("assert"); +const { isCommentToken } = require("eslint-utils"); +const cursors = require("./cursors"); +const ForwardTokenCursor = require("./forward-token-cursor"); +const PaddedTokenCursor = require("./padded-token-cursor"); +const utils = require("./utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const TOKENS = Symbol("tokens"); +const COMMENTS = Symbol("comments"); +const INDEX_MAP = Symbol("indexMap"); + +/** + * Creates the map from locations to indices in `tokens`. + * + * The first/last location of tokens is mapped to the index of the token. + * The first/last location of comments is mapped to the index of the next token of each comment. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @returns {Object} The map from locations to indices in `tokens`. + * @private + */ +function createIndexMap(tokens, comments) { + const map = Object.create(null); + let tokenIndex = 0; + let commentIndex = 0; + let nextStart = 0; + let range = null; + + while (tokenIndex < tokens.length || commentIndex < comments.length) { + nextStart = (commentIndex < comments.length) ? comments[commentIndex].range[0] : Number.MAX_SAFE_INTEGER; + while (tokenIndex < tokens.length && (range = tokens[tokenIndex].range)[0] < nextStart) { + map[range[0]] = tokenIndex; + map[range[1] - 1] = tokenIndex; + tokenIndex += 1; + } + + nextStart = (tokenIndex < tokens.length) ? tokens[tokenIndex].range[0] : Number.MAX_SAFE_INTEGER; + while (commentIndex < comments.length && (range = comments[commentIndex].range)[0] < nextStart) { + map[range[0]] = tokenIndex; + map[range[1] - 1] = tokenIndex; + commentIndex += 1; + } + } + + return map; +} + +/** + * Creates the cursor iterates tokens with options. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.skip=0] The count of tokens the cursor skips. + * @returns {Cursor} The created cursor. + * @private + */ +function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { + let includeComments = false; + let skip = 0; + let filter = null; + + if (typeof opts === "number") { + skip = opts | 0; + } else if (typeof opts === "function") { + filter = opts; + } else if (opts) { + includeComments = !!opts.includeComments; + skip = opts.skip | 0; + filter = opts.filter || null; + } + assert(skip >= 0, "options.skip should be zero or a positive integer."); + assert(!filter || typeof filter === "function", "options.filter should be a function."); + + return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, -1); +} + +/** + * Creates the cursor iterates tokens with options. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @returns {Cursor} The created cursor. + * @private + */ +function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { + let includeComments = false; + let count = 0; + let countExists = false; + let filter = null; + + if (typeof opts === "number") { + count = opts | 0; + countExists = true; + } else if (typeof opts === "function") { + filter = opts; + } else if (opts) { + includeComments = !!opts.includeComments; + count = opts.count | 0; + countExists = typeof opts.count === "number"; + filter = opts.filter || null; + } + assert(count >= 0, "options.count should be zero or a positive integer."); + assert(!filter || typeof filter === "function", "options.filter should be a function."); + + return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, 0, countExists ? count : -1); +} + +/** + * Creates the cursor iterates tokens with options. + * This is overload function of the below. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {Function|Object} opts The option object. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @returns {Cursor} The created cursor. + * @private + */ +/** + * Creates the cursor iterates tokens with options. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {boolean} [afterCount=0] The number of tokens after the node to retrieve. + * @returns {Cursor} The created cursor. + * @private + */ +function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { + if (typeof beforeCount === "undefined" && typeof afterCount === "undefined") { + return new ForwardTokenCursor(tokens, comments, indexMap, startLoc, endLoc); + } + if (typeof beforeCount === "number" || typeof beforeCount === "undefined") { + return new PaddedTokenCursor(tokens, comments, indexMap, startLoc, endLoc, beforeCount | 0, afterCount | 0); + } + return createCursorWithCount(cursors.forward, tokens, comments, indexMap, startLoc, endLoc, beforeCount); +} + +/** + * Gets comment tokens that are adjacent to the current cursor position. + * @param {Cursor} cursor A cursor instance. + * @returns {Array} An array of comment tokens adjacent to the current cursor position. + * @private + */ +function getAdjacentCommentTokensFromCursor(cursor) { + const tokens = []; + let currentToken = cursor.getOneToken(); + + while (currentToken && isCommentToken(currentToken)) { + tokens.push(currentToken); + currentToken = cursor.getOneToken(); + } + + return tokens; +} + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The token store. + * + * This class provides methods to get tokens by locations as fast as possible. + * The methods are a part of public API, so we should be careful if it changes this class. + * + * People can get tokens in O(1) by the hash map which is mapping from the location of tokens/comments to tokens. + * Also people can get a mix of tokens and comments in O(log k), the k is the number of comments. + * Assuming that comments to be much fewer than tokens, this does not make hash map from token's locations to comments to reduce memory cost. + * This uses binary-searching instead for comments. + */ +module.exports = class TokenStore { + + /** + * Initializes this token store. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + */ + constructor(tokens, comments) { + this[TOKENS] = tokens; + this[COMMENTS] = comments; + this[INDEX_MAP] = createIndexMap(tokens, comments); + } + + //-------------------------------------------------------------------------- + // Gets single token. + //-------------------------------------------------------------------------- + + /** + * Gets the token starting at the specified index. + * @param {number} offset Index of the start of the token's range. + * @param {Object} [options=0] The option object. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @returns {Token|null} The token starting at index, or null if no such token. + */ + getTokenByRangeStart(offset, options) { + const includeComments = options && options.includeComments; + const token = cursors.forward.createBaseCursor( + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + offset, + -1, + includeComments + ).getOneToken(); + + if (token && token.range[0] === offset) { + return token; + } + return null; + } + + /** + * Gets the first token of the given node. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.skip=0] The count of tokens the cursor skips. + * @returns {Token|null} An object representing the token. + */ + getFirstToken(node, options) { + return createCursorWithSkip( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[0], + node.range[1], + options + ).getOneToken(); + } + + /** + * Gets the last token of the given node. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() + * @returns {Token|null} An object representing the token. + */ + getLastToken(node, options) { + return createCursorWithSkip( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[0], + node.range[1], + options + ).getOneToken(); + } + + /** + * Gets the token that precedes a given node or token. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() + * @returns {Token|null} An object representing the token. + */ + getTokenBefore(node, options) { + return createCursorWithSkip( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + -1, + node.range[0], + options + ).getOneToken(); + } + + /** + * Gets the token that follows a given node or token. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() + * @returns {Token|null} An object representing the token. + */ + getTokenAfter(node, options) { + return createCursorWithSkip( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[1], + -1, + options + ).getOneToken(); + } + + /** + * Gets the first token between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() + * @returns {Token|null} An object representing the token. + */ + getFirstTokenBetween(left, right, options) { + return createCursorWithSkip( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + left.range[1], + right.range[0], + options + ).getOneToken(); + } + + /** + * Gets the last token between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() + * @returns {Token|null} An object representing the token. + */ + getLastTokenBetween(left, right, options) { + return createCursorWithSkip( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + left.range[1], + right.range[0], + options + ).getOneToken(); + } + + /** + * Gets the token that precedes a given node or token in the token stream. + * This is defined for backward compatibility. Use `includeComments` option instead. + * TODO: We have a plan to remove this in a future major version. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number} [skip=0] A number of tokens to skip. + * @returns {Token|null} An object representing the token. + * @deprecated + */ + getTokenOrCommentBefore(node, skip) { + return this.getTokenBefore(node, { includeComments: true, skip }); + } + + /** + * Gets the token that follows a given node or token in the token stream. + * This is defined for backward compatibility. Use `includeComments` option instead. + * TODO: We have a plan to remove this in a future major version. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number} [skip=0] A number of tokens to skip. + * @returns {Token|null} An object representing the token. + * @deprecated + */ + getTokenOrCommentAfter(node, skip) { + return this.getTokenAfter(node, { includeComments: true, skip }); + } + + //-------------------------------------------------------------------------- + // Gets multiple tokens. + //-------------------------------------------------------------------------- + + /** + * Gets the first `count` tokens of the given node. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. + * @returns {Token[]} Tokens. + */ + getFirstTokens(node, options) { + return createCursorWithCount( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[0], + node.range[1], + options + ).getAllTokens(); + } + + /** + * Gets the last `count` tokens of the given node. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() + * @returns {Token[]} Tokens. + */ + getLastTokens(node, options) { + return createCursorWithCount( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[0], + node.range[1], + options + ).getAllTokens().reverse(); + } + + /** + * Gets the `count` tokens that precedes a given node or token. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() + * @returns {Token[]} Tokens. + */ + getTokensBefore(node, options) { + return createCursorWithCount( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + -1, + node.range[0], + options + ).getAllTokens().reverse(); + } + + /** + * Gets the `count` tokens that follows a given node or token. + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() + * @returns {Token[]} Tokens. + */ + getTokensAfter(node, options) { + return createCursorWithCount( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[1], + -1, + options + ).getAllTokens(); + } + + /** + * Gets the first `count` tokens between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() + * @returns {Token[]} Tokens between left and right. + */ + getFirstTokensBetween(left, right, options) { + return createCursorWithCount( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + left.range[1], + right.range[0], + options + ).getAllTokens(); + } + + /** + * Gets the last `count` tokens between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() + * @returns {Token[]} Tokens between left and right. + */ + getLastTokensBetween(left, right, options) { + return createCursorWithCount( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + left.range[1], + right.range[0], + options + ).getAllTokens().reverse(); + } + + /** + * Gets all tokens that are related to the given node. + * @param {ASTNode} node The AST node. + * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. + * @returns {Token[]} Array of objects representing tokens. + */ + /** + * Gets all tokens that are related to the given node. + * @param {ASTNode} node The AST node. + * @param {int} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {int} [afterCount=0] The number of tokens after the node to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + getTokens(node, beforeCount, afterCount) { + return createCursorWithPadding( + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + node.range[0], + node.range[1], + beforeCount, + afterCount + ).getAllTokens(); + } + + /** + * Gets all of the tokens between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. + * @returns {Token[]} Tokens between left and right. + */ + /** + * Gets all of the tokens between two non-overlapping nodes. + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {int} [padding=0] Number of extra tokens on either side of center. + * @returns {Token[]} Tokens between left and right. + */ + getTokensBetween(left, right, padding) { + return createCursorWithPadding( + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + left.range[1], + right.range[0], + padding, + padding + ).getAllTokens(); + } + + //-------------------------------------------------------------------------- + // Others. + //-------------------------------------------------------------------------- + + /** + * Checks whether any comments exist or not between the given 2 nodes. + * @param {ASTNode} left The node to check. + * @param {ASTNode} right The node to check. + * @returns {boolean} `true` if one or more comments exist. + */ + commentsExistBetween(left, right) { + const index = utils.search(this[COMMENTS], left.range[1]); + + return ( + index < this[COMMENTS].length && + this[COMMENTS][index].range[1] <= right.range[0] + ); + } + + /** + * Gets all comment tokens directly before the given node or token. + * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens. + * @returns {Array} An array of comments in occurrence order. + */ + getCommentsBefore(nodeOrToken) { + const cursor = createCursorWithCount( + cursors.backward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + -1, + nodeOrToken.range[0], + { includeComments: true } + ); + + return getAdjacentCommentTokensFromCursor(cursor).reverse(); + } + + /** + * Gets all comment tokens directly after the given node or token. + * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens. + * @returns {Array} An array of comments in occurrence order. + */ + getCommentsAfter(nodeOrToken) { + const cursor = createCursorWithCount( + cursors.forward, + this[TOKENS], + this[COMMENTS], + this[INDEX_MAP], + nodeOrToken.range[1], + -1, + { includeComments: true } + ); + + return getAdjacentCommentTokensFromCursor(cursor); + } + + /** + * Gets all comment tokens inside the given node. + * @param {ASTNode} node The AST node to get the comments for. + * @returns {Array} An array of comments in occurrence order. + */ + getCommentsInside(node) { + return this.getTokens(node, { + includeComments: true, + filter: isCommentToken + }); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/limit-cursor.js b/node_modules/eslint/lib/source-code/token-store/limit-cursor.js new file mode 100644 index 0000000..0fd92a7 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/limit-cursor.js @@ -0,0 +1,40 @@ +/** + * @fileoverview Define the cursor which limits the number of tokens. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const DecorativeCursor = require("./decorative-cursor"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The decorative cursor which limits the number of tokens. + */ +module.exports = class LimitCursor extends DecorativeCursor { + + /** + * Initializes this cursor. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor iterates. + */ + constructor(cursor, count) { + super(cursor); + this.count = count; + } + + /** @inheritdoc */ + moveNext() { + if (this.count > 0) { + this.count -= 1; + return super.moveNext(); + } + return false; + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js new file mode 100644 index 0000000..89349fa --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js @@ -0,0 +1,38 @@ +/** + * @fileoverview Define the cursor which iterates tokens only, with inflated range. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const ForwardTokenCursor = require("./forward-token-cursor"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The cursor which iterates tokens only, with inflated range. + * This is for the backward compatibility of padding options. + */ +module.exports = class PaddedTokenCursor extends ForwardTokenCursor { + + /** + * Initializes this cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} beforeCount The number of tokens this cursor iterates before start. + * @param {number} afterCount The number of tokens this cursor iterates after end. + */ + constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { + super(tokens, comments, indexMap, startLoc, endLoc); + this.index = Math.max(0, this.index - beforeCount); + this.indexEnd = Math.min(tokens.length - 1, this.indexEnd + afterCount); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/skip-cursor.js b/node_modules/eslint/lib/source-code/token-store/skip-cursor.js new file mode 100644 index 0000000..f068f53 --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/skip-cursor.js @@ -0,0 +1,42 @@ +/** + * @fileoverview Define the cursor which ignores the first few tokens. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const DecorativeCursor = require("./decorative-cursor"); + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * The decorative cursor which ignores the first few tokens. + */ +module.exports = class SkipCursor extends DecorativeCursor { + + /** + * Initializes this cursor. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor skips. + */ + constructor(cursor, count) { + super(cursor); + this.count = count; + } + + /** @inheritdoc */ + moveNext() { + while (this.count > 0) { + this.count -= 1; + if (!super.moveNext()) { + return false; + } + } + return super.moveNext(); + } +}; diff --git a/node_modules/eslint/lib/source-code/token-store/utils.js b/node_modules/eslint/lib/source-code/token-store/utils.js new file mode 100644 index 0000000..a2bd77d --- /dev/null +++ b/node_modules/eslint/lib/source-code/token-store/utils.js @@ -0,0 +1,92 @@ +/** + * @fileoverview Define utility functions for token store. + * @author Toru Nagashima + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Gets `token.range[0]` from the given token. + * @param {Node|Token|Comment} token The token to get. + * @returns {number} The start location. + * @private + */ +function getStartLocation(token) { + return token.range[0]; +} + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * Finds the index of the first token which is after the given location. + * If it was not found, this returns `tokens.length`. + * @param {(Token|Comment)[]} tokens It searches the token in this list. + * @param {number} location The location to search. + * @returns {number} The found index or `tokens.length`. + */ +exports.search = function search(tokens, location) { + const index = tokens.findIndex(el => location <= getStartLocation(el)); + + return index === -1 ? tokens.length : index; +}; + +/** + * Gets the index of the `startLoc` in `tokens`. + * `startLoc` can be the value of `node.range[1]`, so this checks about `startLoc - 1` as well. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} startLoc The location to get an index. + * @returns {number} The index. + */ +exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { + if (startLoc in indexMap) { + return indexMap[startLoc]; + } + if ((startLoc - 1) in indexMap) { + const index = indexMap[startLoc - 1]; + const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; + + /* + * For the map of "comment's location -> token's index", it points the next token of a comment. + * In that case, +1 is unnecessary. + */ + if (token && token.range[0] >= startLoc) { + return index; + } + return index + 1; + } + return 0; +}; + +/** + * Gets the index of the `endLoc` in `tokens`. + * The information of end locations are recorded at `endLoc - 1` in `indexMap`, so this checks about `endLoc - 1` as well. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} endLoc The location to get an index. + * @returns {number} The index. + */ +exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) { + if (endLoc in indexMap) { + return indexMap[endLoc] - 1; + } + if ((endLoc - 1) in indexMap) { + const index = indexMap[endLoc - 1]; + const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; + + /* + * For the map of "comment's location -> token's index", it points the next token of a comment. + * In that case, -1 is necessary. + */ + if (token && token.range[1] > endLoc) { + return index - 1; + } + return index; + } + return tokens.length - 1; +}; diff --git a/node_modules/eslint/lib/unsupported-api.js b/node_modules/eslint/lib/unsupported-api.js new file mode 100644 index 0000000..110b35a --- /dev/null +++ b/node_modules/eslint/lib/unsupported-api.js @@ -0,0 +1,23 @@ +/** + * @fileoverview APIs that are not officially supported by ESLint. + * These APIs may change or be removed at any time. Use at your + * own risk. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//----------------------------------------------------------------------------- +// Requirements +//----------------------------------------------------------------------------- + +const { FileEnumerator } = require("./cli-engine/file-enumerator"); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +module.exports = { + builtinRules: require("./rules"), + FileEnumerator +}; diff --git a/node_modules/eslint/messages/all-files-ignored.js b/node_modules/eslint/messages/all-files-ignored.js new file mode 100644 index 0000000..70877a4 --- /dev/null +++ b/node_modules/eslint/messages/all-files-ignored.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function(it) { + const { pattern } = it; + + return ` +You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored. + +If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint. + +If you do want to lint these files, try the following solutions: + +* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored. +* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument. +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/extend-config-missing.js b/node_modules/eslint/messages/extend-config-missing.js new file mode 100644 index 0000000..5b3498f --- /dev/null +++ b/node_modules/eslint/messages/extend-config-missing.js @@ -0,0 +1,13 @@ +"use strict"; + +module.exports = function(it) { + const { configName, importerName } = it; + + return ` +ESLint couldn't find the config "${configName}" to extend from. Please check that the name of the config is correct. + +The config "${configName}" was referenced from the config file in "${importerName}". + +If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/failed-to-read-json.js b/node_modules/eslint/messages/failed-to-read-json.js new file mode 100644 index 0000000..e7c6cb5 --- /dev/null +++ b/node_modules/eslint/messages/failed-to-read-json.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function(it) { + const { path, message } = it; + + return ` +Failed to read JSON file at ${path}: + +${message} +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/file-not-found.js b/node_modules/eslint/messages/file-not-found.js new file mode 100644 index 0000000..1a62fcf --- /dev/null +++ b/node_modules/eslint/messages/file-not-found.js @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function(it) { + const { pattern, globDisabled } = it; + + return ` +No files matching the pattern "${pattern}"${globDisabled ? " (with disabling globs)" : ""} were found. +Please check for typing mistakes in the pattern. +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/no-config-found.js b/node_modules/eslint/messages/no-config-found.js new file mode 100644 index 0000000..9860410 --- /dev/null +++ b/node_modules/eslint/messages/no-config-found.js @@ -0,0 +1,15 @@ +"use strict"; + +module.exports = function(it) { + const { directoryPath } = it; + + return ` +ESLint couldn't find a configuration file. To set up a configuration file for this project, please run: + + npm init @eslint/config + +ESLint looked for configuration files in ${directoryPath} and its ancestors. If it found none, it then looked in your home directory. + +If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat/help +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/plugin-conflict.js b/node_modules/eslint/messages/plugin-conflict.js new file mode 100644 index 0000000..c8c060e --- /dev/null +++ b/node_modules/eslint/messages/plugin-conflict.js @@ -0,0 +1,22 @@ +"use strict"; + +module.exports = function(it) { + const { pluginId, plugins } = it; + + let result = `ESLint couldn't determine the plugin "${pluginId}" uniquely. +`; + + for (const { filePath, importerName } of plugins) { + result += ` +- ${filePath} (loaded in "${importerName}")`; + } + + result += ` + +Please remove the "plugins" setting from either config or remove either plugin installation. + +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. +`; + + return result; +}; diff --git a/node_modules/eslint/messages/plugin-invalid.js b/node_modules/eslint/messages/plugin-invalid.js new file mode 100644 index 0000000..8b471d4 --- /dev/null +++ b/node_modules/eslint/messages/plugin-invalid.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = function(it) { + const { configName, importerName } = it; + + return ` +"${configName}" is invalid syntax for a config specifier. + +* If your intention is to extend from a configuration exported from the plugin, add the configuration name after a slash: e.g. "${configName}/myConfig". +* If this is the name of a shareable config instead of a plugin, remove the "plugin:" prefix: i.e. "${configName.slice("plugin:".length)}". + +"${configName}" was referenced from the config file in "${importerName}". + +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/plugin-missing.js b/node_modules/eslint/messages/plugin-missing.js new file mode 100644 index 0000000..0b7d34e --- /dev/null +++ b/node_modules/eslint/messages/plugin-missing.js @@ -0,0 +1,19 @@ +"use strict"; + +module.exports = function(it) { + const { pluginName, resolvePluginsRelativeTo, importerName } = it; + + return ` +ESLint couldn't find the plugin "${pluginName}". + +(The package "${pluginName}" was not found when loaded as a Node module from the directory "${resolvePluginsRelativeTo}".) + +It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: + + npm install ${pluginName}@latest --save-dev + +The plugin "${pluginName}" was referenced from the config file in "${importerName}". + +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/print-config-with-directory-path.js b/node_modules/eslint/messages/print-config-with-directory-path.js new file mode 100644 index 0000000..f65bdaa --- /dev/null +++ b/node_modules/eslint/messages/print-config-with-directory-path.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = function() { + return ` +The '--print-config' CLI option requires a path to a source code file rather than a directory. +See also: https://eslint.org/docs/user-guide/command-line-interface#--print-config +`.trimStart(); +}; diff --git a/node_modules/eslint/messages/whitespace-found.js b/node_modules/eslint/messages/whitespace-found.js new file mode 100644 index 0000000..8a801bc --- /dev/null +++ b/node_modules/eslint/messages/whitespace-found.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = function(it) { + const { pluginName } = it; + + return ` +ESLint couldn't find the plugin "${pluginName}". because there is whitespace in the name. Please check your configuration and remove all whitespace from the plugin name. + +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. +`.trimStart(); +}; diff --git a/node_modules/eslint/node_modules/debug/LICENSE b/node_modules/eslint/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/node_modules/eslint/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +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/eslint/node_modules/debug/README.md b/node_modules/eslint/node_modules/debug/README.md new file mode 100644 index 0000000..e9c3e04 --- /dev/null +++ b/node_modules/eslint/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +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/eslint/node_modules/debug/package.json b/node_modules/eslint/node_modules/debug/package.json new file mode 100644 index 0000000..3bcdc24 --- /dev/null +++ b/node_modules/eslint/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.4", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon ", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/node_modules/eslint/node_modules/debug/src/browser.js b/node_modules/eslint/node_modules/debug/src/browser.js new file mode 100644 index 0000000..cd0fc35 --- /dev/null +++ b/node_modules/eslint/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/eslint/node_modules/debug/src/common.js b/node_modules/eslint/node_modules/debug/src/common.js new file mode 100644 index 0000000..e3291b2 --- /dev/null +++ b/node_modules/eslint/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/eslint/node_modules/debug/src/index.js b/node_modules/eslint/node_modules/debug/src/index.js new file mode 100644 index 0000000..bf4c57f --- /dev/null +++ b/node_modules/eslint/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/eslint/node_modules/debug/src/node.js b/node_modules/eslint/node_modules/debug/src/node.js new file mode 100644 index 0000000..79bc085 --- /dev/null +++ b/node_modules/eslint/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/eslint/node_modules/ms/index.js b/node_modules/eslint/node_modules/ms/index.js new file mode 100644 index 0000000..c4498bc --- /dev/null +++ b/node_modules/eslint/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/eslint/node_modules/ms/license.md b/node_modules/eslint/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/node_modules/eslint/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, 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. diff --git a/node_modules/eslint/node_modules/ms/package.json b/node_modules/eslint/node_modules/ms/package.json new file mode 100644 index 0000000..eea666e --- /dev/null +++ b/node_modules/eslint/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/node_modules/eslint/node_modules/ms/readme.md b/node_modules/eslint/node_modules/ms/readme.md new file mode 100644 index 0000000..9a1996b --- /dev/null +++ b/node_modules/eslint/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/eslint/package.json b/node_modules/eslint/package.json new file mode 100644 index 0000000..1b1177f --- /dev/null +++ b/node_modules/eslint/package.json @@ -0,0 +1,167 @@ +{ + "name": "eslint", + "version": "8.18.0", + "author": "Nicholas C. Zakas ", + "description": "An AST-based pattern checker for JavaScript.", + "bin": { + "eslint": "./bin/eslint.js" + }, + "main": "./lib/api.js", + "exports": { + "./package.json": "./package.json", + ".": "./lib/api.js", + "./use-at-your-own-risk": "./lib/unsupported-api.js" + }, + "scripts": { + "test": "node Makefile.js test", + "test:cli": "mocha", + "lint": "node Makefile.js lint", + "lint:docsjs": "node Makefile.js lintDocsJS", + "fix": "node Makefile.js lint -- fix", + "fix:docsjs": "node Makefile.js lintDocsJS -- fix", + "fuzz": "node Makefile.js fuzz", + "generate-release": "node Makefile.js generateRelease", + "generate-alpharelease": "node Makefile.js generatePrerelease -- alpha", + "generate-betarelease": "node Makefile.js generatePrerelease -- beta", + "generate-rcrelease": "node Makefile.js generatePrerelease -- rc", + "publish-release": "node Makefile.js publishRelease", + "gensite": "node Makefile.js gensite", + "webpack": "node Makefile.js webpack", + "perf": "node Makefile.js perf", + "docs:update-links": "node tools/fetch-docs-links.js" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.js": "eslint --fix", + "*.md": "markdownlint --fix", + "docs/src/rules/*.md": [ + "node tools/fetch-docs-links.js", + "git add docs/src/_data/further_reading_links.json" + ] + }, + "files": [ + "LICENSE", + "README.md", + "bin", + "conf", + "lib", + "messages" + ], + "repository": "eslint/eslint", + "funding": "https://opencollective.com/eslint", + "homepage": "https://eslint.org", + "bugs": "https://github.com/eslint/eslint/issues/", + "dependencies": { + "@eslint/eslintrc": "^1.3.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.2", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "devDependencies": { + "@babel/core": "^7.4.3", + "@babel/preset-env": "^7.4.3", + "babel-loader": "^8.0.5", + "chai": "^4.0.1", + "cheerio": "^0.22.0", + "common-tags": "^1.8.0", + "core-js": "^3.1.3", + "dateformat": "^4.5.1", + "ejs": "^3.0.2", + "eslint": "file:.", + "eslint-config-eslint": "file:packages/eslint-config-eslint", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-eslint-plugin": "^4.2.0", + "eslint-plugin-internal-rules": "file:tools/internal-rules", + "eslint-plugin-jsdoc": "^37.0.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-unicorn": "^42.0.0", + "eslint-release": "^3.2.0", + "eslump": "^3.0.0", + "esprima": "^4.0.1", + "fast-glob": "^3.2.11", + "fs-teardown": "^0.1.3", + "glob": "^7.1.6", + "got": "^11.8.3", + "gray-matter": "^4.0.3", + "jsdoc": "^3.5.5", + "karma": "^6.1.1", + "karma-chrome-launcher": "^3.1.0", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-webpack": "^5.0.0", + "lint-staged": "^11.0.0", + "load-perf": "^0.2.0", + "markdownlint": "^0.24.0", + "markdownlint-cli": "^0.30.0", + "marked": "^4.0.8", + "memfs": "^3.0.1", + "metascraper": "^5.25.7", + "metascraper-description": "^5.25.7", + "metascraper-image": "^5.29.3", + "metascraper-logo": "^5.25.7", + "metascraper-logo-favicon": "^5.25.7", + "metascraper-title": "^5.25.7", + "mocha": "^8.3.2", + "mocha-junit-reporter": "^2.0.0", + "node-polyfill-webpack-plugin": "^1.0.3", + "npm-license": "^0.3.3", + "nyc": "^15.0.1", + "pirates": "^4.0.5", + "progress": "^2.0.3", + "proxyquire": "^2.0.1", + "puppeteer": "^9.1.1", + "recast": "^0.20.4", + "regenerator-runtime": "^0.13.2", + "semver": "^7.3.5", + "shelljs": "^0.8.2", + "sinon": "^11.0.0", + "temp": "^0.9.0", + "webpack": "^5.23.0", + "webpack-cli": "^4.5.0", + "yorkie": "^2.0.0" + }, + "keywords": [ + "ast", + "lint", + "javascript", + "ecmascript", + "espree" + ], + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } +} diff --git a/node_modules/espree/LICENSE b/node_modules/espree/LICENSE new file mode 100644 index 0000000..b18469f --- /dev/null +++ b/node_modules/espree/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) Open JS Foundation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/espree/README.md b/node_modules/espree/README.md new file mode 100644 index 0000000..c645982 --- /dev/null +++ b/node_modules/espree/README.md @@ -0,0 +1,250 @@ +[![npm version](https://img.shields.io/npm/v/espree.svg)](https://www.npmjs.com/package/espree) +[![npm downloads](https://img.shields.io/npm/dm/espree.svg)](https://www.npmjs.com/package/espree) +[![Build Status](https://github.com/eslint/espree/workflows/CI/badge.svg)](https://github.com/eslint/espree/actions) +[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=9348450)](https://www.bountysource.com/trackers/9348450-eslint?utm_source=9348450&utm_medium=shield&utm_campaign=TRACKER_BADGE) + +# Espree + +Espree started out as a fork of [Esprima](http://esprima.org) v1.2.2, the last stable published released of Esprima before work on ECMAScript 6 began. Espree is now built on top of [Acorn](https://github.com/ternjs/acorn), which has a modular architecture that allows extension of core functionality. The goal of Espree is to produce output that is similar to Esprima with a similar API so that it can be used in place of Esprima. + +## Usage + +Install: + +``` +npm i espree +``` + +To use in an ESM file: + +```js +import * as espree from "espree"; + +const ast = espree.parse(code); +``` + +To use in a Common JS file: + +```js +const espree = require("espree"); + +const ast = espree.parse(code); +``` + +## API + +### `parse()` + +`parse` parses the given code and returns a abstract syntax tree (AST). It takes two parameters. + +- `code` [string]() - the code which needs to be parsed. +- `options (Optional)` [Object]() - read more about this [here](#options). + +```js +import * as espree from "espree"; + +const ast = espree.parse(code); +``` + +**Example :** + +```js +const ast = espree.parse('let foo = "bar"', { ecmaVersion: 6 }); +console.log(ast); +``` + +
Output +

+ +``` +Node { + type: 'Program', + start: 0, + end: 15, + body: [ + Node { + type: 'VariableDeclaration', + start: 0, + end: 15, + declarations: [Array], + kind: 'let' + } + ], + sourceType: 'script' +} +``` + +

+
+ +### `tokenize()` + +`tokenize` returns the tokens of a given code. It takes two parameters. + +- `code` [string]() - the code which needs to be parsed. +- `options (Optional)` [Object]() - read more about this [here](#options). + +Even if `options` is empty or undefined or `options.tokens` is `false`, it assigns it to `true` in order to get the `tokens` array + +**Example :** + +```js +import * as espree from "espree"; + +const tokens = espree.tokenize('let foo = "bar"', { ecmaVersion: 6 }); +console.log(tokens); +``` + +
Output +

+ +``` +Token { type: 'Keyword', value: 'let', start: 0, end: 3 }, +Token { type: 'Identifier', value: 'foo', start: 4, end: 7 }, +Token { type: 'Punctuator', value: '=', start: 8, end: 9 }, +Token { type: 'String', value: '"bar"', start: 10, end: 15 } +``` + +

+
+ +### `version` + +Returns the current `espree` version + +### `VisitorKeys` + +Returns all visitor keys for traversing the AST from [eslint-visitor-keys](https://github.com/eslint/eslint-visitor-keys) + +### `latestEcmaVersion` + +Returns the latest ECMAScript supported by `espree` + +### `supportedEcmaVersions` + +Returns an array of all supported ECMAScript versions + +## Options + +```js +const options = { + // attach range information to each node + range: false, + + // attach line/column location information to each node + loc: false, + + // create a top-level comments array containing all comments + comment: false, + + // create a top-level tokens array containing all tokens + tokens: false, + + // Set to 3, 5 (the default), 6, 7, 8, 9, 10, 11, 12, or 13 to specify the version of ECMAScript syntax you want to use. + // You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), or 2022 (same as 13) to use the year-based naming. + // You can also set "latest" to use the most recently supported version. + ecmaVersion: 3, + + allowReserved: true, // only allowed when ecmaVersion is 3 + + // specify which type of script you're parsing ("script", "module", or "commonjs") + sourceType: "script", + + // specify additional language features + ecmaFeatures: { + + // enable JSX parsing + jsx: false, + + // enable return in global scope (set to true automatically when sourceType is "commonjs") + globalReturn: false, + + // enable implied strict mode (if ecmaVersion >= 5) + impliedStrict: false + } +} +``` + +## Esprima Compatibility Going Forward + +The primary goal is to produce the exact same AST structure and tokens as Esprima, and that takes precedence over anything else. (The AST structure being the [ESTree](https://github.com/estree/estree) API with JSX extensions.) Separate from that, Espree may deviate from what Esprima outputs in terms of where and how comments are attached, as well as what additional information is available on AST nodes. That is to say, Espree may add more things to the AST nodes than Esprima does but the overall AST structure produced will be the same. + +Espree may also deviate from Esprima in the interface it exposes. + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/espree/issues). + +Espree is licensed under a permissive BSD 2-clause license. + +## Security Policy + +We work hard to ensure that Espree is safe for everyone and that security issues are addressed quickly and responsibly. Read the full [security policy](https://github.com/eslint/.github/blob/master/SECURITY.md). + +## Build Commands + +* `npm test` - run all linting and tests +* `npm run lint` - run all linting + +## Differences from Espree 2.x + +* The `tokenize()` method does not use `ecmaFeatures`. Any string will be tokenized completely based on ECMAScript 6 semantics. +* Trailing whitespace no longer is counted as part of a node. +* `let` and `const` declarations are no longer parsed by default. You must opt-in by using an `ecmaVersion` newer than `5` or setting `sourceType` to `module`. +* The `esparse` and `esvalidate` binary scripts have been removed. +* There is no `tolerant` option. We will investigate adding this back in the future. + +## Known Incompatibilities + +In an effort to help those wanting to transition from other parsers to Espree, the following is a list of noteworthy incompatibilities with other parsers. These are known differences that we do not intend to change. + +### Esprima 1.2.2 + +* Esprima counts trailing whitespace as part of each AST node while Espree does not. In Espree, the end of a node is where the last token occurs. +* Espree does not parse `let` and `const` declarations by default. +* Error messages returned for parsing errors are different. +* There are two addition properties on every node and token: `start` and `end`. These represent the same data as `range` and are used internally by Acorn. + +### Esprima 2.x + +* Esprima 2.x uses a different comment attachment algorithm that results in some comments being added in different places than Espree. The algorithm Espree uses is the same one used in Esprima 1.2.2. + +## Frequently Asked Questions + +### Why another parser + +[ESLint](http://eslint.org) had been relying on Esprima as its parser from the beginning. While that was fine when the JavaScript language was evolving slowly, the pace of development increased dramatically and Esprima had fallen behind. ESLint, like many other tools reliant on Esprima, has been stuck in using new JavaScript language features until Esprima updates, and that caused our users frustration. + +We decided the only way for us to move forward was to create our own parser, bringing us inline with JSHint and JSLint, and allowing us to keep implementing new features as we need them. We chose to fork Esprima instead of starting from scratch in order to move as quickly as possible with a compatible API. + +With Espree 2.0.0, we are no longer a fork of Esprima but rather a translation layer between Acorn and Esprima syntax. This allows us to put work back into a community-supported parser (Acorn) that is continuing to grow and evolve while maintaining an Esprima-compatible parser for those utilities still built on Esprima. + +### Have you tried working with Esprima? + +Yes. Since the start of ESLint, we've regularly filed bugs and feature requests with Esprima and will continue to do so. However, there are some different philosophies around how the projects work that need to be worked through. The initial goal was to have Espree track Esprima and eventually merge the two back together, but we ultimately decided that building on top of Acorn was a better choice due to Acorn's plugin support. + +### Why don't you just use Acorn? + +Acorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint. + +We are building on top of Acorn, however, so that we can contribute back and help make Acorn even better. + +### What ECMAScript features do you support? + +Espree supports all ECMAScript 2021 features and partially supports ECMAScript 2022 features. + +Because ECMAScript 2022 is still under development, we are implementing features as they are finalized. Currently, Espree supports: + +* [Class instance fields](https://github.com/tc39/proposal-class-fields) +* [Class private instance methods and accessors](https://github.com/tc39/proposal-private-methods) +* [Class static fields, static private methods and accessors](https://github.com/tc39/proposal-static-class-features) +* [RegExp match indices](https://github.com/tc39/proposal-regexp-match-indices) +* [Top-level await](https://github.com/tc39/proposal-top-level-await) +* [Class static initialization blocks](https://github.com/tc39/proposal-class-static-block) +* [Ergonomic brand checks for Private Fields](https://github.com/tc39/proposal-private-fields-in-in) + +See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized. + +### How do you determine which experimental features to support? + +In general, we do not support experimental JavaScript features. We may make exceptions from time to time depending on the maturity of the features. diff --git a/node_modules/espree/dist/espree.cjs b/node_modules/espree/dist/espree.cjs new file mode 100644 index 0000000..f2fe26c --- /dev/null +++ b/node_modules/espree/dist/espree.cjs @@ -0,0 +1,917 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var acorn = require('acorn'); +var jsx = require('acorn-jsx'); +var visitorKeys = require('eslint-visitor-keys'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); +var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx); +var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); + +/** + * @fileoverview Translates tokens between Acorn format and Esprima format. + * @author Nicholas C. Zakas + */ +/* eslint no-underscore-dangle: 0 */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +// Esprima Token Types +const Token = { + Boolean: "Boolean", + EOF: "", + Identifier: "Identifier", + PrivateIdentifier: "PrivateIdentifier", + Keyword: "Keyword", + Null: "Null", + Numeric: "Numeric", + Punctuator: "Punctuator", + String: "String", + RegularExpression: "RegularExpression", + Template: "Template", + JSXIdentifier: "JSXIdentifier", + JSXText: "JSXText" +}; + +/** + * Converts part of a template into an Esprima token. + * @param {AcornToken[]} tokens The Acorn tokens representing the template. + * @param {string} code The source code. + * @returns {EsprimaToken} The Esprima equivalent of the template token. + * @private + */ +function convertTemplatePart(tokens, code) { + const firstToken = tokens[0], + lastTemplateToken = tokens[tokens.length - 1]; + + const token = { + type: Token.Template, + value: code.slice(firstToken.start, lastTemplateToken.end) + }; + + if (firstToken.loc) { + token.loc = { + start: firstToken.loc.start, + end: lastTemplateToken.loc.end + }; + } + + if (firstToken.range) { + token.start = firstToken.range[0]; + token.end = lastTemplateToken.range[1]; + token.range = [token.start, token.end]; + } + + return token; +} + +/** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {Object} acornTokTypes The Acorn token types. + * @param {string} code The source code Acorn is parsing. This is necessary + * to correct the "value" property of some tokens. + * @constructor + */ +function TokenTranslator(acornTokTypes, code) { + + // token types + this._acornTokTypes = acornTokTypes; + + // token buffer for templates + this._tokens = []; + + // track the last curly brace + this._curlyBrace = null; + + // the source code + this._code = code; + +} + +TokenTranslator.prototype = { + constructor: TokenTranslator, + + /** + * Translates a single Esprima token to a single Acorn token. This may be + * inaccurate due to how templates are handled differently in Esprima and + * Acorn, but should be accurate for all other tokens. + * @param {AcornToken} token The Acorn token to translate. + * @param {Object} extra Espree extra object. + * @returns {EsprimaToken} The Esprima version of the token. + */ + translate(token, extra) { + + const type = token.type, + tt = this._acornTokTypes; + + if (type === tt.name) { + token.type = Token.Identifier; + + // TODO: See if this is an Acorn bug + if (token.value === "static") { + token.type = Token.Keyword; + } + + if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { + token.type = Token.Keyword; + } + + } else if (type === tt.privateId) { + token.type = Token.PrivateIdentifier; + + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.dot || type === tt.bracketL || + type === tt.colon || type === tt.question || + type === tt.bracketR || type === tt.ellipsis || + type === tt.arrow || type === tt.jsxTagStart || + type === tt.incDec || type === tt.starstar || + type === tt.jsxTagEnd || type === tt.prefix || + type === tt.questionDot || + (type.binop && !type.keyword) || + type.isAssign) { + + token.type = Token.Punctuator; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.jsxName) { + token.type = Token.JSXIdentifier; + } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { + token.type = Token.JSXText; + } else if (type.keyword) { + if (type.keyword === "true" || type.keyword === "false") { + token.type = Token.Boolean; + } else if (type.keyword === "null") { + token.type = Token.Null; + } else { + token.type = Token.Keyword; + } + } else if (type === tt.num) { + token.type = Token.Numeric; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.string) { + + if (extra.jsxAttrValueToken) { + extra.jsxAttrValueToken = false; + token.type = Token.JSXText; + } else { + token.type = Token.String; + } + + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = Token.RegularExpression; + const value = token.value; + + token.regex = { + flags: value.flags, + pattern: value.pattern + }; + token.value = `/${value.pattern}/${value.flags}`; + } + + return token; + }, + + /** + * Function to call during Acorn's onToken handler. + * @param {AcornToken} token The Acorn token. + * @param {Object} extra The Espree extra object. + * @returns {void} + */ + onToken(token, extra) { + + const that = this, + tt = this._acornTokTypes, + tokens = extra.tokens, + templateTokens = this._tokens; + + /** + * Flushes the buffered template tokens and resets the template + * tracking. + * @returns {void} + * @private + */ + function translateTemplateTokens() { + tokens.push(convertTemplatePart(that._tokens, that._code)); + that._tokens = []; + } + + if (token.type === tt.eof) { + + // might be one last curlyBrace + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + return; + } + + if (token.type === tt.backQuote) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + templateTokens.push(token); + + // it's the end + if (templateTokens.length > 1) { + translateTemplateTokens(); + } + + return; + } + if (token.type === tt.dollarBraceL) { + templateTokens.push(token); + translateTemplateTokens(); + return; + } + if (token.type === tt.braceR) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + // store new curly for later + this._curlyBrace = token; + return; + } + if (token.type === tt.template || token.type === tt.invalidTemplate) { + if (this._curlyBrace) { + templateTokens.push(this._curlyBrace); + this._curlyBrace = null; + } + + templateTokens.push(token); + return; + } + + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + tokens.push(this.translate(token, extra)); + } +}; + +/** + * @fileoverview A collection of methods for processing Espree's options. + * @author Kai Cataldo + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SUPPORTED_VERSIONS = [ + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 +]; + +/** + * Get the latest ECMAScript version supported by Espree. + * @returns {number} The latest ECMAScript version. + */ +function getLatestEcmaVersion() { + return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; +} + +/** + * Get the list of ECMAScript versions supported by Espree. + * @returns {number[]} An array containing the supported ECMAScript versions. + */ +function getSupportedEcmaVersions() { + return [...SUPPORTED_VERSIONS]; +} + +/** + * Normalize ECMAScript version from the initial config + * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config + * @throws {Error} throws an error if the ecmaVersion is invalid. + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersion(ecmaVersion = 5) { + + let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; + + if (typeof version !== "number") { + throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); + } + + // Calculate ECMAScript edition number from official year version starting with + // ES2015, which corresponds with ES6 (or a difference of 2009). + if (version >= 2015) { + version -= 2009; + } + + if (!SUPPORTED_VERSIONS.includes(version)) { + throw new Error("Invalid ecmaVersion."); + } + + return version; +} + +/** + * Normalize sourceType from the initial config + * @param {string} sourceType to normalize + * @throws {Error} throw an error if sourceType is invalid + * @returns {string} normalized sourceType + */ +function normalizeSourceType(sourceType = "script") { + if (sourceType === "script" || sourceType === "module") { + return sourceType; + } + + if (sourceType === "commonjs") { + return "script"; + } + + throw new Error("Invalid sourceType."); +} + +/** + * Normalize parserOptions + * @param {Object} options the parser options to normalize + * @throws {Error} throw an error if found invalid option. + * @returns {Object} normalized options + */ +function normalizeOptions(options) { + const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + const sourceType = normalizeSourceType(options.sourceType); + const ranges = options.range === true; + const locations = options.loc === true; + + if (ecmaVersion !== 3 && options.allowReserved) { + + // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed + throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); + } + if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { + throw new Error("`allowReserved`, when present, must be `true` or `false`"); + } + const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; + const ecmaFeatures = options.ecmaFeatures || {}; + const allowReturnOutsideFunction = options.sourceType === "commonjs" || + Boolean(ecmaFeatures.globalReturn); + + if (sourceType === "module" && ecmaVersion < 6) { + throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); + } + + return Object.assign({}, options, { + ecmaVersion, + sourceType, + ranges, + locations, + allowReserved, + allowReturnOutsideFunction + }); +} + +/* eslint-disable no-param-reassign*/ + + +const STATE = Symbol("espree's internal state"); +const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); + + +/** + * Converts an Acorn comment to a Esprima comment. + * @param {boolean} block True if it's a block comment, false if not. + * @param {string} text The text of the comment. + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @param {Location} startLoc The location at which the comment starts. + * @param {Location} endLoc The location at which the comment ends. + * @returns {Object} The comment object. + * @private + */ +function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + const comment = { + type: block ? "Block" : "Line", + value: text + }; + + if (typeof start === "number") { + comment.start = start; + comment.end = end; + comment.range = [start, end]; + } + + if (typeof startLoc === "object") { + comment.loc = { + start: startLoc, + end: endLoc + }; + } + + return comment; +} + +var espree = () => Parser => { + const tokTypes = Object.assign({}, Parser.acorn.tokTypes); + + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } + + return class Espree extends Parser { + constructor(opts, code) { + if (typeof opts !== "object" || opts === null) { + opts = {}; + } + if (typeof code !== "string" && !(code instanceof String)) { + code = String(code); + } + + // save original source type in case of commonjs + const originalSourceType = opts.sourceType; + const options = normalizeOptions(opts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, code) + : null; + + // Initialize acorn parser. + super({ + + // do not use spread, because we don't want to pass any unknown options to acorn + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + allowReserved: options.allowReserved, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: options.allowReturnOutsideFunction, + + // Collect tokens + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, this[STATE]); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + this[STATE].comments.push(comment); + } + } + }, code); + + /* + * Data that is unique to Espree and is not represented internally in + * Acorn. We put all of this data into a symbol property as a way to + * avoid potential naming conflicts with future versions of Acorn. + */ + this[STATE] = { + originalSourceType: originalSourceType || options.sourceType, + tokens: tokenTranslator ? [] : null, + comments: options.comment === true ? [] : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + lastToken: null, + templateElements: [] + }; + } + + tokenize() { + do { + this.next(); + } while (this.type !== tokTypes.eof); + + // Consume the final eof token + this.next(); + + const extra = this[STATE]; + const tokens = extra.tokens; + + if (extra.comments) { + tokens.comments = extra.comments; + } + + return tokens; + } + + finishNode(...args) { + const result = super.finishNode(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + finishNodeAt(...args) { + const result = super.finishNodeAt(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + parse() { + const extra = this[STATE]; + const program = super.parse(); + + program.sourceType = extra.originalSourceType; + + if (extra.comments) { + program.comments = extra.comments; + } + if (extra.tokens) { + program.tokens = extra.tokens; + } + + /* + * Adjust opening and closing position of program to match Esprima. + * Acorn always starts programs at range 0 whereas Esprima starts at the + * first AST node's start (the only real difference is when there's leading + * whitespace or leading comments). Acorn also counts trailing whitespace + * as part of the program whereas Esprima only counts up to the last token. + */ + if (program.body.length) { + const [firstNode] = program.body; + + if (program.range) { + program.range[0] = firstNode.range[0]; + } + if (program.loc) { + program.loc.start = firstNode.loc.start; + } + program.start = firstNode.start; + } + if (extra.lastToken) { + if (program.range) { + program.range[1] = extra.lastToken.range[1]; + } + if (program.loc) { + program.loc.end = extra.lastToken.loc.end; + } + program.end = extra.lastToken.end; + } + + + /* + * https://github.com/eslint/espree/issues/349 + * Ensure that template elements have correct range information. + * This is one location where Acorn produces a different value + * for its start and end properties vs. the values present in the + * range property. In order to avoid confusion, we set the start + * and end properties to the values that are present in range. + * This is done here, instead of in finishNode(), because Acorn + * uses the values of start and end internally while parsing, making + * it dangerous to change those values while parsing is ongoing. + * By waiting until the end of parsing, we can safely change these + * values without affect any other part of the process. + */ + this[STATE].templateElements.forEach(templateElement => { + const startOffset = -1; + const endOffset = templateElement.tail ? 1 : 2; + + templateElement.start += startOffset; + templateElement.end += endOffset; + + if (templateElement.range) { + templateElement.range[0] += startOffset; + templateElement.range[1] += endOffset; + } + + if (templateElement.loc) { + templateElement.loc.start.column += startOffset; + templateElement.loc.end.column += endOffset; + } + }); + + return program; + } + + parseTopLevel(node) { + if (this[STATE].impliedStrict) { + this.strict = true; + } + return super.parseTopLevel(node); + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); + const err = new SyntaxError(message); + + err.index = pos; + err.lineNumber = loc.line; + err.column = loc.column + 1; // acorn uses 0-based columns + throw err; + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos, message) { + this.raise(pos, message); + } + + /** + * Overwrites the default unexpected method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + unexpected(pos) { + let message = "Unexpected token"; + + if (pos !== null && pos !== void 0) { + this.pos = pos; + + if (this.options.locations) { + while (this.pos < this.lineStart) { + this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; + --this.curLine; + } + } + + this.nextToken(); + } + + if (this.end > this.start) { + message += ` ${this.input.slice(this.start, this.end)}`; + } + + this.raise(this.start, message); + } + + /* + * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX + * uses regular tt.string without any distinction between this and regular JS + * strings. As such, we intercept an attempt to read a JSX string and set a flag + * on extra so that when tokens are converted, the next token will be switched + * to JSXText via onToken. + */ + jsx_readString(quote) { // eslint-disable-line camelcase + const result = super.jsx_readString(quote); + + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + return result; + } + + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {ASTNode} result The node to check. + * @returns {ASTNode} The finished node. + */ + [ESPRIMA_FINISH_NODE](result) { + + // Acorn doesn't count the opening and closing backticks as part of templates + // so we have to adjust ranges/locations appropriately. + if (result.type === "TemplateElement") { + + // save template element references to fix start/end later + this[STATE].templateElements.push(result); + } + + if (result.type.includes("Function") && !result.generator) { + result.generator = false; + } + + return result; + } + }; +}; + +const version$1 = "9.3.2"; + +/** + * @fileoverview Main Espree file that converts Acorn into Esprima output. + * + * This file contains code from the following MIT-licensed projects: + * 1. Acorn + * 2. Babylon + * 3. Babel-ESLint + * + * This file also contains code from Esprima, which is BSD licensed. + * + * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS) + * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS) + * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +// To initialize lazily. +const parsers = { + _regular: null, + _jsx: null, + + get regular() { + if (this._regular === null) { + this._regular = acorn__namespace.Parser.extend(espree()); + } + return this._regular; + }, + + get jsx() { + if (this._jsx === null) { + this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree()); + } + return this._jsx; + }, + + get(options) { + const useJsx = Boolean( + options && + options.ecmaFeatures && + options.ecmaFeatures.jsx + ); + + return useJsx ? this.jsx : this.regular; + } +}; + +//------------------------------------------------------------------------------ +// Tokenizer +//------------------------------------------------------------------------------ + +/** + * Tokenizes the given code. + * @param {string} code The code to tokenize. + * @param {Object} options Options defining how to tokenize. + * @returns {Token[]} An array of tokens. + * @throws {SyntaxError} If the input code is invalid. + * @private + */ +function tokenize(code, options) { + const Parser = parsers.get(options); + + // Ensure to collect tokens. + if (!options || options.tokens !== true) { + options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign + } + + return new Parser(options, code).tokenize(); +} + +//------------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------------ + +/** + * Parses the given code. + * @param {string} code The code to tokenize. + * @param {Object} options Options defining how to tokenize. + * @returns {ASTNode} The "Program" AST node. + * @throws {SyntaxError} If the input code is invalid. + */ +function parse(code, options) { + const Parser = parsers.get(options); + + return new Parser(options, code).parse(); +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +const version = version$1; + +/* istanbul ignore next */ +const VisitorKeys = (function() { + return visitorKeys__namespace.KEYS; +}()); + +// Derive node types from VisitorKeys +/* istanbul ignore next */ +const Syntax = (function() { + let name, + types = {}; + + if (typeof Object.create === "function") { + types = Object.create(null); + } + + for (name in VisitorKeys) { + if (Object.hasOwnProperty.call(VisitorKeys, name)) { + types[name] = name; + } + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); + +const latestEcmaVersion = getLatestEcmaVersion(); + +const supportedEcmaVersions = getSupportedEcmaVersions(); + +exports.Syntax = Syntax; +exports.VisitorKeys = VisitorKeys; +exports.latestEcmaVersion = latestEcmaVersion; +exports.parse = parse; +exports.supportedEcmaVersions = supportedEcmaVersions; +exports.tokenize = tokenize; +exports.version = version; +//# sourceMappingURL=espree.cjs.map diff --git a/node_modules/espree/espree.js b/node_modules/espree/espree.js new file mode 100644 index 0000000..71e3d47 --- /dev/null +++ b/node_modules/espree/espree.js @@ -0,0 +1,173 @@ +/** + * @fileoverview Main Espree file that converts Acorn into Esprima output. + * + * This file contains code from the following MIT-licensed projects: + * 1. Acorn + * 2. Babylon + * 3. Babel-ESLint + * + * This file also contains code from Esprima, which is BSD licensed. + * + * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS) + * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS) + * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* eslint no-undefined:0, no-use-before-define: 0 */ + +import * as acorn from "acorn"; +import jsx from "acorn-jsx"; +import espree from "./lib/espree.js"; +import espreeVersion from "./lib/version.js"; +import * as visitorKeys from "eslint-visitor-keys"; +import { getLatestEcmaVersion, getSupportedEcmaVersions } from "./lib/options.js"; + + +// To initialize lazily. +const parsers = { + _regular: null, + _jsx: null, + + get regular() { + if (this._regular === null) { + this._regular = acorn.Parser.extend(espree()); + } + return this._regular; + }, + + get jsx() { + if (this._jsx === null) { + this._jsx = acorn.Parser.extend(jsx(), espree()); + } + return this._jsx; + }, + + get(options) { + const useJsx = Boolean( + options && + options.ecmaFeatures && + options.ecmaFeatures.jsx + ); + + return useJsx ? this.jsx : this.regular; + } +}; + +//------------------------------------------------------------------------------ +// Tokenizer +//------------------------------------------------------------------------------ + +/** + * Tokenizes the given code. + * @param {string} code The code to tokenize. + * @param {Object} options Options defining how to tokenize. + * @returns {Token[]} An array of tokens. + * @throws {SyntaxError} If the input code is invalid. + * @private + */ +export function tokenize(code, options) { + const Parser = parsers.get(options); + + // Ensure to collect tokens. + if (!options || options.tokens !== true) { + options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign + } + + return new Parser(options, code).tokenize(); +} + +//------------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------------ + +/** + * Parses the given code. + * @param {string} code The code to tokenize. + * @param {Object} options Options defining how to tokenize. + * @returns {ASTNode} The "Program" AST node. + * @throws {SyntaxError} If the input code is invalid. + */ +export function parse(code, options) { + const Parser = parsers.get(options); + + return new Parser(options, code).parse(); +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +export const version = espreeVersion; + +/* istanbul ignore next */ +export const VisitorKeys = (function() { + return visitorKeys.KEYS; +}()); + +// Derive node types from VisitorKeys +/* istanbul ignore next */ +export const Syntax = (function() { + let name, + types = {}; + + if (typeof Object.create === "function") { + types = Object.create(null); + } + + for (name in VisitorKeys) { + if (Object.hasOwnProperty.call(VisitorKeys, name)) { + types[name] = name; + } + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); + +export const latestEcmaVersion = getLatestEcmaVersion(); + +export const supportedEcmaVersions = getSupportedEcmaVersions(); diff --git a/node_modules/espree/lib/espree.js b/node_modules/espree/lib/espree.js new file mode 100644 index 0000000..786d89f --- /dev/null +++ b/node_modules/espree/lib/espree.js @@ -0,0 +1,328 @@ +/* eslint-disable no-param-reassign*/ +import TokenTranslator from "./token-translator.js"; +import { normalizeOptions } from "./options.js"; + + +const STATE = Symbol("espree's internal state"); +const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); + + +/** + * Converts an Acorn comment to a Esprima comment. + * @param {boolean} block True if it's a block comment, false if not. + * @param {string} text The text of the comment. + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @param {Location} startLoc The location at which the comment starts. + * @param {Location} endLoc The location at which the comment ends. + * @returns {Object} The comment object. + * @private + */ +function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + const comment = { + type: block ? "Block" : "Line", + value: text + }; + + if (typeof start === "number") { + comment.start = start; + comment.end = end; + comment.range = [start, end]; + } + + if (typeof startLoc === "object") { + comment.loc = { + start: startLoc, + end: endLoc + }; + } + + return comment; +} + +export default () => Parser => { + const tokTypes = Object.assign({}, Parser.acorn.tokTypes); + + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } + + return class Espree extends Parser { + constructor(opts, code) { + if (typeof opts !== "object" || opts === null) { + opts = {}; + } + if (typeof code !== "string" && !(code instanceof String)) { + code = String(code); + } + + // save original source type in case of commonjs + const originalSourceType = opts.sourceType; + const options = normalizeOptions(opts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, code) + : null; + + // Initialize acorn parser. + super({ + + // do not use spread, because we don't want to pass any unknown options to acorn + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + allowReserved: options.allowReserved, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: options.allowReturnOutsideFunction, + + // Collect tokens + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, this[STATE]); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + this[STATE].comments.push(comment); + } + } + }, code); + + /* + * Data that is unique to Espree and is not represented internally in + * Acorn. We put all of this data into a symbol property as a way to + * avoid potential naming conflicts with future versions of Acorn. + */ + this[STATE] = { + originalSourceType: originalSourceType || options.sourceType, + tokens: tokenTranslator ? [] : null, + comments: options.comment === true ? [] : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + lastToken: null, + templateElements: [] + }; + } + + tokenize() { + do { + this.next(); + } while (this.type !== tokTypes.eof); + + // Consume the final eof token + this.next(); + + const extra = this[STATE]; + const tokens = extra.tokens; + + if (extra.comments) { + tokens.comments = extra.comments; + } + + return tokens; + } + + finishNode(...args) { + const result = super.finishNode(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + finishNodeAt(...args) { + const result = super.finishNodeAt(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + parse() { + const extra = this[STATE]; + const program = super.parse(); + + program.sourceType = extra.originalSourceType; + + if (extra.comments) { + program.comments = extra.comments; + } + if (extra.tokens) { + program.tokens = extra.tokens; + } + + /* + * Adjust opening and closing position of program to match Esprima. + * Acorn always starts programs at range 0 whereas Esprima starts at the + * first AST node's start (the only real difference is when there's leading + * whitespace or leading comments). Acorn also counts trailing whitespace + * as part of the program whereas Esprima only counts up to the last token. + */ + if (program.body.length) { + const [firstNode] = program.body; + + if (program.range) { + program.range[0] = firstNode.range[0]; + } + if (program.loc) { + program.loc.start = firstNode.loc.start; + } + program.start = firstNode.start; + } + if (extra.lastToken) { + if (program.range) { + program.range[1] = extra.lastToken.range[1]; + } + if (program.loc) { + program.loc.end = extra.lastToken.loc.end; + } + program.end = extra.lastToken.end; + } + + + /* + * https://github.com/eslint/espree/issues/349 + * Ensure that template elements have correct range information. + * This is one location where Acorn produces a different value + * for its start and end properties vs. the values present in the + * range property. In order to avoid confusion, we set the start + * and end properties to the values that are present in range. + * This is done here, instead of in finishNode(), because Acorn + * uses the values of start and end internally while parsing, making + * it dangerous to change those values while parsing is ongoing. + * By waiting until the end of parsing, we can safely change these + * values without affect any other part of the process. + */ + this[STATE].templateElements.forEach(templateElement => { + const startOffset = -1; + const endOffset = templateElement.tail ? 1 : 2; + + templateElement.start += startOffset; + templateElement.end += endOffset; + + if (templateElement.range) { + templateElement.range[0] += startOffset; + templateElement.range[1] += endOffset; + } + + if (templateElement.loc) { + templateElement.loc.start.column += startOffset; + templateElement.loc.end.column += endOffset; + } + }); + + return program; + } + + parseTopLevel(node) { + if (this[STATE].impliedStrict) { + this.strict = true; + } + return super.parseTopLevel(node); + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); + const err = new SyntaxError(message); + + err.index = pos; + err.lineNumber = loc.line; + err.column = loc.column + 1; // acorn uses 0-based columns + throw err; + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos, message) { + this.raise(pos, message); + } + + /** + * Overwrites the default unexpected method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + unexpected(pos) { + let message = "Unexpected token"; + + if (pos !== null && pos !== void 0) { + this.pos = pos; + + if (this.options.locations) { + while (this.pos < this.lineStart) { + this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; + --this.curLine; + } + } + + this.nextToken(); + } + + if (this.end > this.start) { + message += ` ${this.input.slice(this.start, this.end)}`; + } + + this.raise(this.start, message); + } + + /* + * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX + * uses regular tt.string without any distinction between this and regular JS + * strings. As such, we intercept an attempt to read a JSX string and set a flag + * on extra so that when tokens are converted, the next token will be switched + * to JSXText via onToken. + */ + jsx_readString(quote) { // eslint-disable-line camelcase + const result = super.jsx_readString(quote); + + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + return result; + } + + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {ASTNode} result The node to check. + * @returns {ASTNode} The finished node. + */ + [ESPRIMA_FINISH_NODE](result) { + + // Acorn doesn't count the opening and closing backticks as part of templates + // so we have to adjust ranges/locations appropriately. + if (result.type === "TemplateElement") { + + // save template element references to fix start/end later + this[STATE].templateElements.push(result); + } + + if (result.type.includes("Function") && !result.generator) { + result.generator = false; + } + + return result; + } + }; +}; diff --git a/node_modules/espree/lib/features.js b/node_modules/espree/lib/features.js new file mode 100644 index 0000000..31467d2 --- /dev/null +++ b/node_modules/espree/lib/features.js @@ -0,0 +1,27 @@ +/** + * @fileoverview The list of feature flags supported by the parser and their default + * settings. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +export default { + + // React JSX parsing + jsx: false, + + // allow return statement in global scope + globalReturn: false, + + // allow implied strict mode + impliedStrict: false +}; diff --git a/node_modules/espree/lib/options.js b/node_modules/espree/lib/options.js new file mode 100644 index 0000000..8773969 --- /dev/null +++ b/node_modules/espree/lib/options.js @@ -0,0 +1,121 @@ +/** + * @fileoverview A collection of methods for processing Espree's options. + * @author Kai Cataldo + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SUPPORTED_VERSIONS = [ + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 +]; + +/** + * Get the latest ECMAScript version supported by Espree. + * @returns {number} The latest ECMAScript version. + */ +export function getLatestEcmaVersion() { + return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; +} + +/** + * Get the list of ECMAScript versions supported by Espree. + * @returns {number[]} An array containing the supported ECMAScript versions. + */ +export function getSupportedEcmaVersions() { + return [...SUPPORTED_VERSIONS]; +} + +/** + * Normalize ECMAScript version from the initial config + * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config + * @throws {Error} throws an error if the ecmaVersion is invalid. + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersion(ecmaVersion = 5) { + + let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; + + if (typeof version !== "number") { + throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); + } + + // Calculate ECMAScript edition number from official year version starting with + // ES2015, which corresponds with ES6 (or a difference of 2009). + if (version >= 2015) { + version -= 2009; + } + + if (!SUPPORTED_VERSIONS.includes(version)) { + throw new Error("Invalid ecmaVersion."); + } + + return version; +} + +/** + * Normalize sourceType from the initial config + * @param {string} sourceType to normalize + * @throws {Error} throw an error if sourceType is invalid + * @returns {string} normalized sourceType + */ +function normalizeSourceType(sourceType = "script") { + if (sourceType === "script" || sourceType === "module") { + return sourceType; + } + + if (sourceType === "commonjs") { + return "script"; + } + + throw new Error("Invalid sourceType."); +} + +/** + * Normalize parserOptions + * @param {Object} options the parser options to normalize + * @throws {Error} throw an error if found invalid option. + * @returns {Object} normalized options + */ +export function normalizeOptions(options) { + const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + const sourceType = normalizeSourceType(options.sourceType); + const ranges = options.range === true; + const locations = options.loc === true; + + if (ecmaVersion !== 3 && options.allowReserved) { + + // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed + throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); + } + if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { + throw new Error("`allowReserved`, when present, must be `true` or `false`"); + } + const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; + const ecmaFeatures = options.ecmaFeatures || {}; + const allowReturnOutsideFunction = options.sourceType === "commonjs" || + Boolean(ecmaFeatures.globalReturn); + + if (sourceType === "module" && ecmaVersion < 6) { + throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); + } + + return Object.assign({}, options, { + ecmaVersion, + sourceType, + ranges, + locations, + allowReserved, + allowReturnOutsideFunction + }); +} diff --git a/node_modules/espree/lib/token-translator.js b/node_modules/espree/lib/token-translator.js new file mode 100644 index 0000000..9aa5e22 --- /dev/null +++ b/node_modules/espree/lib/token-translator.js @@ -0,0 +1,265 @@ +/** + * @fileoverview Translates tokens between Acorn format and Esprima format. + * @author Nicholas C. Zakas + */ +/* eslint no-underscore-dangle: 0 */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +// Esprima Token Types +const Token = { + Boolean: "Boolean", + EOF: "", + Identifier: "Identifier", + PrivateIdentifier: "PrivateIdentifier", + Keyword: "Keyword", + Null: "Null", + Numeric: "Numeric", + Punctuator: "Punctuator", + String: "String", + RegularExpression: "RegularExpression", + Template: "Template", + JSXIdentifier: "JSXIdentifier", + JSXText: "JSXText" +}; + +/** + * Converts part of a template into an Esprima token. + * @param {AcornToken[]} tokens The Acorn tokens representing the template. + * @param {string} code The source code. + * @returns {EsprimaToken} The Esprima equivalent of the template token. + * @private + */ +function convertTemplatePart(tokens, code) { + const firstToken = tokens[0], + lastTemplateToken = tokens[tokens.length - 1]; + + const token = { + type: Token.Template, + value: code.slice(firstToken.start, lastTemplateToken.end) + }; + + if (firstToken.loc) { + token.loc = { + start: firstToken.loc.start, + end: lastTemplateToken.loc.end + }; + } + + if (firstToken.range) { + token.start = firstToken.range[0]; + token.end = lastTemplateToken.range[1]; + token.range = [token.start, token.end]; + } + + return token; +} + +/** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {Object} acornTokTypes The Acorn token types. + * @param {string} code The source code Acorn is parsing. This is necessary + * to correct the "value" property of some tokens. + * @constructor + */ +function TokenTranslator(acornTokTypes, code) { + + // token types + this._acornTokTypes = acornTokTypes; + + // token buffer for templates + this._tokens = []; + + // track the last curly brace + this._curlyBrace = null; + + // the source code + this._code = code; + +} + +TokenTranslator.prototype = { + constructor: TokenTranslator, + + /** + * Translates a single Esprima token to a single Acorn token. This may be + * inaccurate due to how templates are handled differently in Esprima and + * Acorn, but should be accurate for all other tokens. + * @param {AcornToken} token The Acorn token to translate. + * @param {Object} extra Espree extra object. + * @returns {EsprimaToken} The Esprima version of the token. + */ + translate(token, extra) { + + const type = token.type, + tt = this._acornTokTypes; + + if (type === tt.name) { + token.type = Token.Identifier; + + // TODO: See if this is an Acorn bug + if (token.value === "static") { + token.type = Token.Keyword; + } + + if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { + token.type = Token.Keyword; + } + + } else if (type === tt.privateId) { + token.type = Token.PrivateIdentifier; + + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.dot || type === tt.bracketL || + type === tt.colon || type === tt.question || + type === tt.bracketR || type === tt.ellipsis || + type === tt.arrow || type === tt.jsxTagStart || + type === tt.incDec || type === tt.starstar || + type === tt.jsxTagEnd || type === tt.prefix || + type === tt.questionDot || + (type.binop && !type.keyword) || + type.isAssign) { + + token.type = Token.Punctuator; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.jsxName) { + token.type = Token.JSXIdentifier; + } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { + token.type = Token.JSXText; + } else if (type.keyword) { + if (type.keyword === "true" || type.keyword === "false") { + token.type = Token.Boolean; + } else if (type.keyword === "null") { + token.type = Token.Null; + } else { + token.type = Token.Keyword; + } + } else if (type === tt.num) { + token.type = Token.Numeric; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.string) { + + if (extra.jsxAttrValueToken) { + extra.jsxAttrValueToken = false; + token.type = Token.JSXText; + } else { + token.type = Token.String; + } + + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = Token.RegularExpression; + const value = token.value; + + token.regex = { + flags: value.flags, + pattern: value.pattern + }; + token.value = `/${value.pattern}/${value.flags}`; + } + + return token; + }, + + /** + * Function to call during Acorn's onToken handler. + * @param {AcornToken} token The Acorn token. + * @param {Object} extra The Espree extra object. + * @returns {void} + */ + onToken(token, extra) { + + const that = this, + tt = this._acornTokTypes, + tokens = extra.tokens, + templateTokens = this._tokens; + + /** + * Flushes the buffered template tokens and resets the template + * tracking. + * @returns {void} + * @private + */ + function translateTemplateTokens() { + tokens.push(convertTemplatePart(that._tokens, that._code)); + that._tokens = []; + } + + if (token.type === tt.eof) { + + // might be one last curlyBrace + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + return; + } + + if (token.type === tt.backQuote) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + templateTokens.push(token); + + // it's the end + if (templateTokens.length > 1) { + translateTemplateTokens(); + } + + return; + } + if (token.type === tt.dollarBraceL) { + templateTokens.push(token); + translateTemplateTokens(); + return; + } + if (token.type === tt.braceR) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + // store new curly for later + this._curlyBrace = token; + return; + } + if (token.type === tt.template || token.type === tt.invalidTemplate) { + if (this._curlyBrace) { + templateTokens.push(this._curlyBrace); + this._curlyBrace = null; + } + + templateTokens.push(token); + return; + } + + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + tokens.push(this.translate(token, extra)); + } +}; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +export default TokenTranslator; diff --git a/node_modules/espree/lib/version.js b/node_modules/espree/lib/version.js new file mode 100644 index 0000000..cabc77e --- /dev/null +++ b/node_modules/espree/lib/version.js @@ -0,0 +1,3 @@ +const version = "9.3.2"; + +export default version; diff --git a/node_modules/espree/package.json b/node_modules/espree/package.json new file mode 100644 index 0000000..7445ef3 --- /dev/null +++ b/node_modules/espree/package.json @@ -0,0 +1,81 @@ +{ + "name": "espree", + "description": "An Esprima-compatible JavaScript parser built on Acorn", + "author": "Nicholas C. Zakas ", + "homepage": "https://github.com/eslint/espree", + "main": "dist/espree.cjs", + "type": "module", + "exports": { + ".": [ + { + "import": "./espree.js", + "require": "./dist/espree.cjs", + "default": "./dist/espree.cjs" + }, + "./dist/espree.cjs" + ], + "./package.json": "./package.json" + }, + "version": "9.3.2", + "files": [ + "lib", + "dist/espree.cjs", + "espree.js" + ], + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "repository": "eslint/espree", + "bugs": { + "url": "http://github.com/eslint/espree.git" + }, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^17.1.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^11.2.0", + "c8": "^7.11.0", + "chai": "^4.3.6", + "eslint": "^8.13.0", + "eslint-config-eslint": "^7.0.0", + "eslint-plugin-jsdoc": "^39.2.4", + "eslint-plugin-node": "^11.1.0", + "eslint-release": "^3.2.0", + "esprima-fb": "^8001.2001.0-dev-harmony-fb", + "mocha": "^9.2.2", + "npm-run-all": "^4.1.5", + "rollup": "^2.41.2", + "shelljs": "^0.3.0" + }, + "keywords": [ + "ast", + "ecmascript", + "javascript", + "parser", + "syntax", + "acorn" + ], + "scripts": { + "unit": "npm-run-all -s unit:*", + "unit:esm": "c8 mocha --color --reporter progress --timeout 30000 'tests/lib/**/*.js'", + "unit:cjs": "mocha --color --reporter progress --timeout 30000 tests/lib/commonjs.cjs", + "test": "npm-run-all -p unit lint", + "lint": "eslint .", + "fixlint": "npm run lint -- --fix", + "build": "rollup -c rollup.config.js", + "update-version": "node tools/update-version.js", + "pretest": "npm run build", + "prepublishOnly": "npm run update-version && npm run build", + "sync-docs": "node sync-docs.js", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + } +} diff --git a/node_modules/esquery/README.md b/node_modules/esquery/README.md new file mode 100644 index 0000000..8264efc --- /dev/null +++ b/node_modules/esquery/README.md @@ -0,0 +1,27 @@ +ESQuery is a library for querying the AST output by Esprima for patterns of syntax using a CSS style selector system. Check out the demo: + +[demo](https://estools.github.io/esquery/) + +The following selectors are supported: +* AST node type: `ForStatement` +* [wildcard](http://dev.w3.org/csswg/selectors4/#universal-selector): `*` +* [attribute existence](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr]` +* [attribute value](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr="foo"]` or `[attr=123]` +* attribute regex: `[attr=/foo.*/]` or (with flags) `[attr=/foo.*/is]` +* attribute conditions: `[attr!="foo"]`, `[attr>2]`, `[attr<3]`, `[attr>=2]`, or `[attr<=3]` +* nested attribute: `[attr.level2="foo"]` +* field: `FunctionDeclaration > Identifier.id` +* [First](http://dev.w3.org/csswg/selectors4/#the-first-child-pseudo) or [last](http://dev.w3.org/csswg/selectors4/#the-last-child-pseudo) child: `:first-child` or `:last-child` +* [nth-child](http://dev.w3.org/csswg/selectors4/#the-nth-child-pseudo) (no ax+b support): `:nth-child(2)` +* [nth-last-child](http://dev.w3.org/csswg/selectors4/#the-nth-last-child-pseudo) (no ax+b support): `:nth-last-child(1)` +* [descendant](http://dev.w3.org/csswg/selectors4/#descendant-combinators): `ancestor descendant` +* [child](http://dev.w3.org/csswg/selectors4/#child-combinators): `parent > child` +* [following sibling](http://dev.w3.org/csswg/selectors4/#general-sibling-combinators): `node ~ sibling` +* [adjacent sibling](http://dev.w3.org/csswg/selectors4/#adjacent-sibling-combinators): `node + adjacent` +* [negation](http://dev.w3.org/csswg/selectors4/#negation-pseudo): `:not(ForStatement)` +* [has](https://drafts.csswg.org/selectors-4/#has-pseudo): `:has(ForStatement)` +* [matches-any](http://dev.w3.org/csswg/selectors4/#matches): `:matches([attr] > :first-child, :last-child)` +* [subject indicator](http://dev.w3.org/csswg/selectors4/#subject): `!IfStatement > [name="foo"]` +* class of AST node: `:statement`, `:expression`, `:declaration`, `:function`, or `:pattern` + +[![Build Status](https://travis-ci.org/estools/esquery.png?branch=master)](https://travis-ci.org/estools/esquery) diff --git a/node_modules/esquery/dist/esquery.esm.js b/node_modules/esquery/dist/esquery.esm.js new file mode 100644 index 0000000..7a62b8b --- /dev/null +++ b/node_modules/esquery/dist/esquery.esm.js @@ -0,0 +1,4793 @@ +function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function _createForOfIteratorHelper(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + + var F = function () {}; + + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = o[Symbol.iterator](); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; +} + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var estraverse = createCommonjsModule(function (module, exports) { + /* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /*jslint vars:false, bitwise:true*/ + + /*jshint indent:4*/ + + /*global exports:true*/ + (function clone(exports) { + + var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE; + + function deepCopy(obj) { + var ret = {}, + key, + val; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + + return ret; + } // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + + function upperBound(array, func) { + var diff, len, i, current; + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', + // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', + // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', + // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], + // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], + // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], + // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], + // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: ['argument'], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; // unique id + + BREAK = {}; + SKIP = {}; + REMOVE = {}; + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() {} // API: + // return property path array from root to current node + + + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } // root node + + + if (!this.__current.path) { + return null; + } // first node is sentinel, second node is root element + + + result = []; + + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + + addToPath(result, this.__current.path); + return result; + }; // API: + // return type of current node + + + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; // API: + // return array of parent elements + + + Controller.prototype.parents = function parents() { + var i, iz, result; // first node is sentinel + + result = []; + + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; // API: + // return current node + + + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + result = undefined; + previous = this.__current; + this.__current = element; + this.__state = null; + + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + + this.__current = previous; + return result; + }; // API: + // notify control skip / break + + + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; // API: + // skip child nodes of current node + + + Controller.prototype.skip = function () { + this.notify(SKIP); + }; // API: + // break traversals + + + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; // API: + // remove node + + + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function (root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + + return false; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, leavelist, element, node, nodeType, ret, key, current, current2, candidates, candidate, sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; // reference + + worklist = this.__worklist; + leavelist = this.__leavelist; // initialize + + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + continue; + } + + if (element.node) { + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key; + + function removeElem(element) { + var i, key, nextElem, parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; // If removed from array, then decrease following items' keys. + + i = worklist.length; + + while (i--) { + nextElem = worklist[i]; + + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; // reference + + worklist = this.__worklist; + leavelist = this.__leavelist; // initialize + + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + target = this.__execute(visitor.leave, element); // node may be replaced with null, + // so distinguish between undefined and null in this place + + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + continue; + } + + target = this.__execute(visitor.enter, element); // node may be replaced with null, + // so distinguish between undefined and null in this place + + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } // node may be null + + + node = element.node; + + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], + comment, + len, + i, + cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } // tokens array is empty, we attach comments to tree as 'leadingComments' + + + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + + tree.leadingComments = comments; + } + + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } // This is based on John Freeman's implementation. + + + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } // already out of owned node + + + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } // already out of owned node + + + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + + exports.cloneEnvironment = function () { + return clone({}); + }; + + return exports; + })(exports); + /* vim: set sw=4 ts=4 et tw=80 : */ + +}); + +var parser = createCommonjsModule(function (module) { + /* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + (function (root, factory) { + if ( module.exports) { + module.exports = factory(); + } + })(commonjsGlobal, function () { + + function peg$subclass(child, parent) { + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function (expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function literal(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + "class": function _class(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + any: function any(expectation) { + return "any character"; + }, + end: function end(expectation) { + return "end of input"; + }, + other: function other(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function classEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, + j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + peg$startRuleFunctions = { + start: peg$parsestart + }, + peg$startRuleFunction = peg$parsestart, + peg$c0 = function peg$c0(ss) { + return ss.length === 1 ? ss[0] : { + type: 'matches', + selectors: ss + }; + }, + peg$c1 = function peg$c1() { + return void 0; + }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function peg$c6(i) { + return i.join(''); + }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function peg$c9() { + return 'child'; + }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function peg$c12() { + return 'sibling'; + }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function peg$c15() { + return 'adjacent'; + }, + peg$c16 = function peg$c16() { + return 'descendant'; + }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function peg$c19(s, ss) { + return [s].concat(ss.map(function (s) { + return s[3]; + })); + }, + peg$c20 = function peg$c20(a, ops) { + return ops.reduce(function (memo, rhs) { + return { + type: rhs[0], + left: memo, + right: rhs[1] + }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function peg$c23(subject, as) { + var b = as.length === 1 ? as[0] : { + type: 'compound', + selectors: as + }; + if (subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function peg$c26(a) { + return { + type: 'wildcard', + value: a + }; + }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function peg$c29(i) { + return { + type: 'identifier', + value: i + }; + }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function peg$c34(v) { + return v; + }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function peg$c39(a) { + return (a || '') + '='; + }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function peg$c44(a, as) { + return [].concat.apply([a], as).join(''); + }, + peg$c45 = function peg$c45(name, op, value) { + return { + type: 'attribute', + name: name, + operator: op, + value: value + }; + }, + peg$c46 = function peg$c46(name) { + return { + type: 'attribute', + name: name + }; + }, + peg$c47 = "\"", + peg$c48 = peg$literalExpectation("\"", false), + peg$c49 = /^[^\\"]/, + peg$c50 = peg$classExpectation(["\\", "\""], true, false), + peg$c51 = "\\", + peg$c52 = peg$literalExpectation("\\", false), + peg$c53 = peg$anyExpectation(), + peg$c54 = function peg$c54(a, b) { + return a + b; + }, + peg$c55 = function peg$c55(d) { + return { + type: 'literal', + value: strUnescape(d.join('')) + }; + }, + peg$c56 = "'", + peg$c57 = peg$literalExpectation("'", false), + peg$c58 = /^[^\\']/, + peg$c59 = peg$classExpectation(["\\", "'"], true, false), + peg$c60 = /^[0-9]/, + peg$c61 = peg$classExpectation([["0", "9"]], false, false), + peg$c62 = function peg$c62(a, b) { + // Can use `a.flat().join('')` once supported + var leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { + type: 'literal', + value: parseFloat(leadingDecimals + b.join('')) + }; + }, + peg$c63 = function peg$c63(i) { + return { + type: 'literal', + value: i + }; + }, + peg$c64 = "type(", + peg$c65 = peg$literalExpectation("type(", false), + peg$c66 = /^[^ )]/, + peg$c67 = peg$classExpectation([" ", ")"], true, false), + peg$c68 = ")", + peg$c69 = peg$literalExpectation(")", false), + peg$c70 = function peg$c70(t) { + return { + type: 'type', + value: t.join('') + }; + }, + peg$c71 = /^[imsu]/, + peg$c72 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c73 = "/", + peg$c74 = peg$literalExpectation("/", false), + peg$c75 = /^[^\/]/, + peg$c76 = peg$classExpectation(["/"], true, false), + peg$c77 = function peg$c77(d, flgs) { + return { + type: 'regexp', + value: new RegExp(d.join(''), flgs ? flgs.join('') : '') + }; + }, + peg$c78 = function peg$c78(i, is) { + return { + type: 'field', + name: is.reduce(function (memo, p) { + return memo + p[0] + p[1]; + }, i) + }; + }, + peg$c79 = ":not(", + peg$c80 = peg$literalExpectation(":not(", false), + peg$c81 = function peg$c81(ss) { + return { + type: 'not', + selectors: ss + }; + }, + peg$c82 = ":matches(", + peg$c83 = peg$literalExpectation(":matches(", false), + peg$c84 = function peg$c84(ss) { + return { + type: 'matches', + selectors: ss + }; + }, + peg$c85 = ":has(", + peg$c86 = peg$literalExpectation(":has(", false), + peg$c87 = function peg$c87(ss) { + return { + type: 'has', + selectors: ss + }; + }, + peg$c88 = ":first-child", + peg$c89 = peg$literalExpectation(":first-child", false), + peg$c90 = function peg$c90() { + return nth(1); + }, + peg$c91 = ":last-child", + peg$c92 = peg$literalExpectation(":last-child", false), + peg$c93 = function peg$c93() { + return nthLast(1); + }, + peg$c94 = ":nth-child(", + peg$c95 = peg$literalExpectation(":nth-child(", false), + peg$c96 = function peg$c96(n) { + return nth(parseInt(n.join(''), 10)); + }, + peg$c97 = ":nth-last-child(", + peg$c98 = peg$literalExpectation(":nth-last-child(", false), + peg$c99 = function peg$c99(n) { + return nthLast(parseInt(n.join(''), 10)); + }, + peg$c100 = ":", + peg$c101 = peg$literalExpectation(":", false), + peg$c102 = "statement", + peg$c103 = peg$literalExpectation("statement", true), + peg$c104 = "expression", + peg$c105 = peg$literalExpectation("expression", true), + peg$c106 = "declaration", + peg$c107 = peg$literalExpectation("declaration", true), + peg$c108 = "function", + peg$c109 = peg$literalExpectation("function", true), + peg$c110 = "pattern", + peg$c111 = peg$literalExpectation("pattern", true), + peg$c112 = function peg$c112(c) { + return { + type: 'class', + name: c + }; + }, + peg$currPos = 0, + peg$posDetailsCache = [{ + line: 1, + column: 1 + }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$resultsCache = {}, + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { + type: "literal", + text: text, + ignoreCase: ignoreCase + }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { + type: "class", + parts: parts, + inverted: inverted, + ignoreCase: ignoreCase + }; + } + + function peg$anyExpectation() { + return { + type: "any" + }; + } + + function peg$endExpectation() { + return { + type: "end" + }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], + p; + + if (details) { + return details; + } else { + p = pos - 1; + + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; + } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s1 = peg$c1(); + } + + s0 = s1; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parse_() { + var s0, s1; + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + } + } else { + s1 = peg$FAILED; + } + + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c8); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c11); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c14); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseatom() { + var s0; + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parsewildcard(); + + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c25); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c26(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c28); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c41); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c44(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c46(s1); + } + + s0 = s1; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c47; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c47; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c56; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c56; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c62(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsepath() { + var s0, s1; + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c63(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c64) { + s1 = peg$c64; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c65); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c70(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseflags() { + var s0, s1; + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c73; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + + if (s4 === peg$FAILED) { + s4 = null; + } + + if (s4 !== peg$FAILED) { + s1 = peg$c77(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c78(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c79) { + s1 = peg$c79; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c80); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c81(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 9) === peg$c82) { + s1 = peg$c82; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c83); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c84(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c85) { + s1 = peg$c85; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c86); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c87(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 12) === peg$c88) { + s1 = peg$c88; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c89); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c90(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parselastChild() { + var s0, s1; + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c91) { + s1 = peg$c91; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c92); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c93(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c94) { + s1 = peg$c94; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c95); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c96(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 16) === peg$c97) { + s1 = peg$c97; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c98); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c99(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c100; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c101); + } + } + + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c103); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c105); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c107); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c109); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c111); + } + } + } + } + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c112(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function nth(n) { + return { + type: 'nth-child', + index: { + type: 'literal', + value: n + } + }; + } + + function nthLast(n) { + return { + type: 'nth-last-child', + index: { + type: 'literal', + value: n + } + }; + } + + function strUnescape(s) { + return s.replace(/\\(.)/g, function (match, ch) { + switch (ch) { + case 'b': + return '\b'; + + case 'f': + return '\f'; + + case 'n': + return '\n'; + + case 'r': + return '\r'; + + case 't': + return '\t'; + + case 'v': + return '\v'; + + default: + return ch; + } + }); + } + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; + }); +}); + +function _objectEntries(obj) { + var entries = []; + var keys = Object.keys(obj); + + for (var k = 0; k < keys.length; k++) entries.push([keys[k], obj[keys[k]]]); + + return entries; +} +/** +* @typedef {"LEFT_SIDE"|"RIGHT_SIDE"} Side +*/ + +var LEFT_SIDE = 'LEFT_SIDE'; +var RIGHT_SIDE = 'RIGHT_SIDE'; +/** + * @external AST + * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html + */ + +/** + * One of the rules of `grammar.pegjs` + * @typedef {PlainObject} SelectorAST + * @see grammar.pegjs +*/ + +/** + * The `sequence` production of `grammar.pegjs` + * @typedef {PlainObject} SelectorSequenceAST +*/ + +/** + * Get the value of a property which may be multiple levels down + * in the object. + * @param {?PlainObject} obj + * @param {string} key + * @returns {undefined|boolean|string|number|external:AST} + */ + +function getPath(obj, key) { + var keys = key.split('.'); + + var _iterator = _createForOfIteratorHelper(keys), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _key = _step.value; + + if (obj == null) { + return obj; + } + + obj = obj[_key]; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return obj; +} +/** + * Determine whether `node` can be reached by following `path`, + * starting at `ancestor`. + * @param {?external:AST} node + * @param {?external:AST} ancestor + * @param {string[]} path + * @returns {boolean} + */ + + +function inPath(node, ancestor, path) { + if (path.length === 0) { + return node === ancestor; + } + + if (ancestor == null) { + return false; + } + + var field = ancestor[path[0]]; + var remainingPath = path.slice(1); + + if (Array.isArray(field)) { + var _iterator2 = _createForOfIteratorHelper(field), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var component = _step2.value; + + if (inPath(node, component, remainingPath)) { + return true; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + + return false; + } else { + return inPath(node, field, remainingPath); + } +} +/** + * @callback TraverseOptionFallback + * @param {external:AST} node The given node. + * @returns {string[]} An array of visitor keys for the given node. + */ + +/** + * @typedef {object} ESQueryOptions + * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node. + * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes. + */ + +/** + * Given a `node` and its ancestors, determine if `node` is matched + * by `selector`. + * @param {?external:AST} node + * @param {?SelectorAST} selector + * @param {external:AST[]} [ancestry=[]] + * @param {ESQueryOptions} [options] + * @throws {Error} Unknowns (operator, class name, selector type, or + * selector value type) + * @returns {boolean} + */ + + +function matches(node, selector, ancestry, options) { + if (!selector) { + return true; + } + + if (!node) { + return false; + } + + if (!ancestry) { + ancestry = []; + } + + switch (selector.type) { + case 'wildcard': + return true; + + case 'identifier': + return selector.value.toLowerCase() === node.type.toLowerCase(); + + case 'field': + { + var path = selector.name.split('.'); + var ancestor = ancestry[path.length - 1]; + return inPath(node, ancestor, path); + } + + case 'matches': + var _iterator3 = _createForOfIteratorHelper(selector.selectors), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var sel = _step3.value; + + if (matches(node, sel, ancestry, options)) { + return true; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + + return false; + + case 'compound': + var _iterator4 = _createForOfIteratorHelper(selector.selectors), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var _sel = _step4.value; + + if (!matches(node, _sel, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + + return true; + + case 'not': + var _iterator5 = _createForOfIteratorHelper(selector.selectors), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var _sel2 = _step5.value; + + if (matches(node, _sel2, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + + return true; + + case 'has': + { + var _ret = function () { + var collector = []; + + var _iterator6 = _createForOfIteratorHelper(selector.selectors), + _step6; + + try { + var _loop = function _loop() { + var sel = _step6.value; + var a = []; + estraverse.traverse(node, { + enter: function enter(node, parent) { + if (parent != null) { + a.unshift(parent); + } + + if (matches(node, sel, a, options)) { + collector.push(node); + } + }, + leave: function leave() { + a.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); + }; + + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + _loop(); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + + return { + v: collector.length !== 0 + }; + }(); + + if (_typeof(_ret) === "object") return _ret.v; + } + + case 'child': + if (matches(node, selector.right, ancestry, options)) { + return matches(ancestry[0], selector.left, ancestry.slice(1), options); + } + + return false; + + case 'descendant': + if (matches(node, selector.right, ancestry, options)) { + for (var i = 0, l = ancestry.length; i < l; ++i) { + if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) { + return true; + } + } + } + + return false; + + case 'attribute': + { + var p = getPath(node, selector.name); + + switch (selector.operator) { + case void 0: + return p != null; + + case '=': + switch (selector.value.type) { + case 'regexp': + return typeof p === 'string' && selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) === "".concat(p); + + case 'type': + return selector.value.value === _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '!=': + switch (selector.value.type) { + case 'regexp': + return !selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) !== "".concat(p); + + case 'type': + return selector.value.value !== _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '<=': + return p <= selector.value.value; + + case '<': + return p < selector.value.value; + + case '>': + return p > selector.value.value; + + case '>=': + return p >= selector.value.value; + } + + throw new Error("Unknown operator: ".concat(selector.operator)); + } + + case 'sibling': + return matches(node, selector.right, ancestry, options) && sibling(node, selector.left, ancestry, LEFT_SIDE, options) || selector.left.subject && matches(node, selector.left, ancestry, options) && sibling(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'adjacent': + return matches(node, selector.right, ancestry, options) && adjacent(node, selector.left, ancestry, LEFT_SIDE, options) || selector.right.subject && matches(node, selector.left, ancestry, options) && adjacent(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'nth-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function () { + return selector.index.value - 1; + }, options); + + case 'nth-last-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function (length) { + return length - selector.index.value; + }, options); + + case 'class': + switch (selector.name.toLowerCase()) { + case 'statement': + if (node.type.slice(-9) === 'Statement') return true; + // fallthrough: interface Declaration <: Statement { } + + case 'declaration': + return node.type.slice(-11) === 'Declaration'; + + case 'pattern': + if (node.type.slice(-7) === 'Pattern') return true; + // fallthrough: interface Expression <: Node, Pattern { } + + case 'expression': + return node.type.slice(-10) === 'Expression' || node.type.slice(-7) === 'Literal' || node.type === 'Identifier' && (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') || node.type === 'MetaProperty'; + + case 'function': + return node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression'; + } + + throw new Error("Unknown class name: ".concat(selector.name)); + } + + throw new Error("Unknown selector type: ".concat(selector.type)); +} +/** + * Get visitor keys of a given node. + * @param {external:AST} node The AST node to get keys. + * @param {ESQueryOptions|undefined} options + * @returns {string[]} Visitor keys of the node. + */ + + +function getVisitorKeys(node, options) { + var nodeType = node.type; + + if (options && options.visitorKeys && options.visitorKeys[nodeType]) { + return options.visitorKeys[nodeType]; + } + + if (estraverse.VisitorKeys[nodeType]) { + return estraverse.VisitorKeys[nodeType]; + } + + if (options && typeof options.fallback === 'function') { + return options.fallback(node); + } // 'iteration' fallback + + + return Object.keys(node).filter(function (key) { + return key !== 'type'; + }); +} +/** + * Check whether the given value is an ASTNode or not. + * @param {any} node The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ + + +function isNode(node) { + return node !== null && _typeof(node) === 'object' && typeof node.type === 'string'; +} +/** + * Determines if the given node has a sibling that matches the + * given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + +function sibling(node, selector, ancestry, side, options) { + var _ancestry = _slicedToArray(ancestry, 1), + parent = _ancestry[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator7 = _createForOfIteratorHelper(keys), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var key = _step7.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var startIndex = listProp.indexOf(node); + + if (startIndex < 0) { + continue; + } + + var lowerBound = void 0, + upperBound = void 0; + + if (side === LEFT_SIDE) { + lowerBound = 0; + upperBound = startIndex; + } else { + lowerBound = startIndex + 1; + upperBound = listProp.length; + } + + for (var k = lowerBound; k < upperBound; ++k) { + if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) { + return true; + } + } + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + + return false; +} +/** + * Determines if the given node has an adjacent sibling that matches + * the given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + +function adjacent(node, selector, ancestry, side, options) { + var _ancestry2 = _slicedToArray(ancestry, 1), + parent = _ancestry2[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator8 = _createForOfIteratorHelper(keys), + _step8; + + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var key = _step8.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx < 0) { + continue; + } + + if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) { + return true; + } + + if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) { + return true; + } + } + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + + return false; +} +/** +* @callback IndexFunction +* @param {Integer} len Containing list's length +* @returns {Integer} +*/ + +/** + * Determines if the given node is the nth child, determined by + * `idxFn`, which is given the containing list's length. + * @param {external:AST} node + * @param {external:AST[]} ancestry + * @param {IndexFunction} idxFn + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + +function nthChild(node, ancestry, idxFn, options) { + var _ancestry3 = _slicedToArray(ancestry, 1), + parent = _ancestry3[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator9 = _createForOfIteratorHelper(keys), + _step9; + + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var key = _step9.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx >= 0 && idx === idxFn(listProp.length)) { + return true; + } + } + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + + return false; +} +/** + * For each selector node marked as a subject, find the portion of the + * selector that the subject must match. + * @param {SelectorAST} selector + * @param {SelectorAST} [ancestor] Defaults to `selector` + * @returns {SelectorAST[]} + */ + + +function subjects(selector, ancestor) { + if (selector == null || _typeof(selector) != 'object') { + return []; + } + + if (ancestor == null) { + ancestor = selector; + } + + var results = selector.subject ? [ancestor] : []; + + for (var _i = 0, _Object$entries = _objectEntries(selector); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + p = _Object$entries$_i[0], + sel = _Object$entries$_i[1]; + + results.push.apply(results, _toConsumableArray(subjects(sel, p === 'left' ? sel : ancestor))); + } + + return results; +} +/** +* @callback TraverseVisitor +* @param {?external:AST} node +* @param {?external:AST} parent +* @param {external:AST[]} ancestry +*/ + +/** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {TraverseVisitor} visitor + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + +function traverse(ast, selector, visitor, options) { + if (!selector) { + return; + } + + var ancestry = []; + var altSubjects = subjects(selector); + estraverse.traverse(ast, { + enter: function enter(node, parent) { + if (parent != null) { + ancestry.unshift(parent); + } + + if (matches(node, selector, ancestry, options)) { + if (altSubjects.length) { + for (var i = 0, l = altSubjects.length; i < l; ++i) { + if (matches(node, altSubjects[i], ancestry, options)) { + visitor(node, parent, ancestry); + } + + for (var k = 0, m = ancestry.length; k < m; ++k) { + var succeedingAncestry = ancestry.slice(k + 1); + + if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) { + visitor(ancestry[k], parent, succeedingAncestry); + } + } + } + } else { + visitor(node, parent, ancestry); + } + } + }, + leave: function leave() { + ancestry.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); +} +/** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + +function match(ast, selector, options) { + var results = []; + traverse(ast, selector, function (node) { + results.push(node); + }, options); + return results; +} +/** + * Parse a selector string and return its AST. + * @param {string} selector + * @returns {SelectorAST} + */ + + +function parse(selector) { + return parser.parse(selector); +} +/** + * Query the code AST using the selector string. + * @param {external:AST} ast + * @param {string} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + +function query(ast, selector, options) { + return match(ast, parse(selector), options); +} + +query.parse = parse; +query.match = match; +query.traverse = traverse; +query.matches = matches; +query.query = query; + +export default query; diff --git a/node_modules/esquery/dist/esquery.esm.min.js b/node_modules/esquery/dist/esquery.esm.min.js new file mode 100644 index 0000000..cd5ac34 --- /dev/null +++ b/node_modules/esquery/dist/esquery.esm.min.js @@ -0,0 +1,2 @@ +function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return s=e.done,e},e:function(e){l=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw i}}}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var s=i((function(e,t){!function e(t){var r,n,a,o,i,s;function l(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?l(r):r);return n}function u(e,t){this.parent=e,this.key=t}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n}function f(){}function p(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function y(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return!0;return!1}function d(e,t){return(new f).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,n,a,o;for(n=e.length,a=0;n;)t(e[o=a+(r=n>>>1)])?n=r:(a=o+1,n-=r+1);return a}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:o={},Skip:i={},Remove:s={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},f.prototype.path=function(){var e,t,r,n,a;function o(e,t){if(Array.isArray(t))for(r=0,n=t.length;r=0;)if(v=s[f=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]&&!y(n,v[m])){if(h(l,x[d]))a=new c(v[m],[f,m],"Property",null);else{if(!p(v[m]))continue;a=new c(v[m],[f,m],null,null)}r.push(a)}}else if(p(v)){if(y(n,v))continue;r.push(new c(v,f,null,null))}}}else if(a=n.pop(),u=this.__execute(t.leave,a),this.__state===o||u===o)return},f.prototype.replace=function(e,t){var r,n,a,l,f,y,d,m,x,v,g,b,A;function E(e){var t,n,a,o;if(e.ref.remove())for(n=e.ref.key,o=e.ref.parent,t=r.length;t--;)if((a=r[t]).ref&&a.ref.parent===o){if(a.ref.key=0;)if(v=a[A=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]){if(h(l,x[d]))y=new c(v[m],[A,m],"Property",new u(v,m));else{if(!p(v[m]))continue;y=new c(v[m],[A,m],null,new u(v,m))}r.push(y)}}else p(v)&&r.push(new c(v,A,null,new u(a,A)))}}else if(y=n.pop(),void 0!==(f=this.__execute(t.leave,y))&&f!==o&&f!==i&&f!==s&&y.ref.replace(f),this.__state!==s&&f!==s||E(y),this.__state===o||f===o)return b.root;return b.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return(new f).replace(e,t)},t.attachComments=function(e,t,r){var a,o,i,s,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(i=0,o=t.length;ie.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(s,1)):s+=1;return s===u.length?n.Break:u[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),s=0,d(e,{leave:function(e){for(var t;se.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=a,t.VisitorOption=n,t.Controller=f,t.cloneEnvironment=function(){return e({})},t}(t)})),l=i((function(e){e.exports&&(e.exports=function(){function e(t,r,n,a){this.message=t,this.expected=r,this.found=n,this.location=a,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+a(e.text)+'"'},class:function(e){var t,r="";for(t=0;t0){for(t=1,n=1;t<~+.]/,p=me([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=de(">",!1),y=de("~",!1),d=de("+",!1),m=de(",",!1),x=de("!",!1),v=de("*",!1),g=de("#",!1),b=de("[",!1),A=de("]",!1),E=/^[>","<","!"],!1,!1),_=de("=",!1),w=function(e){return(e||"")+"="},C=/^[><]/,P=me([">","<"],!1,!1),k=de(".",!1),D=function(e,t,r){return{type:"attribute",name:e,operator:t,value:r}},j=de('"',!1),I=/^[^\\"]/,T=me(["\\",'"'],!0,!1),F=de("\\",!1),L={type:"any"},O=function(e,t){return e+t},R=function(e){return{type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";default:return t}})))};var t},B=de("'",!1),M=/^[^\\']/,U=me(["\\","'"],!0,!1),V=/^[0-9]/,q=me([["0","9"]],!1,!1),N=de("type(",!1),W=/^[^ )]/,K=me([" ",")"],!0,!1),G=de(")",!1),z=/^[imsu]/,H=me(["i","m","s","u"],!1,!1),Y=de("/",!1),$=/^[^\/]/,J=me(["/"],!0,!1),Q=de(":not(",!1),X=de(":matches(",!1),Z=de(":has(",!1),ee=de(":first-child",!1),te=de(":last-child",!1),re=de(":nth-child(",!1),ne=de(":nth-last-child(",!1),ae=de(":",!1),oe=de("statement",!0),ie=de("expression",!0),se=de("declaration",!0),le=de("function",!0),ue=de("pattern",!0),ce=0,fe=[{line:1,column:1}],pe=0,he=[],ye={};if("startRule"in r){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=l[r.startRule]}function de(e,t){return{type:"literal",text:e,ignoreCase:t}}function me(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function xe(e){var r,n=fe[e];if(n)return n;for(r=e-1;!fe[r];)r--;for(n={line:(n=fe[r]).line,column:n.column};rpe&&(pe=ce,he=[]),he.push(e))}function be(){var e,t,r,n,a=30*ce+0,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,(t=Ae())!==s&&(r=_e())!==s&&Ae()!==s?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(ce=e,e=s),e===s&&(e=ce,(t=Ae())!==s&&(t=void 0),e=t),ye[a]={nextPos:ce,result:e},e)}function Ae(){var e,r,n=30*ce+1,a=ye[n];if(a)return ce=a.nextPos,a.result;for(e=[],32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));r!==s;)e.push(r),32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));return ye[n]={nextPos:ce,result:e},e}function Ee(){var e,r,n,a=30*ce+2,o=ye[a];if(o)return ce=o.nextPos,o.result;if(r=[],f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p)),n!==s)for(;n!==s;)r.push(n),f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p));else r=s;return r!==s&&(r=r.join("")),e=r,ye[a]={nextPos:ce,result:e},e}function Se(){var e,r,n,a=30*ce+3,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,(r=Ae())!==s?(62===t.charCodeAt(ce)?(n=">",ce++):(n=s,ge(h)),n!==s&&Ae()!==s?e=r="child":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=Ae())!==s?(126===t.charCodeAt(ce)?(n="~",ce++):(n=s,ge(y)),n!==s&&Ae()!==s?e=r="sibling":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=Ae())!==s?(43===t.charCodeAt(ce)?(n="+",ce++):(n=s,ge(d)),n!==s&&Ae()!==s?e=r="adjacent":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c)),r!==s&&(n=Ae())!==s?e=r="descendant":(ce=e,e=s)))),ye[a]={nextPos:ce,result:e},e)}function _e(){var e,r,n,a,o,i,l,u,c=30*ce+4,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=we())!==s){for(n=[],a=ce,(o=Ae())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(l=Ae())!==s&&(u=we())!==s?a=o=[o,i,l,u]:(ce=a,a=s)):(ce=a,a=s);a!==s;)n.push(a),a=ce,(o=Ae())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(l=Ae())!==s&&(u=we())!==s?a=o=[o,i,l,u]:(ce=a,a=s)):(ce=a,a=s);n!==s?e=r=[r].concat(n.map((function(e){return e[3]}))):(ce=e,e=s)}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function we(){var e,t,r,n,a,o,i,l=30*ce+5,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,(t=Ce())!==s){for(r=[],n=ce,(a=Se())!==s&&(o=Ce())!==s?n=a=[a,o]:(ce=n,n=s);n!==s;)r.push(n),n=ce,(a=Se())!==s&&(o=Ce())!==s?n=a=[a,o]:(ce=n,n=s);r!==s?(i=t,e=t=r.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),i)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}function Ce(){var e,r,n,a,o,i,l,u=30*ce+6,c=ye[u];if(c)return ce=c.nextPos,c.result;if(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s){if(n=[],(a=Pe())!==s)for(;a!==s;)n.push(a),a=Pe();else n=s;n!==s?(o=r,l=1===(i=n).length?i[0]:{type:"compound",selectors:i},o&&(l.subject=!0),e=r=l):(ce=e,e=s)}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}function Pe(){var e,r=30*ce+7,n=ye[r];return n?(ce=n.nextPos,n.result):((e=function(){var e,r,n=30*ce+8,a=ye[n];return a?(ce=a.nextPos,a.result):(42===t.charCodeAt(ce)?(r="*",ce++):(r=s,ge(v)),r!==s&&(r={type:"wildcard",value:r}),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a=30*ce+9,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,35===t.charCodeAt(ce)?(r="#",ce++):(r=s,ge(g)),r===s&&(r=null),r!==s&&(n=Ee())!==s?e=r={type:"identifier",value:n}:(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*ce+10,i=ye[o];return i?(ce=i.nextPos,i.result):(e=ce,91===t.charCodeAt(ce)?(r="[",ce++):(r=s,ge(b)),r!==s&&Ae()!==s&&(n=function(){var e,r,n,a,o=30*ce+14,i=ye[o];return i?(ce=i.nextPos,i.result):(e=ce,(r=ke())!==s&&Ae()!==s&&(n=function(){var e,r,n,a=30*ce+12,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=w(r),e=r):(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?((a=function(){var e,r,n,a,o,i=30*ce+18,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,"type("===t.substr(ce,5)?(r="type(",ce+=5):(r=s,ge(N)),r!==s)if(Ae()!==s){if(n=[],W.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(K)),a!==s)for(;a!==s;)n.push(a),W.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(K));else n=s;n!==s&&(a=Ae())!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?(r={type:"type",value:n.join("")},e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(a=function(){var e,r,n,a,o,i,l=30*ce+20,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,47===t.charCodeAt(ce)?(r="/",ce++):(r=s,ge(Y)),r!==s){if(n=[],$.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(J)),a!==s)for(;a!==s;)n.push(a),$.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(J));else n=s;n!==s?(47===t.charCodeAt(ce)?(a="/",ce++):(a=s,ge(Y)),a!==s?((o=function(){var e,r,n=30*ce+19,a=ye[n];if(a)return ce=a.nextPos,a.result;if(e=[],z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H)),r!==s)for(;r!==s;)e.push(r),z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H));else e=s;return ye[n]={nextPos:ce,result:e},e}())===s&&(o=null),o!==s?(i=o,r={type:"regexp",value:new RegExp(n.join(""),i?i.join(""):"")},e=r):(ce=e,e=s)):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}()),a!==s?(r=D(r,n,a),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&Ae()!==s&&(n=function(){var e,r,n,a=30*ce+11,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,E.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(S)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=w(r),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(C.test(t.charAt(ce))?(e=t.charAt(ce),ce++):(e=s,ge(P))),ye[a]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?((a=function(){var e,r,n,a,o,i,l=30*ce+15,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,34===t.charCodeAt(ce)?(r='"',ce++):(r=s,ge(j)),r!==s){for(n=[],I.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(T)),a===s&&(a=ce,92===t.charCodeAt(ce)?(o="\\",ce++):(o=s,ge(F)),o!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(o=O(o,i),a=o):(ce=a,a=s)):(ce=a,a=s));a!==s;)n.push(a),I.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(T)),a===s&&(a=ce,92===t.charCodeAt(ce)?(o="\\",ce++):(o=s,ge(F)),o!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(o=O(o,i),a=o):(ce=a,a=s)):(ce=a,a=s));n!==s?(34===t.charCodeAt(ce)?(a='"',ce++):(a=s,ge(j)),a!==s?(r=R(n),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;if(e===s)if(e=ce,39===t.charCodeAt(ce)?(r="'",ce++):(r=s,ge(B)),r!==s){for(n=[],M.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(U)),a===s&&(a=ce,92===t.charCodeAt(ce)?(o="\\",ce++):(o=s,ge(F)),o!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(o=O(o,i),a=o):(ce=a,a=s)):(ce=a,a=s));a!==s;)n.push(a),M.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(U)),a===s&&(a=ce,92===t.charCodeAt(ce)?(o="\\",ce++):(o=s,ge(F)),o!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(o=O(o,i),a=o):(ce=a,a=s)):(ce=a,a=s));n!==s?(39===t.charCodeAt(ce)?(a="'",ce++):(a=s,ge(B)),a!==s?(r=R(n),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}())===s&&(a=function(){var e,r,n,a,o,i,l,u=30*ce+16,c=ye[u];if(c)return ce=c.nextPos,c.result;for(e=ce,r=ce,n=[],V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q));a!==s;)n.push(a),V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q));if(n!==s?(46===t.charCodeAt(ce)?(a=".",ce++):(a=s,ge(k)),a!==s?r=n=[n,a]:(ce=r,r=s)):(ce=r,r=s),r===s&&(r=null),r!==s){if(n=[],V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q)),a!==s)for(;a!==s;)n.push(a),V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q));else n=s;n!==s?(i=n,l=(o=r)?[].concat.apply([],o).join(""):"",r={type:"literal",value:parseFloat(l+i.join(""))},e=r):(ce=e,e=s)}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}())===s&&(a=function(){var e,t,r=30*ce+17,n=ye[r];return n?(ce=n.nextPos,n.result):((t=Ee())!==s&&(t={type:"literal",value:t}),e=t,ye[r]={nextPos:ce,result:e},e)}()),a!==s?(r=D(r,n,a),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&(r={type:"attribute",name:r}),e=r)),ye[o]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?(93===t.charCodeAt(ce)?(a="]",ce++):(a=s,ge(A)),a!==s?e=r=n:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a,o,i,l,u,c=30*ce+21,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,46===t.charCodeAt(ce)?(r=".",ce++):(r=s,ge(k)),r!==s)if((n=Ee())!==s){for(a=[],o=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(l=Ee())!==s?o=i=[i,l]:(ce=o,o=s);o!==s;)a.push(o),o=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(l=Ee())!==s?o=i=[i,l]:(ce=o,o=s);a!==s?(u=n,r={type:"field",name:a.reduce((function(e,t){return e+t[0]+t[1]}),u)},e=r):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,a,o=30*ce+22,i=ye[o];return i?(ce=i.nextPos,i.result):(e=ce,":not("===t.substr(ce,5)?(r=":not(",ce+=5):(r=s,ge(Q)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?e=r={type:"not",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*ce+23,i=ye[o];return i?(ce=i.nextPos,i.result):(e=ce,":matches("===t.substr(ce,9)?(r=":matches(",ce+=9):(r=s,ge(X)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?e=r={type:"matches",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a,o=30*ce+24,i=ye[o];return i?(ce=i.nextPos,i.result):(e=ce,":has("===t.substr(ce,5)?(r=":has(",ce+=5):(r=s,ge(Z)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?e=r={type:"has",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+25,a=ye[n];return a?(ce=a.nextPos,a.result):(":first-child"===t.substr(ce,12)?(r=":first-child",ce+=12):(r=s,ge(ee)),r!==s&&(r=De(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+26,a=ye[n];return a?(ce=a.nextPos,a.result):(":last-child"===t.substr(ce,11)?(r=":last-child",ce+=11):(r=s,ge(te)),r!==s&&(r=je(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,a,o,i=30*ce+27,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,":nth-child("===t.substr(ce,11)?(r=":nth-child(",ce+=11):(r=s,ge(re)),r!==s)if(Ae()!==s){if(n=[],V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q)),a!==s)for(;a!==s;)n.push(a),V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q));else n=s;n!==s&&(a=Ae())!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?(r=De(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,a,o,i=30*ce+28,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,":nth-last-child("===t.substr(ce,16)?(r=":nth-last-child(",ce+=16):(r=s,ge(ne)),r!==s)if(Ae()!==s){if(n=[],V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q)),a!==s)for(;a!==s;)n.push(a),V.test(t.charAt(ce))?(a=t.charAt(ce),ce++):(a=s,ge(q));else n=s;n!==s&&(a=Ae())!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?(r=je(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,a=30*ce+29,o=ye[a];return o?(ce=o.nextPos,o.result):(e=ce,58===t.charCodeAt(ce)?(r=":",ce++):(r=s,ge(ae)),r!==s?("statement"===t.substr(ce,9).toLowerCase()?(n=t.substr(ce,9),ce+=9):(n=s,ge(oe)),n===s&&("expression"===t.substr(ce,10).toLowerCase()?(n=t.substr(ce,10),ce+=10):(n=s,ge(ie)),n===s&&("declaration"===t.substr(ce,11).toLowerCase()?(n=t.substr(ce,11),ce+=11):(n=s,ge(se)),n===s&&("function"===t.substr(ce,8).toLowerCase()?(n=t.substr(ce,8),ce+=8):(n=s,ge(le)),n===s&&("pattern"===t.substr(ce,7).toLowerCase()?(n=t.substr(ce,7),ce+=7):(n=s,ge(ue)))))),n!==s?e=r={type:"class",name:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}()),ye[r]={nextPos:ce,result:e},e)}function ke(){var e,r,n,a,o,i,l,u,c=30*ce+13,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=Ee())!==s){for(n=[],a=ce,46===t.charCodeAt(ce)?(o=".",ce++):(o=s,ge(k)),o!==s&&(i=Ee())!==s?a=o=[o,i]:(ce=a,a=s);a!==s;)n.push(a),a=ce,46===t.charCodeAt(ce)?(o=".",ce++):(o=s,ge(k)),o!==s&&(i=Ee())!==s?a=o=[o,i]:(ce=a,a=s);n!==s?(l=r,u=n,e=r=[].concat.apply([l],u).join("")):(ce=e,e=s)}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function De(e){return{type:"nth-child",index:{type:"literal",value:e}}}function je(e){return{type:"nth-last-child",index:{type:"literal",value:e}}}if((n=u())!==s&&ce===t.length)return n;throw n!==s&&ce":return w>r.value.value;case">=":return w>=r.value.value}throw new Error("Unknown operator: ".concat(r.operator));case"sibling":return u(t,r.right,n,a)&&p(t,r.left,n,"LEFT_SIDE",a)||r.left.subject&&u(t,r.left,n,a)&&p(t,r.right,n,"RIGHT_SIDE",a);case"adjacent":return u(t,r.right,n,a)&&h(t,r.left,n,"LEFT_SIDE",a)||r.right.subject&&u(t,r.left,n,a)&&h(t,r.right,n,"RIGHT_SIDE",a);case"nth-child":return u(t,r.right,n,a)&&y(t,n,(function(){return r.index.value-1}),a);case"nth-last-child":return u(t,r.right,n,a)&&y(t,n,(function(e){return e-r.index.value}),a);case"class":switch(r.name.toLowerCase()){case"statement":if("Statement"===t.type.slice(-9))return!0;case"declaration":return"Declaration"===t.type.slice(-11);case"pattern":if("Pattern"===t.type.slice(-7))return!0;case"expression":return"Expression"===t.type.slice(-10)||"Literal"===t.type.slice(-7)||"Identifier"===t.type&&(0===n.length||"MetaProperty"!==n[0].type)||"MetaProperty"===t.type;case"function":return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type}throw new Error("Unknown class name: ".concat(r.name))}throw new Error("Unknown selector type: ".concat(r.type))}function c(e,t){var r=e.type;return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:s.VisitorKeys[r]?s.VisitorKeys[r]:t&&"function"==typeof t.fallback?t.fallback(e):Object.keys(e).filter((function(e){return"type"!==e}))}function f(t){return null!==t&&"object"===e(t)&&"string"==typeof t.type}function p(e,r,n,a,i){var s=t(n,1)[0];if(!s)return!1;var l,p=o(c(s,i));try{for(p.s();!(l=p.n()).done;){var h=s[l.value];if(Array.isArray(h)){var y=h.indexOf(e);if(y<0)continue;var d=void 0,m=void 0;"LEFT_SIDE"===a?(d=0,m=y):(d=y+1,m=h.length);for(var x=d;x0&&f(h[y-1])&&u(h[y-1],r,n,i))return!0;if("RIGHT_SIDE"===a&&y=0&&f===n(u.length))return!0}}}catch(e){l.e(e)}finally{l.f()}return!1}function d(n,a){if(null==n||"object"!=e(n))return[];null==a&&(a=n);for(var o=n.subject?[a]:[],i=0,s=function(e){for(var t=[],r=Object.keys(e),n=0;n\n Copyright (C) 2012 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n/*jslint vars:false, bitwise:true*/\n/*jshint indent:4*/\n/*global exports:true*/\n(function clone(exports) {\n 'use strict';\n\n var Syntax,\n VisitorOption,\n VisitorKeys,\n BREAK,\n SKIP,\n REMOVE;\n\n function deepCopy(obj) {\n var ret = {}, key, val;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n val = obj[key];\n if (typeof val === 'object' && val !== null) {\n ret[key] = deepCopy(val);\n } else {\n ret[key] = val;\n }\n }\n }\n return ret;\n }\n\n // based on LLVM libc++ upper_bound / lower_bound\n // MIT License\n\n function upperBound(array, func) {\n var diff, len, i, current;\n\n len = array.length;\n i = 0;\n\n while (len) {\n diff = len >>> 1;\n current = i + diff;\n if (func(array[current])) {\n len = diff;\n } else {\n i = current + 1;\n len -= diff + 1;\n }\n }\n return i;\n }\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n AssignmentPattern: 'AssignmentPattern',\n ArrayExpression: 'ArrayExpression',\n ArrayPattern: 'ArrayPattern',\n ArrowFunctionExpression: 'ArrowFunctionExpression',\n AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.\n BlockStatement: 'BlockStatement',\n BinaryExpression: 'BinaryExpression',\n BreakStatement: 'BreakStatement',\n CallExpression: 'CallExpression',\n CatchClause: 'CatchClause',\n ChainExpression: 'ChainExpression',\n ClassBody: 'ClassBody',\n ClassDeclaration: 'ClassDeclaration',\n ClassExpression: 'ClassExpression',\n ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.\n ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.\n ConditionalExpression: 'ConditionalExpression',\n ContinueStatement: 'ContinueStatement',\n DebuggerStatement: 'DebuggerStatement',\n DirectiveStatement: 'DirectiveStatement',\n DoWhileStatement: 'DoWhileStatement',\n EmptyStatement: 'EmptyStatement',\n ExportAllDeclaration: 'ExportAllDeclaration',\n ExportDefaultDeclaration: 'ExportDefaultDeclaration',\n ExportNamedDeclaration: 'ExportNamedDeclaration',\n ExportSpecifier: 'ExportSpecifier',\n ExpressionStatement: 'ExpressionStatement',\n ForStatement: 'ForStatement',\n ForInStatement: 'ForInStatement',\n ForOfStatement: 'ForOfStatement',\n FunctionDeclaration: 'FunctionDeclaration',\n FunctionExpression: 'FunctionExpression',\n GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.\n Identifier: 'Identifier',\n IfStatement: 'IfStatement',\n ImportExpression: 'ImportExpression',\n ImportDeclaration: 'ImportDeclaration',\n ImportDefaultSpecifier: 'ImportDefaultSpecifier',\n ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',\n ImportSpecifier: 'ImportSpecifier',\n Literal: 'Literal',\n LabeledStatement: 'LabeledStatement',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n MetaProperty: 'MetaProperty',\n MethodDefinition: 'MethodDefinition',\n ModuleSpecifier: 'ModuleSpecifier',\n NewExpression: 'NewExpression',\n ObjectExpression: 'ObjectExpression',\n ObjectPattern: 'ObjectPattern',\n Program: 'Program',\n Property: 'Property',\n RestElement: 'RestElement',\n ReturnStatement: 'ReturnStatement',\n SequenceExpression: 'SequenceExpression',\n SpreadElement: 'SpreadElement',\n Super: 'Super',\n SwitchStatement: 'SwitchStatement',\n SwitchCase: 'SwitchCase',\n TaggedTemplateExpression: 'TaggedTemplateExpression',\n TemplateElement: 'TemplateElement',\n TemplateLiteral: 'TemplateLiteral',\n ThisExpression: 'ThisExpression',\n ThrowStatement: 'ThrowStatement',\n TryStatement: 'TryStatement',\n UnaryExpression: 'UnaryExpression',\n UpdateExpression: 'UpdateExpression',\n VariableDeclaration: 'VariableDeclaration',\n VariableDeclarator: 'VariableDeclarator',\n WhileStatement: 'WhileStatement',\n WithStatement: 'WithStatement',\n YieldExpression: 'YieldExpression'\n };\n\n VisitorKeys = {\n AssignmentExpression: ['left', 'right'],\n AssignmentPattern: ['left', 'right'],\n ArrayExpression: ['elements'],\n ArrayPattern: ['elements'],\n ArrowFunctionExpression: ['params', 'body'],\n AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.\n BlockStatement: ['body'],\n BinaryExpression: ['left', 'right'],\n BreakStatement: ['label'],\n CallExpression: ['callee', 'arguments'],\n CatchClause: ['param', 'body'],\n ChainExpression: ['expression'],\n ClassBody: ['body'],\n ClassDeclaration: ['id', 'superClass', 'body'],\n ClassExpression: ['id', 'superClass', 'body'],\n ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.\n ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.\n ConditionalExpression: ['test', 'consequent', 'alternate'],\n ContinueStatement: ['label'],\n DebuggerStatement: [],\n DirectiveStatement: [],\n DoWhileStatement: ['body', 'test'],\n EmptyStatement: [],\n ExportAllDeclaration: ['source'],\n ExportDefaultDeclaration: ['declaration'],\n ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],\n ExportSpecifier: ['exported', 'local'],\n ExpressionStatement: ['expression'],\n ForStatement: ['init', 'test', 'update', 'body'],\n ForInStatement: ['left', 'right', 'body'],\n ForOfStatement: ['left', 'right', 'body'],\n FunctionDeclaration: ['id', 'params', 'body'],\n FunctionExpression: ['id', 'params', 'body'],\n GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.\n Identifier: [],\n IfStatement: ['test', 'consequent', 'alternate'],\n ImportExpression: ['source'],\n ImportDeclaration: ['specifiers', 'source'],\n ImportDefaultSpecifier: ['local'],\n ImportNamespaceSpecifier: ['local'],\n ImportSpecifier: ['imported', 'local'],\n Literal: [],\n LabeledStatement: ['label', 'body'],\n LogicalExpression: ['left', 'right'],\n MemberExpression: ['object', 'property'],\n MetaProperty: ['meta', 'property'],\n MethodDefinition: ['key', 'value'],\n ModuleSpecifier: [],\n NewExpression: ['callee', 'arguments'],\n ObjectExpression: ['properties'],\n ObjectPattern: ['properties'],\n Program: ['body'],\n Property: ['key', 'value'],\n RestElement: [ 'argument' ],\n ReturnStatement: ['argument'],\n SequenceExpression: ['expressions'],\n SpreadElement: ['argument'],\n Super: [],\n SwitchStatement: ['discriminant', 'cases'],\n SwitchCase: ['test', 'consequent'],\n TaggedTemplateExpression: ['tag', 'quasi'],\n TemplateElement: [],\n TemplateLiteral: ['quasis', 'expressions'],\n ThisExpression: [],\n ThrowStatement: ['argument'],\n TryStatement: ['block', 'handler', 'finalizer'],\n UnaryExpression: ['argument'],\n UpdateExpression: ['argument'],\n VariableDeclaration: ['declarations'],\n VariableDeclarator: ['id', 'init'],\n WhileStatement: ['test', 'body'],\n WithStatement: ['object', 'body'],\n YieldExpression: ['argument']\n };\n\n // unique id\n BREAK = {};\n SKIP = {};\n REMOVE = {};\n\n VisitorOption = {\n Break: BREAK,\n Skip: SKIP,\n Remove: REMOVE\n };\n\n function Reference(parent, key) {\n this.parent = parent;\n this.key = key;\n }\n\n Reference.prototype.replace = function replace(node) {\n this.parent[this.key] = node;\n };\n\n Reference.prototype.remove = function remove() {\n if (Array.isArray(this.parent)) {\n this.parent.splice(this.key, 1);\n return true;\n } else {\n this.replace(null);\n return false;\n }\n };\n\n function Element(node, path, wrap, ref) {\n this.node = node;\n this.path = path;\n this.wrap = wrap;\n this.ref = ref;\n }\n\n function Controller() { }\n\n // API:\n // return property path array from root to current node\n Controller.prototype.path = function path() {\n var i, iz, j, jz, result, element;\n\n function addToPath(result, path) {\n if (Array.isArray(path)) {\n for (j = 0, jz = path.length; j < jz; ++j) {\n result.push(path[j]);\n }\n } else {\n result.push(path);\n }\n }\n\n // root node\n if (!this.__current.path) {\n return null;\n }\n\n // first node is sentinel, second node is root element\n result = [];\n for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {\n element = this.__leavelist[i];\n addToPath(result, element.path);\n }\n addToPath(result, this.__current.path);\n return result;\n };\n\n // API:\n // return type of current node\n Controller.prototype.type = function () {\n var node = this.current();\n return node.type || this.__current.wrap;\n };\n\n // API:\n // return array of parent elements\n Controller.prototype.parents = function parents() {\n var i, iz, result;\n\n // first node is sentinel\n result = [];\n for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {\n result.push(this.__leavelist[i].node);\n }\n\n return result;\n };\n\n // API:\n // return current node\n Controller.prototype.current = function current() {\n return this.__current.node;\n };\n\n Controller.prototype.__execute = function __execute(callback, element) {\n var previous, result;\n\n result = undefined;\n\n previous = this.__current;\n this.__current = element;\n this.__state = null;\n if (callback) {\n result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);\n }\n this.__current = previous;\n\n return result;\n };\n\n // API:\n // notify control skip / break\n Controller.prototype.notify = function notify(flag) {\n this.__state = flag;\n };\n\n // API:\n // skip child nodes of current node\n Controller.prototype.skip = function () {\n this.notify(SKIP);\n };\n\n // API:\n // break traversals\n Controller.prototype['break'] = function () {\n this.notify(BREAK);\n };\n\n // API:\n // remove node\n Controller.prototype.remove = function () {\n this.notify(REMOVE);\n };\n\n Controller.prototype.__initialize = function(root, visitor) {\n this.visitor = visitor;\n this.root = root;\n this.__worklist = [];\n this.__leavelist = [];\n this.__current = null;\n this.__state = null;\n this.__fallback = null;\n if (visitor.fallback === 'iteration') {\n this.__fallback = Object.keys;\n } else if (typeof visitor.fallback === 'function') {\n this.__fallback = visitor.fallback;\n }\n\n this.__keys = VisitorKeys;\n if (visitor.keys) {\n this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);\n }\n };\n\n function isNode(node) {\n if (node == null) {\n return false;\n }\n return typeof node === 'object' && typeof node.type === 'string';\n }\n\n function isProperty(nodeType, key) {\n return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;\n }\n \n function candidateExistsInLeaveList(leavelist, candidate) {\n for (var i = leavelist.length - 1; i >= 0; --i) {\n if (leavelist[i].node === candidate) {\n return true;\n }\n }\n return false;\n }\n\n Controller.prototype.traverse = function traverse(root, visitor) {\n var worklist,\n leavelist,\n element,\n node,\n nodeType,\n ret,\n key,\n current,\n current2,\n candidates,\n candidate,\n sentinel;\n\n this.__initialize(root, visitor);\n\n sentinel = {};\n\n // reference\n worklist = this.__worklist;\n leavelist = this.__leavelist;\n\n // initialize\n worklist.push(new Element(root, null, null, null));\n leavelist.push(new Element(null, null, null, null));\n\n while (worklist.length) {\n element = worklist.pop();\n\n if (element === sentinel) {\n element = leavelist.pop();\n\n ret = this.__execute(visitor.leave, element);\n\n if (this.__state === BREAK || ret === BREAK) {\n return;\n }\n continue;\n }\n\n if (element.node) {\n\n ret = this.__execute(visitor.enter, element);\n\n if (this.__state === BREAK || ret === BREAK) {\n return;\n }\n\n worklist.push(sentinel);\n leavelist.push(element);\n\n if (this.__state === SKIP || ret === SKIP) {\n continue;\n }\n\n node = element.node;\n nodeType = node.type || element.wrap;\n candidates = this.__keys[nodeType];\n if (!candidates) {\n if (this.__fallback) {\n candidates = this.__fallback(node);\n } else {\n throw new Error('Unknown node type ' + nodeType + '.');\n }\n }\n\n current = candidates.length;\n while ((current -= 1) >= 0) {\n key = candidates[current];\n candidate = node[key];\n if (!candidate) {\n continue;\n }\n\n if (Array.isArray(candidate)) {\n current2 = candidate.length;\n while ((current2 -= 1) >= 0) {\n if (!candidate[current2]) {\n continue;\n }\n\n if (candidateExistsInLeaveList(leavelist, candidate[current2])) {\n continue;\n }\n\n if (isProperty(nodeType, candidates[current])) {\n element = new Element(candidate[current2], [key, current2], 'Property', null);\n } else if (isNode(candidate[current2])) {\n element = new Element(candidate[current2], [key, current2], null, null);\n } else {\n continue;\n }\n worklist.push(element);\n }\n } else if (isNode(candidate)) {\n if (candidateExistsInLeaveList(leavelist, candidate)) {\n continue;\n }\n\n worklist.push(new Element(candidate, key, null, null));\n }\n }\n }\n }\n };\n\n Controller.prototype.replace = function replace(root, visitor) {\n var worklist,\n leavelist,\n node,\n nodeType,\n target,\n element,\n current,\n current2,\n candidates,\n candidate,\n sentinel,\n outer,\n key;\n\n function removeElem(element) {\n var i,\n key,\n nextElem,\n parent;\n\n if (element.ref.remove()) {\n // When the reference is an element of an array.\n key = element.ref.key;\n parent = element.ref.parent;\n\n // If removed from array, then decrease following items' keys.\n i = worklist.length;\n while (i--) {\n nextElem = worklist[i];\n if (nextElem.ref && nextElem.ref.parent === parent) {\n if (nextElem.ref.key < key) {\n break;\n }\n --nextElem.ref.key;\n }\n }\n }\n }\n\n this.__initialize(root, visitor);\n\n sentinel = {};\n\n // reference\n worklist = this.__worklist;\n leavelist = this.__leavelist;\n\n // initialize\n outer = {\n root: root\n };\n element = new Element(root, null, null, new Reference(outer, 'root'));\n worklist.push(element);\n leavelist.push(element);\n\n while (worklist.length) {\n element = worklist.pop();\n\n if (element === sentinel) {\n element = leavelist.pop();\n\n target = this.__execute(visitor.leave, element);\n\n // node may be replaced with null,\n // so distinguish between undefined and null in this place\n if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {\n // replace\n element.ref.replace(target);\n }\n\n if (this.__state === REMOVE || target === REMOVE) {\n removeElem(element);\n }\n\n if (this.__state === BREAK || target === BREAK) {\n return outer.root;\n }\n continue;\n }\n\n target = this.__execute(visitor.enter, element);\n\n // node may be replaced with null,\n // so distinguish between undefined and null in this place\n if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {\n // replace\n element.ref.replace(target);\n element.node = target;\n }\n\n if (this.__state === REMOVE || target === REMOVE) {\n removeElem(element);\n element.node = null;\n }\n\n if (this.__state === BREAK || target === BREAK) {\n return outer.root;\n }\n\n // node may be null\n node = element.node;\n if (!node) {\n continue;\n }\n\n worklist.push(sentinel);\n leavelist.push(element);\n\n if (this.__state === SKIP || target === SKIP) {\n continue;\n }\n\n nodeType = node.type || element.wrap;\n candidates = this.__keys[nodeType];\n if (!candidates) {\n if (this.__fallback) {\n candidates = this.__fallback(node);\n } else {\n throw new Error('Unknown node type ' + nodeType + '.');\n }\n }\n\n current = candidates.length;\n while ((current -= 1) >= 0) {\n key = candidates[current];\n candidate = node[key];\n if (!candidate) {\n continue;\n }\n\n if (Array.isArray(candidate)) {\n current2 = candidate.length;\n while ((current2 -= 1) >= 0) {\n if (!candidate[current2]) {\n continue;\n }\n if (isProperty(nodeType, candidates[current])) {\n element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));\n } else if (isNode(candidate[current2])) {\n element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));\n } else {\n continue;\n }\n worklist.push(element);\n }\n } else if (isNode(candidate)) {\n worklist.push(new Element(candidate, key, null, new Reference(node, key)));\n }\n }\n }\n\n return outer.root;\n };\n\n function traverse(root, visitor) {\n var controller = new Controller();\n return controller.traverse(root, visitor);\n }\n\n function replace(root, visitor) {\n var controller = new Controller();\n return controller.replace(root, visitor);\n }\n\n function extendCommentRange(comment, tokens) {\n var target;\n\n target = upperBound(tokens, function search(token) {\n return token.range[0] > comment.range[0];\n });\n\n comment.extendedRange = [comment.range[0], comment.range[1]];\n\n if (target !== tokens.length) {\n comment.extendedRange[1] = tokens[target].range[0];\n }\n\n target -= 1;\n if (target >= 0) {\n comment.extendedRange[0] = tokens[target].range[1];\n }\n\n return comment;\n }\n\n function attachComments(tree, providedComments, tokens) {\n // At first, we should calculate extended comment ranges.\n var comments = [], comment, len, i, cursor;\n\n if (!tree.range) {\n throw new Error('attachComments needs range information');\n }\n\n // tokens array is empty, we attach comments to tree as 'leadingComments'\n if (!tokens.length) {\n if (providedComments.length) {\n for (i = 0, len = providedComments.length; i < len; i += 1) {\n comment = deepCopy(providedComments[i]);\n comment.extendedRange = [0, tree.range[0]];\n comments.push(comment);\n }\n tree.leadingComments = comments;\n }\n return tree;\n }\n\n for (i = 0, len = providedComments.length; i < len; i += 1) {\n comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));\n }\n\n // This is based on John Freeman's implementation.\n cursor = 0;\n traverse(tree, {\n enter: function (node) {\n var comment;\n\n while (cursor < comments.length) {\n comment = comments[cursor];\n if (comment.extendedRange[1] > node.range[0]) {\n break;\n }\n\n if (comment.extendedRange[1] === node.range[0]) {\n if (!node.leadingComments) {\n node.leadingComments = [];\n }\n node.leadingComments.push(comment);\n comments.splice(cursor, 1);\n } else {\n cursor += 1;\n }\n }\n\n // already out of owned node\n if (cursor === comments.length) {\n return VisitorOption.Break;\n }\n\n if (comments[cursor].extendedRange[0] > node.range[1]) {\n return VisitorOption.Skip;\n }\n }\n });\n\n cursor = 0;\n traverse(tree, {\n leave: function (node) {\n var comment;\n\n while (cursor < comments.length) {\n comment = comments[cursor];\n if (node.range[1] < comment.extendedRange[0]) {\n break;\n }\n\n if (node.range[1] === comment.extendedRange[0]) {\n if (!node.trailingComments) {\n node.trailingComments = [];\n }\n node.trailingComments.push(comment);\n comments.splice(cursor, 1);\n } else {\n cursor += 1;\n }\n }\n\n // already out of owned node\n if (cursor === comments.length) {\n return VisitorOption.Break;\n }\n\n if (comments[cursor].extendedRange[0] > node.range[1]) {\n return VisitorOption.Skip;\n }\n }\n });\n\n return tree;\n }\n\n exports.Syntax = Syntax;\n exports.traverse = traverse;\n exports.replace = replace;\n exports.attachComments = attachComments;\n exports.VisitorKeys = VisitorKeys;\n exports.VisitorOption = VisitorOption;\n exports.Controller = Controller;\n exports.cloneEnvironment = function () { return clone({}); };\n\n return exports;\n}(exports));\n/* vim: set sw=4 ts=4 et tw=80 : */\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function(root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n }\n})(this, function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { start: peg$parsestart },\n peg$startRuleFunction = peg$parsestart,\n\n peg$c0 = function(ss) {\n return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss };\n },\n peg$c1 = function() { return void 0; },\n peg$c2 = \" \",\n peg$c3 = peg$literalExpectation(\" \", false),\n peg$c4 = /^[^ [\\],():#!=><~+.]/,\n peg$c5 = peg$classExpectation([\" \", \"[\", \"]\", \",\", \"(\", \")\", \":\", \"#\", \"!\", \"=\", \">\", \"<\", \"~\", \"+\", \".\"], true, false),\n peg$c6 = function(i) { return i.join(''); },\n peg$c7 = \">\",\n peg$c8 = peg$literalExpectation(\">\", false),\n peg$c9 = function() { return 'child'; },\n peg$c10 = \"~\",\n peg$c11 = peg$literalExpectation(\"~\", false),\n peg$c12 = function() { return 'sibling'; },\n peg$c13 = \"+\",\n peg$c14 = peg$literalExpectation(\"+\", false),\n peg$c15 = function() { return 'adjacent'; },\n peg$c16 = function() { return 'descendant'; },\n peg$c17 = \",\",\n peg$c18 = peg$literalExpectation(\",\", false),\n peg$c19 = function(s, ss) {\n return [s].concat(ss.map(function (s) { return s[3]; }));\n },\n peg$c20 = function(a, ops) {\n return ops.reduce(function (memo, rhs) {\n return { type: rhs[0], left: memo, right: rhs[1] };\n }, a);\n },\n peg$c21 = \"!\",\n peg$c22 = peg$literalExpectation(\"!\", false),\n peg$c23 = function(subject, as) {\n const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as };\n if(subject) b.subject = true;\n return b;\n },\n peg$c24 = \"*\",\n peg$c25 = peg$literalExpectation(\"*\", false),\n peg$c26 = function(a) { return { type: 'wildcard', value: a }; },\n peg$c27 = \"#\",\n peg$c28 = peg$literalExpectation(\"#\", false),\n peg$c29 = function(i) { return { type: 'identifier', value: i }; },\n peg$c30 = \"[\",\n peg$c31 = peg$literalExpectation(\"[\", false),\n peg$c32 = \"]\",\n peg$c33 = peg$literalExpectation(\"]\", false),\n peg$c34 = function(v) { return v; },\n peg$c35 = /^[>\", \"<\", \"!\"], false, false),\n peg$c37 = \"=\",\n peg$c38 = peg$literalExpectation(\"=\", false),\n peg$c39 = function(a) { return (a || '') + '='; },\n peg$c40 = /^[><]/,\n peg$c41 = peg$classExpectation([\">\", \"<\"], false, false),\n peg$c42 = \".\",\n peg$c43 = peg$literalExpectation(\".\", false),\n peg$c44 = function(a, as) {\n return [].concat.apply([a], as).join('');\n },\n peg$c45 = function(name, op, value) {\n return { type: 'attribute', name: name, operator: op, value: value };\n },\n peg$c46 = function(name) { return { type: 'attribute', name: name }; },\n peg$c47 = \"\\\"\",\n peg$c48 = peg$literalExpectation(\"\\\"\", false),\n peg$c49 = /^[^\\\\\"]/,\n peg$c50 = peg$classExpectation([\"\\\\\", \"\\\"\"], true, false),\n peg$c51 = \"\\\\\",\n peg$c52 = peg$literalExpectation(\"\\\\\", false),\n peg$c53 = peg$anyExpectation(),\n peg$c54 = function(a, b) { return a + b; },\n peg$c55 = function(d) {\n return { type: 'literal', value: strUnescape(d.join('')) };\n },\n peg$c56 = \"'\",\n peg$c57 = peg$literalExpectation(\"'\", false),\n peg$c58 = /^[^\\\\']/,\n peg$c59 = peg$classExpectation([\"\\\\\", \"'\"], true, false),\n peg$c60 = /^[0-9]/,\n peg$c61 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c62 = function(a, b) {\n // Can use `a.flat().join('')` once supported\n const leadingDecimals = a ? [].concat.apply([], a).join('') : '';\n return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) };\n },\n peg$c63 = function(i) { return { type: 'literal', value: i }; },\n peg$c64 = \"type(\",\n peg$c65 = peg$literalExpectation(\"type(\", false),\n peg$c66 = /^[^ )]/,\n peg$c67 = peg$classExpectation([\" \", \")\"], true, false),\n peg$c68 = \")\",\n peg$c69 = peg$literalExpectation(\")\", false),\n peg$c70 = function(t) { return { type: 'type', value: t.join('') }; },\n peg$c71 = /^[imsu]/,\n peg$c72 = peg$classExpectation([\"i\", \"m\", \"s\", \"u\"], false, false),\n peg$c73 = \"/\",\n peg$c74 = peg$literalExpectation(\"/\", false),\n peg$c75 = /^[^\\/]/,\n peg$c76 = peg$classExpectation([\"/\"], true, false),\n peg$c77 = function(d, flgs) { return {\n type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') };\n },\n peg$c78 = function(i, is) {\n return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)};\n },\n peg$c79 = \":not(\",\n peg$c80 = peg$literalExpectation(\":not(\", false),\n peg$c81 = function(ss) { return { type: 'not', selectors: ss }; },\n peg$c82 = \":matches(\",\n peg$c83 = peg$literalExpectation(\":matches(\", false),\n peg$c84 = function(ss) { return { type: 'matches', selectors: ss }; },\n peg$c85 = \":has(\",\n peg$c86 = peg$literalExpectation(\":has(\", false),\n peg$c87 = function(ss) { return { type: 'has', selectors: ss }; },\n peg$c88 = \":first-child\",\n peg$c89 = peg$literalExpectation(\":first-child\", false),\n peg$c90 = function() { return nth(1); },\n peg$c91 = \":last-child\",\n peg$c92 = peg$literalExpectation(\":last-child\", false),\n peg$c93 = function() { return nthLast(1); },\n peg$c94 = \":nth-child(\",\n peg$c95 = peg$literalExpectation(\":nth-child(\", false),\n peg$c96 = function(n) { return nth(parseInt(n.join(''), 10)); },\n peg$c97 = \":nth-last-child(\",\n peg$c98 = peg$literalExpectation(\":nth-last-child(\", false),\n peg$c99 = function(n) { return nthLast(parseInt(n.join(''), 10)); },\n peg$c100 = \":\",\n peg$c101 = peg$literalExpectation(\":\", false),\n peg$c102 = \"statement\",\n peg$c103 = peg$literalExpectation(\"statement\", true),\n peg$c104 = \"expression\",\n peg$c105 = peg$literalExpectation(\"expression\", true),\n peg$c106 = \"declaration\",\n peg$c107 = peg$literalExpectation(\"declaration\", true),\n peg$c108 = \"function\",\n peg$c109 = peg$literalExpectation(\"function\", true),\n peg$c110 = \"pattern\",\n peg$c111 = peg$literalExpectation(\"pattern\", true),\n peg$c112 = function(c) {\n return { type: 'class', name: c };\n },\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$resultsCache = {},\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 0,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseselectors();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1();\n }\n s0 = s1;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 1,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifierName() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 2,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c6(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsebinaryOp() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 3,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s2 = peg$c7;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c9();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 126) {\n s2 = peg$c10;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c11); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 43) {\n s2 = peg$c13;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c14); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c15();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselectors() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n var key = peg$currPos * 30 + 4,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseselector();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c19(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselector() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 5,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parsesequence();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsesequence() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 6,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseatom();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseatom();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseatom() {\n var s0;\n\n var key = peg$currPos * 30 + 7,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$parsewildcard();\n if (s0 === peg$FAILED) {\n s0 = peg$parseidentifier();\n if (s0 === peg$FAILED) {\n s0 = peg$parseattr();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefield();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenegation();\n if (s0 === peg$FAILED) {\n s0 = peg$parsematches();\n if (s0 === peg$FAILED) {\n s0 = peg$parsehas();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefirstChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parselastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthLastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parseclass();\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsewildcard() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 8,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 42) {\n s1 = peg$c24;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifier() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 9,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c27;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattr() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 10,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c30;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrValue();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c32;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 11,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (peg$c35.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c40.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c41); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrEqOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 12,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrName() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 13,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c44(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrValue() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 14,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrEqOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsetype();\n if (s5 === peg$FAILED) {\n s5 = peg$parseregex();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsestring();\n if (s5 === peg$FAILED) {\n s5 = peg$parsenumber();\n if (s5 === peg$FAILED) {\n s5 = peg$parsepath();\n }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c46(s1);\n }\n s0 = s1;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsestring() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 15,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c47;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c47;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c56;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c56;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenumber() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 16,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c42;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c62(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsepath() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 17,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsetype() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 18,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c64) {\n s1 = peg$c64;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c65); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c70(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseflags() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 19,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseregex() {\n var s0, s1, s2, s3, s4;\n\n var key = peg$currPos * 30 + 20,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 47) {\n s1 = peg$c73;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 47) {\n s3 = peg$c73;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseflags();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c77(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefield() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n var key = peg$currPos * 30 + 21,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s1 = peg$c42;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c78(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenegation() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 22,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c79) {\n s1 = peg$c79;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c80); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c81(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsematches() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 23,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 9) === peg$c82) {\n s1 = peg$c82;\n peg$currPos += 9;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsehas() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 24,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c85) {\n s1 = peg$c85;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c86); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefirstChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 25,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 12) === peg$c88) {\n s1 = peg$c88;\n peg$currPos += 12;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c89); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c90();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parselastChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 26,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c91) {\n s1 = peg$c91;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c93();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 27,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c94) {\n s1 = peg$c94;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c95); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c96(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthLastChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 28,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 16) === peg$c97) {\n s1 = peg$c97;\n peg$currPos += 16;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c99(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseclass() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 29,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c100;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c101); }\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) {\n s2 = input.substr(peg$currPos, 9);\n peg$currPos += 9;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c103); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) {\n s2 = input.substr(peg$currPos, 10);\n peg$currPos += 10;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c105); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) {\n s2 = input.substr(peg$currPos, 11);\n peg$currPos += 11;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) {\n s2 = input.substr(peg$currPos, 8);\n peg$currPos += 8;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) {\n s2 = input.substr(peg$currPos, 7);\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n }\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c112(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n\n function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; }\n function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; }\n function strUnescape(s) {\n return s.replace(/\\\\(.)/g, function(match, ch) {\n switch(ch) {\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n case 'v': return '\\v';\n default: return ch;\n }\n });\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","/* vim: set sw=4 sts=4 : */\nimport estraverse from 'estraverse';\nimport parser from './parser.js';\n\n/**\n* @typedef {\"LEFT_SIDE\"|\"RIGHT_SIDE\"} Side\n*/\n\nconst LEFT_SIDE = 'LEFT_SIDE';\nconst RIGHT_SIDE = 'RIGHT_SIDE';\n\n/**\n * @external AST\n * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html\n */\n\n/**\n * One of the rules of `grammar.pegjs`\n * @typedef {PlainObject} SelectorAST\n * @see grammar.pegjs\n*/\n\n/**\n * The `sequence` production of `grammar.pegjs`\n * @typedef {PlainObject} SelectorSequenceAST\n*/\n\n/**\n * Get the value of a property which may be multiple levels down\n * in the object.\n * @param {?PlainObject} obj\n * @param {string} key\n * @returns {undefined|boolean|string|number|external:AST}\n */\nfunction getPath(obj, key) {\n const keys = key.split('.');\n for (const key of keys) {\n if (obj == null) { return obj; }\n obj = obj[key];\n }\n return obj;\n}\n\n/**\n * Determine whether `node` can be reached by following `path`,\n * starting at `ancestor`.\n * @param {?external:AST} node\n * @param {?external:AST} ancestor\n * @param {string[]} path\n * @returns {boolean}\n */\nfunction inPath(node, ancestor, path) {\n if (path.length === 0) { return node === ancestor; }\n if (ancestor == null) { return false; }\n const field = ancestor[path[0]];\n const remainingPath = path.slice(1);\n if (Array.isArray(field)) {\n for (const component of field) {\n if (inPath(node, component, remainingPath)) { return true; }\n }\n return false;\n } else {\n return inPath(node, field, remainingPath);\n }\n}\n\n/**\n * @callback TraverseOptionFallback\n * @param {external:AST} node The given node.\n * @returns {string[]} An array of visitor keys for the given node.\n */\n/**\n * @typedef {object} ESQueryOptions\n * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node.\n * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes.\n */\n\n/**\n * Given a `node` and its ancestors, determine if `node` is matched\n * by `selector`.\n * @param {?external:AST} node\n * @param {?SelectorAST} selector\n * @param {external:AST[]} [ancestry=[]]\n * @param {ESQueryOptions} [options]\n * @throws {Error} Unknowns (operator, class name, selector type, or\n * selector value type)\n * @returns {boolean}\n */\nfunction matches(node, selector, ancestry, options) {\n if (!selector) { return true; }\n if (!node) { return false; }\n if (!ancestry) { ancestry = []; }\n\n switch(selector.type) {\n case 'wildcard':\n return true;\n\n case 'identifier':\n return selector.value.toLowerCase() === node.type.toLowerCase();\n\n case 'field': {\n const path = selector.name.split('.');\n const ancestor = ancestry[path.length - 1];\n return inPath(node, ancestor, path);\n\n }\n case 'matches':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return true; }\n }\n return false;\n\n case 'compound':\n for (const sel of selector.selectors) {\n if (!matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'not':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'has': {\n const collector = [];\n for (const sel of selector.selectors) {\n const a = [];\n estraverse.traverse(node, {\n enter (node, parent) {\n if (parent != null) { a.unshift(parent); }\n if (matches(node, sel, a, options)) {\n collector.push(node);\n }\n },\n leave () { a.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n }\n return collector.length !== 0;\n\n }\n case 'child':\n if (matches(node, selector.right, ancestry, options)) {\n return matches(ancestry[0], selector.left, ancestry.slice(1), options);\n }\n return false;\n\n case 'descendant':\n if (matches(node, selector.right, ancestry, options)) {\n for (let i = 0, l = ancestry.length; i < l; ++i) {\n if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) {\n return true;\n }\n }\n }\n return false;\n\n case 'attribute': {\n const p = getPath(node, selector.name);\n switch (selector.operator) {\n case void 0:\n return p != null;\n case '=':\n switch (selector.value.type) {\n case 'regexp': return typeof p === 'string' && selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` === `${p}`;\n case 'type': return selector.value.value === typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '!=':\n switch (selector.value.type) {\n case 'regexp': return !selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` !== `${p}`;\n case 'type': return selector.value.value !== typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '<=': return p <= selector.value.value;\n case '<': return p < selector.value.value;\n case '>': return p > selector.value.value;\n case '>=': return p >= selector.value.value;\n }\n throw new Error(`Unknown operator: ${selector.operator}`);\n }\n case 'sibling':\n return matches(node, selector.right, ancestry, options) &&\n sibling(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.left.subject &&\n matches(node, selector.left, ancestry, options) &&\n sibling(node, selector.right, ancestry, RIGHT_SIDE, options);\n case 'adjacent':\n return matches(node, selector.right, ancestry, options) &&\n adjacent(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.right.subject &&\n matches(node, selector.left, ancestry, options) &&\n adjacent(node, selector.right, ancestry, RIGHT_SIDE, options);\n\n case 'nth-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function () {\n return selector.index.value - 1;\n }, options);\n\n case 'nth-last-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function (length) {\n return length - selector.index.value;\n }, options);\n\n case 'class':\n switch(selector.name.toLowerCase()){\n case 'statement':\n if(node.type.slice(-9) === 'Statement') return true;\n // fallthrough: interface Declaration <: Statement { }\n case 'declaration':\n return node.type.slice(-11) === 'Declaration';\n case 'pattern':\n if(node.type.slice(-7) === 'Pattern') return true;\n // fallthrough: interface Expression <: Node, Pattern { }\n case 'expression':\n return node.type.slice(-10) === 'Expression' ||\n node.type.slice(-7) === 'Literal' ||\n (\n node.type === 'Identifier' &&\n (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty')\n ) ||\n node.type === 'MetaProperty';\n case 'function':\n return node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression';\n }\n throw new Error(`Unknown class name: ${selector.name}`);\n }\n\n throw new Error(`Unknown selector type: ${selector.type}`);\n}\n\n/**\n * Get visitor keys of a given node.\n * @param {external:AST} node The AST node to get keys.\n * @param {ESQueryOptions|undefined} options\n * @returns {string[]} Visitor keys of the node.\n */\nfunction getVisitorKeys(node, options) {\n const nodeType = node.type;\n if (options && options.visitorKeys && options.visitorKeys[nodeType]) {\n return options.visitorKeys[nodeType];\n }\n if (estraverse.VisitorKeys[nodeType]) {\n return estraverse.VisitorKeys[nodeType];\n }\n if (options && typeof options.fallback === 'function') {\n return options.fallback(node);\n }\n // 'iteration' fallback\n return Object.keys(node).filter(function (key) {\n return key !== 'type';\n });\n}\n\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} node The value to check.\n * @returns {boolean} `true` if the value is an ASTNode.\n */\nfunction isNode(node) {\n return node !== null && typeof node === 'object' && typeof node.type === 'string';\n}\n\n/**\n * Determines if the given node has a sibling that matches the\n * given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction sibling(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const startIndex = listProp.indexOf(node);\n if (startIndex < 0) { continue; }\n let lowerBound, upperBound;\n if (side === LEFT_SIDE) {\n lowerBound = 0;\n upperBound = startIndex;\n } else {\n lowerBound = startIndex + 1;\n upperBound = listProp.length;\n }\n for (let k = lowerBound; k < upperBound; ++k) {\n if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Determines if the given node has an adjacent sibling that matches\n * the given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction adjacent(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx < 0) { continue; }\n if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) {\n return true;\n }\n if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n* @callback IndexFunction\n* @param {Integer} len Containing list's length\n* @returns {Integer}\n*/\n\n/**\n * Determines if the given node is the nth child, determined by\n * `idxFn`, which is given the containing list's length.\n * @param {external:AST} node\n * @param {external:AST[]} ancestry\n * @param {IndexFunction} idxFn\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction nthChild(node, ancestry, idxFn, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx >= 0 && idx === idxFn(listProp.length)) { return true; }\n }\n }\n return false;\n}\n\n/**\n * For each selector node marked as a subject, find the portion of the\n * selector that the subject must match.\n * @param {SelectorAST} selector\n * @param {SelectorAST} [ancestor] Defaults to `selector`\n * @returns {SelectorAST[]}\n */\nfunction subjects(selector, ancestor) {\n if (selector == null || typeof selector != 'object') { return []; }\n if (ancestor == null) { ancestor = selector; }\n const results = selector.subject ? [ancestor] : [];\n for (const [p, sel] of Object.entries(selector)) {\n results.push(...subjects(sel, p === 'left' ? sel : ancestor));\n }\n return results;\n}\n\n/**\n* @callback TraverseVisitor\n* @param {?external:AST} node\n* @param {?external:AST} parent\n* @param {external:AST[]} ancestry\n*/\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {TraverseVisitor} visitor\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction traverse(ast, selector, visitor, options) {\n if (!selector) { return; }\n const ancestry = [];\n const altSubjects = subjects(selector);\n estraverse.traverse(ast, {\n enter (node, parent) {\n if (parent != null) { ancestry.unshift(parent); }\n if (matches(node, selector, ancestry, options)) {\n if (altSubjects.length) {\n for (let i = 0, l = altSubjects.length; i < l; ++i) {\n if (matches(node, altSubjects[i], ancestry, options)) {\n visitor(node, parent, ancestry);\n }\n for (let k = 0, m = ancestry.length; k < m; ++k) {\n const succeedingAncestry = ancestry.slice(k + 1);\n if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) {\n visitor(ancestry[k], parent, succeedingAncestry);\n }\n }\n }\n } else {\n visitor(node, parent, ancestry);\n }\n }\n },\n leave () { ancestry.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n}\n\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction match(ast, selector, options) {\n const results = [];\n traverse(ast, selector, function (node) {\n results.push(node);\n }, options);\n return results;\n}\n\n/**\n * Parse a selector string and return its AST.\n * @param {string} selector\n * @returns {SelectorAST}\n */\nfunction parse(selector) {\n return parser.parse(selector);\n}\n\n/**\n * Query the code AST using the selector string.\n * @param {external:AST} ast\n * @param {string} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction query(ast, selector, options) {\n return match(ast, parse(selector), options);\n}\n\nquery.parse = parse;\nquery.match = match;\nquery.traverse = traverse;\nquery.matches = matches;\nquery.query = query;\n\nexport default query;\n"],"names":["clone","exports","Syntax","VisitorOption","VisitorKeys","BREAK","SKIP","REMOVE","deepCopy","obj","key","val","ret","hasOwnProperty","Reference","parent","Element","node","path","wrap","ref","Controller","isNode","type","isProperty","nodeType","ObjectExpression","ObjectPattern","candidateExistsInLeaveList","leavelist","candidate","i","length","traverse","root","visitor","extendCommentRange","comment","tokens","target","array","func","diff","len","current","upperBound","token","range","extendedRange","AssignmentExpression","AssignmentPattern","ArrayExpression","ArrayPattern","ArrowFunctionExpression","AwaitExpression","BlockStatement","BinaryExpression","BreakStatement","CallExpression","CatchClause","ChainExpression","ClassBody","ClassDeclaration","ClassExpression","ComprehensionBlock","ComprehensionExpression","ConditionalExpression","ContinueStatement","DebuggerStatement","DirectiveStatement","DoWhileStatement","EmptyStatement","ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ExportSpecifier","ExpressionStatement","ForStatement","ForInStatement","ForOfStatement","FunctionDeclaration","FunctionExpression","GeneratorExpression","Identifier","IfStatement","ImportExpression","ImportDeclaration","ImportDefaultSpecifier","ImportNamespaceSpecifier","ImportSpecifier","Literal","LabeledStatement","LogicalExpression","MemberExpression","MetaProperty","MethodDefinition","ModuleSpecifier","NewExpression","Program","Property","RestElement","ReturnStatement","SequenceExpression","SpreadElement","Super","SwitchStatement","SwitchCase","TaggedTemplateExpression","TemplateElement","TemplateLiteral","ThisExpression","ThrowStatement","TryStatement","UnaryExpression","UpdateExpression","VariableDeclaration","VariableDeclarator","WhileStatement","WithStatement","YieldExpression","Break","Skip","Remove","prototype","replace","this","remove","Array","isArray","splice","iz","j","jz","result","addToPath","push","__current","__leavelist","parents","__execute","callback","element","previous","undefined","__state","call","notify","flag","skip","__initialize","__worklist","__fallback","fallback","Object","keys","__keys","assign","create","worklist","current2","candidates","sentinel","pop","enter","Error","leave","outer","removeElem","nextElem","attachComments","tree","providedComments","cursor","comments","leadingComments","trailingComments","cloneEnvironment","module","peg$SyntaxError","message","expected","found","location","name","captureStackTrace","child","ctor","constructor","peg$subclass","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","escapedParts","parts","classEscape","inverted","any","end","other","description","hex","ch","charCodeAt","toString","toUpperCase","s","descriptions","sort","slice","join","describeExpected","describeFound","SyntaxError","parse","input","options","peg$result","peg$FAILED","peg$startRuleFunctions","start","peg$parsestart","peg$startRuleFunction","peg$c3","peg$literalExpectation","peg$c4","peg$c5","peg$classExpectation","peg$c8","peg$c11","peg$c14","peg$c18","peg$c22","peg$c25","peg$c28","peg$c31","peg$c33","peg$c35","peg$c36","peg$c38","peg$c39","a","peg$c40","peg$c41","peg$c43","peg$c45","op","value","operator","peg$c48","peg$c49","peg$c50","peg$c52","peg$c53","peg$c54","b","peg$c55","d","match","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c65","peg$c66","peg$c67","peg$c69","peg$c71","peg$c72","peg$c74","peg$c75","peg$c76","peg$c80","peg$c83","peg$c86","peg$c89","peg$c92","peg$c95","peg$c98","peg$c101","peg$c103","peg$c105","peg$c107","peg$c109","peg$c111","peg$currPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","ignoreCase","peg$computePosDetails","pos","p","details","peg$computeLocation","startPos","endPos","startPosDetails","endPosDetails","offset","peg$fail","s0","s1","s2","ss","cached","peg$resultsCache","nextPos","peg$parse_","peg$parseselectors","selectors","peg$c1","peg$parseidentifierName","test","charAt","peg$parsebinaryOp","s3","s4","s5","s6","s7","peg$parseselector","concat","map","peg$parsesequence","reduce","memo","rhs","left","right","subject","as","peg$parseatom","peg$parsewildcard","peg$parseidentifier","peg$parseattrName","peg$parseattrEqOps","substr","peg$parsetype","flgs","peg$parseflags","RegExp","peg$parseregex","peg$parseattrOps","peg$parsestring","leadingDecimals","apply","parseFloat","peg$parsenumber","peg$parsepath","peg$parseattrValue","peg$parseattr","peg$parsefield","peg$parsenegation","peg$parsematches","peg$parsehas","nth","peg$parsefirstChild","nthLast","peg$parselastChild","parseInt","peg$parsenthChild","peg$parsenthLastChild","toLowerCase","peg$parseclass","n","index","factory","matches","selector","ancestry","split","ancestor","inPath","field","remainingPath","sel","collector","estraverse","unshift","shift","visitorKeys","l","getPath","sibling","adjacent","nthChild","getVisitorKeys","filter","_typeof","side","listProp","startIndex","indexOf","lowerBound","k","idx","idxFn","subjects","results","_objectEntries","ast","altSubjects","m","succeedingAncestry","parser","query"],"mappings":"o2EA2BUA,EAAMC,OAGRC,EACAC,EACAC,EACAC,EACAC,EACAC,WAEKC,EAASC,OACAC,EAAKC,EAAfC,EAAM,OACLF,KAAOD,EACJA,EAAII,eAAeH,KACnBC,EAAMF,EAAIC,GAENE,EAAIF,GADW,iBAARC,GAA4B,OAARA,EAChBH,EAASG,GAETA,UAIhBC,WA4LFE,EAAUC,EAAQL,QAClBK,OAASA,OACTL,IAAMA,WAiBNM,EAAQC,EAAMC,EAAMC,EAAMC,QAC1BH,KAAOA,OACPC,KAAOA,OACPC,KAAOA,OACPC,IAAMA,WAGNC,cAuHAC,EAAOL,UACA,MAARA,IAGmB,iBAATA,GAA0C,iBAAdA,EAAKM,eAG1CC,EAAWC,EAAUf,UAClBe,IAAavB,EAAOwB,kBAAoBD,IAAavB,EAAOyB,gBAAkB,eAAiBjB,WAGlGkB,EAA2BC,EAAWC,OACtC,IAAIC,EAAIF,EAAUG,OAAS,EAAGD,GAAK,IAAKA,KACrCF,EAAUE,GAAGd,OAASa,SACf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,EACdyJ,EAAM5X,SAAWA,EACjB4X,EAAMtC,QAAUA,EAChBsC,EAAMA,MAAQA"} \ No newline at end of file diff --git a/node_modules/esquery/dist/esquery.js b/node_modules/esquery/dist/esquery.js new file mode 100644 index 0000000..adc2a5e --- /dev/null +++ b/node_modules/esquery/dist/esquery.js @@ -0,0 +1,4801 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.esquery = factory()); +}(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _createForOfIteratorHelper(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + + var F = function () {}; + + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = o[Symbol.iterator](); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var estraverse = createCommonjsModule(function (module, exports) { + /* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /*jslint vars:false, bitwise:true*/ + + /*jshint indent:4*/ + + /*global exports:true*/ + (function clone(exports) { + + var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE; + + function deepCopy(obj) { + var ret = {}, + key, + val; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + + return ret; + } // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + + function upperBound(array, func) { + var diff, len, i, current; + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', + // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', + // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', + // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], + // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], + // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], + // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], + // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: ['argument'], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; // unique id + + BREAK = {}; + SKIP = {}; + REMOVE = {}; + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() {} // API: + // return property path array from root to current node + + + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } // root node + + + if (!this.__current.path) { + return null; + } // first node is sentinel, second node is root element + + + result = []; + + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + + addToPath(result, this.__current.path); + return result; + }; // API: + // return type of current node + + + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; // API: + // return array of parent elements + + + Controller.prototype.parents = function parents() { + var i, iz, result; // first node is sentinel + + result = []; + + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; // API: + // return current node + + + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + result = undefined; + previous = this.__current; + this.__current = element; + this.__state = null; + + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + + this.__current = previous; + return result; + }; // API: + // notify control skip / break + + + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; // API: + // skip child nodes of current node + + + Controller.prototype.skip = function () { + this.notify(SKIP); + }; // API: + // break traversals + + + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; // API: + // remove node + + + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function (root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + + return false; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, leavelist, element, node, nodeType, ret, key, current, current2, candidates, candidate, sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; // reference + + worklist = this.__worklist; + leavelist = this.__leavelist; // initialize + + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + continue; + } + + if (element.node) { + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key; + + function removeElem(element) { + var i, key, nextElem, parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; // If removed from array, then decrease following items' keys. + + i = worklist.length; + + while (i--) { + nextElem = worklist[i]; + + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; // reference + + worklist = this.__worklist; + leavelist = this.__leavelist; // initialize + + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + target = this.__execute(visitor.leave, element); // node may be replaced with null, + // so distinguish between undefined and null in this place + + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + continue; + } + + target = this.__execute(visitor.enter, element); // node may be replaced with null, + // so distinguish between undefined and null in this place + + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } // node may be null + + + node = element.node; + + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], + comment, + len, + i, + cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } // tokens array is empty, we attach comments to tree as 'leadingComments' + + + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + + tree.leadingComments = comments; + } + + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } // This is based on John Freeman's implementation. + + + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } // already out of owned node + + + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } // already out of owned node + + + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + + exports.cloneEnvironment = function () { + return clone({}); + }; + + return exports; + })(exports); + /* vim: set sw=4 ts=4 et tw=80 : */ + + }); + + var parser = createCommonjsModule(function (module) { + /* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + (function (root, factory) { + if ( module.exports) { + module.exports = factory(); + } + })(commonjsGlobal, function () { + + function peg$subclass(child, parent) { + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function (expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function literal(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + "class": function _class(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + any: function any(expectation) { + return "any character"; + }, + end: function end(expectation) { + return "end of input"; + }, + other: function other(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function classEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, + j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + peg$startRuleFunctions = { + start: peg$parsestart + }, + peg$startRuleFunction = peg$parsestart, + peg$c0 = function peg$c0(ss) { + return ss.length === 1 ? ss[0] : { + type: 'matches', + selectors: ss + }; + }, + peg$c1 = function peg$c1() { + return void 0; + }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function peg$c6(i) { + return i.join(''); + }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function peg$c9() { + return 'child'; + }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function peg$c12() { + return 'sibling'; + }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function peg$c15() { + return 'adjacent'; + }, + peg$c16 = function peg$c16() { + return 'descendant'; + }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function peg$c19(s, ss) { + return [s].concat(ss.map(function (s) { + return s[3]; + })); + }, + peg$c20 = function peg$c20(a, ops) { + return ops.reduce(function (memo, rhs) { + return { + type: rhs[0], + left: memo, + right: rhs[1] + }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function peg$c23(subject, as) { + var b = as.length === 1 ? as[0] : { + type: 'compound', + selectors: as + }; + if (subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function peg$c26(a) { + return { + type: 'wildcard', + value: a + }; + }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function peg$c29(i) { + return { + type: 'identifier', + value: i + }; + }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function peg$c34(v) { + return v; + }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function peg$c39(a) { + return (a || '') + '='; + }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function peg$c44(a, as) { + return [].concat.apply([a], as).join(''); + }, + peg$c45 = function peg$c45(name, op, value) { + return { + type: 'attribute', + name: name, + operator: op, + value: value + }; + }, + peg$c46 = function peg$c46(name) { + return { + type: 'attribute', + name: name + }; + }, + peg$c47 = "\"", + peg$c48 = peg$literalExpectation("\"", false), + peg$c49 = /^[^\\"]/, + peg$c50 = peg$classExpectation(["\\", "\""], true, false), + peg$c51 = "\\", + peg$c52 = peg$literalExpectation("\\", false), + peg$c53 = peg$anyExpectation(), + peg$c54 = function peg$c54(a, b) { + return a + b; + }, + peg$c55 = function peg$c55(d) { + return { + type: 'literal', + value: strUnescape(d.join('')) + }; + }, + peg$c56 = "'", + peg$c57 = peg$literalExpectation("'", false), + peg$c58 = /^[^\\']/, + peg$c59 = peg$classExpectation(["\\", "'"], true, false), + peg$c60 = /^[0-9]/, + peg$c61 = peg$classExpectation([["0", "9"]], false, false), + peg$c62 = function peg$c62(a, b) { + // Can use `a.flat().join('')` once supported + var leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { + type: 'literal', + value: parseFloat(leadingDecimals + b.join('')) + }; + }, + peg$c63 = function peg$c63(i) { + return { + type: 'literal', + value: i + }; + }, + peg$c64 = "type(", + peg$c65 = peg$literalExpectation("type(", false), + peg$c66 = /^[^ )]/, + peg$c67 = peg$classExpectation([" ", ")"], true, false), + peg$c68 = ")", + peg$c69 = peg$literalExpectation(")", false), + peg$c70 = function peg$c70(t) { + return { + type: 'type', + value: t.join('') + }; + }, + peg$c71 = /^[imsu]/, + peg$c72 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c73 = "/", + peg$c74 = peg$literalExpectation("/", false), + peg$c75 = /^[^\/]/, + peg$c76 = peg$classExpectation(["/"], true, false), + peg$c77 = function peg$c77(d, flgs) { + return { + type: 'regexp', + value: new RegExp(d.join(''), flgs ? flgs.join('') : '') + }; + }, + peg$c78 = function peg$c78(i, is) { + return { + type: 'field', + name: is.reduce(function (memo, p) { + return memo + p[0] + p[1]; + }, i) + }; + }, + peg$c79 = ":not(", + peg$c80 = peg$literalExpectation(":not(", false), + peg$c81 = function peg$c81(ss) { + return { + type: 'not', + selectors: ss + }; + }, + peg$c82 = ":matches(", + peg$c83 = peg$literalExpectation(":matches(", false), + peg$c84 = function peg$c84(ss) { + return { + type: 'matches', + selectors: ss + }; + }, + peg$c85 = ":has(", + peg$c86 = peg$literalExpectation(":has(", false), + peg$c87 = function peg$c87(ss) { + return { + type: 'has', + selectors: ss + }; + }, + peg$c88 = ":first-child", + peg$c89 = peg$literalExpectation(":first-child", false), + peg$c90 = function peg$c90() { + return nth(1); + }, + peg$c91 = ":last-child", + peg$c92 = peg$literalExpectation(":last-child", false), + peg$c93 = function peg$c93() { + return nthLast(1); + }, + peg$c94 = ":nth-child(", + peg$c95 = peg$literalExpectation(":nth-child(", false), + peg$c96 = function peg$c96(n) { + return nth(parseInt(n.join(''), 10)); + }, + peg$c97 = ":nth-last-child(", + peg$c98 = peg$literalExpectation(":nth-last-child(", false), + peg$c99 = function peg$c99(n) { + return nthLast(parseInt(n.join(''), 10)); + }, + peg$c100 = ":", + peg$c101 = peg$literalExpectation(":", false), + peg$c102 = "statement", + peg$c103 = peg$literalExpectation("statement", true), + peg$c104 = "expression", + peg$c105 = peg$literalExpectation("expression", true), + peg$c106 = "declaration", + peg$c107 = peg$literalExpectation("declaration", true), + peg$c108 = "function", + peg$c109 = peg$literalExpectation("function", true), + peg$c110 = "pattern", + peg$c111 = peg$literalExpectation("pattern", true), + peg$c112 = function peg$c112(c) { + return { + type: 'class', + name: c + }; + }, + peg$currPos = 0, + peg$posDetailsCache = [{ + line: 1, + column: 1 + }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$resultsCache = {}, + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { + type: "literal", + text: text, + ignoreCase: ignoreCase + }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { + type: "class", + parts: parts, + inverted: inverted, + ignoreCase: ignoreCase + }; + } + + function peg$anyExpectation() { + return { + type: "any" + }; + } + + function peg$endExpectation() { + return { + type: "end" + }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], + p; + + if (details) { + return details; + } else { + p = pos - 1; + + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; + } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s1 = peg$c1(); + } + + s0 = s1; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parse_() { + var s0, s1; + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + } + } else { + s1 = peg$FAILED; + } + + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c8); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c11); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c14); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseatom() { + var s0; + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parsewildcard(); + + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c25); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c26(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c28); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c41); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c44(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c46(s1); + } + + s0 = s1; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c47; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c47; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c56; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c56; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c62(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsepath() { + var s0, s1; + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c63(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c64) { + s1 = peg$c64; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c65); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c70(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseflags() { + var s0, s1; + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c73; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + + if (s4 === peg$FAILED) { + s4 = null; + } + + if (s4 !== peg$FAILED) { + s1 = peg$c77(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c78(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c79) { + s1 = peg$c79; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c80); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c81(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 9) === peg$c82) { + s1 = peg$c82; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c83); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c84(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c85) { + s1 = peg$c85; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c86); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c87(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 12) === peg$c88) { + s1 = peg$c88; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c89); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c90(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parselastChild() { + var s0, s1; + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c91) { + s1 = peg$c91; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c92); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c93(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c94) { + s1 = peg$c94; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c95); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c96(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 16) === peg$c97) { + s1 = peg$c97; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c98); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c99(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c100; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c101); + } + } + + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c103); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c105); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c107); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c109); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c111); + } + } + } + } + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c112(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function nth(n) { + return { + type: 'nth-child', + index: { + type: 'literal', + value: n + } + }; + } + + function nthLast(n) { + return { + type: 'nth-last-child', + index: { + type: 'literal', + value: n + } + }; + } + + function strUnescape(s) { + return s.replace(/\\(.)/g, function (match, ch) { + switch (ch) { + case 'b': + return '\b'; + + case 'f': + return '\f'; + + case 'n': + return '\n'; + + case 'r': + return '\r'; + + case 't': + return '\t'; + + case 'v': + return '\v'; + + default: + return ch; + } + }); + } + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; + }); + }); + + function _objectEntries(obj) { + var entries = []; + var keys = Object.keys(obj); + + for (var k = 0; k < keys.length; k++) entries.push([keys[k], obj[keys[k]]]); + + return entries; + } + /** + * @typedef {"LEFT_SIDE"|"RIGHT_SIDE"} Side + */ + + var LEFT_SIDE = 'LEFT_SIDE'; + var RIGHT_SIDE = 'RIGHT_SIDE'; + /** + * @external AST + * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html + */ + + /** + * One of the rules of `grammar.pegjs` + * @typedef {PlainObject} SelectorAST + * @see grammar.pegjs + */ + + /** + * The `sequence` production of `grammar.pegjs` + * @typedef {PlainObject} SelectorSequenceAST + */ + + /** + * Get the value of a property which may be multiple levels down + * in the object. + * @param {?PlainObject} obj + * @param {string} key + * @returns {undefined|boolean|string|number|external:AST} + */ + + function getPath(obj, key) { + var keys = key.split('.'); + + var _iterator = _createForOfIteratorHelper(keys), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _key = _step.value; + + if (obj == null) { + return obj; + } + + obj = obj[_key]; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return obj; + } + /** + * Determine whether `node` can be reached by following `path`, + * starting at `ancestor`. + * @param {?external:AST} node + * @param {?external:AST} ancestor + * @param {string[]} path + * @returns {boolean} + */ + + + function inPath(node, ancestor, path) { + if (path.length === 0) { + return node === ancestor; + } + + if (ancestor == null) { + return false; + } + + var field = ancestor[path[0]]; + var remainingPath = path.slice(1); + + if (Array.isArray(field)) { + var _iterator2 = _createForOfIteratorHelper(field), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var component = _step2.value; + + if (inPath(node, component, remainingPath)) { + return true; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + + return false; + } else { + return inPath(node, field, remainingPath); + } + } + /** + * @callback TraverseOptionFallback + * @param {external:AST} node The given node. + * @returns {string[]} An array of visitor keys for the given node. + */ + + /** + * @typedef {object} ESQueryOptions + * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node. + * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes. + */ + + /** + * Given a `node` and its ancestors, determine if `node` is matched + * by `selector`. + * @param {?external:AST} node + * @param {?SelectorAST} selector + * @param {external:AST[]} [ancestry=[]] + * @param {ESQueryOptions} [options] + * @throws {Error} Unknowns (operator, class name, selector type, or + * selector value type) + * @returns {boolean} + */ + + + function matches(node, selector, ancestry, options) { + if (!selector) { + return true; + } + + if (!node) { + return false; + } + + if (!ancestry) { + ancestry = []; + } + + switch (selector.type) { + case 'wildcard': + return true; + + case 'identifier': + return selector.value.toLowerCase() === node.type.toLowerCase(); + + case 'field': + { + var path = selector.name.split('.'); + var ancestor = ancestry[path.length - 1]; + return inPath(node, ancestor, path); + } + + case 'matches': + var _iterator3 = _createForOfIteratorHelper(selector.selectors), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var sel = _step3.value; + + if (matches(node, sel, ancestry, options)) { + return true; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + + return false; + + case 'compound': + var _iterator4 = _createForOfIteratorHelper(selector.selectors), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var _sel = _step4.value; + + if (!matches(node, _sel, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + + return true; + + case 'not': + var _iterator5 = _createForOfIteratorHelper(selector.selectors), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var _sel2 = _step5.value; + + if (matches(node, _sel2, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + + return true; + + case 'has': + { + var _ret = function () { + var collector = []; + + var _iterator6 = _createForOfIteratorHelper(selector.selectors), + _step6; + + try { + var _loop = function _loop() { + var sel = _step6.value; + var a = []; + estraverse.traverse(node, { + enter: function enter(node, parent) { + if (parent != null) { + a.unshift(parent); + } + + if (matches(node, sel, a, options)) { + collector.push(node); + } + }, + leave: function leave() { + a.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); + }; + + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + _loop(); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + + return { + v: collector.length !== 0 + }; + }(); + + if (_typeof(_ret) === "object") return _ret.v; + } + + case 'child': + if (matches(node, selector.right, ancestry, options)) { + return matches(ancestry[0], selector.left, ancestry.slice(1), options); + } + + return false; + + case 'descendant': + if (matches(node, selector.right, ancestry, options)) { + for (var i = 0, l = ancestry.length; i < l; ++i) { + if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) { + return true; + } + } + } + + return false; + + case 'attribute': + { + var p = getPath(node, selector.name); + + switch (selector.operator) { + case void 0: + return p != null; + + case '=': + switch (selector.value.type) { + case 'regexp': + return typeof p === 'string' && selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) === "".concat(p); + + case 'type': + return selector.value.value === _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '!=': + switch (selector.value.type) { + case 'regexp': + return !selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) !== "".concat(p); + + case 'type': + return selector.value.value !== _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '<=': + return p <= selector.value.value; + + case '<': + return p < selector.value.value; + + case '>': + return p > selector.value.value; + + case '>=': + return p >= selector.value.value; + } + + throw new Error("Unknown operator: ".concat(selector.operator)); + } + + case 'sibling': + return matches(node, selector.right, ancestry, options) && sibling(node, selector.left, ancestry, LEFT_SIDE, options) || selector.left.subject && matches(node, selector.left, ancestry, options) && sibling(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'adjacent': + return matches(node, selector.right, ancestry, options) && adjacent(node, selector.left, ancestry, LEFT_SIDE, options) || selector.right.subject && matches(node, selector.left, ancestry, options) && adjacent(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'nth-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function () { + return selector.index.value - 1; + }, options); + + case 'nth-last-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function (length) { + return length - selector.index.value; + }, options); + + case 'class': + switch (selector.name.toLowerCase()) { + case 'statement': + if (node.type.slice(-9) === 'Statement') return true; + // fallthrough: interface Declaration <: Statement { } + + case 'declaration': + return node.type.slice(-11) === 'Declaration'; + + case 'pattern': + if (node.type.slice(-7) === 'Pattern') return true; + // fallthrough: interface Expression <: Node, Pattern { } + + case 'expression': + return node.type.slice(-10) === 'Expression' || node.type.slice(-7) === 'Literal' || node.type === 'Identifier' && (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') || node.type === 'MetaProperty'; + + case 'function': + return node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression'; + } + + throw new Error("Unknown class name: ".concat(selector.name)); + } + + throw new Error("Unknown selector type: ".concat(selector.type)); + } + /** + * Get visitor keys of a given node. + * @param {external:AST} node The AST node to get keys. + * @param {ESQueryOptions|undefined} options + * @returns {string[]} Visitor keys of the node. + */ + + + function getVisitorKeys(node, options) { + var nodeType = node.type; + + if (options && options.visitorKeys && options.visitorKeys[nodeType]) { + return options.visitorKeys[nodeType]; + } + + if (estraverse.VisitorKeys[nodeType]) { + return estraverse.VisitorKeys[nodeType]; + } + + if (options && typeof options.fallback === 'function') { + return options.fallback(node); + } // 'iteration' fallback + + + return Object.keys(node).filter(function (key) { + return key !== 'type'; + }); + } + /** + * Check whether the given value is an ASTNode or not. + * @param {any} node The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ + + + function isNode(node) { + return node !== null && _typeof(node) === 'object' && typeof node.type === 'string'; + } + /** + * Determines if the given node has a sibling that matches the + * given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function sibling(node, selector, ancestry, side, options) { + var _ancestry = _slicedToArray(ancestry, 1), + parent = _ancestry[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator7 = _createForOfIteratorHelper(keys), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var key = _step7.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var startIndex = listProp.indexOf(node); + + if (startIndex < 0) { + continue; + } + + var lowerBound = void 0, + upperBound = void 0; + + if (side === LEFT_SIDE) { + lowerBound = 0; + upperBound = startIndex; + } else { + lowerBound = startIndex + 1; + upperBound = listProp.length; + } + + for (var k = lowerBound; k < upperBound; ++k) { + if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) { + return true; + } + } + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + + return false; + } + /** + * Determines if the given node has an adjacent sibling that matches + * the given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function adjacent(node, selector, ancestry, side, options) { + var _ancestry2 = _slicedToArray(ancestry, 1), + parent = _ancestry2[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator8 = _createForOfIteratorHelper(keys), + _step8; + + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var key = _step8.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx < 0) { + continue; + } + + if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) { + return true; + } + + if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) { + return true; + } + } + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + + return false; + } + /** + * @callback IndexFunction + * @param {Integer} len Containing list's length + * @returns {Integer} + */ + + /** + * Determines if the given node is the nth child, determined by + * `idxFn`, which is given the containing list's length. + * @param {external:AST} node + * @param {external:AST[]} ancestry + * @param {IndexFunction} idxFn + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function nthChild(node, ancestry, idxFn, options) { + var _ancestry3 = _slicedToArray(ancestry, 1), + parent = _ancestry3[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator9 = _createForOfIteratorHelper(keys), + _step9; + + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var key = _step9.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx >= 0 && idx === idxFn(listProp.length)) { + return true; + } + } + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + + return false; + } + /** + * For each selector node marked as a subject, find the portion of the + * selector that the subject must match. + * @param {SelectorAST} selector + * @param {SelectorAST} [ancestor] Defaults to `selector` + * @returns {SelectorAST[]} + */ + + + function subjects(selector, ancestor) { + if (selector == null || _typeof(selector) != 'object') { + return []; + } + + if (ancestor == null) { + ancestor = selector; + } + + var results = selector.subject ? [ancestor] : []; + + for (var _i = 0, _Object$entries = _objectEntries(selector); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + p = _Object$entries$_i[0], + sel = _Object$entries$_i[1]; + + results.push.apply(results, _toConsumableArray(subjects(sel, p === 'left' ? sel : ancestor))); + } + + return results; + } + /** + * @callback TraverseVisitor + * @param {?external:AST} node + * @param {?external:AST} parent + * @param {external:AST[]} ancestry + */ + + /** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {TraverseVisitor} visitor + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function traverse(ast, selector, visitor, options) { + if (!selector) { + return; + } + + var ancestry = []; + var altSubjects = subjects(selector); + estraverse.traverse(ast, { + enter: function enter(node, parent) { + if (parent != null) { + ancestry.unshift(parent); + } + + if (matches(node, selector, ancestry, options)) { + if (altSubjects.length) { + for (var i = 0, l = altSubjects.length; i < l; ++i) { + if (matches(node, altSubjects[i], ancestry, options)) { + visitor(node, parent, ancestry); + } + + for (var k = 0, m = ancestry.length; k < m; ++k) { + var succeedingAncestry = ancestry.slice(k + 1); + + if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) { + visitor(ancestry[k], parent, succeedingAncestry); + } + } + } + } else { + visitor(node, parent, ancestry); + } + } + }, + leave: function leave() { + ancestry.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); + } + /** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function match(ast, selector, options) { + var results = []; + traverse(ast, selector, function (node) { + results.push(node); + }, options); + return results; + } + /** + * Parse a selector string and return its AST. + * @param {string} selector + * @returns {SelectorAST} + */ + + + function parse(selector) { + return parser.parse(selector); + } + /** + * Query the code AST using the selector string. + * @param {external:AST} ast + * @param {string} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function query(ast, selector, options) { + return match(ast, parse(selector), options); + } + + query.parse = parse; + query.match = match; + query.traverse = traverse; + query.matches = matches; + query.query = query; + + return query; + +}))); diff --git a/node_modules/esquery/dist/esquery.lite.js b/node_modules/esquery/dist/esquery.lite.js new file mode 100644 index 0000000..8a181ab --- /dev/null +++ b/node_modules/esquery/dist/esquery.lite.js @@ -0,0 +1,3995 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('estraverse')) : + typeof define === 'function' && define.amd ? define(['estraverse'], factory) : + (global = global || self, global.esquery = factory(global.estraverse)); +}(this, (function (estraverse) { 'use strict'; + + estraverse = estraverse && Object.prototype.hasOwnProperty.call(estraverse, 'default') ? estraverse['default'] : estraverse; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _createForOfIteratorHelper(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + + var F = function () {}; + + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = o[Symbol.iterator](); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var parser = createCommonjsModule(function (module) { + /* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + (function (root, factory) { + if ( module.exports) { + module.exports = factory(); + } + })(commonjsGlobal, function () { + + function peg$subclass(child, parent) { + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function (expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function literal(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + "class": function _class(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + any: function any(expectation) { + return "any character"; + }, + end: function end(expectation) { + return "end of input"; + }, + other: function other(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function classEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, + j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + peg$startRuleFunctions = { + start: peg$parsestart + }, + peg$startRuleFunction = peg$parsestart, + peg$c0 = function peg$c0(ss) { + return ss.length === 1 ? ss[0] : { + type: 'matches', + selectors: ss + }; + }, + peg$c1 = function peg$c1() { + return void 0; + }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function peg$c6(i) { + return i.join(''); + }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function peg$c9() { + return 'child'; + }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function peg$c12() { + return 'sibling'; + }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function peg$c15() { + return 'adjacent'; + }, + peg$c16 = function peg$c16() { + return 'descendant'; + }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function peg$c19(s, ss) { + return [s].concat(ss.map(function (s) { + return s[3]; + })); + }, + peg$c20 = function peg$c20(a, ops) { + return ops.reduce(function (memo, rhs) { + return { + type: rhs[0], + left: memo, + right: rhs[1] + }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function peg$c23(subject, as) { + var b = as.length === 1 ? as[0] : { + type: 'compound', + selectors: as + }; + if (subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function peg$c26(a) { + return { + type: 'wildcard', + value: a + }; + }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function peg$c29(i) { + return { + type: 'identifier', + value: i + }; + }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function peg$c34(v) { + return v; + }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function peg$c39(a) { + return (a || '') + '='; + }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function peg$c44(a, as) { + return [].concat.apply([a], as).join(''); + }, + peg$c45 = function peg$c45(name, op, value) { + return { + type: 'attribute', + name: name, + operator: op, + value: value + }; + }, + peg$c46 = function peg$c46(name) { + return { + type: 'attribute', + name: name + }; + }, + peg$c47 = "\"", + peg$c48 = peg$literalExpectation("\"", false), + peg$c49 = /^[^\\"]/, + peg$c50 = peg$classExpectation(["\\", "\""], true, false), + peg$c51 = "\\", + peg$c52 = peg$literalExpectation("\\", false), + peg$c53 = peg$anyExpectation(), + peg$c54 = function peg$c54(a, b) { + return a + b; + }, + peg$c55 = function peg$c55(d) { + return { + type: 'literal', + value: strUnescape(d.join('')) + }; + }, + peg$c56 = "'", + peg$c57 = peg$literalExpectation("'", false), + peg$c58 = /^[^\\']/, + peg$c59 = peg$classExpectation(["\\", "'"], true, false), + peg$c60 = /^[0-9]/, + peg$c61 = peg$classExpectation([["0", "9"]], false, false), + peg$c62 = function peg$c62(a, b) { + // Can use `a.flat().join('')` once supported + var leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { + type: 'literal', + value: parseFloat(leadingDecimals + b.join('')) + }; + }, + peg$c63 = function peg$c63(i) { + return { + type: 'literal', + value: i + }; + }, + peg$c64 = "type(", + peg$c65 = peg$literalExpectation("type(", false), + peg$c66 = /^[^ )]/, + peg$c67 = peg$classExpectation([" ", ")"], true, false), + peg$c68 = ")", + peg$c69 = peg$literalExpectation(")", false), + peg$c70 = function peg$c70(t) { + return { + type: 'type', + value: t.join('') + }; + }, + peg$c71 = /^[imsu]/, + peg$c72 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c73 = "/", + peg$c74 = peg$literalExpectation("/", false), + peg$c75 = /^[^\/]/, + peg$c76 = peg$classExpectation(["/"], true, false), + peg$c77 = function peg$c77(d, flgs) { + return { + type: 'regexp', + value: new RegExp(d.join(''), flgs ? flgs.join('') : '') + }; + }, + peg$c78 = function peg$c78(i, is) { + return { + type: 'field', + name: is.reduce(function (memo, p) { + return memo + p[0] + p[1]; + }, i) + }; + }, + peg$c79 = ":not(", + peg$c80 = peg$literalExpectation(":not(", false), + peg$c81 = function peg$c81(ss) { + return { + type: 'not', + selectors: ss + }; + }, + peg$c82 = ":matches(", + peg$c83 = peg$literalExpectation(":matches(", false), + peg$c84 = function peg$c84(ss) { + return { + type: 'matches', + selectors: ss + }; + }, + peg$c85 = ":has(", + peg$c86 = peg$literalExpectation(":has(", false), + peg$c87 = function peg$c87(ss) { + return { + type: 'has', + selectors: ss + }; + }, + peg$c88 = ":first-child", + peg$c89 = peg$literalExpectation(":first-child", false), + peg$c90 = function peg$c90() { + return nth(1); + }, + peg$c91 = ":last-child", + peg$c92 = peg$literalExpectation(":last-child", false), + peg$c93 = function peg$c93() { + return nthLast(1); + }, + peg$c94 = ":nth-child(", + peg$c95 = peg$literalExpectation(":nth-child(", false), + peg$c96 = function peg$c96(n) { + return nth(parseInt(n.join(''), 10)); + }, + peg$c97 = ":nth-last-child(", + peg$c98 = peg$literalExpectation(":nth-last-child(", false), + peg$c99 = function peg$c99(n) { + return nthLast(parseInt(n.join(''), 10)); + }, + peg$c100 = ":", + peg$c101 = peg$literalExpectation(":", false), + peg$c102 = "statement", + peg$c103 = peg$literalExpectation("statement", true), + peg$c104 = "expression", + peg$c105 = peg$literalExpectation("expression", true), + peg$c106 = "declaration", + peg$c107 = peg$literalExpectation("declaration", true), + peg$c108 = "function", + peg$c109 = peg$literalExpectation("function", true), + peg$c110 = "pattern", + peg$c111 = peg$literalExpectation("pattern", true), + peg$c112 = function peg$c112(c) { + return { + type: 'class', + name: c + }; + }, + peg$currPos = 0, + peg$posDetailsCache = [{ + line: 1, + column: 1 + }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$resultsCache = {}, + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { + type: "literal", + text: text, + ignoreCase: ignoreCase + }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { + type: "class", + parts: parts, + inverted: inverted, + ignoreCase: ignoreCase + }; + } + + function peg$anyExpectation() { + return { + type: "any" + }; + } + + function peg$endExpectation() { + return { + type: "end" + }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], + p; + + if (details) { + return details; + } else { + p = pos - 1; + + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; + } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + s1 = peg$c1(); + } + + s0 = s1; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parse_() { + var s0, s1; + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c5); + } + } + } + } else { + s1 = peg$FAILED; + } + + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c8); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c11); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c14); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + + if (s3 !== peg$FAILED) { + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c3); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c18); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseatom() { + var s0; + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parsewildcard(); + + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c25); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c26(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c28); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c41); + } + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c38); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c44(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c46(s1); + } + + s0 = s1; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c47; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c50); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c47; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c48); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c56; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c59); + } + } + + if (s3 === peg$FAILED) { + s3 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c52); + } + } + + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s5 !== peg$FAILED) { + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c56; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c57); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + + if (s1 === peg$FAILED) { + s1 = null; + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + s1 = peg$c62(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsepath() { + var s0, s1; + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + + if (s1 !== peg$FAILED) { + s1 = peg$c63(s1); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c64) { + s1 = peg$c64; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c65); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c67); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c70(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseflags() { + var s0, s1; + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = []; + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c72); + } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c73; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c76); + } + } + } + } else { + s2 = peg$FAILED; + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c74); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + + if (s4 === peg$FAILED) { + s4 = null; + } + + if (s4 !== peg$FAILED) { + s1 = peg$c77(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c43); + } + } + + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c78(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c79) { + s1 = peg$c79; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c80); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c81(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 9) === peg$c82) { + s1 = peg$c82; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c83); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c84(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 5) === peg$c85) { + s1 = peg$c85; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c86); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c87(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 12) === peg$c88) { + s1 = peg$c88; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c89); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c90(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parselastChild() { + var s0, s1; + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c91) { + s1 = peg$c91; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c92); + } + } + + if (s1 !== peg$FAILED) { + s1 = peg$c93(); + } + + s0 = s1; + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 11) === peg$c94) { + s1 = peg$c94; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c95); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c96(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.substr(peg$currPos, 16) === peg$c97) { + s1 = peg$c97; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c98); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = []; + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c61); + } + } + } + } else { + s3 = peg$FAILED; + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c69); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c99(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c100; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c101); + } + } + + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c103); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c105); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c107); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c109); + } + } + + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c111); + } + } + } + } + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c112(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { + nextPos: peg$currPos, + result: s0 + }; + return s0; + } + + function nth(n) { + return { + type: 'nth-child', + index: { + type: 'literal', + value: n + } + }; + } + + function nthLast(n) { + return { + type: 'nth-last-child', + index: { + type: 'literal', + value: n + } + }; + } + + function strUnescape(s) { + return s.replace(/\\(.)/g, function (match, ch) { + switch (ch) { + case 'b': + return '\b'; + + case 'f': + return '\f'; + + case 'n': + return '\n'; + + case 'r': + return '\r'; + + case 't': + return '\t'; + + case 'v': + return '\v'; + + default: + return ch; + } + }); + } + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; + }); + }); + + function _objectEntries(obj) { + var entries = []; + var keys = Object.keys(obj); + + for (var k = 0; k < keys.length; k++) entries.push([keys[k], obj[keys[k]]]); + + return entries; + } + /** + * @typedef {"LEFT_SIDE"|"RIGHT_SIDE"} Side + */ + + var LEFT_SIDE = 'LEFT_SIDE'; + var RIGHT_SIDE = 'RIGHT_SIDE'; + /** + * @external AST + * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html + */ + + /** + * One of the rules of `grammar.pegjs` + * @typedef {PlainObject} SelectorAST + * @see grammar.pegjs + */ + + /** + * The `sequence` production of `grammar.pegjs` + * @typedef {PlainObject} SelectorSequenceAST + */ + + /** + * Get the value of a property which may be multiple levels down + * in the object. + * @param {?PlainObject} obj + * @param {string} key + * @returns {undefined|boolean|string|number|external:AST} + */ + + function getPath(obj, key) { + var keys = key.split('.'); + + var _iterator = _createForOfIteratorHelper(keys), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _key = _step.value; + + if (obj == null) { + return obj; + } + + obj = obj[_key]; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return obj; + } + /** + * Determine whether `node` can be reached by following `path`, + * starting at `ancestor`. + * @param {?external:AST} node + * @param {?external:AST} ancestor + * @param {string[]} path + * @returns {boolean} + */ + + + function inPath(node, ancestor, path) { + if (path.length === 0) { + return node === ancestor; + } + + if (ancestor == null) { + return false; + } + + var field = ancestor[path[0]]; + var remainingPath = path.slice(1); + + if (Array.isArray(field)) { + var _iterator2 = _createForOfIteratorHelper(field), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var component = _step2.value; + + if (inPath(node, component, remainingPath)) { + return true; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + + return false; + } else { + return inPath(node, field, remainingPath); + } + } + /** + * @callback TraverseOptionFallback + * @param {external:AST} node The given node. + * @returns {string[]} An array of visitor keys for the given node. + */ + + /** + * @typedef {object} ESQueryOptions + * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node. + * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes. + */ + + /** + * Given a `node` and its ancestors, determine if `node` is matched + * by `selector`. + * @param {?external:AST} node + * @param {?SelectorAST} selector + * @param {external:AST[]} [ancestry=[]] + * @param {ESQueryOptions} [options] + * @throws {Error} Unknowns (operator, class name, selector type, or + * selector value type) + * @returns {boolean} + */ + + + function matches(node, selector, ancestry, options) { + if (!selector) { + return true; + } + + if (!node) { + return false; + } + + if (!ancestry) { + ancestry = []; + } + + switch (selector.type) { + case 'wildcard': + return true; + + case 'identifier': + return selector.value.toLowerCase() === node.type.toLowerCase(); + + case 'field': + { + var path = selector.name.split('.'); + var ancestor = ancestry[path.length - 1]; + return inPath(node, ancestor, path); + } + + case 'matches': + var _iterator3 = _createForOfIteratorHelper(selector.selectors), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var sel = _step3.value; + + if (matches(node, sel, ancestry, options)) { + return true; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + + return false; + + case 'compound': + var _iterator4 = _createForOfIteratorHelper(selector.selectors), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var _sel = _step4.value; + + if (!matches(node, _sel, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + + return true; + + case 'not': + var _iterator5 = _createForOfIteratorHelper(selector.selectors), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var _sel2 = _step5.value; + + if (matches(node, _sel2, ancestry, options)) { + return false; + } + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + + return true; + + case 'has': + { + var _ret = function () { + var collector = []; + + var _iterator6 = _createForOfIteratorHelper(selector.selectors), + _step6; + + try { + var _loop = function _loop() { + var sel = _step6.value; + var a = []; + estraverse.traverse(node, { + enter: function enter(node, parent) { + if (parent != null) { + a.unshift(parent); + } + + if (matches(node, sel, a, options)) { + collector.push(node); + } + }, + leave: function leave() { + a.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); + }; + + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + _loop(); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + + return { + v: collector.length !== 0 + }; + }(); + + if (_typeof(_ret) === "object") return _ret.v; + } + + case 'child': + if (matches(node, selector.right, ancestry, options)) { + return matches(ancestry[0], selector.left, ancestry.slice(1), options); + } + + return false; + + case 'descendant': + if (matches(node, selector.right, ancestry, options)) { + for (var i = 0, l = ancestry.length; i < l; ++i) { + if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) { + return true; + } + } + } + + return false; + + case 'attribute': + { + var p = getPath(node, selector.name); + + switch (selector.operator) { + case void 0: + return p != null; + + case '=': + switch (selector.value.type) { + case 'regexp': + return typeof p === 'string' && selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) === "".concat(p); + + case 'type': + return selector.value.value === _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '!=': + switch (selector.value.type) { + case 'regexp': + return !selector.value.value.test(p); + + case 'literal': + return "".concat(selector.value.value) !== "".concat(p); + + case 'type': + return selector.value.value !== _typeof(p); + } + + throw new Error("Unknown selector value type: ".concat(selector.value.type)); + + case '<=': + return p <= selector.value.value; + + case '<': + return p < selector.value.value; + + case '>': + return p > selector.value.value; + + case '>=': + return p >= selector.value.value; + } + + throw new Error("Unknown operator: ".concat(selector.operator)); + } + + case 'sibling': + return matches(node, selector.right, ancestry, options) && sibling(node, selector.left, ancestry, LEFT_SIDE, options) || selector.left.subject && matches(node, selector.left, ancestry, options) && sibling(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'adjacent': + return matches(node, selector.right, ancestry, options) && adjacent(node, selector.left, ancestry, LEFT_SIDE, options) || selector.right.subject && matches(node, selector.left, ancestry, options) && adjacent(node, selector.right, ancestry, RIGHT_SIDE, options); + + case 'nth-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function () { + return selector.index.value - 1; + }, options); + + case 'nth-last-child': + return matches(node, selector.right, ancestry, options) && nthChild(node, ancestry, function (length) { + return length - selector.index.value; + }, options); + + case 'class': + switch (selector.name.toLowerCase()) { + case 'statement': + if (node.type.slice(-9) === 'Statement') return true; + // fallthrough: interface Declaration <: Statement { } + + case 'declaration': + return node.type.slice(-11) === 'Declaration'; + + case 'pattern': + if (node.type.slice(-7) === 'Pattern') return true; + // fallthrough: interface Expression <: Node, Pattern { } + + case 'expression': + return node.type.slice(-10) === 'Expression' || node.type.slice(-7) === 'Literal' || node.type === 'Identifier' && (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') || node.type === 'MetaProperty'; + + case 'function': + return node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression'; + } + + throw new Error("Unknown class name: ".concat(selector.name)); + } + + throw new Error("Unknown selector type: ".concat(selector.type)); + } + /** + * Get visitor keys of a given node. + * @param {external:AST} node The AST node to get keys. + * @param {ESQueryOptions|undefined} options + * @returns {string[]} Visitor keys of the node. + */ + + + function getVisitorKeys(node, options) { + var nodeType = node.type; + + if (options && options.visitorKeys && options.visitorKeys[nodeType]) { + return options.visitorKeys[nodeType]; + } + + if (estraverse.VisitorKeys[nodeType]) { + return estraverse.VisitorKeys[nodeType]; + } + + if (options && typeof options.fallback === 'function') { + return options.fallback(node); + } // 'iteration' fallback + + + return Object.keys(node).filter(function (key) { + return key !== 'type'; + }); + } + /** + * Check whether the given value is an ASTNode or not. + * @param {any} node The value to check. + * @returns {boolean} `true` if the value is an ASTNode. + */ + + + function isNode(node) { + return node !== null && _typeof(node) === 'object' && typeof node.type === 'string'; + } + /** + * Determines if the given node has a sibling that matches the + * given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function sibling(node, selector, ancestry, side, options) { + var _ancestry = _slicedToArray(ancestry, 1), + parent = _ancestry[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator7 = _createForOfIteratorHelper(keys), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var key = _step7.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var startIndex = listProp.indexOf(node); + + if (startIndex < 0) { + continue; + } + + var lowerBound = void 0, + upperBound = void 0; + + if (side === LEFT_SIDE) { + lowerBound = 0; + upperBound = startIndex; + } else { + lowerBound = startIndex + 1; + upperBound = listProp.length; + } + + for (var k = lowerBound; k < upperBound; ++k) { + if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) { + return true; + } + } + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + + return false; + } + /** + * Determines if the given node has an adjacent sibling that matches + * the given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function adjacent(node, selector, ancestry, side, options) { + var _ancestry2 = _slicedToArray(ancestry, 1), + parent = _ancestry2[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator8 = _createForOfIteratorHelper(keys), + _step8; + + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var key = _step8.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx < 0) { + continue; + } + + if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) { + return true; + } + + if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) { + return true; + } + } + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + + return false; + } + /** + * @callback IndexFunction + * @param {Integer} len Containing list's length + * @returns {Integer} + */ + + /** + * Determines if the given node is the nth child, determined by + * `idxFn`, which is given the containing list's length. + * @param {external:AST} node + * @param {external:AST[]} ancestry + * @param {IndexFunction} idxFn + * @param {ESQueryOptions|undefined} options + * @returns {boolean} + */ + + + function nthChild(node, ancestry, idxFn, options) { + var _ancestry3 = _slicedToArray(ancestry, 1), + parent = _ancestry3[0]; + + if (!parent) { + return false; + } + + var keys = getVisitorKeys(parent, options); + + var _iterator9 = _createForOfIteratorHelper(keys), + _step9; + + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var key = _step9.value; + var listProp = parent[key]; + + if (Array.isArray(listProp)) { + var idx = listProp.indexOf(node); + + if (idx >= 0 && idx === idxFn(listProp.length)) { + return true; + } + } + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + + return false; + } + /** + * For each selector node marked as a subject, find the portion of the + * selector that the subject must match. + * @param {SelectorAST} selector + * @param {SelectorAST} [ancestor] Defaults to `selector` + * @returns {SelectorAST[]} + */ + + + function subjects(selector, ancestor) { + if (selector == null || _typeof(selector) != 'object') { + return []; + } + + if (ancestor == null) { + ancestor = selector; + } + + var results = selector.subject ? [ancestor] : []; + + for (var _i = 0, _Object$entries = _objectEntries(selector); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + p = _Object$entries$_i[0], + sel = _Object$entries$_i[1]; + + results.push.apply(results, _toConsumableArray(subjects(sel, p === 'left' ? sel : ancestor))); + } + + return results; + } + /** + * @callback TraverseVisitor + * @param {?external:AST} node + * @param {?external:AST} parent + * @param {external:AST[]} ancestry + */ + + /** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {TraverseVisitor} visitor + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function traverse(ast, selector, visitor, options) { + if (!selector) { + return; + } + + var ancestry = []; + var altSubjects = subjects(selector); + estraverse.traverse(ast, { + enter: function enter(node, parent) { + if (parent != null) { + ancestry.unshift(parent); + } + + if (matches(node, selector, ancestry, options)) { + if (altSubjects.length) { + for (var i = 0, l = altSubjects.length; i < l; ++i) { + if (matches(node, altSubjects[i], ancestry, options)) { + visitor(node, parent, ancestry); + } + + for (var k = 0, m = ancestry.length; k < m; ++k) { + var succeedingAncestry = ancestry.slice(k + 1); + + if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) { + visitor(ancestry[k], parent, succeedingAncestry); + } + } + } + } else { + visitor(node, parent, ancestry); + } + } + }, + leave: function leave() { + ancestry.shift(); + }, + keys: options && options.visitorKeys, + fallback: options && options.fallback || 'iteration' + }); + } + /** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function match(ast, selector, options) { + var results = []; + traverse(ast, selector, function (node) { + results.push(node); + }, options); + return results; + } + /** + * Parse a selector string and return its AST. + * @param {string} selector + * @returns {SelectorAST} + */ + + + function parse(selector) { + return parser.parse(selector); + } + /** + * Query the code AST using the selector string. + * @param {external:AST} ast + * @param {string} selector + * @param {ESQueryOptions} [options] + * @returns {external:AST[]} + */ + + + function query(ast, selector, options) { + return match(ast, parse(selector), options); + } + + query.parse = parse; + query.match = match; + query.traverse = traverse; + query.matches = matches; + query.query = query; + + return query; + +}))); diff --git a/node_modules/esquery/dist/esquery.lite.min.js b/node_modules/esquery/dist/esquery.lite.min.js new file mode 100644 index 0000000..70d7b76 --- /dev/null +++ b/node_modules/esquery/dist/esquery.lite.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("estraverse")):"function"==typeof define&&define.amd?define(["estraverse"],e):(t=t||self).esquery=e(t.estraverse)}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var u,s=t[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,s=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){c=!0,u=t},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw u}}}}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var s=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){t.exports&&(t.exports=function(){function t(e,r,n,a){this.message=e,this.expected=r,this.found=n,this.location=a,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.buildMessage=function(t,e){var r={literal:function(t){return'"'+a(t.text)+'"'},class:function(t){var e,r="";for(e=0;e0){for(e=1,n=1;e<~+.]/,h=dt([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),p=vt(">",!1),y=vt("~",!1),v=vt("+",!1),d=vt(",",!1),A=vt("!",!1),x=vt("*",!1),g=vt("#",!1),b=vt("[",!1),m=vt("]",!1),P=/^[>","<","!"],!1,!1),C=vt("=",!1),j=function(t){return(t||"")+"="},S=/^[><]/,E=dt([">","<"],!1,!1),I=vt(".",!1),k=function(t,e,r){return{type:"attribute",name:t,operator:e,value:r}},F=vt('"',!1),T=/^[^\\"]/,L=dt(["\\",'"'],!0,!1),O=vt("\\",!1),D={type:"any"},R=function(t,e){return t+e},K=function(t){return{type:"literal",value:(e=t.join(""),e.replace(/\\(.)/g,(function(t,e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";default:return e}})))};var e},U=vt("'",!1),_=/^[^\\']/,M=dt(["\\","'"],!0,!1),q=/^[0-9]/,G=dt([["0","9"]],!1,!1),H=vt("type(",!1),V=/^[^ )]/,$=dt([" ",")"],!0,!1),z=vt(")",!1),B=/^[imsu]/,J=dt(["i","m","s","u"],!1,!1),N=vt("/",!1),Q=/^[^\/]/,W=dt(["/"],!0,!1),X=vt(":not(",!1),Y=vt(":matches(",!1),Z=vt(":has(",!1),tt=vt(":first-child",!1),et=vt(":last-child",!1),rt=vt(":nth-child(",!1),nt=vt(":nth-last-child(",!1),at=vt(":",!1),ot=vt("statement",!0),ut=vt("expression",!0),st=vt("declaration",!0),ct=vt("function",!0),it=vt("pattern",!0),lt=0,ft=[{line:1,column:1}],ht=0,pt=[],yt={};if("startRule"in r){if(!(r.startRule in c))throw new Error("Can't start parsing from rule \""+r.startRule+'".');i=c[r.startRule]}function vt(t,e){return{type:"literal",text:t,ignoreCase:e}}function dt(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function At(t){var r,n=ft[t];if(n)return n;for(r=t-1;!ft[r];)r--;for(n={line:(n=ft[r]).line,column:n.column};rht&&(ht=lt,pt=[]),pt.push(t))}function bt(){var t,e,r,n,a=30*lt+0,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,(e=mt())!==s&&(r=Ct())!==s&&mt()!==s?t=e=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(lt=t,t=s),t===s&&(t=lt,(e=mt())!==s&&(e=void 0),t=e),yt[a]={nextPos:lt,result:t},t)}function mt(){var t,r,n=30*lt+1,a=yt[n];if(a)return lt=a.nextPos,a.result;for(t=[],32===e.charCodeAt(lt)?(r=" ",lt++):(r=s,gt(l));r!==s;)t.push(r),32===e.charCodeAt(lt)?(r=" ",lt++):(r=s,gt(l));return yt[n]={nextPos:lt,result:t},t}function Pt(){var t,r,n,a=30*lt+2,o=yt[a];if(o)return lt=o.nextPos,o.result;if(r=[],f.test(e.charAt(lt))?(n=e.charAt(lt),lt++):(n=s,gt(h)),n!==s)for(;n!==s;)r.push(n),f.test(e.charAt(lt))?(n=e.charAt(lt),lt++):(n=s,gt(h));else r=s;return r!==s&&(r=r.join("")),t=r,yt[a]={nextPos:lt,result:t},t}function wt(){var t,r,n,a=30*lt+3,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,(r=mt())!==s?(62===e.charCodeAt(lt)?(n=">",lt++):(n=s,gt(p)),n!==s&&mt()!==s?t=r="child":(lt=t,t=s)):(lt=t,t=s),t===s&&(t=lt,(r=mt())!==s?(126===e.charCodeAt(lt)?(n="~",lt++):(n=s,gt(y)),n!==s&&mt()!==s?t=r="sibling":(lt=t,t=s)):(lt=t,t=s),t===s&&(t=lt,(r=mt())!==s?(43===e.charCodeAt(lt)?(n="+",lt++):(n=s,gt(v)),n!==s&&mt()!==s?t=r="adjacent":(lt=t,t=s)):(lt=t,t=s),t===s&&(t=lt,32===e.charCodeAt(lt)?(r=" ",lt++):(r=s,gt(l)),r!==s&&(n=mt())!==s?t=r="descendant":(lt=t,t=s)))),yt[a]={nextPos:lt,result:t},t)}function Ct(){var t,r,n,a,o,u,c,i,l=30*lt+4,f=yt[l];if(f)return lt=f.nextPos,f.result;if(t=lt,(r=jt())!==s){for(n=[],a=lt,(o=mt())!==s?(44===e.charCodeAt(lt)?(u=",",lt++):(u=s,gt(d)),u!==s&&(c=mt())!==s&&(i=jt())!==s?a=o=[o,u,c,i]:(lt=a,a=s)):(lt=a,a=s);a!==s;)n.push(a),a=lt,(o=mt())!==s?(44===e.charCodeAt(lt)?(u=",",lt++):(u=s,gt(d)),u!==s&&(c=mt())!==s&&(i=jt())!==s?a=o=[o,u,c,i]:(lt=a,a=s)):(lt=a,a=s);n!==s?t=r=[r].concat(n.map((function(t){return t[3]}))):(lt=t,t=s)}else lt=t,t=s;return yt[l]={nextPos:lt,result:t},t}function jt(){var t,e,r,n,a,o,u,c=30*lt+5,i=yt[c];if(i)return lt=i.nextPos,i.result;if(t=lt,(e=St())!==s){for(r=[],n=lt,(a=wt())!==s&&(o=St())!==s?n=a=[a,o]:(lt=n,n=s);n!==s;)r.push(n),n=lt,(a=wt())!==s&&(o=St())!==s?n=a=[a,o]:(lt=n,n=s);r!==s?(u=e,t=e=r.reduce((function(t,e){return{type:e[0],left:t,right:e[1]}}),u)):(lt=t,t=s)}else lt=t,t=s;return yt[c]={nextPos:lt,result:t},t}function St(){var t,r,n,a,o,u,c,i=30*lt+6,l=yt[i];if(l)return lt=l.nextPos,l.result;if(t=lt,33===e.charCodeAt(lt)?(r="!",lt++):(r=s,gt(A)),r===s&&(r=null),r!==s){if(n=[],(a=Et())!==s)for(;a!==s;)n.push(a),a=Et();else n=s;n!==s?(o=r,c=1===(u=n).length?u[0]:{type:"compound",selectors:u},o&&(c.subject=!0),t=r=c):(lt=t,t=s)}else lt=t,t=s;return yt[i]={nextPos:lt,result:t},t}function Et(){var t,r=30*lt+7,n=yt[r];return n?(lt=n.nextPos,n.result):((t=function(){var t,r,n=30*lt+8,a=yt[n];return a?(lt=a.nextPos,a.result):(42===e.charCodeAt(lt)?(r="*",lt++):(r=s,gt(x)),r!==s&&(r={type:"wildcard",value:r}),t=r,yt[n]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a=30*lt+9,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,35===e.charCodeAt(lt)?(r="#",lt++):(r=s,gt(g)),r===s&&(r=null),r!==s&&(n=Pt())!==s?t=r={type:"identifier",value:n}:(lt=t,t=s),yt[a]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a,o=30*lt+10,u=yt[o];return u?(lt=u.nextPos,u.result):(t=lt,91===e.charCodeAt(lt)?(r="[",lt++):(r=s,gt(b)),r!==s&&mt()!==s&&(n=function(){var t,r,n,a,o=30*lt+14,u=yt[o];return u?(lt=u.nextPos,u.result):(t=lt,(r=It())!==s&&mt()!==s&&(n=function(){var t,r,n,a=30*lt+12,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,33===e.charCodeAt(lt)?(r="!",lt++):(r=s,gt(A)),r===s&&(r=null),r!==s?(61===e.charCodeAt(lt)?(n="=",lt++):(n=s,gt(C)),n!==s?(r=j(r),t=r):(lt=t,t=s)):(lt=t,t=s),yt[a]={nextPos:lt,result:t},t)}())!==s&&mt()!==s?((a=function(){var t,r,n,a,o,u=30*lt+18,c=yt[u];if(c)return lt=c.nextPos,c.result;if(t=lt,"type("===e.substr(lt,5)?(r="type(",lt+=5):(r=s,gt(H)),r!==s)if(mt()!==s){if(n=[],V.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt($)),a!==s)for(;a!==s;)n.push(a),V.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt($));else n=s;n!==s&&(a=mt())!==s?(41===e.charCodeAt(lt)?(o=")",lt++):(o=s,gt(z)),o!==s?(r={type:"type",value:n.join("")},t=r):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;else lt=t,t=s;return yt[u]={nextPos:lt,result:t},t}())===s&&(a=function(){var t,r,n,a,o,u,c=30*lt+20,i=yt[c];if(i)return lt=i.nextPos,i.result;if(t=lt,47===e.charCodeAt(lt)?(r="/",lt++):(r=s,gt(N)),r!==s){if(n=[],Q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(W)),a!==s)for(;a!==s;)n.push(a),Q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(W));else n=s;n!==s?(47===e.charCodeAt(lt)?(a="/",lt++):(a=s,gt(N)),a!==s?((o=function(){var t,r,n=30*lt+19,a=yt[n];if(a)return lt=a.nextPos,a.result;if(t=[],B.test(e.charAt(lt))?(r=e.charAt(lt),lt++):(r=s,gt(J)),r!==s)for(;r!==s;)t.push(r),B.test(e.charAt(lt))?(r=e.charAt(lt),lt++):(r=s,gt(J));else t=s;return yt[n]={nextPos:lt,result:t},t}())===s&&(o=null),o!==s?(u=o,r={type:"regexp",value:new RegExp(n.join(""),u?u.join(""):"")},t=r):(lt=t,t=s)):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;return yt[c]={nextPos:lt,result:t},t}()),a!==s?(r=k(r,n,a),t=r):(lt=t,t=s)):(lt=t,t=s),t===s&&(t=lt,(r=It())!==s&&mt()!==s&&(n=function(){var t,r,n,a=30*lt+11,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,P.test(e.charAt(lt))?(r=e.charAt(lt),lt++):(r=s,gt(w)),r===s&&(r=null),r!==s?(61===e.charCodeAt(lt)?(n="=",lt++):(n=s,gt(C)),n!==s?(r=j(r),t=r):(lt=t,t=s)):(lt=t,t=s),t===s&&(S.test(e.charAt(lt))?(t=e.charAt(lt),lt++):(t=s,gt(E))),yt[a]={nextPos:lt,result:t},t)}())!==s&&mt()!==s?((a=function(){var t,r,n,a,o,u,c=30*lt+15,i=yt[c];if(i)return lt=i.nextPos,i.result;if(t=lt,34===e.charCodeAt(lt)?(r='"',lt++):(r=s,gt(F)),r!==s){for(n=[],T.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(L)),a===s&&(a=lt,92===e.charCodeAt(lt)?(o="\\",lt++):(o=s,gt(O)),o!==s?(e.length>lt?(u=e.charAt(lt),lt++):(u=s,gt(D)),u!==s?(o=R(o,u),a=o):(lt=a,a=s)):(lt=a,a=s));a!==s;)n.push(a),T.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(L)),a===s&&(a=lt,92===e.charCodeAt(lt)?(o="\\",lt++):(o=s,gt(O)),o!==s?(e.length>lt?(u=e.charAt(lt),lt++):(u=s,gt(D)),u!==s?(o=R(o,u),a=o):(lt=a,a=s)):(lt=a,a=s));n!==s?(34===e.charCodeAt(lt)?(a='"',lt++):(a=s,gt(F)),a!==s?(r=K(n),t=r):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;if(t===s)if(t=lt,39===e.charCodeAt(lt)?(r="'",lt++):(r=s,gt(U)),r!==s){for(n=[],_.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(M)),a===s&&(a=lt,92===e.charCodeAt(lt)?(o="\\",lt++):(o=s,gt(O)),o!==s?(e.length>lt?(u=e.charAt(lt),lt++):(u=s,gt(D)),u!==s?(o=R(o,u),a=o):(lt=a,a=s)):(lt=a,a=s));a!==s;)n.push(a),_.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(M)),a===s&&(a=lt,92===e.charCodeAt(lt)?(o="\\",lt++):(o=s,gt(O)),o!==s?(e.length>lt?(u=e.charAt(lt),lt++):(u=s,gt(D)),u!==s?(o=R(o,u),a=o):(lt=a,a=s)):(lt=a,a=s));n!==s?(39===e.charCodeAt(lt)?(a="'",lt++):(a=s,gt(U)),a!==s?(r=K(n),t=r):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;return yt[c]={nextPos:lt,result:t},t}())===s&&(a=function(){var t,r,n,a,o,u,c,i=30*lt+16,l=yt[i];if(l)return lt=l.nextPos,l.result;for(t=lt,r=lt,n=[],q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G));a!==s;)n.push(a),q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G));if(n!==s?(46===e.charCodeAt(lt)?(a=".",lt++):(a=s,gt(I)),a!==s?r=n=[n,a]:(lt=r,r=s)):(lt=r,r=s),r===s&&(r=null),r!==s){if(n=[],q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G)),a!==s)for(;a!==s;)n.push(a),q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G));else n=s;n!==s?(u=n,c=(o=r)?[].concat.apply([],o).join(""):"",r={type:"literal",value:parseFloat(c+u.join(""))},t=r):(lt=t,t=s)}else lt=t,t=s;return yt[i]={nextPos:lt,result:t},t}())===s&&(a=function(){var t,e,r=30*lt+17,n=yt[r];return n?(lt=n.nextPos,n.result):((e=Pt())!==s&&(e={type:"literal",value:e}),t=e,yt[r]={nextPos:lt,result:t},t)}()),a!==s?(r=k(r,n,a),t=r):(lt=t,t=s)):(lt=t,t=s),t===s&&(t=lt,(r=It())!==s&&(r={type:"attribute",name:r}),t=r)),yt[o]={nextPos:lt,result:t},t)}())!==s&&mt()!==s?(93===e.charCodeAt(lt)?(a="]",lt++):(a=s,gt(m)),a!==s?t=r=n:(lt=t,t=s)):(lt=t,t=s),yt[o]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a,o,u,c,i,l=30*lt+21,f=yt[l];if(f)return lt=f.nextPos,f.result;if(t=lt,46===e.charCodeAt(lt)?(r=".",lt++):(r=s,gt(I)),r!==s)if((n=Pt())!==s){for(a=[],o=lt,46===e.charCodeAt(lt)?(u=".",lt++):(u=s,gt(I)),u!==s&&(c=Pt())!==s?o=u=[u,c]:(lt=o,o=s);o!==s;)a.push(o),o=lt,46===e.charCodeAt(lt)?(u=".",lt++):(u=s,gt(I)),u!==s&&(c=Pt())!==s?o=u=[u,c]:(lt=o,o=s);a!==s?(i=n,r={type:"field",name:a.reduce((function(t,e){return t+e[0]+e[1]}),i)},t=r):(lt=t,t=s)}else lt=t,t=s;else lt=t,t=s;return yt[l]={nextPos:lt,result:t},t}())===s&&(t=function(){var t,r,n,a,o=30*lt+22,u=yt[o];return u?(lt=u.nextPos,u.result):(t=lt,":not("===e.substr(lt,5)?(r=":not(",lt+=5):(r=s,gt(X)),r!==s&&mt()!==s&&(n=Ct())!==s&&mt()!==s?(41===e.charCodeAt(lt)?(a=")",lt++):(a=s,gt(z)),a!==s?t=r={type:"not",selectors:n}:(lt=t,t=s)):(lt=t,t=s),yt[o]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a,o=30*lt+23,u=yt[o];return u?(lt=u.nextPos,u.result):(t=lt,":matches("===e.substr(lt,9)?(r=":matches(",lt+=9):(r=s,gt(Y)),r!==s&&mt()!==s&&(n=Ct())!==s&&mt()!==s?(41===e.charCodeAt(lt)?(a=")",lt++):(a=s,gt(z)),a!==s?t=r={type:"matches",selectors:n}:(lt=t,t=s)):(lt=t,t=s),yt[o]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a,o=30*lt+24,u=yt[o];return u?(lt=u.nextPos,u.result):(t=lt,":has("===e.substr(lt,5)?(r=":has(",lt+=5):(r=s,gt(Z)),r!==s&&mt()!==s&&(n=Ct())!==s&&mt()!==s?(41===e.charCodeAt(lt)?(a=")",lt++):(a=s,gt(z)),a!==s?t=r={type:"has",selectors:n}:(lt=t,t=s)):(lt=t,t=s),yt[o]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n=30*lt+25,a=yt[n];return a?(lt=a.nextPos,a.result):(":first-child"===e.substr(lt,12)?(r=":first-child",lt+=12):(r=s,gt(tt)),r!==s&&(r=kt(1)),t=r,yt[n]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n=30*lt+26,a=yt[n];return a?(lt=a.nextPos,a.result):(":last-child"===e.substr(lt,11)?(r=":last-child",lt+=11):(r=s,gt(et)),r!==s&&(r=Ft(1)),t=r,yt[n]={nextPos:lt,result:t},t)}())===s&&(t=function(){var t,r,n,a,o,u=30*lt+27,c=yt[u];if(c)return lt=c.nextPos,c.result;if(t=lt,":nth-child("===e.substr(lt,11)?(r=":nth-child(",lt+=11):(r=s,gt(rt)),r!==s)if(mt()!==s){if(n=[],q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G)),a!==s)for(;a!==s;)n.push(a),q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G));else n=s;n!==s&&(a=mt())!==s?(41===e.charCodeAt(lt)?(o=")",lt++):(o=s,gt(z)),o!==s?(r=kt(parseInt(n.join(""),10)),t=r):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;else lt=t,t=s;return yt[u]={nextPos:lt,result:t},t}())===s&&(t=function(){var t,r,n,a,o,u=30*lt+28,c=yt[u];if(c)return lt=c.nextPos,c.result;if(t=lt,":nth-last-child("===e.substr(lt,16)?(r=":nth-last-child(",lt+=16):(r=s,gt(nt)),r!==s)if(mt()!==s){if(n=[],q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G)),a!==s)for(;a!==s;)n.push(a),q.test(e.charAt(lt))?(a=e.charAt(lt),lt++):(a=s,gt(G));else n=s;n!==s&&(a=mt())!==s?(41===e.charCodeAt(lt)?(o=")",lt++):(o=s,gt(z)),o!==s?(r=Ft(parseInt(n.join(""),10)),t=r):(lt=t,t=s)):(lt=t,t=s)}else lt=t,t=s;else lt=t,t=s;return yt[u]={nextPos:lt,result:t},t}())===s&&(t=function(){var t,r,n,a=30*lt+29,o=yt[a];return o?(lt=o.nextPos,o.result):(t=lt,58===e.charCodeAt(lt)?(r=":",lt++):(r=s,gt(at)),r!==s?("statement"===e.substr(lt,9).toLowerCase()?(n=e.substr(lt,9),lt+=9):(n=s,gt(ot)),n===s&&("expression"===e.substr(lt,10).toLowerCase()?(n=e.substr(lt,10),lt+=10):(n=s,gt(ut)),n===s&&("declaration"===e.substr(lt,11).toLowerCase()?(n=e.substr(lt,11),lt+=11):(n=s,gt(st)),n===s&&("function"===e.substr(lt,8).toLowerCase()?(n=e.substr(lt,8),lt+=8):(n=s,gt(ct)),n===s&&("pattern"===e.substr(lt,7).toLowerCase()?(n=e.substr(lt,7),lt+=7):(n=s,gt(it)))))),n!==s?t=r={type:"class",name:n}:(lt=t,t=s)):(lt=t,t=s),yt[a]={nextPos:lt,result:t},t)}()),yt[r]={nextPos:lt,result:t},t)}function It(){var t,r,n,a,o,u,c,i,l=30*lt+13,f=yt[l];if(f)return lt=f.nextPos,f.result;if(t=lt,(r=Pt())!==s){for(n=[],a=lt,46===e.charCodeAt(lt)?(o=".",lt++):(o=s,gt(I)),o!==s&&(u=Pt())!==s?a=o=[o,u]:(lt=a,a=s);a!==s;)n.push(a),a=lt,46===e.charCodeAt(lt)?(o=".",lt++):(o=s,gt(I)),o!==s&&(u=Pt())!==s?a=o=[o,u]:(lt=a,a=s);n!==s?(c=r,i=n,t=r=[].concat.apply([c],i).join("")):(lt=t,t=s)}else lt=t,t=s;return yt[l]={nextPos:lt,result:t},t}function kt(t){return{type:"nth-child",index:{type:"literal",value:t}}}function Ft(t){return{type:"nth-last-child",index:{type:"literal",value:t}}}if((n=i())!==s&<===e.length)return n;throw n!==s&<":return j>n.value.value;case">=":return j>=n.value.value}throw new Error("Unknown operator: ".concat(n.operator));case"sibling":return c(r,n.right,a,o)&&f(r,n.left,a,"LEFT_SIDE",o)||n.left.subject&&c(r,n.left,a,o)&&f(r,n.right,a,"RIGHT_SIDE",o);case"adjacent":return c(r,n.right,a,o)&&h(r,n.left,a,"LEFT_SIDE",o)||n.right.subject&&c(r,n.left,a,o)&&h(r,n.right,a,"RIGHT_SIDE",o);case"nth-child":return c(r,n.right,a,o)&&p(r,a,(function(){return n.index.value-1}),o);case"nth-last-child":return c(r,n.right,a,o)&&p(r,a,(function(t){return t-n.index.value}),o);case"class":switch(n.name.toLowerCase()){case"statement":if("Statement"===r.type.slice(-9))return!0;case"declaration":return"Declaration"===r.type.slice(-11);case"pattern":if("Pattern"===r.type.slice(-7))return!0;case"expression":return"Expression"===r.type.slice(-10)||"Literal"===r.type.slice(-7)||"Identifier"===r.type&&(0===a.length||"MetaProperty"!==a[0].type)||"MetaProperty"===r.type;case"function":return"FunctionDeclaration"===r.type||"FunctionExpression"===r.type||"ArrowFunctionExpression"===r.type}throw new Error("Unknown class name: ".concat(n.name))}throw new Error("Unknown selector type: ".concat(n.type))}function i(e,r){var n=e.type;return r&&r.visitorKeys&&r.visitorKeys[n]?r.visitorKeys[n]:t.VisitorKeys[n]?t.VisitorKeys[n]:r&&"function"==typeof r.fallback?r.fallback(e):Object.keys(e).filter((function(t){return"type"!==t}))}function l(t){return null!==t&&"object"===e(t)&&"string"==typeof t.type}function f(t,e,n,a,o){var s=r(n,1)[0];if(!s)return!1;var f,h=u(i(s,o));try{for(h.s();!(f=h.n()).done;){var p=s[f.value];if(Array.isArray(p)){var y=p.indexOf(t);if(y<0)continue;var v=void 0,d=void 0;"LEFT_SIDE"===a?(v=0,d=y):(v=y+1,d=p.length);for(var A=v;A0&&l(p[y-1])&&c(p[y-1],e,n,o))return!0;if("RIGHT_SIDE"===a&&y=0&&f===n(l.length))return!0}}}catch(t){c.e(t)}finally{c.f()}return!1}function y(t,a){if(null==t||"object"!=e(t))return[];null==a&&(a=t);for(var o=t.subject?[a]:[],u=0,s=function(t){for(var e=[],r=Object.keys(t),n=0;n 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { start: peg$parsestart },\n peg$startRuleFunction = peg$parsestart,\n\n peg$c0 = function(ss) {\n return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss };\n },\n peg$c1 = function() { return void 0; },\n peg$c2 = \" \",\n peg$c3 = peg$literalExpectation(\" \", false),\n peg$c4 = /^[^ [\\],():#!=><~+.]/,\n peg$c5 = peg$classExpectation([\" \", \"[\", \"]\", \",\", \"(\", \")\", \":\", \"#\", \"!\", \"=\", \">\", \"<\", \"~\", \"+\", \".\"], true, false),\n peg$c6 = function(i) { return i.join(''); },\n peg$c7 = \">\",\n peg$c8 = peg$literalExpectation(\">\", false),\n peg$c9 = function() { return 'child'; },\n peg$c10 = \"~\",\n peg$c11 = peg$literalExpectation(\"~\", false),\n peg$c12 = function() { return 'sibling'; },\n peg$c13 = \"+\",\n peg$c14 = peg$literalExpectation(\"+\", false),\n peg$c15 = function() { return 'adjacent'; },\n peg$c16 = function() { return 'descendant'; },\n peg$c17 = \",\",\n peg$c18 = peg$literalExpectation(\",\", false),\n peg$c19 = function(s, ss) {\n return [s].concat(ss.map(function (s) { return s[3]; }));\n },\n peg$c20 = function(a, ops) {\n return ops.reduce(function (memo, rhs) {\n return { type: rhs[0], left: memo, right: rhs[1] };\n }, a);\n },\n peg$c21 = \"!\",\n peg$c22 = peg$literalExpectation(\"!\", false),\n peg$c23 = function(subject, as) {\n const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as };\n if(subject) b.subject = true;\n return b;\n },\n peg$c24 = \"*\",\n peg$c25 = peg$literalExpectation(\"*\", false),\n peg$c26 = function(a) { return { type: 'wildcard', value: a }; },\n peg$c27 = \"#\",\n peg$c28 = peg$literalExpectation(\"#\", false),\n peg$c29 = function(i) { return { type: 'identifier', value: i }; },\n peg$c30 = \"[\",\n peg$c31 = peg$literalExpectation(\"[\", false),\n peg$c32 = \"]\",\n peg$c33 = peg$literalExpectation(\"]\", false),\n peg$c34 = function(v) { return v; },\n peg$c35 = /^[>\", \"<\", \"!\"], false, false),\n peg$c37 = \"=\",\n peg$c38 = peg$literalExpectation(\"=\", false),\n peg$c39 = function(a) { return (a || '') + '='; },\n peg$c40 = /^[><]/,\n peg$c41 = peg$classExpectation([\">\", \"<\"], false, false),\n peg$c42 = \".\",\n peg$c43 = peg$literalExpectation(\".\", false),\n peg$c44 = function(a, as) {\n return [].concat.apply([a], as).join('');\n },\n peg$c45 = function(name, op, value) {\n return { type: 'attribute', name: name, operator: op, value: value };\n },\n peg$c46 = function(name) { return { type: 'attribute', name: name }; },\n peg$c47 = \"\\\"\",\n peg$c48 = peg$literalExpectation(\"\\\"\", false),\n peg$c49 = /^[^\\\\\"]/,\n peg$c50 = peg$classExpectation([\"\\\\\", \"\\\"\"], true, false),\n peg$c51 = \"\\\\\",\n peg$c52 = peg$literalExpectation(\"\\\\\", false),\n peg$c53 = peg$anyExpectation(),\n peg$c54 = function(a, b) { return a + b; },\n peg$c55 = function(d) {\n return { type: 'literal', value: strUnescape(d.join('')) };\n },\n peg$c56 = \"'\",\n peg$c57 = peg$literalExpectation(\"'\", false),\n peg$c58 = /^[^\\\\']/,\n peg$c59 = peg$classExpectation([\"\\\\\", \"'\"], true, false),\n peg$c60 = /^[0-9]/,\n peg$c61 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c62 = function(a, b) {\n // Can use `a.flat().join('')` once supported\n const leadingDecimals = a ? [].concat.apply([], a).join('') : '';\n return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) };\n },\n peg$c63 = function(i) { return { type: 'literal', value: i }; },\n peg$c64 = \"type(\",\n peg$c65 = peg$literalExpectation(\"type(\", false),\n peg$c66 = /^[^ )]/,\n peg$c67 = peg$classExpectation([\" \", \")\"], true, false),\n peg$c68 = \")\",\n peg$c69 = peg$literalExpectation(\")\", false),\n peg$c70 = function(t) { return { type: 'type', value: t.join('') }; },\n peg$c71 = /^[imsu]/,\n peg$c72 = peg$classExpectation([\"i\", \"m\", \"s\", \"u\"], false, false),\n peg$c73 = \"/\",\n peg$c74 = peg$literalExpectation(\"/\", false),\n peg$c75 = /^[^\\/]/,\n peg$c76 = peg$classExpectation([\"/\"], true, false),\n peg$c77 = function(d, flgs) { return {\n type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') };\n },\n peg$c78 = function(i, is) {\n return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)};\n },\n peg$c79 = \":not(\",\n peg$c80 = peg$literalExpectation(\":not(\", false),\n peg$c81 = function(ss) { return { type: 'not', selectors: ss }; },\n peg$c82 = \":matches(\",\n peg$c83 = peg$literalExpectation(\":matches(\", false),\n peg$c84 = function(ss) { return { type: 'matches', selectors: ss }; },\n peg$c85 = \":has(\",\n peg$c86 = peg$literalExpectation(\":has(\", false),\n peg$c87 = function(ss) { return { type: 'has', selectors: ss }; },\n peg$c88 = \":first-child\",\n peg$c89 = peg$literalExpectation(\":first-child\", false),\n peg$c90 = function() { return nth(1); },\n peg$c91 = \":last-child\",\n peg$c92 = peg$literalExpectation(\":last-child\", false),\n peg$c93 = function() { return nthLast(1); },\n peg$c94 = \":nth-child(\",\n peg$c95 = peg$literalExpectation(\":nth-child(\", false),\n peg$c96 = function(n) { return nth(parseInt(n.join(''), 10)); },\n peg$c97 = \":nth-last-child(\",\n peg$c98 = peg$literalExpectation(\":nth-last-child(\", false),\n peg$c99 = function(n) { return nthLast(parseInt(n.join(''), 10)); },\n peg$c100 = \":\",\n peg$c101 = peg$literalExpectation(\":\", false),\n peg$c102 = \"statement\",\n peg$c103 = peg$literalExpectation(\"statement\", true),\n peg$c104 = \"expression\",\n peg$c105 = peg$literalExpectation(\"expression\", true),\n peg$c106 = \"declaration\",\n peg$c107 = peg$literalExpectation(\"declaration\", true),\n peg$c108 = \"function\",\n peg$c109 = peg$literalExpectation(\"function\", true),\n peg$c110 = \"pattern\",\n peg$c111 = peg$literalExpectation(\"pattern\", true),\n peg$c112 = function(c) {\n return { type: 'class', name: c };\n },\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$resultsCache = {},\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 0,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseselectors();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1();\n }\n s0 = s1;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 1,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifierName() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 2,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c6(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsebinaryOp() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 3,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s2 = peg$c7;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c9();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 126) {\n s2 = peg$c10;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c11); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 43) {\n s2 = peg$c13;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c14); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c15();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselectors() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n var key = peg$currPos * 30 + 4,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseselector();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c19(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselector() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 5,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parsesequence();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsesequence() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 6,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseatom();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseatom();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseatom() {\n var s0;\n\n var key = peg$currPos * 30 + 7,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$parsewildcard();\n if (s0 === peg$FAILED) {\n s0 = peg$parseidentifier();\n if (s0 === peg$FAILED) {\n s0 = peg$parseattr();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefield();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenegation();\n if (s0 === peg$FAILED) {\n s0 = peg$parsematches();\n if (s0 === peg$FAILED) {\n s0 = peg$parsehas();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefirstChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parselastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthLastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parseclass();\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsewildcard() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 8,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 42) {\n s1 = peg$c24;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifier() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 9,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c27;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattr() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 10,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c30;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrValue();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c32;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 11,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (peg$c35.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c40.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c41); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrEqOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 12,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrName() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 13,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c44(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrValue() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 14,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrEqOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsetype();\n if (s5 === peg$FAILED) {\n s5 = peg$parseregex();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsestring();\n if (s5 === peg$FAILED) {\n s5 = peg$parsenumber();\n if (s5 === peg$FAILED) {\n s5 = peg$parsepath();\n }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c46(s1);\n }\n s0 = s1;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsestring() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 15,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c47;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c47;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c56;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c56;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenumber() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 16,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c42;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c62(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsepath() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 17,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsetype() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 18,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c64) {\n s1 = peg$c64;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c65); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c70(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseflags() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 19,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseregex() {\n var s0, s1, s2, s3, s4;\n\n var key = peg$currPos * 30 + 20,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 47) {\n s1 = peg$c73;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 47) {\n s3 = peg$c73;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseflags();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c77(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefield() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n var key = peg$currPos * 30 + 21,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s1 = peg$c42;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c78(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenegation() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 22,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c79) {\n s1 = peg$c79;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c80); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c81(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsematches() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 23,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 9) === peg$c82) {\n s1 = peg$c82;\n peg$currPos += 9;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsehas() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 24,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c85) {\n s1 = peg$c85;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c86); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefirstChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 25,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 12) === peg$c88) {\n s1 = peg$c88;\n peg$currPos += 12;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c89); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c90();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parselastChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 26,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c91) {\n s1 = peg$c91;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c93();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 27,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c94) {\n s1 = peg$c94;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c95); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c96(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthLastChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 28,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 16) === peg$c97) {\n s1 = peg$c97;\n peg$currPos += 16;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c99(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseclass() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 29,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c100;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c101); }\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) {\n s2 = input.substr(peg$currPos, 9);\n peg$currPos += 9;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c103); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) {\n s2 = input.substr(peg$currPos, 10);\n peg$currPos += 10;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c105); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) {\n s2 = input.substr(peg$currPos, 11);\n peg$currPos += 11;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) {\n s2 = input.substr(peg$currPos, 8);\n peg$currPos += 8;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) {\n s2 = input.substr(peg$currPos, 7);\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n }\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c112(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n\n function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; }\n function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; }\n function strUnescape(s) {\n return s.replace(/\\\\(.)/g, function(match, ch) {\n switch(ch) {\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n case 'v': return '\\v';\n default: return ch;\n }\n });\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","/* vim: set sw=4 sts=4 : */\nimport estraverse from 'estraverse';\nimport parser from './parser.js';\n\n/**\n* @typedef {\"LEFT_SIDE\"|\"RIGHT_SIDE\"} Side\n*/\n\nconst LEFT_SIDE = 'LEFT_SIDE';\nconst RIGHT_SIDE = 'RIGHT_SIDE';\n\n/**\n * @external AST\n * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html\n */\n\n/**\n * One of the rules of `grammar.pegjs`\n * @typedef {PlainObject} SelectorAST\n * @see grammar.pegjs\n*/\n\n/**\n * The `sequence` production of `grammar.pegjs`\n * @typedef {PlainObject} SelectorSequenceAST\n*/\n\n/**\n * Get the value of a property which may be multiple levels down\n * in the object.\n * @param {?PlainObject} obj\n * @param {string} key\n * @returns {undefined|boolean|string|number|external:AST}\n */\nfunction getPath(obj, key) {\n const keys = key.split('.');\n for (const key of keys) {\n if (obj == null) { return obj; }\n obj = obj[key];\n }\n return obj;\n}\n\n/**\n * Determine whether `node` can be reached by following `path`,\n * starting at `ancestor`.\n * @param {?external:AST} node\n * @param {?external:AST} ancestor\n * @param {string[]} path\n * @returns {boolean}\n */\nfunction inPath(node, ancestor, path) {\n if (path.length === 0) { return node === ancestor; }\n if (ancestor == null) { return false; }\n const field = ancestor[path[0]];\n const remainingPath = path.slice(1);\n if (Array.isArray(field)) {\n for (const component of field) {\n if (inPath(node, component, remainingPath)) { return true; }\n }\n return false;\n } else {\n return inPath(node, field, remainingPath);\n }\n}\n\n/**\n * @callback TraverseOptionFallback\n * @param {external:AST} node The given node.\n * @returns {string[]} An array of visitor keys for the given node.\n */\n/**\n * @typedef {object} ESQueryOptions\n * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node.\n * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes.\n */\n\n/**\n * Given a `node` and its ancestors, determine if `node` is matched\n * by `selector`.\n * @param {?external:AST} node\n * @param {?SelectorAST} selector\n * @param {external:AST[]} [ancestry=[]]\n * @param {ESQueryOptions} [options]\n * @throws {Error} Unknowns (operator, class name, selector type, or\n * selector value type)\n * @returns {boolean}\n */\nfunction matches(node, selector, ancestry, options) {\n if (!selector) { return true; }\n if (!node) { return false; }\n if (!ancestry) { ancestry = []; }\n\n switch(selector.type) {\n case 'wildcard':\n return true;\n\n case 'identifier':\n return selector.value.toLowerCase() === node.type.toLowerCase();\n\n case 'field': {\n const path = selector.name.split('.');\n const ancestor = ancestry[path.length - 1];\n return inPath(node, ancestor, path);\n\n }\n case 'matches':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return true; }\n }\n return false;\n\n case 'compound':\n for (const sel of selector.selectors) {\n if (!matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'not':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'has': {\n const collector = [];\n for (const sel of selector.selectors) {\n const a = [];\n estraverse.traverse(node, {\n enter (node, parent) {\n if (parent != null) { a.unshift(parent); }\n if (matches(node, sel, a, options)) {\n collector.push(node);\n }\n },\n leave () { a.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n }\n return collector.length !== 0;\n\n }\n case 'child':\n if (matches(node, selector.right, ancestry, options)) {\n return matches(ancestry[0], selector.left, ancestry.slice(1), options);\n }\n return false;\n\n case 'descendant':\n if (matches(node, selector.right, ancestry, options)) {\n for (let i = 0, l = ancestry.length; i < l; ++i) {\n if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) {\n return true;\n }\n }\n }\n return false;\n\n case 'attribute': {\n const p = getPath(node, selector.name);\n switch (selector.operator) {\n case void 0:\n return p != null;\n case '=':\n switch (selector.value.type) {\n case 'regexp': return typeof p === 'string' && selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` === `${p}`;\n case 'type': return selector.value.value === typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '!=':\n switch (selector.value.type) {\n case 'regexp': return !selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` !== `${p}`;\n case 'type': return selector.value.value !== typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '<=': return p <= selector.value.value;\n case '<': return p < selector.value.value;\n case '>': return p > selector.value.value;\n case '>=': return p >= selector.value.value;\n }\n throw new Error(`Unknown operator: ${selector.operator}`);\n }\n case 'sibling':\n return matches(node, selector.right, ancestry, options) &&\n sibling(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.left.subject &&\n matches(node, selector.left, ancestry, options) &&\n sibling(node, selector.right, ancestry, RIGHT_SIDE, options);\n case 'adjacent':\n return matches(node, selector.right, ancestry, options) &&\n adjacent(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.right.subject &&\n matches(node, selector.left, ancestry, options) &&\n adjacent(node, selector.right, ancestry, RIGHT_SIDE, options);\n\n case 'nth-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function () {\n return selector.index.value - 1;\n }, options);\n\n case 'nth-last-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function (length) {\n return length - selector.index.value;\n }, options);\n\n case 'class':\n switch(selector.name.toLowerCase()){\n case 'statement':\n if(node.type.slice(-9) === 'Statement') return true;\n // fallthrough: interface Declaration <: Statement { }\n case 'declaration':\n return node.type.slice(-11) === 'Declaration';\n case 'pattern':\n if(node.type.slice(-7) === 'Pattern') return true;\n // fallthrough: interface Expression <: Node, Pattern { }\n case 'expression':\n return node.type.slice(-10) === 'Expression' ||\n node.type.slice(-7) === 'Literal' ||\n (\n node.type === 'Identifier' &&\n (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty')\n ) ||\n node.type === 'MetaProperty';\n case 'function':\n return node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression';\n }\n throw new Error(`Unknown class name: ${selector.name}`);\n }\n\n throw new Error(`Unknown selector type: ${selector.type}`);\n}\n\n/**\n * Get visitor keys of a given node.\n * @param {external:AST} node The AST node to get keys.\n * @param {ESQueryOptions|undefined} options\n * @returns {string[]} Visitor keys of the node.\n */\nfunction getVisitorKeys(node, options) {\n const nodeType = node.type;\n if (options && options.visitorKeys && options.visitorKeys[nodeType]) {\n return options.visitorKeys[nodeType];\n }\n if (estraverse.VisitorKeys[nodeType]) {\n return estraverse.VisitorKeys[nodeType];\n }\n if (options && typeof options.fallback === 'function') {\n return options.fallback(node);\n }\n // 'iteration' fallback\n return Object.keys(node).filter(function (key) {\n return key !== 'type';\n });\n}\n\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} node The value to check.\n * @returns {boolean} `true` if the value is an ASTNode.\n */\nfunction isNode(node) {\n return node !== null && typeof node === 'object' && typeof node.type === 'string';\n}\n\n/**\n * Determines if the given node has a sibling that matches the\n * given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction sibling(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const startIndex = listProp.indexOf(node);\n if (startIndex < 0) { continue; }\n let lowerBound, upperBound;\n if (side === LEFT_SIDE) {\n lowerBound = 0;\n upperBound = startIndex;\n } else {\n lowerBound = startIndex + 1;\n upperBound = listProp.length;\n }\n for (let k = lowerBound; k < upperBound; ++k) {\n if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Determines if the given node has an adjacent sibling that matches\n * the given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction adjacent(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx < 0) { continue; }\n if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) {\n return true;\n }\n if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n* @callback IndexFunction\n* @param {Integer} len Containing list's length\n* @returns {Integer}\n*/\n\n/**\n * Determines if the given node is the nth child, determined by\n * `idxFn`, which is given the containing list's length.\n * @param {external:AST} node\n * @param {external:AST[]} ancestry\n * @param {IndexFunction} idxFn\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction nthChild(node, ancestry, idxFn, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx >= 0 && idx === idxFn(listProp.length)) { return true; }\n }\n }\n return false;\n}\n\n/**\n * For each selector node marked as a subject, find the portion of the\n * selector that the subject must match.\n * @param {SelectorAST} selector\n * @param {SelectorAST} [ancestor] Defaults to `selector`\n * @returns {SelectorAST[]}\n */\nfunction subjects(selector, ancestor) {\n if (selector == null || typeof selector != 'object') { return []; }\n if (ancestor == null) { ancestor = selector; }\n const results = selector.subject ? [ancestor] : [];\n for (const [p, sel] of Object.entries(selector)) {\n results.push(...subjects(sel, p === 'left' ? sel : ancestor));\n }\n return results;\n}\n\n/**\n* @callback TraverseVisitor\n* @param {?external:AST} node\n* @param {?external:AST} parent\n* @param {external:AST[]} ancestry\n*/\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {TraverseVisitor} visitor\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction traverse(ast, selector, visitor, options) {\n if (!selector) { return; }\n const ancestry = [];\n const altSubjects = subjects(selector);\n estraverse.traverse(ast, {\n enter (node, parent) {\n if (parent != null) { ancestry.unshift(parent); }\n if (matches(node, selector, ancestry, options)) {\n if (altSubjects.length) {\n for (let i = 0, l = altSubjects.length; i < l; ++i) {\n if (matches(node, altSubjects[i], ancestry, options)) {\n visitor(node, parent, ancestry);\n }\n for (let k = 0, m = ancestry.length; k < m; ++k) {\n const succeedingAncestry = ancestry.slice(k + 1);\n if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) {\n visitor(ancestry[k], parent, succeedingAncestry);\n }\n }\n }\n } else {\n visitor(node, parent, ancestry);\n }\n }\n },\n leave () { ancestry.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n}\n\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction match(ast, selector, options) {\n const results = [];\n traverse(ast, selector, function (node) {\n results.push(node);\n }, options);\n return results;\n}\n\n/**\n * Parse a selector string and return its AST.\n * @param {string} selector\n * @returns {SelectorAST}\n */\nfunction parse(selector) {\n return parser.parse(selector);\n}\n\n/**\n * Query the code AST using the selector string.\n * @param {external:AST} ast\n * @param {string} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction query(ast, selector, options) {\n return match(ast, parse(selector), options);\n}\n\nquery.parse = parse;\nquery.match = match;\nquery.traverse = traverse;\nquery.matches = matches;\nquery.query = query;\n\nexport default query;\n"],"names":["module","exports","peg$SyntaxError","message","expected","found","location","name","Error","captureStackTrace","this","child","parent","ctor","constructor","prototype","peg$subclass","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","i","escapedParts","parts","length","Array","classEscape","inverted","any","end","other","description","hex","ch","charCodeAt","toString","toUpperCase","s","replace","j","descriptions","type","sort","slice","join","describeExpected","describeFound","SyntaxError","parse","input","options","peg$result","peg$FAILED","peg$startRuleFunctions","start","peg$parsestart","peg$startRuleFunction","peg$c3","peg$literalExpectation","peg$c4","peg$c5","peg$classExpectation","peg$c8","peg$c11","peg$c14","peg$c18","peg$c22","peg$c25","peg$c28","peg$c31","peg$c33","peg$c35","peg$c36","peg$c38","peg$c39","a","peg$c40","peg$c41","peg$c43","peg$c45","op","value","operator","peg$c48","peg$c49","peg$c50","peg$c52","peg$c53","peg$c54","b","peg$c55","d","match","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c65","peg$c66","peg$c67","peg$c69","peg$c71","peg$c72","peg$c74","peg$c75","peg$c76","peg$c80","peg$c83","peg$c86","peg$c89","peg$c92","peg$c95","peg$c98","peg$c101","peg$c103","peg$c105","peg$c107","peg$c109","peg$c111","peg$currPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$resultsCache","startRule","ignoreCase","peg$computePosDetails","pos","p","details","peg$computeLocation","startPos","endPos","startPosDetails","endPosDetails","offset","peg$fail","push","s0","s1","s2","ss","key","cached","nextPos","result","peg$parse_","peg$parseselectors","selectors","peg$c1","peg$parseidentifierName","test","charAt","peg$parsebinaryOp","s3","s4","s5","s6","s7","peg$parseselector","concat","map","peg$parsesequence","reduce","memo","rhs","left","right","subject","as","peg$parseatom","peg$parsewildcard","peg$parseidentifier","peg$parseattrName","peg$parseattrEqOps","substr","peg$parsetype","flgs","peg$parseflags","RegExp","peg$parseregex","peg$parseattrOps","peg$parsestring","leadingDecimals","apply","parseFloat","peg$parsenumber","peg$parsepath","peg$parseattrValue","peg$parseattr","peg$parsefield","peg$parsenegation","peg$parsematches","peg$parsehas","nth","peg$parsefirstChild","nthLast","peg$parselastChild","parseInt","peg$parsenthChild","peg$parsenthLastChild","toLowerCase","peg$parseclass","n","index","factory","matches","node","selector","ancestry","path","split","ancestor","inPath","field","remainingPath","isArray","sel","collector","estraverse","traverse","enter","unshift","leave","shift","keys","visitorKeys","fallback","l","obj","getPath","sibling","adjacent","nthChild","getVisitorKeys","nodeType","VisitorKeys","Object","filter","isNode","_typeof","side","listProp","startIndex","indexOf","lowerBound","upperBound","k","idx","idxFn","subjects","results","_objectEntries","ast","visitor","altSubjects","m","succeedingAncestry","parser","query"],"mappings":"uoFAQ2CA,EAAOC,UAC9CD,UAEK,oBASEE,EAAgBC,EAASC,EAAUC,EAAOC,QAC5CH,QAAWA,OACXC,SAAWA,OACXC,MAAWA,OACXC,SAAWA,OACXC,KAAW,cAEuB,mBAA5BC,MAAMC,mBACfD,MAAMC,kBAAkBC,KAAMR,mBAdZS,EAAOC,YAClBC,SAAcC,YAAcH,EACrCE,EAAKE,UAAYH,EAAOG,UACxBJ,EAAMI,UAAY,IAAIF,EAexBG,CAAad,EAAiBM,OAE9BN,EAAgBe,aAAe,SAASb,EAAUC,OAC5Ca,EAA2B,CACzBC,QAAS,SAASC,SACT,IAAOC,EAAcD,EAAYE,MAAQ,WAGzC,SAASF,OAEZG,EADAC,EAAe,OAGdD,EAAI,EAAGA,EAAIH,EAAYK,MAAMC,OAAQH,IACxCC,GAAgBJ,EAAYK,MAAMF,aAAcI,MAC5CC,EAAYR,EAAYK,MAAMF,GAAG,IAAM,IAAMK,EAAYR,EAAYK,MAAMF,GAAG,IAC9EK,EAAYR,EAAYK,MAAMF,UAG7B,KAAOH,EAAYS,SAAW,IAAM,IAAML,EAAe,KAGlEM,IAAK,SAASV,SACL,iBAGTW,IAAK,SAASX,SACL,gBAGTY,MAAO,SAASZ,UACPA,EAAYa,uBAIlBC,EAAIC,UACJA,EAAGC,WAAW,GAAGC,SAAS,IAAIC,uBAG9BjB,EAAckB,UACdA,EACJC,QAAQ,MAAO,QACfA,QAAQ,KAA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GAAWA,EAAQmL,YACzBC,SAAUpL,GAAWA,EAAQoL,UAAY,eAajD,SAAS1I,EAAMoK,EAAK7C,EAAUjK,OACpB4M,EAAU,UAChB/B,EAASiC,EAAK7C,GAAU,SAAUD,GAC9B4C,EAAQlH,KAAKsE,KACdhK,GACI4M,EAQX,SAAS9M,EAAMmK,UACJkD,EAAOrN,MAAMmK,GAUxB,SAASmD,EAAMN,EAAK7C,EAAUjK,UACnB0C,EAAMoK,EAAKhN,EAAMmK,GAAWjK,UAGvCoN,EAAMtN,MAAQA,EACdsN,EAAM1K,MAAQA,EACd0K,EAAMvC,SAAWA,EACjBuC,EAAMrD,QAAUA,EAChBqD,EAAMA,MAAQA"} \ No newline at end of file diff --git a/node_modules/esquery/dist/esquery.min.js b/node_modules/esquery/dist/esquery.min.js new file mode 100644 index 0000000..279d1c7 --- /dev/null +++ b/node_modules/esquery/dist/esquery.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).esquery=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return s=e.done,e},e:function(e){l=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw i}}}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var s=i((function(e,t){!function e(t){var r,n,o,a,i,s;function l(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?l(r):r);return n}function u(e,t){this.parent=e,this.key=t}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n}function f(){}function p(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function y(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return!0;return!1}function d(e,t){return(new f).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,n,o,a;for(n=e.length,o=0;n;)t(e[a=o+(r=n>>>1)])?n=r:(o=a+1,n-=r+1);return o}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},o={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:a={},Skip:i={},Remove:s={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},f.prototype.path=function(){var e,t,r,n,o;function a(e,t){if(Array.isArray(t))for(r=0,n=t.length;r=0;)if(v=s[f=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]&&!y(n,v[m])){if(h(l,x[d]))o=new c(v[m],[f,m],"Property",null);else{if(!p(v[m]))continue;o=new c(v[m],[f,m],null,null)}r.push(o)}}else if(p(v)){if(y(n,v))continue;r.push(new c(v,f,null,null))}}}else if(o=n.pop(),u=this.__execute(t.leave,o),this.__state===a||u===a)return},f.prototype.replace=function(e,t){var r,n,o,l,f,y,d,m,x,v,g,b,A;function E(e){var t,n,o,a;if(e.ref.remove())for(n=e.ref.key,a=e.ref.parent,t=r.length;t--;)if((o=r[t]).ref&&o.ref.parent===a){if(o.ref.key=0;)if(v=o[A=x[d]])if(Array.isArray(v)){for(m=v.length;(m-=1)>=0;)if(v[m]){if(h(l,x[d]))y=new c(v[m],[A,m],"Property",new u(v,m));else{if(!p(v[m]))continue;y=new c(v[m],[A,m],null,new u(v,m))}r.push(y)}}else p(v)&&r.push(new c(v,A,null,new u(o,A)))}}else if(y=n.pop(),void 0!==(f=this.__execute(t.leave,y))&&f!==a&&f!==i&&f!==s&&y.ref.replace(f),this.__state!==s&&f!==s||E(y),this.__state===a||f===a)return b.root;return b.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return(new f).replace(e,t)},t.attachComments=function(e,t,r){var o,a,i,s,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(i=0,a=t.length;ie.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(s,1)):s+=1;return s===u.length?n.Break:u[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),s=0,d(e,{leave:function(e){for(var t;se.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=o,t.VisitorOption=n,t.Controller=f,t.cloneEnvironment=function(){return e({})},t}(t)})),l=i((function(e){e.exports&&(e.exports=function(){function e(t,r,n,o){this.message=t,this.expected=r,this.found=n,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t,r="";for(t=0;t0){for(t=1,n=1;t<~+.]/,p=me([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=de(">",!1),y=de("~",!1),d=de("+",!1),m=de(",",!1),x=de("!",!1),v=de("*",!1),g=de("#",!1),b=de("[",!1),A=de("]",!1),E=/^[>","<","!"],!1,!1),_=de("=",!1),w=function(e){return(e||"")+"="},C=/^[><]/,P=me([">","<"],!1,!1),k=de(".",!1),D=function(e,t,r){return{type:"attribute",name:e,operator:t,value:r}},j=de('"',!1),I=/^[^\\"]/,T=me(["\\",'"'],!0,!1),F=de("\\",!1),L={type:"any"},O=function(e,t){return e+t},R=function(e){return{type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";default:return t}})))};var t},B=de("'",!1),M=/^[^\\']/,U=me(["\\","'"],!0,!1),q=/^[0-9]/,V=me([["0","9"]],!1,!1),N=de("type(",!1),W=/^[^ )]/,K=me([" ",")"],!0,!1),G=de(")",!1),z=/^[imsu]/,H=me(["i","m","s","u"],!1,!1),Y=de("/",!1),$=/^[^\/]/,J=me(["/"],!0,!1),Q=de(":not(",!1),X=de(":matches(",!1),Z=de(":has(",!1),ee=de(":first-child",!1),te=de(":last-child",!1),re=de(":nth-child(",!1),ne=de(":nth-last-child(",!1),oe=de(":",!1),ae=de("statement",!0),ie=de("expression",!0),se=de("declaration",!0),le=de("function",!0),ue=de("pattern",!0),ce=0,fe=[{line:1,column:1}],pe=0,he=[],ye={};if("startRule"in r){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=l[r.startRule]}function de(e,t){return{type:"literal",text:e,ignoreCase:t}}function me(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function xe(e){var r,n=fe[e];if(n)return n;for(r=e-1;!fe[r];)r--;for(n={line:(n=fe[r]).line,column:n.column};rpe&&(pe=ce,he=[]),he.push(e))}function be(){var e,t,r,n,o=30*ce+0,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,(t=Ae())!==s&&(r=_e())!==s&&Ae()!==s?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(ce=e,e=s),e===s&&(e=ce,(t=Ae())!==s&&(t=void 0),e=t),ye[o]={nextPos:ce,result:e},e)}function Ae(){var e,r,n=30*ce+1,o=ye[n];if(o)return ce=o.nextPos,o.result;for(e=[],32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));r!==s;)e.push(r),32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c));return ye[n]={nextPos:ce,result:e},e}function Ee(){var e,r,n,o=30*ce+2,a=ye[o];if(a)return ce=a.nextPos,a.result;if(r=[],f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p)),n!==s)for(;n!==s;)r.push(n),f.test(t.charAt(ce))?(n=t.charAt(ce),ce++):(n=s,ge(p));else r=s;return r!==s&&(r=r.join("")),e=r,ye[o]={nextPos:ce,result:e},e}function Se(){var e,r,n,o=30*ce+3,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,(r=Ae())!==s?(62===t.charCodeAt(ce)?(n=">",ce++):(n=s,ge(h)),n!==s&&Ae()!==s?e=r="child":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=Ae())!==s?(126===t.charCodeAt(ce)?(n="~",ce++):(n=s,ge(y)),n!==s&&Ae()!==s?e=r="sibling":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=Ae())!==s?(43===t.charCodeAt(ce)?(n="+",ce++):(n=s,ge(d)),n!==s&&Ae()!==s?e=r="adjacent":(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,32===t.charCodeAt(ce)?(r=" ",ce++):(r=s,ge(c)),r!==s&&(n=Ae())!==s?e=r="descendant":(ce=e,e=s)))),ye[o]={nextPos:ce,result:e},e)}function _e(){var e,r,n,o,a,i,l,u,c=30*ce+4,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=we())!==s){for(n=[],o=ce,(a=Ae())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(l=Ae())!==s&&(u=we())!==s?o=a=[a,i,l,u]:(ce=o,o=s)):(ce=o,o=s);o!==s;)n.push(o),o=ce,(a=Ae())!==s?(44===t.charCodeAt(ce)?(i=",",ce++):(i=s,ge(m)),i!==s&&(l=Ae())!==s&&(u=we())!==s?o=a=[a,i,l,u]:(ce=o,o=s)):(ce=o,o=s);n!==s?e=r=[r].concat(n.map((function(e){return e[3]}))):(ce=e,e=s)}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function we(){var e,t,r,n,o,a,i,l=30*ce+5,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,(t=Ce())!==s){for(r=[],n=ce,(o=Se())!==s&&(a=Ce())!==s?n=o=[o,a]:(ce=n,n=s);n!==s;)r.push(n),n=ce,(o=Se())!==s&&(a=Ce())!==s?n=o=[o,a]:(ce=n,n=s);r!==s?(i=t,e=t=r.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),i)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}function Ce(){var e,r,n,o,a,i,l,u=30*ce+6,c=ye[u];if(c)return ce=c.nextPos,c.result;if(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s){if(n=[],(o=Pe())!==s)for(;o!==s;)n.push(o),o=Pe();else n=s;n!==s?(a=r,l=1===(i=n).length?i[0]:{type:"compound",selectors:i},a&&(l.subject=!0),e=r=l):(ce=e,e=s)}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}function Pe(){var e,r=30*ce+7,n=ye[r];return n?(ce=n.nextPos,n.result):((e=function(){var e,r,n=30*ce+8,o=ye[n];return o?(ce=o.nextPos,o.result):(42===t.charCodeAt(ce)?(r="*",ce++):(r=s,ge(v)),r!==s&&(r={type:"wildcard",value:r}),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o=30*ce+9,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,35===t.charCodeAt(ce)?(r="#",ce++):(r=s,ge(g)),r===s&&(r=null),r!==s&&(n=Ee())!==s?e=r={type:"identifier",value:n}:(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+10,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,91===t.charCodeAt(ce)?(r="[",ce++):(r=s,ge(b)),r!==s&&Ae()!==s&&(n=function(){var e,r,n,o,a=30*ce+14,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,(r=ke())!==s&&Ae()!==s&&(n=function(){var e,r,n,o=30*ce+12,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,33===t.charCodeAt(ce)?(r="!",ce++):(r=s,ge(x)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=w(r),e=r):(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?((o=function(){var e,r,n,o,a,i=30*ce+18,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,"type("===t.substr(ce,5)?(r="type(",ce+=5):(r=s,ge(N)),r!==s)if(Ae()!==s){if(n=[],W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(K)),o!==s)for(;o!==s;)n.push(o),W.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(K));else n=s;n!==s&&(o=Ae())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r={type:"type",value:n.join("")},e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,r,n,o,a,i,l=30*ce+20,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,47===t.charCodeAt(ce)?(r="/",ce++):(r=s,ge(Y)),r!==s){if(n=[],$.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(J)),o!==s)for(;o!==s;)n.push(o),$.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(J));else n=s;n!==s?(47===t.charCodeAt(ce)?(o="/",ce++):(o=s,ge(Y)),o!==s?((a=function(){var e,r,n=30*ce+19,o=ye[n];if(o)return ce=o.nextPos,o.result;if(e=[],z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H)),r!==s)for(;r!==s;)e.push(r),z.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(H));else e=s;return ye[n]={nextPos:ce,result:e},e}())===s&&(a=null),a!==s?(i=a,r={type:"regexp",value:new RegExp(n.join(""),i?i.join(""):"")},e=r):(ce=e,e=s)):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}()),o!==s?(r=D(r,n,o),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&Ae()!==s&&(n=function(){var e,r,n,o=30*ce+11,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,E.test(t.charAt(ce))?(r=t.charAt(ce),ce++):(r=s,ge(S)),r===s&&(r=null),r!==s?(61===t.charCodeAt(ce)?(n="=",ce++):(n=s,ge(_)),n!==s?(r=w(r),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(C.test(t.charAt(ce))?(e=t.charAt(ce),ce++):(e=s,ge(P))),ye[o]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?((o=function(){var e,r,n,o,a,i,l=30*ce+15,u=ye[l];if(u)return ce=u.nextPos,u.result;if(e=ce,34===t.charCodeAt(ce)?(r='"',ce++):(r=s,ge(j)),r!==s){for(n=[],I.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(T)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(F)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=O(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));o!==s;)n.push(o),I.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(T)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(F)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=O(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));n!==s?(34===t.charCodeAt(ce)?(o='"',ce++):(o=s,ge(j)),o!==s?(r=R(n),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;if(e===s)if(e=ce,39===t.charCodeAt(ce)?(r="'",ce++):(r=s,ge(B)),r!==s){for(n=[],M.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(U)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(F)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=O(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));o!==s;)n.push(o),M.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(U)),o===s&&(o=ce,92===t.charCodeAt(ce)?(a="\\",ce++):(a=s,ge(F)),a!==s?(t.length>ce?(i=t.charAt(ce),ce++):(i=s,ge(L)),i!==s?(a=O(a,i),o=a):(ce=o,o=s)):(ce=o,o=s));n!==s?(39===t.charCodeAt(ce)?(o="'",ce++):(o=s,ge(B)),o!==s?(r=R(n),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;return ye[l]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,r,n,o,a,i,l,u=30*ce+16,c=ye[u];if(c)return ce=c.nextPos,c.result;for(e=ce,r=ce,n=[],q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));o!==s;)n.push(o),q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));if(n!==s?(46===t.charCodeAt(ce)?(o=".",ce++):(o=s,ge(k)),o!==s?r=n=[n,o]:(ce=r,r=s)):(ce=r,r=s),r===s&&(r=null),r!==s){if(n=[],q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s?(i=n,l=(a=r)?[].concat.apply([],a).join(""):"",r={type:"literal",value:parseFloat(l+i.join(""))},e=r):(ce=e,e=s)}else ce=e,e=s;return ye[u]={nextPos:ce,result:e},e}())===s&&(o=function(){var e,t,r=30*ce+17,n=ye[r];return n?(ce=n.nextPos,n.result):((t=Ee())!==s&&(t={type:"literal",value:t}),e=t,ye[r]={nextPos:ce,result:e},e)}()),o!==s?(r=D(r,n,o),e=r):(ce=e,e=s)):(ce=e,e=s),e===s&&(e=ce,(r=ke())!==s&&(r={type:"attribute",name:r}),e=r)),ye[a]={nextPos:ce,result:e},e)}())!==s&&Ae()!==s?(93===t.charCodeAt(ce)?(o="]",ce++):(o=s,ge(A)),o!==s?e=r=n:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a,i,l,u,c=30*ce+21,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,46===t.charCodeAt(ce)?(r=".",ce++):(r=s,ge(k)),r!==s)if((n=Ee())!==s){for(o=[],a=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(l=Ee())!==s?a=i=[i,l]:(ce=a,a=s);a!==s;)o.push(a),a=ce,46===t.charCodeAt(ce)?(i=".",ce++):(i=s,ge(k)),i!==s&&(l=Ee())!==s?a=i=[i,l]:(ce=a,a=s);o!==s?(u=n,r={type:"field",name:o.reduce((function(e,t){return e+t[0]+t[1]}),u)},e=r):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o,a=30*ce+22,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":not("===t.substr(ce,5)?(r=":not(",ce+=5):(r=s,ge(Q)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"not",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+23,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":matches("===t.substr(ce,9)?(r=":matches(",ce+=9):(r=s,ge(X)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"matches",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a=30*ce+24,i=ye[a];return i?(ce=i.nextPos,i.result):(e=ce,":has("===t.substr(ce,5)?(r=":has(",ce+=5):(r=s,ge(Z)),r!==s&&Ae()!==s&&(n=_e())!==s&&Ae()!==s?(41===t.charCodeAt(ce)?(o=")",ce++):(o=s,ge(G)),o!==s?e=r={type:"has",selectors:n}:(ce=e,e=s)):(ce=e,e=s),ye[a]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+25,o=ye[n];return o?(ce=o.nextPos,o.result):(":first-child"===t.substr(ce,12)?(r=":first-child",ce+=12):(r=s,ge(ee)),r!==s&&(r=De(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n=30*ce+26,o=ye[n];return o?(ce=o.nextPos,o.result):(":last-child"===t.substr(ce,11)?(r=":last-child",ce+=11):(r=s,ge(te)),r!==s&&(r=je(1)),e=r,ye[n]={nextPos:ce,result:e},e)}())===s&&(e=function(){var e,r,n,o,a,i=30*ce+27,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,":nth-child("===t.substr(ce,11)?(r=":nth-child(",ce+=11):(r=s,ge(re)),r!==s)if(Ae()!==s){if(n=[],q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s&&(o=Ae())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r=De(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o,a,i=30*ce+28,l=ye[i];if(l)return ce=l.nextPos,l.result;if(e=ce,":nth-last-child("===t.substr(ce,16)?(r=":nth-last-child(",ce+=16):(r=s,ge(ne)),r!==s)if(Ae()!==s){if(n=[],q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V)),o!==s)for(;o!==s;)n.push(o),q.test(t.charAt(ce))?(o=t.charAt(ce),ce++):(o=s,ge(V));else n=s;n!==s&&(o=Ae())!==s?(41===t.charCodeAt(ce)?(a=")",ce++):(a=s,ge(G)),a!==s?(r=je(parseInt(n.join(""),10)),e=r):(ce=e,e=s)):(ce=e,e=s)}else ce=e,e=s;else ce=e,e=s;return ye[i]={nextPos:ce,result:e},e}())===s&&(e=function(){var e,r,n,o=30*ce+29,a=ye[o];return a?(ce=a.nextPos,a.result):(e=ce,58===t.charCodeAt(ce)?(r=":",ce++):(r=s,ge(oe)),r!==s?("statement"===t.substr(ce,9).toLowerCase()?(n=t.substr(ce,9),ce+=9):(n=s,ge(ae)),n===s&&("expression"===t.substr(ce,10).toLowerCase()?(n=t.substr(ce,10),ce+=10):(n=s,ge(ie)),n===s&&("declaration"===t.substr(ce,11).toLowerCase()?(n=t.substr(ce,11),ce+=11):(n=s,ge(se)),n===s&&("function"===t.substr(ce,8).toLowerCase()?(n=t.substr(ce,8),ce+=8):(n=s,ge(le)),n===s&&("pattern"===t.substr(ce,7).toLowerCase()?(n=t.substr(ce,7),ce+=7):(n=s,ge(ue)))))),n!==s?e=r={type:"class",name:n}:(ce=e,e=s)):(ce=e,e=s),ye[o]={nextPos:ce,result:e},e)}()),ye[r]={nextPos:ce,result:e},e)}function ke(){var e,r,n,o,a,i,l,u,c=30*ce+13,f=ye[c];if(f)return ce=f.nextPos,f.result;if(e=ce,(r=Ee())!==s){for(n=[],o=ce,46===t.charCodeAt(ce)?(a=".",ce++):(a=s,ge(k)),a!==s&&(i=Ee())!==s?o=a=[a,i]:(ce=o,o=s);o!==s;)n.push(o),o=ce,46===t.charCodeAt(ce)?(a=".",ce++):(a=s,ge(k)),a!==s&&(i=Ee())!==s?o=a=[a,i]:(ce=o,o=s);n!==s?(l=r,u=n,e=r=[].concat.apply([l],u).join("")):(ce=e,e=s)}else ce=e,e=s;return ye[c]={nextPos:ce,result:e},e}function De(e){return{type:"nth-child",index:{type:"literal",value:e}}}function je(e){return{type:"nth-last-child",index:{type:"literal",value:e}}}if((n=u())!==s&&ce===t.length)return n;throw n!==s&&ce":return w>r.value.value;case">=":return w>=r.value.value}throw new Error("Unknown operator: ".concat(r.operator));case"sibling":return u(t,r.right,n,o)&&p(t,r.left,n,"LEFT_SIDE",o)||r.left.subject&&u(t,r.left,n,o)&&p(t,r.right,n,"RIGHT_SIDE",o);case"adjacent":return u(t,r.right,n,o)&&h(t,r.left,n,"LEFT_SIDE",o)||r.right.subject&&u(t,r.left,n,o)&&h(t,r.right,n,"RIGHT_SIDE",o);case"nth-child":return u(t,r.right,n,o)&&y(t,n,(function(){return r.index.value-1}),o);case"nth-last-child":return u(t,r.right,n,o)&&y(t,n,(function(e){return e-r.index.value}),o);case"class":switch(r.name.toLowerCase()){case"statement":if("Statement"===t.type.slice(-9))return!0;case"declaration":return"Declaration"===t.type.slice(-11);case"pattern":if("Pattern"===t.type.slice(-7))return!0;case"expression":return"Expression"===t.type.slice(-10)||"Literal"===t.type.slice(-7)||"Identifier"===t.type&&(0===n.length||"MetaProperty"!==n[0].type)||"MetaProperty"===t.type;case"function":return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type}throw new Error("Unknown class name: ".concat(r.name))}throw new Error("Unknown selector type: ".concat(r.type))}function c(e,t){var r=e.type;return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:s.VisitorKeys[r]?s.VisitorKeys[r]:t&&"function"==typeof t.fallback?t.fallback(e):Object.keys(e).filter((function(e){return"type"!==e}))}function f(t){return null!==t&&"object"===e(t)&&"string"==typeof t.type}function p(e,r,n,o,i){var s=t(n,1)[0];if(!s)return!1;var l,p=a(c(s,i));try{for(p.s();!(l=p.n()).done;){var h=s[l.value];if(Array.isArray(h)){var y=h.indexOf(e);if(y<0)continue;var d=void 0,m=void 0;"LEFT_SIDE"===o?(d=0,m=y):(d=y+1,m=h.length);for(var x=d;x0&&f(h[y-1])&&u(h[y-1],r,n,i))return!0;if("RIGHT_SIDE"===o&&y=0&&f===n(u.length))return!0}}}catch(e){l.e(e)}finally{l.f()}return!1}function d(n,o){if(null==n||"object"!=e(n))return[];null==o&&(o=n);for(var a=n.subject?[o]:[],i=0,s=function(e){for(var t=[],r=Object.keys(e),n=0;n\n Copyright (C) 2012 Ariya Hidayat \n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n/*jslint vars:false, bitwise:true*/\n/*jshint indent:4*/\n/*global exports:true*/\n(function clone(exports) {\n 'use strict';\n\n var Syntax,\n VisitorOption,\n VisitorKeys,\n BREAK,\n SKIP,\n REMOVE;\n\n function deepCopy(obj) {\n var ret = {}, key, val;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n val = obj[key];\n if (typeof val === 'object' && val !== null) {\n ret[key] = deepCopy(val);\n } else {\n ret[key] = val;\n }\n }\n }\n return ret;\n }\n\n // based on LLVM libc++ upper_bound / lower_bound\n // MIT License\n\n function upperBound(array, func) {\n var diff, len, i, current;\n\n len = array.length;\n i = 0;\n\n while (len) {\n diff = len >>> 1;\n current = i + diff;\n if (func(array[current])) {\n len = diff;\n } else {\n i = current + 1;\n len -= diff + 1;\n }\n }\n return i;\n }\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n AssignmentPattern: 'AssignmentPattern',\n ArrayExpression: 'ArrayExpression',\n ArrayPattern: 'ArrayPattern',\n ArrowFunctionExpression: 'ArrowFunctionExpression',\n AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.\n BlockStatement: 'BlockStatement',\n BinaryExpression: 'BinaryExpression',\n BreakStatement: 'BreakStatement',\n CallExpression: 'CallExpression',\n CatchClause: 'CatchClause',\n ChainExpression: 'ChainExpression',\n ClassBody: 'ClassBody',\n ClassDeclaration: 'ClassDeclaration',\n ClassExpression: 'ClassExpression',\n ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.\n ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.\n ConditionalExpression: 'ConditionalExpression',\n ContinueStatement: 'ContinueStatement',\n DebuggerStatement: 'DebuggerStatement',\n DirectiveStatement: 'DirectiveStatement',\n DoWhileStatement: 'DoWhileStatement',\n EmptyStatement: 'EmptyStatement',\n ExportAllDeclaration: 'ExportAllDeclaration',\n ExportDefaultDeclaration: 'ExportDefaultDeclaration',\n ExportNamedDeclaration: 'ExportNamedDeclaration',\n ExportSpecifier: 'ExportSpecifier',\n ExpressionStatement: 'ExpressionStatement',\n ForStatement: 'ForStatement',\n ForInStatement: 'ForInStatement',\n ForOfStatement: 'ForOfStatement',\n FunctionDeclaration: 'FunctionDeclaration',\n FunctionExpression: 'FunctionExpression',\n GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.\n Identifier: 'Identifier',\n IfStatement: 'IfStatement',\n ImportExpression: 'ImportExpression',\n ImportDeclaration: 'ImportDeclaration',\n ImportDefaultSpecifier: 'ImportDefaultSpecifier',\n ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',\n ImportSpecifier: 'ImportSpecifier',\n Literal: 'Literal',\n LabeledStatement: 'LabeledStatement',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n MetaProperty: 'MetaProperty',\n MethodDefinition: 'MethodDefinition',\n ModuleSpecifier: 'ModuleSpecifier',\n NewExpression: 'NewExpression',\n ObjectExpression: 'ObjectExpression',\n ObjectPattern: 'ObjectPattern',\n Program: 'Program',\n Property: 'Property',\n RestElement: 'RestElement',\n ReturnStatement: 'ReturnStatement',\n SequenceExpression: 'SequenceExpression',\n SpreadElement: 'SpreadElement',\n Super: 'Super',\n SwitchStatement: 'SwitchStatement',\n SwitchCase: 'SwitchCase',\n TaggedTemplateExpression: 'TaggedTemplateExpression',\n TemplateElement: 'TemplateElement',\n TemplateLiteral: 'TemplateLiteral',\n ThisExpression: 'ThisExpression',\n ThrowStatement: 'ThrowStatement',\n TryStatement: 'TryStatement',\n UnaryExpression: 'UnaryExpression',\n UpdateExpression: 'UpdateExpression',\n VariableDeclaration: 'VariableDeclaration',\n VariableDeclarator: 'VariableDeclarator',\n WhileStatement: 'WhileStatement',\n WithStatement: 'WithStatement',\n YieldExpression: 'YieldExpression'\n };\n\n VisitorKeys = {\n AssignmentExpression: ['left', 'right'],\n AssignmentPattern: ['left', 'right'],\n ArrayExpression: ['elements'],\n ArrayPattern: ['elements'],\n ArrowFunctionExpression: ['params', 'body'],\n AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.\n BlockStatement: ['body'],\n BinaryExpression: ['left', 'right'],\n BreakStatement: ['label'],\n CallExpression: ['callee', 'arguments'],\n CatchClause: ['param', 'body'],\n ChainExpression: ['expression'],\n ClassBody: ['body'],\n ClassDeclaration: ['id', 'superClass', 'body'],\n ClassExpression: ['id', 'superClass', 'body'],\n ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.\n ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.\n ConditionalExpression: ['test', 'consequent', 'alternate'],\n ContinueStatement: ['label'],\n DebuggerStatement: [],\n DirectiveStatement: [],\n DoWhileStatement: ['body', 'test'],\n EmptyStatement: [],\n ExportAllDeclaration: ['source'],\n ExportDefaultDeclaration: ['declaration'],\n ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],\n ExportSpecifier: ['exported', 'local'],\n ExpressionStatement: ['expression'],\n ForStatement: ['init', 'test', 'update', 'body'],\n ForInStatement: ['left', 'right', 'body'],\n ForOfStatement: ['left', 'right', 'body'],\n FunctionDeclaration: ['id', 'params', 'body'],\n FunctionExpression: ['id', 'params', 'body'],\n GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.\n Identifier: [],\n IfStatement: ['test', 'consequent', 'alternate'],\n ImportExpression: ['source'],\n ImportDeclaration: ['specifiers', 'source'],\n ImportDefaultSpecifier: ['local'],\n ImportNamespaceSpecifier: ['local'],\n ImportSpecifier: ['imported', 'local'],\n Literal: [],\n LabeledStatement: ['label', 'body'],\n LogicalExpression: ['left', 'right'],\n MemberExpression: ['object', 'property'],\n MetaProperty: ['meta', 'property'],\n MethodDefinition: ['key', 'value'],\n ModuleSpecifier: [],\n NewExpression: ['callee', 'arguments'],\n ObjectExpression: ['properties'],\n ObjectPattern: ['properties'],\n Program: ['body'],\n Property: ['key', 'value'],\n RestElement: [ 'argument' ],\n ReturnStatement: ['argument'],\n SequenceExpression: ['expressions'],\n SpreadElement: ['argument'],\n Super: [],\n SwitchStatement: ['discriminant', 'cases'],\n SwitchCase: ['test', 'consequent'],\n TaggedTemplateExpression: ['tag', 'quasi'],\n TemplateElement: [],\n TemplateLiteral: ['quasis', 'expressions'],\n ThisExpression: [],\n ThrowStatement: ['argument'],\n TryStatement: ['block', 'handler', 'finalizer'],\n UnaryExpression: ['argument'],\n UpdateExpression: ['argument'],\n VariableDeclaration: ['declarations'],\n VariableDeclarator: ['id', 'init'],\n WhileStatement: ['test', 'body'],\n WithStatement: ['object', 'body'],\n YieldExpression: ['argument']\n };\n\n // unique id\n BREAK = {};\n SKIP = {};\n REMOVE = {};\n\n VisitorOption = {\n Break: BREAK,\n Skip: SKIP,\n Remove: REMOVE\n };\n\n function Reference(parent, key) {\n this.parent = parent;\n this.key = key;\n }\n\n Reference.prototype.replace = function replace(node) {\n this.parent[this.key] = node;\n };\n\n Reference.prototype.remove = function remove() {\n if (Array.isArray(this.parent)) {\n this.parent.splice(this.key, 1);\n return true;\n } else {\n this.replace(null);\n return false;\n }\n };\n\n function Element(node, path, wrap, ref) {\n this.node = node;\n this.path = path;\n this.wrap = wrap;\n this.ref = ref;\n }\n\n function Controller() { }\n\n // API:\n // return property path array from root to current node\n Controller.prototype.path = function path() {\n var i, iz, j, jz, result, element;\n\n function addToPath(result, path) {\n if (Array.isArray(path)) {\n for (j = 0, jz = path.length; j < jz; ++j) {\n result.push(path[j]);\n }\n } else {\n result.push(path);\n }\n }\n\n // root node\n if (!this.__current.path) {\n return null;\n }\n\n // first node is sentinel, second node is root element\n result = [];\n for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {\n element = this.__leavelist[i];\n addToPath(result, element.path);\n }\n addToPath(result, this.__current.path);\n return result;\n };\n\n // API:\n // return type of current node\n Controller.prototype.type = function () {\n var node = this.current();\n return node.type || this.__current.wrap;\n };\n\n // API:\n // return array of parent elements\n Controller.prototype.parents = function parents() {\n var i, iz, result;\n\n // first node is sentinel\n result = [];\n for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {\n result.push(this.__leavelist[i].node);\n }\n\n return result;\n };\n\n // API:\n // return current node\n Controller.prototype.current = function current() {\n return this.__current.node;\n };\n\n Controller.prototype.__execute = function __execute(callback, element) {\n var previous, result;\n\n result = undefined;\n\n previous = this.__current;\n this.__current = element;\n this.__state = null;\n if (callback) {\n result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);\n }\n this.__current = previous;\n\n return result;\n };\n\n // API:\n // notify control skip / break\n Controller.prototype.notify = function notify(flag) {\n this.__state = flag;\n };\n\n // API:\n // skip child nodes of current node\n Controller.prototype.skip = function () {\n this.notify(SKIP);\n };\n\n // API:\n // break traversals\n Controller.prototype['break'] = function () {\n this.notify(BREAK);\n };\n\n // API:\n // remove node\n Controller.prototype.remove = function () {\n this.notify(REMOVE);\n };\n\n Controller.prototype.__initialize = function(root, visitor) {\n this.visitor = visitor;\n this.root = root;\n this.__worklist = [];\n this.__leavelist = [];\n this.__current = null;\n this.__state = null;\n this.__fallback = null;\n if (visitor.fallback === 'iteration') {\n this.__fallback = Object.keys;\n } else if (typeof visitor.fallback === 'function') {\n this.__fallback = visitor.fallback;\n }\n\n this.__keys = VisitorKeys;\n if (visitor.keys) {\n this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);\n }\n };\n\n function isNode(node) {\n if (node == null) {\n return false;\n }\n return typeof node === 'object' && typeof node.type === 'string';\n }\n\n function isProperty(nodeType, key) {\n return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;\n }\n \n function candidateExistsInLeaveList(leavelist, candidate) {\n for (var i = leavelist.length - 1; i >= 0; --i) {\n if (leavelist[i].node === candidate) {\n return true;\n }\n }\n return false;\n }\n\n Controller.prototype.traverse = function traverse(root, visitor) {\n var worklist,\n leavelist,\n element,\n node,\n nodeType,\n ret,\n key,\n current,\n current2,\n candidates,\n candidate,\n sentinel;\n\n this.__initialize(root, visitor);\n\n sentinel = {};\n\n // reference\n worklist = this.__worklist;\n leavelist = this.__leavelist;\n\n // initialize\n worklist.push(new Element(root, null, null, null));\n leavelist.push(new Element(null, null, null, null));\n\n while (worklist.length) {\n element = worklist.pop();\n\n if (element === sentinel) {\n element = leavelist.pop();\n\n ret = this.__execute(visitor.leave, element);\n\n if (this.__state === BREAK || ret === BREAK) {\n return;\n }\n continue;\n }\n\n if (element.node) {\n\n ret = this.__execute(visitor.enter, element);\n\n if (this.__state === BREAK || ret === BREAK) {\n return;\n }\n\n worklist.push(sentinel);\n leavelist.push(element);\n\n if (this.__state === SKIP || ret === SKIP) {\n continue;\n }\n\n node = element.node;\n nodeType = node.type || element.wrap;\n candidates = this.__keys[nodeType];\n if (!candidates) {\n if (this.__fallback) {\n candidates = this.__fallback(node);\n } else {\n throw new Error('Unknown node type ' + nodeType + '.');\n }\n }\n\n current = candidates.length;\n while ((current -= 1) >= 0) {\n key = candidates[current];\n candidate = node[key];\n if (!candidate) {\n continue;\n }\n\n if (Array.isArray(candidate)) {\n current2 = candidate.length;\n while ((current2 -= 1) >= 0) {\n if (!candidate[current2]) {\n continue;\n }\n\n if (candidateExistsInLeaveList(leavelist, candidate[current2])) {\n continue;\n }\n\n if (isProperty(nodeType, candidates[current])) {\n element = new Element(candidate[current2], [key, current2], 'Property', null);\n } else if (isNode(candidate[current2])) {\n element = new Element(candidate[current2], [key, current2], null, null);\n } else {\n continue;\n }\n worklist.push(element);\n }\n } else if (isNode(candidate)) {\n if (candidateExistsInLeaveList(leavelist, candidate)) {\n continue;\n }\n\n worklist.push(new Element(candidate, key, null, null));\n }\n }\n }\n }\n };\n\n Controller.prototype.replace = function replace(root, visitor) {\n var worklist,\n leavelist,\n node,\n nodeType,\n target,\n element,\n current,\n current2,\n candidates,\n candidate,\n sentinel,\n outer,\n key;\n\n function removeElem(element) {\n var i,\n key,\n nextElem,\n parent;\n\n if (element.ref.remove()) {\n // When the reference is an element of an array.\n key = element.ref.key;\n parent = element.ref.parent;\n\n // If removed from array, then decrease following items' keys.\n i = worklist.length;\n while (i--) {\n nextElem = worklist[i];\n if (nextElem.ref && nextElem.ref.parent === parent) {\n if (nextElem.ref.key < key) {\n break;\n }\n --nextElem.ref.key;\n }\n }\n }\n }\n\n this.__initialize(root, visitor);\n\n sentinel = {};\n\n // reference\n worklist = this.__worklist;\n leavelist = this.__leavelist;\n\n // initialize\n outer = {\n root: root\n };\n element = new Element(root, null, null, new Reference(outer, 'root'));\n worklist.push(element);\n leavelist.push(element);\n\n while (worklist.length) {\n element = worklist.pop();\n\n if (element === sentinel) {\n element = leavelist.pop();\n\n target = this.__execute(visitor.leave, element);\n\n // node may be replaced with null,\n // so distinguish between undefined and null in this place\n if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {\n // replace\n element.ref.replace(target);\n }\n\n if (this.__state === REMOVE || target === REMOVE) {\n removeElem(element);\n }\n\n if (this.__state === BREAK || target === BREAK) {\n return outer.root;\n }\n continue;\n }\n\n target = this.__execute(visitor.enter, element);\n\n // node may be replaced with null,\n // so distinguish between undefined and null in this place\n if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {\n // replace\n element.ref.replace(target);\n element.node = target;\n }\n\n if (this.__state === REMOVE || target === REMOVE) {\n removeElem(element);\n element.node = null;\n }\n\n if (this.__state === BREAK || target === BREAK) {\n return outer.root;\n }\n\n // node may be null\n node = element.node;\n if (!node) {\n continue;\n }\n\n worklist.push(sentinel);\n leavelist.push(element);\n\n if (this.__state === SKIP || target === SKIP) {\n continue;\n }\n\n nodeType = node.type || element.wrap;\n candidates = this.__keys[nodeType];\n if (!candidates) {\n if (this.__fallback) {\n candidates = this.__fallback(node);\n } else {\n throw new Error('Unknown node type ' + nodeType + '.');\n }\n }\n\n current = candidates.length;\n while ((current -= 1) >= 0) {\n key = candidates[current];\n candidate = node[key];\n if (!candidate) {\n continue;\n }\n\n if (Array.isArray(candidate)) {\n current2 = candidate.length;\n while ((current2 -= 1) >= 0) {\n if (!candidate[current2]) {\n continue;\n }\n if (isProperty(nodeType, candidates[current])) {\n element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));\n } else if (isNode(candidate[current2])) {\n element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));\n } else {\n continue;\n }\n worklist.push(element);\n }\n } else if (isNode(candidate)) {\n worklist.push(new Element(candidate, key, null, new Reference(node, key)));\n }\n }\n }\n\n return outer.root;\n };\n\n function traverse(root, visitor) {\n var controller = new Controller();\n return controller.traverse(root, visitor);\n }\n\n function replace(root, visitor) {\n var controller = new Controller();\n return controller.replace(root, visitor);\n }\n\n function extendCommentRange(comment, tokens) {\n var target;\n\n target = upperBound(tokens, function search(token) {\n return token.range[0] > comment.range[0];\n });\n\n comment.extendedRange = [comment.range[0], comment.range[1]];\n\n if (target !== tokens.length) {\n comment.extendedRange[1] = tokens[target].range[0];\n }\n\n target -= 1;\n if (target >= 0) {\n comment.extendedRange[0] = tokens[target].range[1];\n }\n\n return comment;\n }\n\n function attachComments(tree, providedComments, tokens) {\n // At first, we should calculate extended comment ranges.\n var comments = [], comment, len, i, cursor;\n\n if (!tree.range) {\n throw new Error('attachComments needs range information');\n }\n\n // tokens array is empty, we attach comments to tree as 'leadingComments'\n if (!tokens.length) {\n if (providedComments.length) {\n for (i = 0, len = providedComments.length; i < len; i += 1) {\n comment = deepCopy(providedComments[i]);\n comment.extendedRange = [0, tree.range[0]];\n comments.push(comment);\n }\n tree.leadingComments = comments;\n }\n return tree;\n }\n\n for (i = 0, len = providedComments.length; i < len; i += 1) {\n comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));\n }\n\n // This is based on John Freeman's implementation.\n cursor = 0;\n traverse(tree, {\n enter: function (node) {\n var comment;\n\n while (cursor < comments.length) {\n comment = comments[cursor];\n if (comment.extendedRange[1] > node.range[0]) {\n break;\n }\n\n if (comment.extendedRange[1] === node.range[0]) {\n if (!node.leadingComments) {\n node.leadingComments = [];\n }\n node.leadingComments.push(comment);\n comments.splice(cursor, 1);\n } else {\n cursor += 1;\n }\n }\n\n // already out of owned node\n if (cursor === comments.length) {\n return VisitorOption.Break;\n }\n\n if (comments[cursor].extendedRange[0] > node.range[1]) {\n return VisitorOption.Skip;\n }\n }\n });\n\n cursor = 0;\n traverse(tree, {\n leave: function (node) {\n var comment;\n\n while (cursor < comments.length) {\n comment = comments[cursor];\n if (node.range[1] < comment.extendedRange[0]) {\n break;\n }\n\n if (node.range[1] === comment.extendedRange[0]) {\n if (!node.trailingComments) {\n node.trailingComments = [];\n }\n node.trailingComments.push(comment);\n comments.splice(cursor, 1);\n } else {\n cursor += 1;\n }\n }\n\n // already out of owned node\n if (cursor === comments.length) {\n return VisitorOption.Break;\n }\n\n if (comments[cursor].extendedRange[0] > node.range[1]) {\n return VisitorOption.Skip;\n }\n }\n });\n\n return tree;\n }\n\n exports.Syntax = Syntax;\n exports.traverse = traverse;\n exports.replace = replace;\n exports.attachComments = attachComments;\n exports.VisitorKeys = VisitorKeys;\n exports.VisitorOption = VisitorOption;\n exports.Controller = Controller;\n exports.cloneEnvironment = function () { return clone({}); };\n\n return exports;\n}(exports));\n/* vim: set sw=4 ts=4 et tw=80 : */\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function(root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n }\n})(this, function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { start: peg$parsestart },\n peg$startRuleFunction = peg$parsestart,\n\n peg$c0 = function(ss) {\n return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss };\n },\n peg$c1 = function() { return void 0; },\n peg$c2 = \" \",\n peg$c3 = peg$literalExpectation(\" \", false),\n peg$c4 = /^[^ [\\],():#!=><~+.]/,\n peg$c5 = peg$classExpectation([\" \", \"[\", \"]\", \",\", \"(\", \")\", \":\", \"#\", \"!\", \"=\", \">\", \"<\", \"~\", \"+\", \".\"], true, false),\n peg$c6 = function(i) { return i.join(''); },\n peg$c7 = \">\",\n peg$c8 = peg$literalExpectation(\">\", false),\n peg$c9 = function() { return 'child'; },\n peg$c10 = \"~\",\n peg$c11 = peg$literalExpectation(\"~\", false),\n peg$c12 = function() { return 'sibling'; },\n peg$c13 = \"+\",\n peg$c14 = peg$literalExpectation(\"+\", false),\n peg$c15 = function() { return 'adjacent'; },\n peg$c16 = function() { return 'descendant'; },\n peg$c17 = \",\",\n peg$c18 = peg$literalExpectation(\",\", false),\n peg$c19 = function(s, ss) {\n return [s].concat(ss.map(function (s) { return s[3]; }));\n },\n peg$c20 = function(a, ops) {\n return ops.reduce(function (memo, rhs) {\n return { type: rhs[0], left: memo, right: rhs[1] };\n }, a);\n },\n peg$c21 = \"!\",\n peg$c22 = peg$literalExpectation(\"!\", false),\n peg$c23 = function(subject, as) {\n const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as };\n if(subject) b.subject = true;\n return b;\n },\n peg$c24 = \"*\",\n peg$c25 = peg$literalExpectation(\"*\", false),\n peg$c26 = function(a) { return { type: 'wildcard', value: a }; },\n peg$c27 = \"#\",\n peg$c28 = peg$literalExpectation(\"#\", false),\n peg$c29 = function(i) { return { type: 'identifier', value: i }; },\n peg$c30 = \"[\",\n peg$c31 = peg$literalExpectation(\"[\", false),\n peg$c32 = \"]\",\n peg$c33 = peg$literalExpectation(\"]\", false),\n peg$c34 = function(v) { return v; },\n peg$c35 = /^[>\", \"<\", \"!\"], false, false),\n peg$c37 = \"=\",\n peg$c38 = peg$literalExpectation(\"=\", false),\n peg$c39 = function(a) { return (a || '') + '='; },\n peg$c40 = /^[><]/,\n peg$c41 = peg$classExpectation([\">\", \"<\"], false, false),\n peg$c42 = \".\",\n peg$c43 = peg$literalExpectation(\".\", false),\n peg$c44 = function(a, as) {\n return [].concat.apply([a], as).join('');\n },\n peg$c45 = function(name, op, value) {\n return { type: 'attribute', name: name, operator: op, value: value };\n },\n peg$c46 = function(name) { return { type: 'attribute', name: name }; },\n peg$c47 = \"\\\"\",\n peg$c48 = peg$literalExpectation(\"\\\"\", false),\n peg$c49 = /^[^\\\\\"]/,\n peg$c50 = peg$classExpectation([\"\\\\\", \"\\\"\"], true, false),\n peg$c51 = \"\\\\\",\n peg$c52 = peg$literalExpectation(\"\\\\\", false),\n peg$c53 = peg$anyExpectation(),\n peg$c54 = function(a, b) { return a + b; },\n peg$c55 = function(d) {\n return { type: 'literal', value: strUnescape(d.join('')) };\n },\n peg$c56 = \"'\",\n peg$c57 = peg$literalExpectation(\"'\", false),\n peg$c58 = /^[^\\\\']/,\n peg$c59 = peg$classExpectation([\"\\\\\", \"'\"], true, false),\n peg$c60 = /^[0-9]/,\n peg$c61 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c62 = function(a, b) {\n // Can use `a.flat().join('')` once supported\n const leadingDecimals = a ? [].concat.apply([], a).join('') : '';\n return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) };\n },\n peg$c63 = function(i) { return { type: 'literal', value: i }; },\n peg$c64 = \"type(\",\n peg$c65 = peg$literalExpectation(\"type(\", false),\n peg$c66 = /^[^ )]/,\n peg$c67 = peg$classExpectation([\" \", \")\"], true, false),\n peg$c68 = \")\",\n peg$c69 = peg$literalExpectation(\")\", false),\n peg$c70 = function(t) { return { type: 'type', value: t.join('') }; },\n peg$c71 = /^[imsu]/,\n peg$c72 = peg$classExpectation([\"i\", \"m\", \"s\", \"u\"], false, false),\n peg$c73 = \"/\",\n peg$c74 = peg$literalExpectation(\"/\", false),\n peg$c75 = /^[^\\/]/,\n peg$c76 = peg$classExpectation([\"/\"], true, false),\n peg$c77 = function(d, flgs) { return {\n type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') };\n },\n peg$c78 = function(i, is) {\n return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)};\n },\n peg$c79 = \":not(\",\n peg$c80 = peg$literalExpectation(\":not(\", false),\n peg$c81 = function(ss) { return { type: 'not', selectors: ss }; },\n peg$c82 = \":matches(\",\n peg$c83 = peg$literalExpectation(\":matches(\", false),\n peg$c84 = function(ss) { return { type: 'matches', selectors: ss }; },\n peg$c85 = \":has(\",\n peg$c86 = peg$literalExpectation(\":has(\", false),\n peg$c87 = function(ss) { return { type: 'has', selectors: ss }; },\n peg$c88 = \":first-child\",\n peg$c89 = peg$literalExpectation(\":first-child\", false),\n peg$c90 = function() { return nth(1); },\n peg$c91 = \":last-child\",\n peg$c92 = peg$literalExpectation(\":last-child\", false),\n peg$c93 = function() { return nthLast(1); },\n peg$c94 = \":nth-child(\",\n peg$c95 = peg$literalExpectation(\":nth-child(\", false),\n peg$c96 = function(n) { return nth(parseInt(n.join(''), 10)); },\n peg$c97 = \":nth-last-child(\",\n peg$c98 = peg$literalExpectation(\":nth-last-child(\", false),\n peg$c99 = function(n) { return nthLast(parseInt(n.join(''), 10)); },\n peg$c100 = \":\",\n peg$c101 = peg$literalExpectation(\":\", false),\n peg$c102 = \"statement\",\n peg$c103 = peg$literalExpectation(\"statement\", true),\n peg$c104 = \"expression\",\n peg$c105 = peg$literalExpectation(\"expression\", true),\n peg$c106 = \"declaration\",\n peg$c107 = peg$literalExpectation(\"declaration\", true),\n peg$c108 = \"function\",\n peg$c109 = peg$literalExpectation(\"function\", true),\n peg$c110 = \"pattern\",\n peg$c111 = peg$literalExpectation(\"pattern\", true),\n peg$c112 = function(c) {\n return { type: 'class', name: c };\n },\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$resultsCache = {},\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 0,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseselectors();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1();\n }\n s0 = s1;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 1,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifierName() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 2,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c6(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsebinaryOp() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 3,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s2 = peg$c7;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c9();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 126) {\n s2 = peg$c10;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c11); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 43) {\n s2 = peg$c13;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c14); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c15();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c2;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c3); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselectors() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n var key = peg$currPos * 30 + 4,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseselector();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c17;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseselector();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c19(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseselector() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 5,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parsesequence();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parsebinaryOp();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsesequence();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsesequence() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 6,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseatom();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseatom();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseatom() {\n var s0;\n\n var key = peg$currPos * 30 + 7,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$parsewildcard();\n if (s0 === peg$FAILED) {\n s0 = peg$parseidentifier();\n if (s0 === peg$FAILED) {\n s0 = peg$parseattr();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefield();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenegation();\n if (s0 === peg$FAILED) {\n s0 = peg$parsematches();\n if (s0 === peg$FAILED) {\n s0 = peg$parsehas();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefirstChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parselastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenthLastChild();\n if (s0 === peg$FAILED) {\n s0 = peg$parseclass();\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsewildcard() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 8,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 42) {\n s1 = peg$c24;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseidentifier() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 9,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c27;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattr() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 10,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c30;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrValue();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c32;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 11,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (peg$c35.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c40.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c41); }\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrEqOps() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 12,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 33) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c37;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrName() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 13,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c42;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parseidentifierName();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c44(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseattrValue() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 14,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrEqOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsetype();\n if (s5 === peg$FAILED) {\n s5 = peg$parseregex();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseattrOps();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsestring();\n if (s5 === peg$FAILED) {\n s5 = peg$parsenumber();\n if (s5 === peg$FAILED) {\n s5 = peg$parsepath();\n }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseattrName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c46(s1);\n }\n s0 = s1;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsestring() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 15,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c47;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c49.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c50); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c47;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c48); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c56;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c58.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s4 = peg$c51;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c52); }\n }\n if (s4 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c54(s4, s5);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c56;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenumber() {\n var s0, s1, s2, s3;\n\n var key = peg$currPos * 30 + 16,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c42;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c62(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsepath() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 17,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n s1 = peg$parseidentifierName();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s1);\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsetype() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 18,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c64) {\n s1 = peg$c64;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c65); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c70(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseflags() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 19,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = [];\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseregex() {\n var s0, s1, s2, s3, s4;\n\n var key = peg$currPos * 30 + 20,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 47) {\n s1 = peg$c73;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 47) {\n s3 = peg$c73;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseflags();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c77(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefield() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n var key = peg$currPos * 30 + 21,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s1 = peg$c42;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseidentifierName();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseidentifierName();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c78(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenegation() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 22,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c79) {\n s1 = peg$c79;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c80); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c81(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsematches() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 23,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 9) === peg$c82) {\n s1 = peg$c82;\n peg$currPos += 9;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsehas() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 24,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c85) {\n s1 = peg$c85;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c86); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseselectors();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsefirstChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 25,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 12) === peg$c88) {\n s1 = peg$c88;\n peg$currPos += 12;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c89); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c90();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parselastChild() {\n var s0, s1;\n\n var key = peg$currPos * 30 + 26,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c91) {\n s1 = peg$c91;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c93();\n }\n s0 = s1;\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 27,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 11) === peg$c94) {\n s1 = peg$c94;\n peg$currPos += 11;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c95); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c96(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parsenthLastChild() {\n var s0, s1, s2, s3, s4, s5;\n\n var key = peg$currPos * 30 + 28,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 16) === peg$c97) {\n s1 = peg$c97;\n peg$currPos += 16;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c60.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c68;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c99(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n function peg$parseclass() {\n var s0, s1, s2;\n\n var key = peg$currPos * 30 + 29,\n cached = peg$resultsCache[key];\n\n if (cached) {\n peg$currPos = cached.nextPos;\n\n return cached.result;\n }\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c100;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c101); }\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) {\n s2 = input.substr(peg$currPos, 9);\n peg$currPos += 9;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c103); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) {\n s2 = input.substr(peg$currPos, 10);\n peg$currPos += 10;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c105); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) {\n s2 = input.substr(peg$currPos, 11);\n peg$currPos += 11;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) {\n s2 = input.substr(peg$currPos, 8);\n peg$currPos += 8;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s2 === peg$FAILED) {\n if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) {\n s2 = input.substr(peg$currPos, 7);\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n }\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c112(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };\n\n return s0;\n }\n\n\n function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; }\n function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; }\n function strUnescape(s) {\n return s.replace(/\\\\(.)/g, function(match, ch) {\n switch(ch) {\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n case 'v': return '\\v';\n default: return ch;\n }\n });\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","/* vim: set sw=4 sts=4 : */\nimport estraverse from 'estraverse';\nimport parser from './parser.js';\n\n/**\n* @typedef {\"LEFT_SIDE\"|\"RIGHT_SIDE\"} Side\n*/\n\nconst LEFT_SIDE = 'LEFT_SIDE';\nconst RIGHT_SIDE = 'RIGHT_SIDE';\n\n/**\n * @external AST\n * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html\n */\n\n/**\n * One of the rules of `grammar.pegjs`\n * @typedef {PlainObject} SelectorAST\n * @see grammar.pegjs\n*/\n\n/**\n * The `sequence` production of `grammar.pegjs`\n * @typedef {PlainObject} SelectorSequenceAST\n*/\n\n/**\n * Get the value of a property which may be multiple levels down\n * in the object.\n * @param {?PlainObject} obj\n * @param {string} key\n * @returns {undefined|boolean|string|number|external:AST}\n */\nfunction getPath(obj, key) {\n const keys = key.split('.');\n for (const key of keys) {\n if (obj == null) { return obj; }\n obj = obj[key];\n }\n return obj;\n}\n\n/**\n * Determine whether `node` can be reached by following `path`,\n * starting at `ancestor`.\n * @param {?external:AST} node\n * @param {?external:AST} ancestor\n * @param {string[]} path\n * @returns {boolean}\n */\nfunction inPath(node, ancestor, path) {\n if (path.length === 0) { return node === ancestor; }\n if (ancestor == null) { return false; }\n const field = ancestor[path[0]];\n const remainingPath = path.slice(1);\n if (Array.isArray(field)) {\n for (const component of field) {\n if (inPath(node, component, remainingPath)) { return true; }\n }\n return false;\n } else {\n return inPath(node, field, remainingPath);\n }\n}\n\n/**\n * @callback TraverseOptionFallback\n * @param {external:AST} node The given node.\n * @returns {string[]} An array of visitor keys for the given node.\n */\n/**\n * @typedef {object} ESQueryOptions\n * @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node.\n * @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes.\n */\n\n/**\n * Given a `node` and its ancestors, determine if `node` is matched\n * by `selector`.\n * @param {?external:AST} node\n * @param {?SelectorAST} selector\n * @param {external:AST[]} [ancestry=[]]\n * @param {ESQueryOptions} [options]\n * @throws {Error} Unknowns (operator, class name, selector type, or\n * selector value type)\n * @returns {boolean}\n */\nfunction matches(node, selector, ancestry, options) {\n if (!selector) { return true; }\n if (!node) { return false; }\n if (!ancestry) { ancestry = []; }\n\n switch(selector.type) {\n case 'wildcard':\n return true;\n\n case 'identifier':\n return selector.value.toLowerCase() === node.type.toLowerCase();\n\n case 'field': {\n const path = selector.name.split('.');\n const ancestor = ancestry[path.length - 1];\n return inPath(node, ancestor, path);\n\n }\n case 'matches':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return true; }\n }\n return false;\n\n case 'compound':\n for (const sel of selector.selectors) {\n if (!matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'not':\n for (const sel of selector.selectors) {\n if (matches(node, sel, ancestry, options)) { return false; }\n }\n return true;\n\n case 'has': {\n const collector = [];\n for (const sel of selector.selectors) {\n const a = [];\n estraverse.traverse(node, {\n enter (node, parent) {\n if (parent != null) { a.unshift(parent); }\n if (matches(node, sel, a, options)) {\n collector.push(node);\n }\n },\n leave () { a.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n }\n return collector.length !== 0;\n\n }\n case 'child':\n if (matches(node, selector.right, ancestry, options)) {\n return matches(ancestry[0], selector.left, ancestry.slice(1), options);\n }\n return false;\n\n case 'descendant':\n if (matches(node, selector.right, ancestry, options)) {\n for (let i = 0, l = ancestry.length; i < l; ++i) {\n if (matches(ancestry[i], selector.left, ancestry.slice(i + 1), options)) {\n return true;\n }\n }\n }\n return false;\n\n case 'attribute': {\n const p = getPath(node, selector.name);\n switch (selector.operator) {\n case void 0:\n return p != null;\n case '=':\n switch (selector.value.type) {\n case 'regexp': return typeof p === 'string' && selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` === `${p}`;\n case 'type': return selector.value.value === typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '!=':\n switch (selector.value.type) {\n case 'regexp': return !selector.value.value.test(p);\n case 'literal': return `${selector.value.value}` !== `${p}`;\n case 'type': return selector.value.value !== typeof p;\n }\n throw new Error(`Unknown selector value type: ${selector.value.type}`);\n case '<=': return p <= selector.value.value;\n case '<': return p < selector.value.value;\n case '>': return p > selector.value.value;\n case '>=': return p >= selector.value.value;\n }\n throw new Error(`Unknown operator: ${selector.operator}`);\n }\n case 'sibling':\n return matches(node, selector.right, ancestry, options) &&\n sibling(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.left.subject &&\n matches(node, selector.left, ancestry, options) &&\n sibling(node, selector.right, ancestry, RIGHT_SIDE, options);\n case 'adjacent':\n return matches(node, selector.right, ancestry, options) &&\n adjacent(node, selector.left, ancestry, LEFT_SIDE, options) ||\n selector.right.subject &&\n matches(node, selector.left, ancestry, options) &&\n adjacent(node, selector.right, ancestry, RIGHT_SIDE, options);\n\n case 'nth-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function () {\n return selector.index.value - 1;\n }, options);\n\n case 'nth-last-child':\n return matches(node, selector.right, ancestry, options) &&\n nthChild(node, ancestry, function (length) {\n return length - selector.index.value;\n }, options);\n\n case 'class':\n switch(selector.name.toLowerCase()){\n case 'statement':\n if(node.type.slice(-9) === 'Statement') return true;\n // fallthrough: interface Declaration <: Statement { }\n case 'declaration':\n return node.type.slice(-11) === 'Declaration';\n case 'pattern':\n if(node.type.slice(-7) === 'Pattern') return true;\n // fallthrough: interface Expression <: Node, Pattern { }\n case 'expression':\n return node.type.slice(-10) === 'Expression' ||\n node.type.slice(-7) === 'Literal' ||\n (\n node.type === 'Identifier' &&\n (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty')\n ) ||\n node.type === 'MetaProperty';\n case 'function':\n return node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression';\n }\n throw new Error(`Unknown class name: ${selector.name}`);\n }\n\n throw new Error(`Unknown selector type: ${selector.type}`);\n}\n\n/**\n * Get visitor keys of a given node.\n * @param {external:AST} node The AST node to get keys.\n * @param {ESQueryOptions|undefined} options\n * @returns {string[]} Visitor keys of the node.\n */\nfunction getVisitorKeys(node, options) {\n const nodeType = node.type;\n if (options && options.visitorKeys && options.visitorKeys[nodeType]) {\n return options.visitorKeys[nodeType];\n }\n if (estraverse.VisitorKeys[nodeType]) {\n return estraverse.VisitorKeys[nodeType];\n }\n if (options && typeof options.fallback === 'function') {\n return options.fallback(node);\n }\n // 'iteration' fallback\n return Object.keys(node).filter(function (key) {\n return key !== 'type';\n });\n}\n\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} node The value to check.\n * @returns {boolean} `true` if the value is an ASTNode.\n */\nfunction isNode(node) {\n return node !== null && typeof node === 'object' && typeof node.type === 'string';\n}\n\n/**\n * Determines if the given node has a sibling that matches the\n * given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction sibling(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const startIndex = listProp.indexOf(node);\n if (startIndex < 0) { continue; }\n let lowerBound, upperBound;\n if (side === LEFT_SIDE) {\n lowerBound = 0;\n upperBound = startIndex;\n } else {\n lowerBound = startIndex + 1;\n upperBound = listProp.length;\n }\n for (let k = lowerBound; k < upperBound; ++k) {\n if (isNode(listProp[k]) && matches(listProp[k], selector, ancestry, options)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Determines if the given node has an adjacent sibling that matches\n * the given selector.\n * @param {external:AST} node\n * @param {SelectorSequenceAST} selector\n * @param {external:AST[]} ancestry\n * @param {Side} side\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction adjacent(node, selector, ancestry, side, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx < 0) { continue; }\n if (side === LEFT_SIDE && idx > 0 && isNode(listProp[idx - 1]) && matches(listProp[idx - 1], selector, ancestry, options)) {\n return true;\n }\n if (side === RIGHT_SIDE && idx < listProp.length - 1 && isNode(listProp[idx + 1]) && matches(listProp[idx + 1], selector, ancestry, options)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n* @callback IndexFunction\n* @param {Integer} len Containing list's length\n* @returns {Integer}\n*/\n\n/**\n * Determines if the given node is the nth child, determined by\n * `idxFn`, which is given the containing list's length.\n * @param {external:AST} node\n * @param {external:AST[]} ancestry\n * @param {IndexFunction} idxFn\n * @param {ESQueryOptions|undefined} options\n * @returns {boolean}\n */\nfunction nthChild(node, ancestry, idxFn, options) {\n const [parent] = ancestry;\n if (!parent) { return false; }\n const keys = getVisitorKeys(parent, options);\n for (const key of keys) {\n const listProp = parent[key];\n if (Array.isArray(listProp)) {\n const idx = listProp.indexOf(node);\n if (idx >= 0 && idx === idxFn(listProp.length)) { return true; }\n }\n }\n return false;\n}\n\n/**\n * For each selector node marked as a subject, find the portion of the\n * selector that the subject must match.\n * @param {SelectorAST} selector\n * @param {SelectorAST} [ancestor] Defaults to `selector`\n * @returns {SelectorAST[]}\n */\nfunction subjects(selector, ancestor) {\n if (selector == null || typeof selector != 'object') { return []; }\n if (ancestor == null) { ancestor = selector; }\n const results = selector.subject ? [ancestor] : [];\n for (const [p, sel] of Object.entries(selector)) {\n results.push(...subjects(sel, p === 'left' ? sel : ancestor));\n }\n return results;\n}\n\n/**\n* @callback TraverseVisitor\n* @param {?external:AST} node\n* @param {?external:AST} parent\n* @param {external:AST[]} ancestry\n*/\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {TraverseVisitor} visitor\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction traverse(ast, selector, visitor, options) {\n if (!selector) { return; }\n const ancestry = [];\n const altSubjects = subjects(selector);\n estraverse.traverse(ast, {\n enter (node, parent) {\n if (parent != null) { ancestry.unshift(parent); }\n if (matches(node, selector, ancestry, options)) {\n if (altSubjects.length) {\n for (let i = 0, l = altSubjects.length; i < l; ++i) {\n if (matches(node, altSubjects[i], ancestry, options)) {\n visitor(node, parent, ancestry);\n }\n for (let k = 0, m = ancestry.length; k < m; ++k) {\n const succeedingAncestry = ancestry.slice(k + 1);\n if (matches(ancestry[k], altSubjects[i], succeedingAncestry, options)) {\n visitor(ancestry[k], parent, succeedingAncestry);\n }\n }\n }\n } else {\n visitor(node, parent, ancestry);\n }\n }\n },\n leave () { ancestry.shift(); },\n keys: options && options.visitorKeys,\n fallback: options && options.fallback || 'iteration'\n });\n}\n\n\n/**\n * From a JS AST and a selector AST, collect all JS AST nodes that\n * match the selector.\n * @param {external:AST} ast\n * @param {?SelectorAST} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction match(ast, selector, options) {\n const results = [];\n traverse(ast, selector, function (node) {\n results.push(node);\n }, options);\n return results;\n}\n\n/**\n * Parse a selector string and return its AST.\n * @param {string} selector\n * @returns {SelectorAST}\n */\nfunction parse(selector) {\n return parser.parse(selector);\n}\n\n/**\n * Query the code AST using the selector string.\n * @param {external:AST} ast\n * @param {string} selector\n * @param {ESQueryOptions} [options]\n * @returns {external:AST[]}\n */\nfunction query(ast, selector, options) {\n return match(ast, parse(selector), options);\n}\n\nquery.parse = parse;\nquery.match = match;\nquery.traverse = traverse;\nquery.matches = matches;\nquery.query = query;\n\nexport default query;\n"],"names":["clone","exports","Syntax","VisitorOption","VisitorKeys","BREAK","SKIP","REMOVE","deepCopy","obj","key","val","ret","hasOwnProperty","Reference","parent","Element","node","path","wrap","ref","Controller","isNode","type","isProperty","nodeType","ObjectExpression","ObjectPattern","candidateExistsInLeaveList","leavelist","candidate","i","length","traverse","root","visitor","extendCommentRange","comment","tokens","target","array","func","diff","len","current","upperBound","token","range","extendedRange","AssignmentExpression","AssignmentPattern","ArrayExpression","ArrayPattern","ArrowFunctionExpression","AwaitExpression","BlockStatement","BinaryExpression","BreakStatement","CallExpression","CatchClause","ChainExpression","ClassBody","ClassDeclaration","ClassExpression","ComprehensionBlock","ComprehensionExpression","ConditionalExpression","ContinueStatement","DebuggerStatement","DirectiveStatement","DoWhileStatement","EmptyStatement","ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ExportSpecifier","ExpressionStatement","ForStatement","ForInStatement","ForOfStatement","FunctionDeclaration","FunctionExpression","GeneratorExpression","Identifier","IfStatement","ImportExpression","ImportDeclaration","ImportDefaultSpecifier","ImportNamespaceSpecifier","ImportSpecifier","Literal","LabeledStatement","LogicalExpression","MemberExpression","MetaProperty","MethodDefinition","ModuleSpecifier","NewExpression","Program","Property","RestElement","ReturnStatement","SequenceExpression","SpreadElement","Super","SwitchStatement","SwitchCase","TaggedTemplateExpression","TemplateElement","TemplateLiteral","ThisExpression","ThrowStatement","TryStatement","UnaryExpression","UpdateExpression","VariableDeclaration","VariableDeclarator","WhileStatement","WithStatement","YieldExpression","Break","Skip","Remove","prototype","replace","this","remove","Array","isArray","splice","iz","j","jz","result","addToPath","push","__current","__leavelist","parents","__execute","callback","element","previous","undefined","__state","call","notify","flag","skip","__initialize","__worklist","__fallback","fallback","Object","keys","__keys","assign","create","worklist","current2","candidates","sentinel","pop","enter","Error","leave","outer","removeElem","nextElem","attachComments","tree","providedComments","cursor","comments","leadingComments","trailingComments","cloneEnvironment","module","peg$SyntaxError","message","expected","found","location","name","captureStackTrace","child","ctor","constructor","peg$subclass","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","escapedParts","parts","classEscape","inverted","any","end","other","description","hex","ch","charCodeAt","toString","toUpperCase","s","descriptions","sort","slice","join","describeExpected","describeFound","SyntaxError","parse","input","options","peg$result","peg$FAILED","peg$startRuleFunctions","start","peg$parsestart","peg$startRuleFunction","peg$c3","peg$literalExpectation","peg$c4","peg$c5","peg$classExpectation","peg$c8","peg$c11","peg$c14","peg$c18","peg$c22","peg$c25","peg$c28","peg$c31","peg$c33","peg$c35","peg$c36","peg$c38","peg$c39","a","peg$c40","peg$c41","peg$c43","peg$c45","op","value","operator","peg$c48","peg$c49","peg$c50","peg$c52","peg$c53","peg$c54","b","peg$c55","d","match","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c65","peg$c66","peg$c67","peg$c69","peg$c71","peg$c72","peg$c74","peg$c75","peg$c76","peg$c80","peg$c83","peg$c86","peg$c89","peg$c92","peg$c95","peg$c98","peg$c101","peg$c103","peg$c105","peg$c107","peg$c109","peg$c111","peg$currPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","ignoreCase","peg$computePosDetails","pos","p","details","peg$computeLocation","startPos","endPos","startPosDetails","endPosDetails","offset","peg$fail","s0","s1","s2","ss","cached","peg$resultsCache","nextPos","peg$parse_","peg$parseselectors","selectors","peg$c1","peg$parseidentifierName","test","charAt","peg$parsebinaryOp","s3","s4","s5","s6","s7","peg$parseselector","concat","map","peg$parsesequence","reduce","memo","rhs","left","right","subject","as","peg$parseatom","peg$parsewildcard","peg$parseidentifier","peg$parseattrName","peg$parseattrEqOps","substr","peg$parsetype","flgs","peg$parseflags","RegExp","peg$parseregex","peg$parseattrOps","peg$parsestring","leadingDecimals","apply","parseFloat","peg$parsenumber","peg$parsepath","peg$parseattrValue","peg$parseattr","peg$parsefield","peg$parsenegation","peg$parsematches","peg$parsehas","nth","peg$parsefirstChild","nthLast","peg$parselastChild","parseInt","peg$parsenthChild","peg$parsenthLastChild","toLowerCase","peg$parseclass","n","index","factory","matches","selector","ancestry","split","ancestor","inPath","field","remainingPath","sel","collector","estraverse","unshift","shift","visitorKeys","l","getPath","sibling","adjacent","nthChild","getVisitorKeys","filter","_typeof","side","listProp","startIndex","indexOf","lowerBound","k","idx","idxFn","subjects","results","_objectEntries","ast","altSubjects","m","succeedingAncestry","parser","query"],"mappings":"kiFA2BUA,EAAMC,OAGRC,EACAC,EACAC,EACAC,EACAC,EACAC,WAEKC,EAASC,OACAC,EAAKC,EAAfC,EAAM,OACLF,KAAOD,EACJA,EAAII,eAAeH,KACnBC,EAAMF,EAAIC,GAENE,EAAIF,GADW,iBAARC,GAA4B,OAARA,EAChBH,EAASG,GAETA,UAIhBC,WA4LFE,EAAUC,EAAQL,QAClBK,OAASA,OACTL,IAAMA,WAiBNM,EAAQ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ACzB5O,SAAUkE,GAAWA,EAAQlE,UAAY,eAajD,SAAS4G,EAAMoJ,EAAKhC,EAAU9J,OACpB4L,EAAU,UAChBrX,EAASuX,EAAKhC,GAAU,SAAUvW,GAC9BqY,EAAQ/Q,KAAKtH,KACdyM,GACI4L,EAQX,SAAS9L,EAAMgK,UACJoC,EAAOpM,MAAMgK,GAUxB,SAASqC,EAAML,EAAKhC,EAAU9J,UACnB0C,EAAMoJ,EAAKhM,EAAMgK,GAAW9J,UAGvCmM,EAAMrM,MAAQA,EACdqM,EAAMzJ,MAAQA,EACdyJ,EAAM5X,SAAWA,EACjB4X,EAAMtC,QAAUA,EAChBsC,EAAMA,MAAQA"} \ No newline at end of file diff --git a/node_modules/esquery/license.txt b/node_modules/esquery/license.txt new file mode 100644 index 0000000..52f915e --- /dev/null +++ b/node_modules/esquery/license.txt @@ -0,0 +1,24 @@ +Copyright (c) 2013, Joel Feenstra +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the ESQuery nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL JOEL FEENSTRA BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/esquery/package.json b/node_modules/esquery/package.json new file mode 100644 index 0000000..3d81875 --- /dev/null +++ b/node_modules/esquery/package.json @@ -0,0 +1,78 @@ +{ + "name": "esquery", + "version": "1.4.0", + "author": "Joel Feenstra ", + "contributors": [], + "description": "A query library for ECMAScript AST using a CSS selector like query language.", + "main": "dist/esquery.min.js", + "module": "dist/esquery.esm.min.js", + "files": [ + "dist/*.js", + "dist/*.map", + "parser.js", + "license.txt", + "README.md" + ], + "nyc": { + "branches": 100, + "lines": 100, + "functions": 100, + "statements": 100, + "reporter": [ + "html", + "text" + ], + "exclude": [ + "parser.js", + "dist", + "tests" + ] + }, + "scripts": { + "prepublishOnly": "npm run build && npm test", + "build:parser": "rm parser.js && pegjs --cache --format umd -o \"parser.js\" \"grammar.pegjs\"", + "build:browser": "rollup -c", + "build": "npm run build:parser && npm run build:browser", + "mocha": "mocha --require chai/register-assert --require @babel/register tests", + "test": "nyc npm run mocha && npm run lint", + "test:ci": "npm run mocha", + "lint": "eslint ." + }, + "repository": { + "type": "git", + "url": "https://github.com/estools/esquery.git" + }, + "bugs": "https://github.com/estools/esquery/issues", + "homepage": "https://github.com/estools/esquery/", + "keywords": [ + "ast", + "ecmascript", + "javascript", + "query" + ], + "devDependencies": { + "@babel/core": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/register": "^7.9.0", + "@rollup/plugin-commonjs": "^11.1.0", + "@rollup/plugin-json": "^4.0.2", + "@rollup/plugin-node-resolve": "^7.1.3", + "babel-plugin-transform-es2017-object-entries": "0.0.5", + "chai": "^4.2.0", + "eslint": "^6.8.0", + "esprima": "~4.0.1", + "mocha": "^7.1.1", + "nyc": "^15.0.1", + "pegjs": "~0.10.0", + "rollup": "^1.32.1", + "rollup-plugin-babel": "^4.4.0", + "rollup-plugin-terser": "^5.3.0" + }, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10" + }, + "dependencies": { + "estraverse": "^5.1.0" + } +} diff --git a/node_modules/esquery/parser.js b/node_modules/esquery/parser.js new file mode 100644 index 0000000..36d590c --- /dev/null +++ b/node_modules/esquery/parser.js @@ -0,0 +1,2602 @@ +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ +(function(root, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(); + } +})(this, function() { + "use strict"; + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + "class": function(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function(expectation) { + return "any character"; + }, + + end: function(expectation) { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = function(ss) { + return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss }; + }, + peg$c1 = function() { return void 0; }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function(i) { return i.join(''); }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function() { return 'child'; }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function() { return 'sibling'; }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function() { return 'adjacent'; }, + peg$c16 = function() { return 'descendant'; }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function(s, ss) { + return [s].concat(ss.map(function (s) { return s[3]; })); + }, + peg$c20 = function(a, ops) { + return ops.reduce(function (memo, rhs) { + return { type: rhs[0], left: memo, right: rhs[1] }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function(subject, as) { + const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as }; + if(subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function(a) { return { type: 'wildcard', value: a }; }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function(i) { return { type: 'identifier', value: i }; }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function(v) { return v; }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function(a) { return (a || '') + '='; }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function(a, as) { + return [].concat.apply([a], as).join(''); + }, + peg$c45 = function(name, op, value) { + return { type: 'attribute', name: name, operator: op, value: value }; + }, + peg$c46 = function(name) { return { type: 'attribute', name: name }; }, + peg$c47 = "\"", + peg$c48 = peg$literalExpectation("\"", false), + peg$c49 = /^[^\\"]/, + peg$c50 = peg$classExpectation(["\\", "\""], true, false), + peg$c51 = "\\", + peg$c52 = peg$literalExpectation("\\", false), + peg$c53 = peg$anyExpectation(), + peg$c54 = function(a, b) { return a + b; }, + peg$c55 = function(d) { + return { type: 'literal', value: strUnescape(d.join('')) }; + }, + peg$c56 = "'", + peg$c57 = peg$literalExpectation("'", false), + peg$c58 = /^[^\\']/, + peg$c59 = peg$classExpectation(["\\", "'"], true, false), + peg$c60 = /^[0-9]/, + peg$c61 = peg$classExpectation([["0", "9"]], false, false), + peg$c62 = function(a, b) { + // Can use `a.flat().join('')` once supported + const leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) }; + }, + peg$c63 = function(i) { return { type: 'literal', value: i }; }, + peg$c64 = "type(", + peg$c65 = peg$literalExpectation("type(", false), + peg$c66 = /^[^ )]/, + peg$c67 = peg$classExpectation([" ", ")"], true, false), + peg$c68 = ")", + peg$c69 = peg$literalExpectation(")", false), + peg$c70 = function(t) { return { type: 'type', value: t.join('') }; }, + peg$c71 = /^[imsu]/, + peg$c72 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c73 = "/", + peg$c74 = peg$literalExpectation("/", false), + peg$c75 = /^[^\/]/, + peg$c76 = peg$classExpectation(["/"], true, false), + peg$c77 = function(d, flgs) { return { + type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') }; + }, + peg$c78 = function(i, is) { + return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)}; + }, + peg$c79 = ":not(", + peg$c80 = peg$literalExpectation(":not(", false), + peg$c81 = function(ss) { return { type: 'not', selectors: ss }; }, + peg$c82 = ":matches(", + peg$c83 = peg$literalExpectation(":matches(", false), + peg$c84 = function(ss) { return { type: 'matches', selectors: ss }; }, + peg$c85 = ":has(", + peg$c86 = peg$literalExpectation(":has(", false), + peg$c87 = function(ss) { return { type: 'has', selectors: ss }; }, + peg$c88 = ":first-child", + peg$c89 = peg$literalExpectation(":first-child", false), + peg$c90 = function() { return nth(1); }, + peg$c91 = ":last-child", + peg$c92 = peg$literalExpectation(":last-child", false), + peg$c93 = function() { return nthLast(1); }, + peg$c94 = ":nth-child(", + peg$c95 = peg$literalExpectation(":nth-child(", false), + peg$c96 = function(n) { return nth(parseInt(n.join(''), 10)); }, + peg$c97 = ":nth-last-child(", + peg$c98 = peg$literalExpectation(":nth-last-child(", false), + peg$c99 = function(n) { return nthLast(parseInt(n.join(''), 10)); }, + peg$c100 = ":", + peg$c101 = peg$literalExpectation(":", false), + peg$c102 = "statement", + peg$c103 = peg$literalExpectation("statement", true), + peg$c104 = "expression", + peg$c105 = peg$literalExpectation("expression", true), + peg$c106 = "declaration", + peg$c107 = peg$literalExpectation("declaration", true), + peg$c108 = "function", + peg$c109 = peg$literalExpectation("function", true), + peg$c110 = "pattern", + peg$c111 = peg$literalExpectation("pattern", true), + peg$c112 = function(c) { + return { type: 'class', name: c }; + }, + + peg$currPos = 0, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$resultsCache = {}, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } + + function error(message, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c1(); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parse_() { + var s0, s1; + + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c8); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseatom() { + var s0; + + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parsewildcard(); + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c26(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c31); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c42; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseidentifierName(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c44(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c45(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c46(s1); + } + s0 = s1; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c47; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c48); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c53); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c49.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c53); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c47; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c48); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c56; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c59); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c53); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c58.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c59); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c51; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c53); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c54(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c56; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c55(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c60.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c62(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsepath() { + var s0, s1; + + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c63(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c64) { + s1 = peg$c64; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c66.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c70(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseflags() { + var s0, s1; + + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c71.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c73; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c75.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c77(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c78(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c79) { + s1 = peg$c79; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c81(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c82) { + s1 = peg$c82; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c83); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c84(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c85) { + s1 = peg$c85; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c86); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c87(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12) === peg$c88) { + s1 = peg$c88; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c89); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c90(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselastChild() { + var s0, s1; + + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c91) { + s1 = peg$c91; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c92); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c93(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c94) { + s1 = peg$c94; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c95); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c96(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c97) { + s1 = peg$c97; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c60.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c68; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c99(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c100; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c101); } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c102) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c103); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c104) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c105); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c106) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c107); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c108) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c109); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c111); } + } + } + } + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c112(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + + function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; } + function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; } + function strUnescape(s) { + return s.replace(/\\(.)/g, function(match, ch) { + switch(ch) { + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + default: return ch; + } + }); + } + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; +}); diff --git a/node_modules/esrecurse/.babelrc b/node_modules/esrecurse/.babelrc new file mode 100644 index 0000000..a0765e1 --- /dev/null +++ b/node_modules/esrecurse/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/node_modules/esrecurse/README.md b/node_modules/esrecurse/README.md new file mode 100644 index 0000000..ffea6b4 --- /dev/null +++ b/node_modules/esrecurse/README.md @@ -0,0 +1,171 @@ +### Esrecurse [![Build Status](https://travis-ci.org/estools/esrecurse.svg?branch=master)](https://travis-ci.org/estools/esrecurse) + +Esrecurse ([esrecurse](https://github.com/estools/esrecurse)) is +[ECMAScript](https://www.ecma-international.org/publications/standards/Ecma-262.htm) +recursive traversing functionality. + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +esrecurse.visit(ast, { + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); +``` + +We can use `Visitor` instance. + +```javascript +var visitor = new esrecurse.Visitor({ + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); + +visitor.visit(ast); +``` + +We can inherit `Visitor` instance easily. + +```javascript +class Derived extends esrecurse.Visitor { + constructor() + { + super(null); + } + + XXXStatement(node) { + } +} +``` + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this /* visitor object automatically becomes this. */); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); +}; +``` + +And you can invoke default visiting operation inside custom visit operation. + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this /* visitor object automatically becomes this. */); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + // do something... + this.visitChildren(node); +}; +``` + +The `childVisitorKeys` option does customize the behaviour of `this.visitChildren(node)`. +We can use user-defined node types. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + // Extending the existing traversing rules. + childVisitorKeys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } + } +); +``` + +We can use the `fallback` option as well. +If the `fallback` option is `"iteration"`, `esrecurse` would visit all enumerable properties of unknown nodes. +Please note circular references cause the stack overflow. AST might have circular references in additional properties for some purpose (e.g. `node.parent`). + +```javascript +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + fallback: 'iteration' + } +); +``` + +If the `fallback` option is a function, `esrecurse` calls this function to determine the enumerable properties of unknown nodes. +Please note circular references cause the stack overflow. AST might have circular references in additional properties for some purpose (e.g. `node.parent`). + +```javascript +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + fallback: function (node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument' + }); + } + } +); +``` + +### License + +Copyright (C) 2014 [Yusuke Suzuki](https://github.com/Constellation) + (twitter: [@Constellation](https://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/esrecurse/esrecurse.js b/node_modules/esrecurse/esrecurse.js new file mode 100644 index 0000000..15d57df --- /dev/null +++ b/node_modules/esrecurse/esrecurse.js @@ -0,0 +1,117 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +(function () { + 'use strict'; + + var estraverse = require('estraverse'); + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + } + + function Visitor(visitor, options) { + options = options || {}; + + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys + ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) + : estraverse.VisitorKeys; + if (options.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof options.fallback === 'function') { + this.__fallback = options.fallback; + } + } + + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + + children = this.__childVisitorKeys[type]; + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + type + '.'); + } + } + + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; + + /* Dispatching node. */ + Visitor.prototype.visit = function (node) { + var type; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; + + exports.version = require('./package.json').version; + exports.Visitor = Visitor; + exports.visit = function (node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/esrecurse/gulpfile.babel.js b/node_modules/esrecurse/gulpfile.babel.js new file mode 100644 index 0000000..aa881c9 --- /dev/null +++ b/node_modules/esrecurse/gulpfile.babel.js @@ -0,0 +1,92 @@ +// Copyright (C) 2014 Yusuke Suzuki +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import gulp from 'gulp'; +import mocha from 'gulp-mocha'; +import eslint from 'gulp-eslint'; +import minimist from 'minimist'; +import git from 'gulp-git'; +import bump from 'gulp-bump'; +import filter from 'gulp-filter'; +import tagVersion from 'gulp-tag-version'; +import 'babel-register'; + +const SOURCE = [ + '*.js' +]; + +let ESLINT_OPTION = { + parser: 'babel-eslint', + parserOptions: { + 'sourceType': 'module' + }, + rules: { + 'quotes': 0, + 'eqeqeq': 0, + 'no-use-before-define': 0, + 'no-shadow': 0, + 'no-new': 0, + 'no-underscore-dangle': 0, + 'no-multi-spaces': 0, + 'no-native-reassign': 0, + 'no-loop-func': 0 + }, + env: { + 'node': true + } +}; + +gulp.task('test', function() { + let options = minimist(process.argv.slice(2), { + string: 'test', + default: { + test: 'test/*.js' + } + } + ); + return gulp.src(options.test).pipe(mocha({reporter: 'spec'})); +}); + +gulp.task('lint', () => + gulp.src(SOURCE) + .pipe(eslint(ESLINT_OPTION)) + .pipe(eslint.formatEach('stylish', process.stderr)) + .pipe(eslint.failOnError()) +); + +let inc = importance => + gulp.src(['./package.json']) + .pipe(bump({type: importance})) + .pipe(gulp.dest('./')) + .pipe(git.commit('Bumps package version')) + .pipe(filter('package.json')) + .pipe(tagVersion({ + prefix: '' + })) +; + +gulp.task('travis', [ 'lint', 'test' ]); +gulp.task('default', [ 'travis' ]); + +gulp.task('patch', [ ], () => inc('patch')); +gulp.task('minor', [ ], () => inc('minor')); +gulp.task('major', [ ], () => inc('major')); diff --git a/node_modules/esrecurse/package.json b/node_modules/esrecurse/package.json new file mode 100755 index 0000000..dec5b1b --- /dev/null +++ b/node_modules/esrecurse/package.json @@ -0,0 +1,52 @@ +{ + "name": "esrecurse", + "description": "ECMAScript AST recursive visitor", + "homepage": "https://github.com/estools/esrecurse", + "main": "esrecurse.js", + "version": "4.3.0", + "engines": { + "node": ">=4.0" + }, + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "https://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/estools/esrecurse.git" + }, + "dependencies": { + "estraverse": "^5.2.0" + }, + "devDependencies": { + "babel-cli": "^6.24.1", + "babel-eslint": "^7.2.3", + "babel-preset-es2015": "^6.24.1", + "babel-register": "^6.24.1", + "chai": "^4.0.2", + "esprima": "^4.0.0", + "gulp": "^3.9.0", + "gulp-bump": "^2.7.0", + "gulp-eslint": "^4.0.0", + "gulp-filter": "^5.0.0", + "gulp-git": "^2.4.1", + "gulp-mocha": "^4.3.1", + "gulp-tag-version": "^1.2.1", + "jsdoc": "^3.3.0-alpha10", + "minimist": "^1.1.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "gulp travis", + "unit-test": "gulp test", + "lint": "gulp lint" + }, + "babel": { + "presets": [ + "es2015" + ] + } +} diff --git a/node_modules/estraverse/.jshintrc b/node_modules/estraverse/.jshintrc new file mode 100644 index 0000000..f642dae --- /dev/null +++ b/node_modules/estraverse/.jshintrc @@ -0,0 +1,16 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "eqnull": true, + "latedef": true, + "noarg": true, + "noempty": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + + "node": true +} diff --git a/node_modules/estraverse/LICENSE.BSD b/node_modules/estraverse/LICENSE.BSD new file mode 100644 index 0000000..3e580c3 --- /dev/null +++ b/node_modules/estraverse/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/estraverse/README.md b/node_modules/estraverse/README.md new file mode 100644 index 0000000..ccd3377 --- /dev/null +++ b/node_modules/estraverse/README.md @@ -0,0 +1,153 @@ +### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.svg)](http://travis-ci.org/estools/estraverse) + +Estraverse ([estraverse](http://github.com/estools/estraverse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +traversal functions from [esmangle project](http://github.com/estools/esmangle). + +### Documentation + +You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage). + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +estraverse.traverse(ast, { + enter: function (node, parent) { + if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration') + return estraverse.VisitorOption.Skip; + }, + leave: function (node, parent) { + if (node.type == 'VariableDeclarator') + console.log(node.id.name); + } +}); +``` + +We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break. + +```javascript +estraverse.traverse(ast, { + enter: function (node) { + this.break(); + } +}); +``` + +And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it. + +```javascript +result = estraverse.replace(tree, { + enter: function (node) { + // Replace it with replaced. + if (node.type === 'Literal') + return replaced; + } +}); +``` + +By passing `visitor.keys` mapping, we can extend estraverse traversing functionality. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Extending the existing traversing rules. + keys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } +}); +``` + +By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Iterating the child **nodes** of unknown nodes. + fallback: 'iteration' +}); +``` + +When `visitor.fallback` is a function, we can determine which keys to visit on each node. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Skip the `argument` property of each node + fallback: function(node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument'; + }); + } +}); +``` + +### License + +Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/estraverse/estraverse.js b/node_modules/estraverse/estraverse.js new file mode 100644 index 0000000..f0d9af9 --- /dev/null +++ b/node_modules/estraverse/estraverse.js @@ -0,0 +1,805 @@ +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + PrivateIdentifier: 'PrivateIdentifier', + Program: 'Program', + Property: 'Property', + PropertyDefinition: 'PropertyDefinition', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + PrivateIdentifier: [], + Program: ['body'], + Property: ['key', 'value'], + PropertyDefinition: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + return false; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/estraverse/gulpfile.js b/node_modules/estraverse/gulpfile.js new file mode 100644 index 0000000..8772bbc --- /dev/null +++ b/node_modules/estraverse/gulpfile.js @@ -0,0 +1,70 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +'use strict'; + +var gulp = require('gulp'), + git = require('gulp-git'), + bump = require('gulp-bump'), + filter = require('gulp-filter'), + tagVersion = require('gulp-tag-version'); + +var TEST = [ 'test/*.js' ]; +var POWERED = [ 'powered-test/*.js' ]; +var SOURCE = [ 'src/**/*.js' ]; + +/** + * Bumping version number and tagging the repository with it. + * Please read http://semver.org/ + * + * You can use the commands + * + * gulp patch # makes v0.1.0 -> v0.1.1 + * gulp feature # makes v0.1.1 -> v0.2.0 + * gulp release # makes v0.2.1 -> v1.0.0 + * + * To bump the version numbers accordingly after you did a patch, + * introduced a feature or made a backwards-incompatible release. + */ + +function inc(importance) { + // get all the files to bump version in + return gulp.src(['./package.json']) + // bump the version number in those files + .pipe(bump({type: importance})) + // save it back to filesystem + .pipe(gulp.dest('./')) + // commit the changed version number + .pipe(git.commit('Bumps package version')) + // read only one file to get the version number + .pipe(filter('package.json')) + // **tag it in the repository** + .pipe(tagVersion({ + prefix: '' + })); +} + +gulp.task('patch', [ ], function () { return inc('patch'); }) +gulp.task('minor', [ ], function () { return inc('minor'); }) +gulp.task('major', [ ], function () { return inc('major'); }) diff --git a/node_modules/estraverse/package.json b/node_modules/estraverse/package.json new file mode 100644 index 0000000..a863218 --- /dev/null +++ b/node_modules/estraverse/package.json @@ -0,0 +1,40 @@ +{ + "name": "estraverse", + "description": "ECMAScript JS AST traversal functions", + "homepage": "https://github.com/estools/estraverse", + "main": "estraverse.js", + "version": "5.3.0", + "engines": { + "node": ">=4.0" + }, + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/estraverse.git" + }, + "devDependencies": { + "babel-preset-env": "^1.6.1", + "babel-register": "^6.3.13", + "chai": "^2.1.1", + "espree": "^1.11.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.2.2", + "gulp-filter": "^2.0.0", + "gulp-git": "^1.0.1", + "gulp-tag-version": "^1.3.0", + "jshint": "^2.5.6", + "mocha": "^2.1.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint estraverse.js", + "unit-test": "mocha --compilers js:babel-register" + } +} diff --git a/node_modules/esutils/LICENSE.BSD b/node_modules/esutils/LICENSE.BSD new file mode 100644 index 0000000..3e580c3 --- /dev/null +++ b/node_modules/esutils/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/esutils/README.md b/node_modules/esutils/README.md new file mode 100644 index 0000000..517526c --- /dev/null +++ b/node_modules/esutils/README.md @@ -0,0 +1,174 @@ +### esutils [![Build Status](https://secure.travis-ci.org/estools/esutils.svg)](http://travis-ci.org/estools/esutils) +esutils ([esutils](http://github.com/estools/esutils)) is +utility box for ECMAScript language tools. + +### API + +### ast + +#### ast.isExpression(node) + +Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section +[11](https://es5.github.io/#x11). + +#### ast.isStatement(node) + +Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section +[12](https://es5.github.io/#x12). + +#### ast.isIterationStatement(node) + +Returns true if `node` is an IterationStatement as defined in ECMA262 edition +5.1 section [12.6](https://es5.github.io/#x12.6). + +#### ast.isSourceElement(node) + +Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1 +section [14](https://es5.github.io/#x14). + +#### ast.trailingStatement(node) + +Returns `Statement?` if `node` has trailing `Statement`. +```js +if (cond) + consequent; +``` +When taking this `IfStatement`, returns `consequent;` statement. + +#### ast.isProblematicIfStatement(node) + +Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code. +```js +{ + type: 'IfStatement', + consequent: { + type: 'WithStatement', + body: { + type: 'IfStatement', + consequent: {type: 'EmptyStatement'} + } + }, + alternate: {type: 'EmptyStatement'} +} +``` +The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`. + + +### code + +#### code.isDecimalDigit(code) + +Return true if provided code is decimal digit. + +#### code.isHexDigit(code) + +Return true if provided code is hexadecimal digit. + +#### code.isOctalDigit(code) + +Return true if provided code is octal digit. + +#### code.isWhiteSpace(code) + +Return true if provided code is white space. White space characters are formally defined in ECMA262. + +#### code.isLineTerminator(code) + +Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262. + +#### code.isIdentifierStart(code) + +Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262. + +#### code.isIdentifierPart(code) + +Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262. + +### keyword + +#### keyword.isKeywordES5(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 5.1. They are formally defined in ECMA262 sections +[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isKeywordES6(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 6. They are formally defined in ECMA262 sections +[11.6.2.1](http://ecma-international.org/ecma-262/6.0/#sec-keywords) and +[11.6.2.2](http://ecma-international.org/ecma-262/6.0/#sec-future-reserved-words), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isReservedWordES5(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1. +They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isReservedWordES6(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6. +They are formally defined in ECMA262 section [11.6.2](http://ecma-international.org/ecma-262/6.0/#sec-reserved-words). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isRestrictedWord(id) + +Returns `true` if provided identifier string is one of `eval` or `arguments`. +They are restricted in strict mode code throughout ECMA262 edition 5.1 and +in ECMA262 edition 6 section [12.1.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers-static-semantics-early-errors). + +#### keyword.isIdentifierNameES5(id) + +Return true if provided identifier string is an IdentifierName as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). + +#### keyword.isIdentifierNameES6(id) + +Return true if provided identifier string is an IdentifierName as specified in +ECMA262 edition 6 section [11.6](http://ecma-international.org/ecma-262/6.0/#sec-names-and-keywords). + +#### keyword.isIdentifierES5(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict` +flag is truthy, this function additionally checks whether `id` is an Identifier +under strict mode. + +#### keyword.isIdentifierES6(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 6 section [12.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers). +If the `strict` flag is truthy, this function additionally checks whether `id` +is an Identifier under strict mode. + +### License + +Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/esutils/lib/ast.js b/node_modules/esutils/lib/ast.js new file mode 100644 index 0000000..8faadae --- /dev/null +++ b/node_modules/esutils/lib/ast.js @@ -0,0 +1,144 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + function isExpression(node) { + if (node == null) { return false; } + switch (node.type) { + case 'ArrayExpression': + case 'AssignmentExpression': + case 'BinaryExpression': + case 'CallExpression': + case 'ConditionalExpression': + case 'FunctionExpression': + case 'Identifier': + case 'Literal': + case 'LogicalExpression': + case 'MemberExpression': + case 'NewExpression': + case 'ObjectExpression': + case 'SequenceExpression': + case 'ThisExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return true; + } + return false; + } + + function isIterationStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'DoWhileStatement': + case 'ForInStatement': + case 'ForStatement': + case 'WhileStatement': + return true; + } + return false; + } + + function isStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'BlockStatement': + case 'BreakStatement': + case 'ContinueStatement': + case 'DebuggerStatement': + case 'DoWhileStatement': + case 'EmptyStatement': + case 'ExpressionStatement': + case 'ForInStatement': + case 'ForStatement': + case 'IfStatement': + case 'LabeledStatement': + case 'ReturnStatement': + case 'SwitchStatement': + case 'ThrowStatement': + case 'TryStatement': + case 'VariableDeclaration': + case 'WhileStatement': + case 'WithStatement': + return true; + } + return false; + } + + function isSourceElement(node) { + return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; + } + + function trailingStatement(node) { + switch (node.type) { + case 'IfStatement': + if (node.alternate != null) { + return node.alternate; + } + return node.consequent; + + case 'LabeledStatement': + case 'ForStatement': + case 'ForInStatement': + case 'WhileStatement': + case 'WithStatement': + return node.body; + } + return null; + } + + function isProblematicIfStatement(node) { + var current; + + if (node.type !== 'IfStatement') { + return false; + } + if (node.alternate == null) { + return false; + } + current = node.consequent; + do { + if (current.type === 'IfStatement') { + if (current.alternate == null) { + return true; + } + } + current = trailingStatement(current); + } while (current); + + return false; + } + + module.exports = { + isExpression: isExpression, + isStatement: isStatement, + isIterationStatement: isIterationStatement, + isSourceElement: isSourceElement, + isProblematicIfStatement: isProblematicIfStatement, + + trailingStatement: trailingStatement + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/esutils/lib/code.js b/node_modules/esutils/lib/code.js new file mode 100644 index 0000000..23136af --- /dev/null +++ b/node_modules/esutils/lib/code.js @@ -0,0 +1,135 @@ +/* + Copyright (C) 2013-2014 Yusuke Suzuki + Copyright (C) 2014 Ivan Nikulin + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; + + // See `tools/generate-identifier-regex.js`. + ES5Regex = { + // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\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-\u08B4\u08B6-\u08BD\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\u0AF9\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-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\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-\u13F5\u13F8-\u13FD\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-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\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-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\uAB70-\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]/, + // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u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\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\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-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + }; + + ES6Regex = { + // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\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-\u08B4\u08B6-\u08BD\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\u0AF9\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-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\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-\u13F5\u13F8-\u13FD\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\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\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\u2118-\u211D\u2124\u2126\u2128\u212A-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\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E7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, + // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE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uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72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D]|\uDB40[\uDD00-\uDDEF]/ + }; + + function isDecimalDigit(ch) { + return 0x30 <= ch && ch <= 0x39; // 0..9 + } + + function isHexDigit(ch) { + return 0x30 <= ch && ch <= 0x39 || // 0..9 + 0x61 <= ch && ch <= 0x66 || // a..f + 0x41 <= ch && ch <= 0x46; // A..F + } + + function isOctalDigit(ch) { + return ch >= 0x30 && ch <= 0x37; // 0..7 + } + + // 7.2 White Space + + NON_ASCII_WHITESPACES = [ + 0x1680, + 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, + 0x202F, 0x205F, + 0x3000, + 0xFEFF + ]; + + function isWhiteSpace(ch) { + return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || + ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; + } + + // 7.6 Identifier Names and Identifiers + + function fromCodePoint(cp) { + if (cp <= 0xFFFF) { return String.fromCharCode(cp); } + var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); + var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00); + return cu1 + cu2; + } + + IDENTIFIER_START = new Array(0x80); + for(ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_START[ch] = + ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + IDENTIFIER_PART = new Array(0x80); + for(ch = 0; ch < 0x80; ++ch) { + IDENTIFIER_PART[ch] = + ch >= 0x61 && ch <= 0x7A || // a..z + ch >= 0x41 && ch <= 0x5A || // A..Z + ch >= 0x30 && ch <= 0x39 || // 0..9 + ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) + } + + function isIdentifierStartES5(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES5(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + function isIdentifierStartES6(ch) { + return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); + } + + function isIdentifierPartES6(ch) { + return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); + } + + module.exports = { + isDecimalDigit: isDecimalDigit, + isHexDigit: isHexDigit, + isOctalDigit: isOctalDigit, + isWhiteSpace: isWhiteSpace, + isLineTerminator: isLineTerminator, + isIdentifierStartES5: isIdentifierStartES5, + isIdentifierPartES5: isIdentifierPartES5, + isIdentifierStartES6: isIdentifierStartES6, + isIdentifierPartES6: isIdentifierPartES6 + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/esutils/lib/keyword.js b/node_modules/esutils/lib/keyword.js new file mode 100644 index 0000000..13c8c6a --- /dev/null +++ b/node_modules/esutils/lib/keyword.js @@ -0,0 +1,165 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var code = require('./code'); + + function isStrictModeReservedWordES6(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'let': + return true; + default: + return false; + } + } + + function isKeywordES5(id, strict) { + // yield should not be treated as keyword under non-strict mode. + if (!strict && id === 'yield') { + return false; + } + return isKeywordES6(id, strict); + } + + function isKeywordES6(id, strict) { + if (strict && isStrictModeReservedWordES6(id)) { + return true; + } + + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } + + function isReservedWordES5(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); + } + + function isReservedWordES6(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + function isIdentifierNameES5(id) { + var i, iz, ch; + + if (id.length === 0) { return false; } + + ch = id.charCodeAt(0); + if (!code.isIdentifierStartES5(ch)) { + return false; + } + + for (i = 1, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (!code.isIdentifierPartES5(ch)) { + return false; + } + } + return true; + } + + function decodeUtf16(lead, trail) { + return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + } + + function isIdentifierNameES6(id) { + var i, iz, ch, lowCh, check; + + if (id.length === 0) { return false; } + + check = code.isIdentifierStartES6; + for (i = 0, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (0xD800 <= ch && ch <= 0xDBFF) { + ++i; + if (i >= iz) { return false; } + lowCh = id.charCodeAt(i); + if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { + return false; + } + ch = decodeUtf16(ch, lowCh); + } + if (!check(ch)) { + return false; + } + check = code.isIdentifierPartES6; + } + return true; + } + + function isIdentifierES5(id, strict) { + return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); + } + + function isIdentifierES6(id, strict) { + return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); + } + + module.exports = { + isKeywordES5: isKeywordES5, + isKeywordES6: isKeywordES6, + isReservedWordES5: isReservedWordES5, + isReservedWordES6: isReservedWordES6, + isRestrictedWord: isRestrictedWord, + isIdentifierNameES5: isIdentifierNameES5, + isIdentifierNameES6: isIdentifierNameES6, + isIdentifierES5: isIdentifierES5, + isIdentifierES6: isIdentifierES6 + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/esutils/lib/utils.js b/node_modules/esutils/lib/utils.js new file mode 100644 index 0000000..ce18faa --- /dev/null +++ b/node_modules/esutils/lib/utils.js @@ -0,0 +1,33 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +(function () { + 'use strict'; + + exports.ast = require('./ast'); + exports.code = require('./code'); + exports.keyword = require('./keyword'); +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/esutils/package.json b/node_modules/esutils/package.json new file mode 100644 index 0000000..8396f4c --- /dev/null +++ b/node_modules/esutils/package.json @@ -0,0 +1,44 @@ +{ + "name": "esutils", + "description": "utility box for ECMAScript language tools", + "homepage": "https://github.com/estools/esutils", + "main": "lib/utils.js", + "version": "2.0.3", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "LICENSE.BSD", + "README.md", + "lib" + ], + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/esutils.git" + }, + "devDependencies": { + "chai": "~1.7.2", + "coffee-script": "~1.6.3", + "jshint": "2.6.3", + "mocha": "~2.2.1", + "regenerate": "~1.3.1", + "unicode-9.0.0": "~0.7.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint lib/*.js", + "unit-test": "mocha --compilers coffee:coffee-script -R spec", + "generate-regex": "node tools/generate-identifier-regex.js" + } +} diff --git a/node_modules/fast-deep-equal/LICENSE b/node_modules/fast-deep-equal/LICENSE new file mode 100644 index 0000000..7f15435 --- /dev/null +++ b/node_modules/fast-deep-equal/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +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/fast-deep-equal/README.md b/node_modules/fast-deep-equal/README.md new file mode 100644 index 0000000..d3f4ffc --- /dev/null +++ b/node_modules/fast-deep-equal/README.md @@ -0,0 +1,96 @@ +# fast-deep-equal +The fastest deep equal with ES6 Map, Set and Typed arrays support. + +[![Build Status](https://travis-ci.org/epoberezkin/fast-deep-equal.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-deep-equal) +[![npm](https://img.shields.io/npm/v/fast-deep-equal.svg)](https://www.npmjs.com/package/fast-deep-equal) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-deep-equal/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-deep-equal?branch=master) + + +## Install + +```bash +npm install fast-deep-equal +``` + + +## Features + +- ES5 compatible +- works in node.js (8+) and browsers (IE9+) +- checks equality of Date and RegExp objects by value. + +ES6 equal (`require('fast-deep-equal/es6')`) also supports: +- Maps +- Sets +- Typed arrays + + +## Usage + +```javascript +var equal = require('fast-deep-equal'); +console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true +``` + +To support ES6 Maps, Sets and Typed arrays equality use: + +```javascript +var equal = require('fast-deep-equal/es6'); +console.log(equal(Int16Array([1, 2]), Int16Array([1, 2]))); // true +``` + +To use with React (avoiding the traversal of React elements' _owner +property that contains circular references and is not needed when +comparing the elements - borrowed from [react-fast-compare](https://github.com/FormidableLabs/react-fast-compare)): + +```javascript +var equal = require('fast-deep-equal/react'); +var equal = require('fast-deep-equal/es6/react'); +``` + + +## Performance benchmark + +Node.js v12.6.0: + +``` +fast-deep-equal x 261,950 ops/sec ±0.52% (89 runs sampled) +fast-deep-equal/es6 x 212,991 ops/sec ±0.34% (92 runs sampled) +fast-equals x 230,957 ops/sec ±0.83% (85 runs sampled) +nano-equal x 187,995 ops/sec ±0.53% (88 runs sampled) +shallow-equal-fuzzy x 138,302 ops/sec ±0.49% (90 runs sampled) +underscore.isEqual x 74,423 ops/sec ±0.38% (89 runs sampled) +lodash.isEqual x 36,637 ops/sec ±0.72% (90 runs sampled) +deep-equal x 2,310 ops/sec ±0.37% (90 runs sampled) +deep-eql x 35,312 ops/sec ±0.67% (91 runs sampled) +ramda.equals x 12,054 ops/sec ±0.40% (91 runs sampled) +util.isDeepStrictEqual x 46,440 ops/sec ±0.43% (90 runs sampled) +assert.deepStrictEqual x 456 ops/sec ±0.71% (88 runs sampled) + +The fastest is fast-deep-equal +``` + +To run benchmark (requires node.js 6+): + +```bash +npm run benchmark +``` + +__Please note__: this benchmark runs against the available test cases. To choose the most performant library for your application, it is recommended to benchmark against your data and to NOT expect this benchmark to reflect the performance difference in your application. + + +## Enterprise support + +fast-deep-equal package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-deep-equal?utm_source=npm-fast-deep-equal&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + +## License + +[MIT](https://github.com/epoberezkin/fast-deep-equal/blob/master/LICENSE) diff --git a/node_modules/fast-deep-equal/es6/index.d.ts b/node_modules/fast-deep-equal/es6/index.d.ts new file mode 100644 index 0000000..c7eb9c7 --- /dev/null +++ b/node_modules/fast-deep-equal/es6/index.d.ts @@ -0,0 +1,2 @@ +declare const equal: (a: any, b: any) => boolean; +export = equal; diff --git a/node_modules/fast-deep-equal/es6/index.js b/node_modules/fast-deep-equal/es6/index.js new file mode 100644 index 0000000..d980be2 --- /dev/null +++ b/node_modules/fast-deep-equal/es6/index.js @@ -0,0 +1,72 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + if ((a instanceof Map) && (b instanceof Map)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + for (i of a.entries()) + if (!equal(i[1], b.get(i[0]))) return false; + return true; + } + + if ((a instanceof Set) && (b instanceof Set)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + return true; + } + + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (a[i] !== b[i]) return false; + return true; + } + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/node_modules/fast-deep-equal/es6/react.d.ts b/node_modules/fast-deep-equal/es6/react.d.ts new file mode 100644 index 0000000..c7eb9c7 --- /dev/null +++ b/node_modules/fast-deep-equal/es6/react.d.ts @@ -0,0 +1,2 @@ +declare const equal: (a: any, b: any) => boolean; +export = equal; diff --git a/node_modules/fast-deep-equal/es6/react.js b/node_modules/fast-deep-equal/es6/react.js new file mode 100644 index 0000000..98e2f9b --- /dev/null +++ b/node_modules/fast-deep-equal/es6/react.js @@ -0,0 +1,79 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + if ((a instanceof Map) && (b instanceof Map)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + for (i of a.entries()) + if (!equal(i[1], b.get(i[0]))) return false; + return true; + } + + if ((a instanceof Set) && (b instanceof Set)) { + if (a.size !== b.size) return false; + for (i of a.entries()) + if (!b.has(i[0])) return false; + return true; + } + + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (a[i] !== b[i]) return false; + return true; + } + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (key === '_owner' && a.$$typeof) { + // React-specific: avoid traversing React elements' _owner. + // _owner contains circular references + // and is not needed when comparing the actual elements (and not their owners) + continue; + } + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/node_modules/fast-deep-equal/index.d.ts b/node_modules/fast-deep-equal/index.d.ts new file mode 100644 index 0000000..3c042ca --- /dev/null +++ b/node_modules/fast-deep-equal/index.d.ts @@ -0,0 +1,4 @@ +declare module 'fast-deep-equal' { + const equal: (a: any, b: any) => boolean; + export = equal; +} diff --git a/node_modules/fast-deep-equal/index.js b/node_modules/fast-deep-equal/index.js new file mode 100644 index 0000000..30dd1ba --- /dev/null +++ b/node_modules/fast-deep-equal/index.js @@ -0,0 +1,46 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/node_modules/fast-deep-equal/package.json b/node_modules/fast-deep-equal/package.json new file mode 100644 index 0000000..3cfe66c --- /dev/null +++ b/node_modules/fast-deep-equal/package.json @@ -0,0 +1,61 @@ +{ + "name": "fast-deep-equal", + "version": "3.1.3", + "description": "Fast deep equal", + "main": "index.js", + "scripts": { + "eslint": "eslint *.js benchmark/*.js spec/*.js", + "build": "node build", + "benchmark": "npm i && npm run build && cd ./benchmark && npm i && node ./", + "test-spec": "mocha spec/*.spec.js -R spec", + "test-cov": "nyc npm run test-spec", + "test-ts": "tsc --target ES5 --noImplicitAny index.d.ts", + "test": "npm run build && npm run eslint && npm run test-ts && npm run test-cov", + "prepublish": "npm run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/fast-deep-equal.git" + }, + "keywords": [ + "fast", + "equal", + "deep-equal" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/fast-deep-equal/issues" + }, + "homepage": "https://github.com/epoberezkin/fast-deep-equal#readme", + "devDependencies": { + "coveralls": "^3.1.0", + "dot": "^1.1.2", + "eslint": "^7.2.0", + "mocha": "^7.2.0", + "nyc": "^15.1.0", + "pre-commit": "^1.2.2", + "react": "^16.12.0", + "react-test-renderer": "^16.12.0", + "sinon": "^9.0.2", + "typescript": "^3.9.5" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "files": [ + "index.js", + "index.d.ts", + "react.js", + "react.d.ts", + "es6/" + ], + "types": "index.d.ts" +} diff --git a/node_modules/fast-deep-equal/react.d.ts b/node_modules/fast-deep-equal/react.d.ts new file mode 100644 index 0000000..c7eb9c7 --- /dev/null +++ b/node_modules/fast-deep-equal/react.d.ts @@ -0,0 +1,2 @@ +declare const equal: (a: any, b: any) => boolean; +export = equal; diff --git a/node_modules/fast-deep-equal/react.js b/node_modules/fast-deep-equal/react.js new file mode 100644 index 0000000..3489b98 --- /dev/null +++ b/node_modules/fast-deep-equal/react.js @@ -0,0 +1,53 @@ +'use strict'; + +// do not edit .js files directly - edit src/index.jst + + + +module.exports = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (key === '_owner' && a.$$typeof) { + // React-specific: avoid traversing React elements' _owner. + // _owner contains circular references + // and is not needed when comparing the actual elements (and not their owners) + continue; + } + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; diff --git a/node_modules/fast-json-stable-stringify/.eslintrc.yml b/node_modules/fast-json-stable-stringify/.eslintrc.yml new file mode 100644 index 0000000..1c77b0d --- /dev/null +++ b/node_modules/fast-json-stable-stringify/.eslintrc.yml @@ -0,0 +1,26 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + callback-return: 2 + dot-notation: 2 + indent: 2 + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 + no-useless-escape: 2 diff --git a/node_modules/fast-json-stable-stringify/.github/FUNDING.yml b/node_modules/fast-json-stable-stringify/.github/FUNDING.yml new file mode 100644 index 0000000..61f9daa --- /dev/null +++ b/node_modules/fast-json-stable-stringify/.github/FUNDING.yml @@ -0,0 +1 @@ +tidelift: "npm/fast-json-stable-stringify" diff --git a/node_modules/fast-json-stable-stringify/.travis.yml b/node_modules/fast-json-stable-stringify/.travis.yml new file mode 100644 index 0000000..b61e8f0 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "8" + - "10" + - "12" + - "13" +after_script: + - coveralls < coverage/lcov.info diff --git a/node_modules/fast-json-stable-stringify/LICENSE b/node_modules/fast-json-stable-stringify/LICENSE new file mode 100644 index 0000000..c932223 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/LICENSE @@ -0,0 +1,21 @@ +This software is released under the MIT license: + +Copyright (c) 2017 Evgeny Poberezkin +Copyright (c) 2013 James Halliday + +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/fast-json-stable-stringify/README.md b/node_modules/fast-json-stable-stringify/README.md new file mode 100644 index 0000000..02cf49f --- /dev/null +++ b/node_modules/fast-json-stable-stringify/README.md @@ -0,0 +1,131 @@ +# fast-json-stable-stringify + +Deterministic `JSON.stringify()` - a faster version of [@substack](https://github.com/substack)'s json-stable-strigify without [jsonify](https://github.com/substack/jsonify). + +You can also pass in a custom comparison function. + +[![Build Status](https://travis-ci.org/epoberezkin/fast-json-stable-stringify.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-json-stable-stringify) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-json-stable-stringify/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-json-stable-stringify?branch=master) + +# example + +``` js +var stringify = require('fast-json-stable-stringify'); +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +console.log(stringify(obj)); +``` + +output: + +``` +{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8} +``` + + +# methods + +``` js +var stringify = require('fast-json-stable-stringify') +``` + +## var str = stringify(obj, opts) + +Return a deterministic stringified string `str` from the object `obj`. + + +## options + +### cmp + +If `opts` is given, you can supply an `opts.cmp` to have a custom comparison +function for object keys. Your function `opts.cmp` is called with these +parameters: + +``` js +opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue }) +``` + +For example, to sort on the object key names in reverse order you could write: + +``` js +var stringify = require('fast-json-stable-stringify'); + +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; +}); +console.log(s); +``` + +which results in the output string: + +``` +{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3} +``` + +Or if you wanted to sort on the object values in reverse order, you could write: + +``` +var stringify = require('fast-json-stable-stringify'); + +var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; +var s = stringify(obj, function (a, b) { + return a.value < b.value ? 1 : -1; +}); +console.log(s); +``` + +which outputs: + +``` +{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10} +``` + +### cycles + +Pass `true` in `opts.cycles` to stringify circular property as `__cycle__` - the result will not be a valid JSON string in this case. + +TypeError will be thrown in case of circular object without this option. + + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install fast-json-stable-stringify +``` + + +# benchmark + +To run benchmark (requires Node.js 6+): +``` +node benchmark +``` + +Results: +``` +fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled) +json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled) +fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled) +faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled) +The fastest is fast-stable-stringify +``` + + +## Enterprise support + +fast-json-stable-stringify package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-json-stable-stringify?utm_source=npm-fast-json-stable-stringify&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + +# license + +[MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE) diff --git a/node_modules/fast-json-stable-stringify/benchmark/index.js b/node_modules/fast-json-stable-stringify/benchmark/index.js new file mode 100644 index 0000000..e725f9f --- /dev/null +++ b/node_modules/fast-json-stable-stringify/benchmark/index.js @@ -0,0 +1,31 @@ +'use strict'; + +const Benchmark = require('benchmark'); +const suite = new Benchmark.Suite; +const testData = require('./test.json'); + + +const stringifyPackages = { + // 'JSON.stringify': JSON.stringify, + 'fast-json-stable-stringify': require('../index'), + 'json-stable-stringify': true, + 'fast-stable-stringify': true, + 'faster-stable-stringify': true +}; + + +for (const name in stringifyPackages) { + let func = stringifyPackages[name]; + if (func === true) func = require(name); + + suite.add(name, function() { + func(testData); + }); +} + +suite + .on('cycle', (event) => console.log(String(event.target))) + .on('complete', function () { + console.log('The fastest is ' + this.filter('fastest').map('name')); + }) + .run({async: true}); diff --git a/node_modules/fast-json-stable-stringify/benchmark/test.json b/node_modules/fast-json-stable-stringify/benchmark/test.json new file mode 100644 index 0000000..c9118c1 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/benchmark/test.json @@ -0,0 +1,137 @@ +[ + { + "_id": "59ef4a83ee8364808d761beb", + "index": 0, + "guid": "e50ffae9-7128-4148-9ee5-40c3fc523c5d", + "isActive": false, + "balance": "$2,341.81", + "picture": "http://placehold.it/32x32", + "age": 28, + "eyeColor": "brown", + "name": "Carey Savage", + "gender": "female", + "company": "VERAQ", + "email": "careysavage@veraq.com", + "phone": "+1 (897) 574-3014", + "address": "458 Willow Street, Henrietta, California, 7234", + "about": "Nisi reprehenderit nulla ad officia pariatur non dolore laboris irure cupidatat laborum. Minim eu ex Lorem adipisicing exercitation irure minim sunt est enim mollit incididunt voluptate nulla. Ut mollit anim reprehenderit et aliqua ex esse aliquip. Aute sit duis deserunt do incididunt consequat minim qui dolor commodo deserunt et voluptate.\r\n", + "registered": "2014-05-21T01:56:51 -01:00", + "latitude": 63.89502, + "longitude": 62.369807, + "tags": [ + "nostrud", + "nisi", + "consectetur", + "ullamco", + "cupidatat", + "culpa", + "commodo" + ], + "friends": [ + { + "id": 0, + "name": "Henry Walls" + }, + { + "id": 1, + "name": "Janice Baker" + }, + { + "id": 2, + "name": "Russell Bush" + } + ], + "greeting": "Hello, Carey Savage! You have 4 unread messages.", + "favoriteFruit": "banana" + }, + { + "_id": "59ef4a83ff5774a691454e89", + "index": 1, + "guid": "2bee9efc-4095-4c2e-87ef-d08c8054c89d", + "isActive": true, + "balance": "$1,618.15", + "picture": "http://placehold.it/32x32", + "age": 35, + "eyeColor": "blue", + "name": "Elinor Pearson", + "gender": "female", + "company": "FLEXIGEN", + "email": "elinorpearson@flexigen.com", + "phone": "+1 (923) 548-3751", + "address": "600 Bayview Avenue, Draper, Montana, 3088", + "about": "Mollit commodo ea sit Lorem velit. Irure anim esse Lorem sint quis officia ut. Aliqua nisi dolore in aute deserunt mollit ex ea in mollit.\r\n", + "registered": "2017-04-22T07:58:41 -01:00", + "latitude": -87.824919, + "longitude": 69.538927, + "tags": [ + "fugiat", + "labore", + "proident", + "quis", + "eiusmod", + "qui", + "est" + ], + "friends": [ + { + "id": 0, + "name": "Massey Wagner" + }, + { + "id": 1, + "name": "Marcella Ferrell" + }, + { + "id": 2, + "name": "Evans Mckee" + } + ], + "greeting": "Hello, Elinor Pearson! You have 3 unread messages.", + "favoriteFruit": "strawberry" + }, + { + "_id": "59ef4a839ec8a4be4430b36b", + "index": 2, + "guid": "ddd6e8c0-95bd-416d-8b46-a768d6363809", + "isActive": false, + "balance": "$2,046.95", + "picture": "http://placehold.it/32x32", + "age": 40, + "eyeColor": "green", + "name": "Irwin Davidson", + "gender": "male", + "company": "DANJA", + "email": "irwindavidson@danja.com", + "phone": "+1 (883) 537-2041", + "address": "439 Cook Street, Chapin, Kentucky, 7398", + "about": "Irure velit non commodo aliqua exercitation ut nostrud minim magna. Dolor ad ad ut irure eu. Non pariatur dolor eiusmod ipsum do et exercitation cillum. Et amet laboris minim eiusmod ullamco magna ea reprehenderit proident sunt.\r\n", + "registered": "2016-09-01T07:49:08 -01:00", + "latitude": -49.803812, + "longitude": 104.93279, + "tags": [ + "consequat", + "enim", + "quis", + "magna", + "est", + "culpa", + "tempor" + ], + "friends": [ + { + "id": 0, + "name": "Ruth Hansen" + }, + { + "id": 1, + "name": "Kathrine Austin" + }, + { + "id": 2, + "name": "Rivera Munoz" + } + ], + "greeting": "Hello, Irwin Davidson! You have 2 unread messages.", + "favoriteFruit": "banana" + } +] diff --git a/node_modules/fast-json-stable-stringify/example/key_cmp.js b/node_modules/fast-json-stable-stringify/example/key_cmp.js new file mode 100644 index 0000000..d5f6675 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/example/key_cmp.js @@ -0,0 +1,7 @@ +var stringify = require('../'); + +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; +}); +console.log(s); diff --git a/node_modules/fast-json-stable-stringify/example/nested.js b/node_modules/fast-json-stable-stringify/example/nested.js new file mode 100644 index 0000000..9a672fc --- /dev/null +++ b/node_modules/fast-json-stable-stringify/example/nested.js @@ -0,0 +1,3 @@ +var stringify = require('../'); +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/str.js b/node_modules/fast-json-stable-stringify/example/str.js new file mode 100644 index 0000000..9b4b3cd --- /dev/null +++ b/node_modules/fast-json-stable-stringify/example/str.js @@ -0,0 +1,3 @@ +var stringify = require('../'); +var obj = { c: 6, b: [4,5], a: 3 }; +console.log(stringify(obj)); diff --git a/node_modules/fast-json-stable-stringify/example/value_cmp.js b/node_modules/fast-json-stable-stringify/example/value_cmp.js new file mode 100644 index 0000000..09f1c5f --- /dev/null +++ b/node_modules/fast-json-stable-stringify/example/value_cmp.js @@ -0,0 +1,7 @@ +var stringify = require('../'); + +var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; +var s = stringify(obj, function (a, b) { + return a.value < b.value ? 1 : -1; +}); +console.log(s); diff --git a/node_modules/fast-json-stable-stringify/index.d.ts b/node_modules/fast-json-stable-stringify/index.d.ts new file mode 100644 index 0000000..23e46ca --- /dev/null +++ b/node_modules/fast-json-stable-stringify/index.d.ts @@ -0,0 +1,4 @@ +declare module 'fast-json-stable-stringify' { + function stringify(obj: any): string; + export = stringify; +} diff --git a/node_modules/fast-json-stable-stringify/index.js b/node_modules/fast-json-stable-stringify/index.js new file mode 100644 index 0000000..c44e6a4 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/index.js @@ -0,0 +1,59 @@ +'use strict'; + +module.exports = function (data, opts) { + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; + + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); + + var seen = []; + return (function stringify (node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + + if (node === undefined) return; + if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') return JSON.stringify(node); + + var i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) out += ','; + out += stringify(node[i]) || 'null'; + } + return out + ']'; + } + + if (node === null) return 'null'; + + if (seen.indexOf(node) !== -1) { + if (cycles) return JSON.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } + + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ''; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node[key]); + + if (!value) continue; + if (out) out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return '{' + out + '}'; + })(data); +}; diff --git a/node_modules/fast-json-stable-stringify/package.json b/node_modules/fast-json-stable-stringify/package.json new file mode 100644 index 0000000..ad2c8bf --- /dev/null +++ b/node_modules/fast-json-stable-stringify/package.json @@ -0,0 +1,52 @@ +{ + "name": "fast-json-stable-stringify", + "version": "2.1.0", + "description": "deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify", + "main": "index.js", + "types": "index.d.ts", + "dependencies": {}, + "devDependencies": { + "benchmark": "^2.1.4", + "coveralls": "^3.0.0", + "eslint": "^6.7.0", + "fast-stable-stringify": "latest", + "faster-stable-stringify": "latest", + "json-stable-stringify": "latest", + "nyc": "^14.1.0", + "pre-commit": "^1.2.2", + "tape": "^4.11.0" + }, + "scripts": { + "eslint": "eslint index.js test", + "test-spec": "tape test/*.js", + "test": "npm run eslint && nyc npm run test-spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/epoberezkin/fast-json-stable-stringify.git" + }, + "homepage": "https://github.com/epoberezkin/fast-json-stable-stringify", + "keywords": [ + "json", + "stringify", + "deterministic", + "hash", + "stable" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "nyc": { + "exclude": [ + "test", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + } +} diff --git a/node_modules/fast-json-stable-stringify/test/cmp.js b/node_modules/fast-json-stable-stringify/test/cmp.js new file mode 100644 index 0000000..4efd6b5 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/test/cmp.js @@ -0,0 +1,13 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('custom comparison function', function (t) { + t.plan(1); + var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; + var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; + }); + t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}'); +}); diff --git a/node_modules/fast-json-stable-stringify/test/nested.js b/node_modules/fast-json-stable-stringify/test/nested.js new file mode 100644 index 0000000..167a358 --- /dev/null +++ b/node_modules/fast-json-stable-stringify/test/nested.js @@ -0,0 +1,44 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('nested', function (t) { + t.plan(1); + var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; + t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}'); +}); + +test('cyclic (default)', function (t) { + t.plan(1); + var one = { a: 1 }; + var two = { a: 2, one: one }; + one.two = two; + try { + stringify(one); + } catch (ex) { + t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON'); + } +}); + +test('cyclic (specifically allowed)', function (t) { + t.plan(1); + var one = { a: 1 }; + var two = { a: 2, one: one }; + one.two = two; + t.equal(stringify(one, {cycles:true}), '{"a":1,"two":{"a":2,"one":"__cycle__"}}'); +}); + +test('repeated non-cyclic value', function(t) { + t.plan(1); + var one = { x: 1 }; + var two = { a: one, b: one }; + t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}'); +}); + +test('acyclic but with reused obj-property pointers', function (t) { + t.plan(1); + var x = { a: 1 }; + var y = { b: x, c: x }; + t.equal(stringify(y), '{"b":{"a":1},"c":{"a":1}}'); +}); diff --git a/node_modules/fast-json-stable-stringify/test/str.js b/node_modules/fast-json-stable-stringify/test/str.js new file mode 100644 index 0000000..99a9ade --- /dev/null +++ b/node_modules/fast-json-stable-stringify/test/str.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('simple object', function (t) { + t.plan(1); + var obj = { c: 6, b: [4,5], a: 3, z: null }; + t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}'); +}); + +test('object with undefined', function (t) { + t.plan(1); + var obj = { a: 3, z: undefined }; + t.equal(stringify(obj), '{"a":3}'); +}); + +test('object with null', function (t) { + t.plan(1); + var obj = { a: 3, z: null }; + t.equal(stringify(obj), '{"a":3,"z":null}'); +}); + +test('object with NaN and Infinity', function (t) { + t.plan(1); + var obj = { a: 3, b: NaN, c: Infinity }; + t.equal(stringify(obj), '{"a":3,"b":null,"c":null}'); +}); + +test('array with undefined', function (t) { + t.plan(1); + var obj = [4, undefined, 6]; + t.equal(stringify(obj), '[4,null,6]'); +}); + +test('object with empty string', function (t) { + t.plan(1); + var obj = { a: 3, z: '' }; + t.equal(stringify(obj), '{"a":3,"z":""}'); +}); + +test('array with empty string', function (t) { + t.plan(1); + var obj = [4, '', 6]; + t.equal(stringify(obj), '[4,"",6]'); +}); diff --git a/node_modules/fast-json-stable-stringify/test/to-json.js b/node_modules/fast-json-stable-stringify/test/to-json.js new file mode 100644 index 0000000..2fb2cfa --- /dev/null +++ b/node_modules/fast-json-stable-stringify/test/to-json.js @@ -0,0 +1,22 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('toJSON function', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; + t.equal(stringify(obj), '{"one":1}' ); +}); + +test('toJSON returns string', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; + t.equal(stringify(obj), '"one"'); +}); + +test('toJSON returns array', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; + t.equal(stringify(obj), '["one"]'); +}); diff --git a/node_modules/fast-levenshtein/LICENSE.md b/node_modules/fast-levenshtein/LICENSE.md new file mode 100644 index 0000000..6212406 --- /dev/null +++ b/node_modules/fast-levenshtein/LICENSE.md @@ -0,0 +1,25 @@ +(MIT License) + +Copyright (c) 2013 [Ramesh Nair](http://www.hiddentao.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/fast-levenshtein/README.md b/node_modules/fast-levenshtein/README.md new file mode 100644 index 0000000..a778995 --- /dev/null +++ b/node_modules/fast-levenshtein/README.md @@ -0,0 +1,104 @@ +# fast-levenshtein - Levenshtein algorithm in Javascript + +[![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein) +[![NPM module](https://badge.fury.io/js/fast-levenshtein.png)](https://badge.fury.io/js/fast-levenshtein) +[![NPM downloads](https://img.shields.io/npm/dm/fast-levenshtein.svg?maxAge=2592000)](https://www.npmjs.com/package/fast-levenshtein) +[![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/hiddentao) + +An efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support. + +## Features + +* Works in node.js and in the browser. +* Better performance than other implementations by not needing to store the whole matrix ([more info](http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm)). +* Locale-sensitive string comparisions if needed. +* Comprehensive test suite and performance benchmark. +* Small: <1 KB minified and gzipped + +## Installation + +### node.js + +Install using [npm](http://npmjs.org/): + +```bash +$ npm install fast-levenshtein +``` + +### Browser + +Using bower: + +```bash +$ bower install fast-levenshtein +``` + +If you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object. + +## Examples + +**Default usage** + +```javascript +var levenshtein = require('fast-levenshtein'); + +var distance = levenshtein.get('back', 'book'); // 2 +var distance = levenshtein.get('我愛你', '我叫你'); // 1 +``` + +**Locale-sensitive string comparisons** + +It supports using [Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) for locale-sensitive string comparisons: + +```javascript +var levenshtein = require('fast-levenshtein'); + +levenshtein.get('mikailovitch', 'Mikhaïlovitch', { useCollator: true}); +// 1 +``` + +## Building and Testing + +To build the code and run the tests: + +```bash +$ npm install -g grunt-cli +$ npm install +$ npm run build +``` + +## Performance + +_Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._ + +Benchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM): + +```bash +Running suite Implementation comparison [benchmark/speed.js]... +>> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled) +>> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled) +>> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled) +>> natural x 255 ops/sec ±0.76% (88 runs sampled) +>> levenshtein x 180 ops/sec ±3.55% (86 runs sampled) +>> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled) +Benchmark done. +Fastest test is fast-levenshtein at 4.2x faster than levenshtein-component +``` + +You can run this benchmark yourself by doing: + +```bash +$ npm install +$ npm run build +$ npm run benchmark +``` + +## Contributing + +If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes. + +See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details. + +## License + +MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md) diff --git a/node_modules/fast-levenshtein/levenshtein.js b/node_modules/fast-levenshtein/levenshtein.js new file mode 100644 index 0000000..dbe3628 --- /dev/null +++ b/node_modules/fast-levenshtein/levenshtein.js @@ -0,0 +1,136 @@ +(function() { + 'use strict'; + + var collator; + try { + collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null; + } catch (err){ + console.log("Collator could not be initialized and wouldn't be used"); + } + // arrays to re-use + var prevRow = [], + str2Char = []; + + /** + * Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance. + */ + var Levenshtein = { + /** + * Calculate levenshtein distance of the two strings. + * + * @param str1 String the first string. + * @param str2 String the second string. + * @param [options] Additional options. + * @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison. + * @return Integer the levenshtein distance (0 and above). + */ + get: function(str1, str2, options) { + var useCollator = (options && collator && options.useCollator); + + var str1Len = str1.length, + str2Len = str2.length; + + // base cases + if (str1Len === 0) return str2Len; + if (str2Len === 0) return str1Len; + + // two rows + var curCol, nextCol, i, j, tmp; + + // initialise previous row + for (i=0; i tmp) { + nextCol = tmp; + } + // deletion + tmp = prevRow[j + 1] + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + + // copy current col value into previous (in preparation for next iteration) + prevRow[j] = curCol; + } + + // copy last col value into previous (in preparation for next iteration) + prevRow[j] = nextCol; + } + } + else { + // calculate current row distance from previous row without collator + for (i = 0; i < str1Len; ++i) { + nextCol = i + 1; + + for (j = 0; j < str2Len; ++j) { + curCol = nextCol; + + // substution + strCmp = str1.charCodeAt(i) === str2Char[j]; + + nextCol = prevRow[j] + (strCmp ? 0 : 1); + + // insertion + tmp = curCol + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + // deletion + tmp = prevRow[j + 1] + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + + // copy current col value into previous (in preparation for next iteration) + prevRow[j] = curCol; + } + + // copy last col value into previous (in preparation for next iteration) + prevRow[j] = nextCol; + } + } + return nextCol; + } + + }; + + // amd + if (typeof define !== "undefined" && define !== null && define.amd) { + define(function() { + return Levenshtein; + }); + } + // commonjs + else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) { + module.exports = Levenshtein; + } + // web worker + else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') { + self.Levenshtein = Levenshtein; + } + // browser main thread + else if (typeof window !== "undefined" && window !== null) { + window.Levenshtein = Levenshtein; + } +}()); + diff --git a/node_modules/fast-levenshtein/package.json b/node_modules/fast-levenshtein/package.json new file mode 100644 index 0000000..5b4736d --- /dev/null +++ b/node_modules/fast-levenshtein/package.json @@ -0,0 +1,39 @@ +{ + "name": "fast-levenshtein", + "version": "2.0.6", + "description": "Efficient implementation of Levenshtein algorithm with locale-specific collator support.", + "main": "levenshtein.js", + "files": [ + "levenshtein.js" + ], + "scripts": { + "build": "grunt build", + "prepublish": "npm run build", + "benchmark": "grunt benchmark", + "test": "mocha" + }, + "devDependencies": { + "chai": "~1.5.0", + "grunt": "~0.4.1", + "grunt-benchmark": "~0.2.0", + "grunt-cli": "^1.2.0", + "grunt-contrib-jshint": "~0.4.3", + "grunt-contrib-uglify": "~0.2.0", + "grunt-mocha-test": "~0.2.2", + "grunt-npm-install": "~0.1.0", + "load-grunt-tasks": "~0.6.0", + "lodash": "^4.0.1", + "mocha": "~1.9.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/hiddentao/fast-levenshtein.git" + }, + "keywords": [ + "levenshtein", + "distance", + "string" + ], + "author": "Ramesh Nair (http://www.hiddentao.com/)", + "license": "MIT" +} diff --git a/node_modules/file-entry-cache/LICENSE b/node_modules/file-entry-cache/LICENSE new file mode 100644 index 0000000..c58c339 --- /dev/null +++ b/node_modules/file-entry-cache/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Roy Riojas + +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/file-entry-cache/README.md b/node_modules/file-entry-cache/README.md new file mode 100644 index 0000000..854a512 --- /dev/null +++ b/node_modules/file-entry-cache/README.md @@ -0,0 +1,112 @@ +# file-entry-cache +> Super simple cache for file metadata, useful for process that work o a given series of files +> and that only need to repeat the job on the changed ones since the previous run of the process — Edit + +[![NPM Version](http://img.shields.io/npm/v/file-entry-cache.svg?style=flat)](https://npmjs.org/package/file-entry-cache) +[![Build Status](http://img.shields.io/travis/royriojas/file-entry-cache.svg?style=flat)](https://travis-ci.org/royriojas/file-entry-cache) + +## install + +```bash +npm i --save file-entry-cache +``` + +## Usage + +The module exposes two functions `create` and `createFromFile`. + +## `create(cacheName, [directory, useCheckSum])` +- **cacheName**: the name of the cache to be created +- **directory**: Optional the directory to load the cache from +- **usecheckSum**: Whether to use md5 checksum to verify if file changed. If false the default will be to use the mtime and size of the file. + +## `createFromFile(pathToCache, [useCheckSum])` +- **pathToCache**: the path to the cache file (this combines the cache name and directory) +- **useCheckSum**: Whether to use md5 checksum to verify if file changed. If false the default will be to use the mtime and size of the file. + +```js +// loads the cache, if one does not exists for the given +// Id a new one will be prepared to be created +var fileEntryCache = require('file-entry-cache'); + +var cache = fileEntryCache.create('testCache'); + +var files = expand('../fixtures/*.txt'); + +// the first time this method is called, will return all the files +var oFiles = cache.getUpdatedFiles(files); + +// this will persist this to disk checking each file stats and +// updating the meta attributes `size` and `mtime`. +// custom fields could also be added to the meta object and will be persisted +// in order to retrieve them later +cache.reconcile(); + +// use this if you want the non visited file entries to be kept in the cache +// for more than one execution +// +// cache.reconcile( true /* noPrune */) + +// on a second run +var cache2 = fileEntryCache.create('testCache'); + +// will return now only the files that were modified or none +// if no files were modified previous to the execution of this function +var oFiles = cache.getUpdatedFiles(files); + +// if you want to prevent a file from being considered non modified +// something useful if a file failed some sort of validation +// you can then remove the entry from the cache doing +cache.removeEntry('path/to/file'); // path to file should be the same path of the file received on `getUpdatedFiles` +// that will effectively make the file to appear again as modified until the validation is passed. In that +// case you should not remove it from the cache + +// if you need all the files, so you can determine what to do with the changed ones +// you can call +var oFiles = cache.normalizeEntries(files); + +// oFiles will be an array of objects like the following +entry = { + key: 'some/name/file', the path to the file + changed: true, // if the file was changed since previous run + meta: { + size: 3242, // the size of the file + mtime: 231231231, // the modification time of the file + data: {} // some extra field stored for this file (useful to save the result of a transformation on the file + } +} + +``` + +## Motivation for this module + +I needed a super simple and dumb **in-memory cache** with optional disk persistence (write-back cache) in order to make +a script that will beautify files with `esformatter` to execute only on the files that were changed since the last run. + +In doing so the process of beautifying files was reduced from several seconds to a small fraction of a second. + +This module uses [flat-cache](https://www.npmjs.com/package/flat-cache) a super simple `key/value` cache storage with +optional file persistance. + +The main idea is to read the files when the task begins, apply the transforms required, and if the process succeed, +then store the new state of the files. The next time this module request for `getChangedFiles` will return only +the files that were modified. Making the process to end faster. + +This module could also be used by processes that modify the files applying a transform, in that case the result of the +transform could be stored in the `meta` field, of the entries. Anything added to the meta field will be persisted. +Those processes won't need to call `getChangedFiles` they will instead call `normalizeEntries` that will return the +entries with a `changed` field that can be used to determine if the file was changed or not. If it was not changed +the transformed stored data could be used instead of actually applying the transformation, saving time in case of only +a few files changed. + +In the worst case scenario all the files will be processed. In the best case scenario only a few of them will be processed. + +## Important notes +- The values set on the meta attribute of the entries should be `stringify-able` ones if possible, flat-cache uses `circular-json` to try to persist circular structures, but this should be considered experimental. The best results are always obtained with non circular values +- All the changes to the cache state are done to memory first and only persisted after reconcile. + +## License + +MIT + + diff --git a/node_modules/file-entry-cache/cache.js b/node_modules/file-entry-cache/cache.js new file mode 100644 index 0000000..6b15767 --- /dev/null +++ b/node_modules/file-entry-cache/cache.js @@ -0,0 +1,291 @@ +var path = require('path'); +var crypto = require('crypto'); + +module.exports = { + createFromFile: function (filePath, useChecksum) { + var fname = path.basename(filePath); + var dir = path.dirname(filePath); + return this.create(fname, dir, useChecksum); + }, + + create: function (cacheId, _path, useChecksum) { + var fs = require('fs'); + var flatCache = require('flat-cache'); + var cache = flatCache.load(cacheId, _path); + var normalizedEntries = {}; + + var removeNotFoundFiles = function removeNotFoundFiles() { + const cachedEntries = cache.keys(); + // remove not found entries + cachedEntries.forEach(function remover(fPath) { + try { + fs.statSync(fPath); + } catch (err) { + if (err.code === 'ENOENT') { + cache.removeKey(fPath); + } + } + }); + }; + + removeNotFoundFiles(); + + return { + /** + * the flat cache storage used to persist the metadata of the `files + * @type {Object} + */ + cache: cache, + + /** + * Given a buffer, calculate md5 hash of its content. + * @method getHash + * @param {Buffer} buffer buffer to calculate hash on + * @return {String} content hash digest + */ + getHash: function (buffer) { + return crypto.createHash('md5').update(buffer).digest('hex'); + }, + + /** + * Return whether or not a file has changed since last time reconcile was called. + * @method hasFileChanged + * @param {String} file the filepath to check + * @return {Boolean} wheter or not the file has changed + */ + hasFileChanged: function (file) { + return this.getFileDescriptor(file).changed; + }, + + /** + * given an array of file paths it return and object with three arrays: + * - changedFiles: Files that changed since previous run + * - notChangedFiles: Files that haven't change + * - notFoundFiles: Files that were not found, probably deleted + * + * @param {Array} files the files to analyze and compare to the previous seen files + * @return {[type]} [description] + */ + analyzeFiles: function (files) { + var me = this; + files = files || []; + + var res = { + changedFiles: [], + notFoundFiles: [], + notChangedFiles: [], + }; + + me.normalizeEntries(files).forEach(function (entry) { + if (entry.changed) { + res.changedFiles.push(entry.key); + return; + } + if (entry.notFound) { + res.notFoundFiles.push(entry.key); + return; + } + res.notChangedFiles.push(entry.key); + }); + return res; + }, + + getFileDescriptor: function (file) { + var fstat; + + try { + fstat = fs.statSync(file); + } catch (ex) { + this.removeEntry(file); + return { key: file, notFound: true, err: ex }; + } + + if (useChecksum) { + return this._getFileDescriptorUsingChecksum(file); + } + + return this._getFileDescriptorUsingMtimeAndSize(file, fstat); + }, + + _getFileDescriptorUsingMtimeAndSize: function (file, fstat) { + var meta = cache.getKey(file); + var cacheExists = !!meta; + + var cSize = fstat.size; + var cTime = fstat.mtime.getTime(); + + var isDifferentDate; + var isDifferentSize; + + if (!meta) { + meta = { size: cSize, mtime: cTime }; + } else { + isDifferentDate = cTime !== meta.mtime; + isDifferentSize = cSize !== meta.size; + } + + var nEntry = (normalizedEntries[file] = { + key: file, + changed: !cacheExists || isDifferentDate || isDifferentSize, + meta: meta, + }); + + return nEntry; + }, + + _getFileDescriptorUsingChecksum: function (file) { + var meta = cache.getKey(file); + var cacheExists = !!meta; + + var contentBuffer; + try { + contentBuffer = fs.readFileSync(file); + } catch (ex) { + contentBuffer = ''; + } + + var isDifferent = true; + var hash = this.getHash(contentBuffer); + + if (!meta) { + meta = { hash: hash }; + } else { + isDifferent = hash !== meta.hash; + } + + var nEntry = (normalizedEntries[file] = { + key: file, + changed: !cacheExists || isDifferent, + meta: meta, + }); + + return nEntry; + }, + + /** + * Return the list o the files that changed compared + * against the ones stored in the cache + * + * @method getUpdated + * @param files {Array} the array of files to compare against the ones in the cache + * @returns {Array} + */ + getUpdatedFiles: function (files) { + var me = this; + files = files || []; + + return me + .normalizeEntries(files) + .filter(function (entry) { + return entry.changed; + }) + .map(function (entry) { + return entry.key; + }); + }, + + /** + * return the list of files + * @method normalizeEntries + * @param files + * @returns {*} + */ + normalizeEntries: function (files) { + files = files || []; + + var me = this; + var nEntries = files.map(function (file) { + return me.getFileDescriptor(file); + }); + + //normalizeEntries = nEntries; + return nEntries; + }, + + /** + * Remove an entry from the file-entry-cache. Useful to force the file to still be considered + * modified the next time the process is run + * + * @method removeEntry + * @param entryName + */ + removeEntry: function (entryName) { + delete normalizedEntries[entryName]; + cache.removeKey(entryName); + }, + + /** + * Delete the cache file from the disk + * @method deleteCacheFile + */ + deleteCacheFile: function () { + cache.removeCacheFile(); + }, + + /** + * remove the cache from the file and clear the memory cache + */ + destroy: function () { + normalizedEntries = {}; + cache.destroy(); + }, + + _getMetaForFileUsingCheckSum: function (cacheEntry) { + var contentBuffer = fs.readFileSync(cacheEntry.key); + var hash = this.getHash(contentBuffer); + var meta = Object.assign(cacheEntry.meta, { hash: hash }); + delete meta.size; + delete meta.mtime; + return meta; + }, + + _getMetaForFileUsingMtimeAndSize: function (cacheEntry) { + var stat = fs.statSync(cacheEntry.key); + var meta = Object.assign(cacheEntry.meta, { + size: stat.size, + mtime: stat.mtime.getTime(), + }); + delete meta.hash; + return meta; + }, + + /** + * Sync the files and persist them to the cache + * @method reconcile + */ + reconcile: function (noPrune) { + removeNotFoundFiles(); + + noPrune = typeof noPrune === 'undefined' ? true : noPrune; + + var entries = normalizedEntries; + var keys = Object.keys(entries); + + if (keys.length === 0) { + return; + } + + var me = this; + + keys.forEach(function (entryName) { + var cacheEntry = entries[entryName]; + + try { + var meta = useChecksum + ? me._getMetaForFileUsingCheckSum(cacheEntry) + : me._getMetaForFileUsingMtimeAndSize(cacheEntry); + cache.setKey(entryName, meta); + } catch (err) { + // if the file does not exists we don't save it + // other errors are just thrown + if (err.code !== 'ENOENT') { + throw err; + } + } + }); + + cache.save(noPrune); + }, + }; + }, +}; diff --git a/node_modules/file-entry-cache/changelog.md b/node_modules/file-entry-cache/changelog.md new file mode 100644 index 0000000..64d62a0 --- /dev/null +++ b/node_modules/file-entry-cache/changelog.md @@ -0,0 +1,163 @@ + +# file-entry-cache - Changelog +## v6.0.1 +- **Other changes** + - Delete previous mtime when checksum is used and vice versa - [abcf0f9]( https://github.com/royriojas/file-entry-cache/commit/abcf0f9 ), [Milos Djermanovic](https://github.com/Milos Djermanovic), 19/02/2021 18:19:43 + + + - Adds travis jobs on ppc64le - [92e4d4a]( https://github.com/royriojas/file-entry-cache/commit/92e4d4a ), [dineshks1](https://github.com/dineshks1), 25/11/2020 04:52:11 + + +## v6.0.0 +- **Refactoring** + - Align file-entry-cache with latest eslint - [4c6f1fb]( https://github.com/royriojas/file-entry-cache/commit/4c6f1fb ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:43:09 + + + - Upgrade deps - [8ab3257]( https://github.com/royriojas/file-entry-cache/commit/8ab3257 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:41:53 + + + - updated packages - [3dd4231]( https://github.com/royriojas/file-entry-cache/commit/3dd4231 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:29:37 + + + - Upgrade flat-cache to version 3 - [d7c60ef]( https://github.com/royriojas/file-entry-cache/commit/d7c60ef ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:18:04 + + +## v5.0.1 +- **Bug Fixes** + - Fix missing checksum comparison from reconcile since now we use mtime and size by default. - [e858aa9]( https://github.com/royriojas/file-entry-cache/commit/e858aa9 ), [Roy Riojas](https://github.com/Roy Riojas), 04/02/2019 09:30:22 + + Old mode using checkSum can still be used by passing the `useCheckSum` parameter to the `create` or `createFromFile` methods. + +## v5.0.0 +- **Refactoring** + - Make checksum comparison optional - [b0f9ae0]( https://github.com/royriojas/file-entry-cache/commit/b0f9ae0 ), [Roy Riojas](https://github.com/Roy Riojas), 03/02/2019 18:17:39 + + To determine if a file has changed we were using the checksum in the newer versions, but eslint was relying on the old behavior where we use the mtime and file size to determine if a file changed. That's why we decided to make the checksum check optional. + + To use it: + + ```js + // to make the cache use the checkSum check do the following: + var fCache = fileEntryCache.create(cacheName, dir, useCheckSum); // pass the third parameter as true + var otherCache = fileEntryCache.createFromFile(cacheName, useCheckSum); // pass the second parameter as true + ``` + +## v4.0.0 +- **Build Scripts Changes** + - use the same node versions eslint use - [563cfee]( https://github.com/royriojas/file-entry-cache/commit/563cfee ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 20:29:34 + + +- **Other changes** + - Remove object-assign dependency. - [d0f598e]( https://github.com/royriojas/file-entry-cache/commit/d0f598e ), [Corey Farrell](https://github.com/Corey Farrell), 08/01/2019 20:09:51 + + node.js >=4 is required so object-assign is no longer needed, the native + Object.assign can be used instead. + +## v3.0.0 +- **Build Scripts Changes** + - Upgrade flat-cache dep to latest - [078b0df]( https://github.com/royriojas/file-entry-cache/commit/078b0df ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 18:54:40 + + + - Commit new package-lock.json file - [245fe62]( https://github.com/royriojas/file-entry-cache/commit/245fe62 ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 17:56:21 + + +- **Refactoring** + - add eslintrc file - [6dd32d8]( https://github.com/royriojas/file-entry-cache/commit/6dd32d8 ), [Roy Riojas](https://github.com/Roy Riojas), 22/08/2018 09:58:17 + + +- **Other changes** + - Move variable definition out of else block - [ea05441]( https://github.com/royriojas/file-entry-cache/commit/ea05441 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 11:19:00 + + + - Add script and cmd to test hash/checksum performance - [7f60e0a]( https://github.com/royriojas/file-entry-cache/commit/7f60e0a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 14:43:12 + + + - Calculate md5 hexdigest instead of Adler-32 checksum - [f9e5c69]( https://github.com/royriojas/file-entry-cache/commit/f9e5c69 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 14:43:12 + + + - How to reproduce - [4edc2dc]( https://github.com/royriojas/file-entry-cache/commit/4edc2dc ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 13:49:32 + + + - Test handling of removed files - [09d9ec5]( https://github.com/royriojas/file-entry-cache/commit/09d9ec5 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 19:51:50 + + + - Use content checksum instead of mtime and fsize - [343b340]( https://github.com/royriojas/file-entry-cache/commit/343b340 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 19:51:47 + + +- **Revert** + - Revert "How to reproduce" - [4b4e54a]( https://github.com/royriojas/file-entry-cache/commit/4b4e54a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 11:15:36 + + This reverts commit 4edc2dcec01574247bfc2e0a2fe26527332b7df3. + +## v2.0.0 +- **Features** + - do not persist and prune removed files from cache. Relates to [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [408374d]( https://github.com/royriojas/file-entry-cache/commit/408374d ), [Roy Riojas](https://github.com/Roy Riojas), 16/08/2016 13:47:58 + + +## v1.3.1 +- **Build Scripts Changes** + - remove older node version - [0a26ac4]( https://github.com/royriojas/file-entry-cache/commit/0a26ac4 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 04:09:17 + + +## v1.3.0 +- **Features** + - Add an option to not prune non visited keys. Closes [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [b1a64db]( https://github.com/royriojas/file-entry-cache/commit/b1a64db ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 03:52:12 + + +## v1.2.4 +- **Enhancements** + - Expose the flat-cache instance - [f34c557]( https://github.com/royriojas/file-entry-cache/commit/f34c557 ), [royriojas](https://github.com/royriojas), 23/09/2015 18:26:33 + + +## v1.2.3 +- **Build Scripts Changes** + - update flat-cache dep - [cc7b9ce]( https://github.com/royriojas/file-entry-cache/commit/cc7b9ce ), [royriojas](https://github.com/royriojas), 11/09/2015 16:04:44 + + +## v1.2.2 +- **Build Scripts Changes** + - Add changelogx section to package.json - [a3916ff]( https://github.com/royriojas/file-entry-cache/commit/a3916ff ), [royriojas](https://github.com/royriojas), 11/09/2015 16:00:26 + + +## v1.2.1 +- **Build Scripts Changes** + - update flat-cache dep - [e49b0d4]( https://github.com/royriojas/file-entry-cache/commit/e49b0d4 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:55:25 + + +- **Other changes** + - Update dependencies Replaced lodash.assign with smaller object-assign Fixed tests for windows - [0ad3000]( https://github.com/royriojas/file-entry-cache/commit/0ad3000 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:44:18 + + +## v1.2.0 +- **Features** + - analyzeFiles now returns also the files that were removed - [6ac2431]( https://github.com/royriojas/file-entry-cache/commit/6ac2431 ), [royriojas](https://github.com/royriojas), 04/09/2015 12:40:53 + + +## v1.1.1 +- **Features** + - Add method to check if a file hasChanged - [3640e2b]( https://github.com/royriojas/file-entry-cache/commit/3640e2b ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 05:33:32 + + +## v1.1.0 +- **Features** + - Create the cache directly from a file path - [a23de61]( https://github.com/royriojas/file-entry-cache/commit/a23de61 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 04:41:33 + + + - Add a method to remove an entry from the filecache - [7af29fc]( https://github.com/royriojas/file-entry-cache/commit/7af29fc ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 23:25:32 + + + - cache module finished - [1f95544]( https://github.com/royriojas/file-entry-cache/commit/1f95544 ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:08:08 + + +- **Build Scripts Changes** + - set the version for the first release - [7472eaa]( https://github.com/royriojas/file-entry-cache/commit/7472eaa ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:29:54 + + +- **Documentation** + - Updated documentation - [557358f]( https://github.com/royriojas/file-entry-cache/commit/557358f ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:29:29 + + +- **Other changes** + - Initial commit - [3d5f42b]( https://github.com/royriojas/file-entry-cache/commit/3d5f42b ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 21:58:29 + + diff --git a/node_modules/file-entry-cache/package.json b/node_modules/file-entry-cache/package.json new file mode 100644 index 0000000..f03ef48 --- /dev/null +++ b/node_modules/file-entry-cache/package.json @@ -0,0 +1,80 @@ +{ + "name": "file-entry-cache", + "version": "6.0.1", + "description": "Super simple cache for file metadata, useful for process that work o a given series of files and that only need to repeat the job on the changed ones since the previous run of the process", + "repository": "royriojas/file-entry-cache", + "license": "MIT", + "author": { + "name": "Roy Riojas", + "url": "http://royriojas.com" + }, + "main": "cache.js", + "files": [ + "cache.js" + ], + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "scripts": { + "eslint": "eslint --cache --cache-location=node_modules/.cache/ 'cache.js' 'test/**/*.js' 'perf.js'", + "autofix": "npm run eslint -- --fix", + "install-hooks": "prepush install && changelogx install-hook && precommit install", + "changelog": "changelogx -f markdown -o ./changelog.md", + "do-changelog": "npm run changelog && git add ./changelog.md && git commit -m 'DOC: Generate changelog' --no-verify", + "pre-v": "npm run test", + "post-v": "npm run do-changelog && git push --no-verify && git push --tags --no-verify", + "bump-major": "npm run pre-v && npm version major -m 'BLD: Release v%s' && npm run post-v", + "bump-minor": "npm run pre-v && npm version minor -m 'BLD: Release v%s' && npm run post-v", + "bump-patch": "npm run pre-v && npm version patch -m 'BLD: Release v%s' && npm run post-v", + "test": "npm run eslint --silent && mocha -R spec test/specs", + "perf": "node perf.js", + "cover": "istanbul cover test/runner.js html text-summary", + "watch": "watch-run -i -p 'test/specs/**/*.js' istanbul cover test/runner.js html text-summary" + }, + "prepush": [ + "npm run eslint --silent" + ], + "precommit": [ + "npm run eslint --silent" + ], + "keywords": [ + "file cache", + "task cache files", + "file cache", + "key par", + "key value", + "cache" + ], + "changelogx": { + "ignoreRegExp": [ + "BLD: Release", + "DOC: Generate Changelog", + "Generated Changelog" + ], + "issueIDRegExp": "#(\\d+)", + "commitURL": "https://github.com/royriojas/file-entry-cache/commit/{0}", + "authorURL": "https://github.com/{0}", + "issueIDURL": "https://github.com/royriojas/file-entry-cache/issues/{0}", + "projectName": "file-entry-cache" + }, + "devDependencies": { + "chai": "^4.2.0", + "changelogx": "^5.0.6", + "del": "^6.0.0", + "eslint": "^7.13.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-mocha": "^8.0.0", + "eslint-plugin-prettier": "^3.1.4", + "glob-expand": "^0.2.1", + "istanbul": "^0.4.5", + "mocha": "^8.2.1", + "precommit": "^1.2.2", + "prepush": "^3.1.11", + "prettier": "^2.1.2", + "watch-run": "^1.2.5", + "write": "^2.0.0" + }, + "dependencies": { + "flat-cache": "^3.0.4" + } +} diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js new file mode 100644 index 0000000..939c955 --- /dev/null +++ b/node_modules/find-up/index.js @@ -0,0 +1,48 @@ +'use strict'; +const path = require('path'); +const locatePath = require('locate-path'); + +module.exports = (filename, opts) => { + opts = opts || {}; + + const startDir = path.resolve(opts.cwd || ''); + const root = path.parse(startDir).root; + + const filenames = [].concat(filename); + + return new Promise(resolve => { + (function find(dir) { + locatePath(filenames, {cwd: dir}).then(file => { + if (file) { + resolve(path.join(dir, file)); + } else if (dir === root) { + resolve(null); + } else { + find(path.dirname(dir)); + } + }); + })(startDir); + }); +}; + +module.exports.sync = (filename, opts) => { + opts = opts || {}; + + let dir = path.resolve(opts.cwd || ''); + const root = path.parse(dir).root; + + const filenames = [].concat(filename); + + // eslint-disable-next-line no-constant-condition + while (true) { + const file = locatePath.sync(filenames, {cwd: dir}); + + if (file) { + return path.join(dir, file); + } else if (dir === root) { + return null; + } + + dir = path.dirname(dir); + } +}; diff --git a/node_modules/find-up/license b/node_modules/find-up/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/find-up/license @@ -0,0 +1,21 @@ +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/find-up/package.json b/node_modules/find-up/package.json new file mode 100644 index 0000000..7ec85bb --- /dev/null +++ b/node_modules/find-up/package.json @@ -0,0 +1,53 @@ +{ + "name": "find-up", + "version": "2.1.0", + "description": "Find a file by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "tempfile": "^1.1.1", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/find-up/readme.md b/node_modules/find-up/readme.md new file mode 100644 index 0000000..b5ad694 --- /dev/null +++ b/node_modules/find-up/readme.md @@ -0,0 +1,85 @@ +# find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master) + +> Find a file by walking up parent directories + + +## Install + +``` +$ npm install --save find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const findUp = require('find-up'); + +findUp('unicorn.png').then(filepath => { + console.log(filepath); + //=> '/Users/sindresorhus/unicorn.png' +}); + +findUp(['rainbow.png', 'unicorn.png']).then(filepath => { + console.log(filepath); + //=> '/Users/sindresorhus/unicorn.png' +}); +``` + + +## API + +### findUp(filename, [options]) + +Returns a `Promise` for the filepath or `null`. + +### findUp([filenameA, filenameB], [options]) + +Returns a `Promise` for the first filepath found (by respecting the order) or `null`. + +### findUp.sync(filename, [options]) + +Returns a filepath or `null`. + +### findUp.sync([filenameA, filenameB], [options]) + +Returns the first filepath found (by respecting the order) or `null`. + +#### filename + +Type: `string` + +Filename of the file to find. + +#### options + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/flat-cache/LICENSE b/node_modules/flat-cache/LICENSE new file mode 100644 index 0000000..c58c339 --- /dev/null +++ b/node_modules/flat-cache/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Roy Riojas + +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/flat-cache/README.md b/node_modules/flat-cache/README.md new file mode 100644 index 0000000..03e256a --- /dev/null +++ b/node_modules/flat-cache/README.md @@ -0,0 +1,73 @@ +# flat-cache +> A stupidly simple key/value storage using files to persist the data + +[![NPM Version](http://img.shields.io/npm/v/flat-cache.svg?style=flat)](https://npmjs.org/package/flat-cache) +[![Build Status](https://api.travis-ci.org/royriojas/flat-cache.svg?branch=master)](https://travis-ci.org/royriojas/flat-cache) + +## install + +```bash +npm i --save flat-cache +``` + +## Usage + +```js +var flatCache = require('flat-cache') +// loads the cache, if one does not exists for the given +// Id a new one will be prepared to be created +var cache = flatCache.load('cacheId'); + +// sets a key on the cache +cache.setKey('key', { foo: 'var' }); + +// get a key from the cache +cache.getKey('key') // { foo: 'var' } + +// fetch the entire persisted object +cache.all() // { 'key': { foo: 'var' } } + +// remove a key +cache.removeKey('key'); // removes a key from the cache + +// save it to disk +cache.save(); // very important, if you don't save no changes will be persisted. +// cache.save( true /* noPrune */) // can be used to prevent the removal of non visited keys + +// loads the cache from a given directory, if one does +// not exists for the given Id a new one will be prepared to be created +var cache = flatCache.load('cacheId', path.resolve('./path/to/folder')); + +// The following methods are useful to clear the cache +// delete a given cache +flatCache.clearCacheById('cacheId') // removes the cacheId document if one exists. + +// delete all cache +flatCache.clearAll(); // remove the cache directory +``` + +## Motivation for this module + +I needed a super simple and dumb **in-memory cache** with optional disk persistance in order to make +a script that will beutify files with `esformatter` only execute on the files that were changed since the last run. +To make that possible we need to store the `fileSize` and `modificationTime` of the files. So a simple `key/value` +storage was needed and Bam! this module was born. + +## Important notes +- If no directory is especified when the `load` method is called, a folder named `.cache` will be created + inside the module directory when `cache.save` is called. If you're committing your `node_modules` to any vcs, you + might want to ignore the default `.cache` folder, or specify a custom directory. +- The values set on the keys of the cache should be `stringify-able` ones, meaning no circular references +- All the changes to the cache state are done to memory +- I could have used a timer or `Object.observe` to deliver the changes to disk, but I wanted to keep this module + intentionally dumb and simple +- Non visited keys are removed when `cache.save()` is called. If this is not desired, you can pass `true` to the save call + like: `cache.save( true /* noPrune */ )`. + +## License + +MIT + +## Changelog + +[changelog](./changelog.md) diff --git a/node_modules/flat-cache/changelog.md b/node_modules/flat-cache/changelog.md new file mode 100644 index 0000000..1ad0fdf --- /dev/null +++ b/node_modules/flat-cache/changelog.md @@ -0,0 +1,328 @@ + +# flat-cache - Changelog +## v3.0.4 +- **Refactoring** + - add files by name to the list of exported files - [89a2698]( https://github.com/royriojas/flat-cache/commit/89a2698 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:35:39 + + +## v3.0.3 +- **Bug Fixes** + - Fix wrong eslint command - [f268e42]( https://github.com/royriojas/flat-cache/commit/f268e42 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:15:04 + + +## v3.0.2 +- **Refactoring** + - Update the files paths - [6983a80]( https://github.com/royriojas/flat-cache/commit/6983a80 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:58:39 + + + - Move code to src/ - [18ed6e8]( https://github.com/royriojas/flat-cache/commit/18ed6e8 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:57:17 + + + - Change eslint-cache location - [beed74c]( https://github.com/royriojas/flat-cache/commit/beed74c ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:48:32 + + +## v3.0.1 +- **Refactoring** + - Remove unused deps - [8c6d9dc]( https://github.com/royriojas/flat-cache/commit/8c6d9dc ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:43:29 + + +## v3.0.0 +- **Refactoring** + - Fix engines - [52b824c]( https://github.com/royriojas/flat-cache/commit/52b824c ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:01:52 + + +- **Other changes** + - Replace write with combination of mkdir and writeFile ([#49](https://github.com/royriojas/flat-cache/issues/49)) - [ef48276]( https://github.com/royriojas/flat-cache/commit/ef48276 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 08/11/2020 00:17:15 + + Node v10 introduced a great "recursive" option for mkdir which allows to + get rid from mkdirp package and easily rewrite "write" package usage + with two function calls. + + https://nodejs.org/api/fs.html#fs_fs_mkdir_path_options_callback + - Added a testcase for clearAll ([#48](https://github.com/royriojas/flat-cache/issues/48)) - [45b51ca]( https://github.com/royriojas/flat-cache/commit/45b51ca ), [Aaron Chen](https://github.com/Aaron Chen), 21/05/2020 08:40:03 + + + - requet node>=10 - [a5c482c]( https://github.com/royriojas/flat-cache/commit/a5c482c ), [yumetodo](https://github.com/yumetodo), 10/04/2020 23:14:53 + + thanks @SuperITMan + + - Update README.md - [29fe40b]( https://github.com/royriojas/flat-cache/commit/29fe40b ), [Roy Riojas](https://github.com/Roy Riojas), 10/04/2020 20:08:05 + + + - reduce vulnerability to 1 - [e9db1b2]( https://github.com/royriojas/flat-cache/commit/e9db1b2 ), [yumetodo](https://github.com/yumetodo), 30/03/2020 11:10:43 + + + - reduce vulnerabilities dependencies to 8 - [b58d196]( https://github.com/royriojas/flat-cache/commit/b58d196 ), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:54:56 + + + - use prettier instead of esbeautifier - [03b1db7]( https://github.com/royriojas/flat-cache/commit/03b1db7 ), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:27:14 + + + - update proxyquire - [c2f048d]( https://github.com/royriojas/flat-cache/commit/c2f048d ), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:16:16 + + + - update flatted and mocha - [a0e56da]( https://github.com/royriojas/flat-cache/commit/a0e56da ), [yumetodo](https://github.com/yumetodo), 30/03/2020 09:46:45 + + mocha > mkdirp is updated + istanble >>> optimist > minimist is not updated + + - drop support node.js < 10 in develop - [beba691]( https://github.com/royriojas/flat-cache/commit/beba691 ), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:31:09 + + see mkdirp + + - npm aufit fix(still remains) - [ce166cb]( https://github.com/royriojas/flat-cache/commit/ce166cb ), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:18:08 + + 37 vulnerabilities required manual review and could not be updated + + - updtate sinon - [9f2d1b6]( https://github.com/royriojas/flat-cache/commit/9f2d1b6 ), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:17:51 + + + - apply eslint-plugin-mocha - [07343b5]( https://github.com/royriojas/flat-cache/commit/07343b5 ), [yumetodo](https://github.com/yumetodo), 13/03/2020 22:17:21 + + + - Less strint version check ([#44](https://github.com/royriojas/flat-cache/issues/44)) - [92aca1c]( https://github.com/royriojas/flat-cache/commit/92aca1c ), [Wojciech Maj](https://github.com/Wojciech Maj), 13/11/2019 16:18:25 + + * Use ^ version matching for production dependencies + + * Run npm audit fix + +- **Bug Fixes** + - update dependencies and use eslint directly - [73fbed2]( https://github.com/royriojas/flat-cache/commit/73fbed2 ), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:17:27 + + +## v2.0.1 +- **Refactoring** + - upgrade node modules to latest versions - [6402ed3]( https://github.com/royriojas/flat-cache/commit/6402ed3 ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 18:47:05 + + +## v2.0.0 +- **Bug Fixes** + - upgrade package.json lock file - [8d21c7b]( https://github.com/royriojas/flat-cache/commit/8d21c7b ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 17:03:13 + + + - Use the same versions of node_js that eslint use - [8d23379]( https://github.com/royriojas/flat-cache/commit/8d23379 ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 16:25:11 + + +- **Other changes** + - Replace circular-json with flatted ([#36](https://github.com/royriojas/flat-cache/issues/36)) - [b93aced]( https://github.com/royriojas/flat-cache/commit/b93aced ), [C. K. Tang](https://github.com/C. K. Tang), 08/01/2019 17:03:01 + + + - Change JSON parser from circular-json to flatted & 1 more changes ([#37](https://github.com/royriojas/flat-cache/issues/37)) - [745e65a]( https://github.com/royriojas/flat-cache/commit/745e65a ), [Andy Chen](https://github.com/Andy Chen), 08/01/2019 16:17:20 + + * Change JSON parser from circular-json to flatted & 1 more changes + + * Change JSON parser from circular-json + * Audited 2 vulnerabilities + + * Update package.json + + * Update Engine require + + * There's a bunch of dependencies in this pkg requires node >=4, so I changed it to 4 + + * Remove and add node versions + + * I have seen this pkg is not available with node 0.12 so I removed it + * I have added a popular used LTS version of node - 10 + +## v1.3.4 +- **Refactoring** + - Add del.js and utils.js to the list of files to be beautified - [9d0ca9b]( https://github.com/royriojas/flat-cache/commit/9d0ca9b ), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 12:19:02 + + +## v1.3.3 +- **Refactoring** + - Make sure package-lock.json is up to date - [a7d2598]( https://github.com/royriojas/flat-cache/commit/a7d2598 ), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 11:36:08 + + +- **Other changes** + - Removed the need for del ([#33](https://github.com/royriojas/flat-cache/issues/33)) - [c429012]( https://github.com/royriojas/flat-cache/commit/c429012 ), [S. Gilroy](https://github.com/S. Gilroy), 13/11/2018 13:56:37 + + * Removed the need for del + + Removed the need for del as newer versions have broken backwards + compatibility. del mainly uses rimraf for deleting folders + and files, replaceing it with rimraf only is a minimal change. + + * Disable glob on rimraf calls + + * Added glob disable to wrong call + + * Wrapped rimraf to simplify solution + +## v1.3.2 +- **Refactoring** + - remove yarn.lock file - [704c6c4]( https://github.com/royriojas/flat-cache/commit/704c6c4 ), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:41:08 + + +- **Other changes** + - replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23))" - [db12d74]( https://github.com/royriojas/flat-cache/commit/db12d74 ), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:40:39 + + This reverts commit 00f689277a75e85fef28e6a048fad227afc525e6. + +## v1.3.1 +- **Refactoring** + - upgrade deps to remove some security warnings - [f405719]( https://github.com/royriojas/flat-cache/commit/f405719 ), [Roy Riojas](https://github.com/Roy Riojas), 06/11/2018 12:07:31 + + +- **Bug Fixes** + - replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23)) - [00f6892]( https://github.com/royriojas/flat-cache/commit/00f6892 ), [Terry](https://github.com/Terry), 05/11/2018 18:44:16 + + +- **Other changes** + - update del to v3.0.0 ([#26](https://github.com/royriojas/flat-cache/issues/26)) - [d42883f]( https://github.com/royriojas/flat-cache/commit/d42883f ), [Patrick Silva](https://github.com/Patrick Silva), 03/11/2018 01:00:44 + + Closes #25 +## v1.3.0 +- **Other changes** + - Added #all method ([#16](https://github.com/royriojas/flat-cache/issues/16)) - [12293be]( https://github.com/royriojas/flat-cache/commit/12293be ), [Ozair Patel](https://github.com/Ozair Patel), 25/09/2017 14:46:38 + + * Added #all method + + * Added #all method test + + * Updated readme + + * Added yarn.lock + + * Added more keys for #all test + + * Beautified file + + - fix changelog title style ([#14](https://github.com/royriojas/flat-cache/issues/14)) - [af8338a]( https://github.com/royriojas/flat-cache/commit/af8338a ), [前端小武](https://github.com/前端小武), 19/12/2016 20:34:48 + + +## v1.2.2 +- **Bug Fixes** + - Do not crash if cache file is invalid JSON. ([#13](https://github.com/royriojas/flat-cache/issues/13)) - [87beaa6]( https://github.com/royriojas/flat-cache/commit/87beaa6 ), [Roy Riojas](https://github.com/Roy Riojas), 19/12/2016 18:03:35 + + Fixes #12 + + Not sure under which situations a cache file might exist that does + not contain a valid JSON structure, but just in case to cover + the possibility of this happening a try catch block has been added + + If the cache is somehow not valid the cache will be discarded an a + a new cache will be stored instead +- **Other changes** + - Added travis ci support for modern node versions ([#11](https://github.com/royriojas/flat-cache/issues/11)) - [1c2b1f7]( https://github.com/royriojas/flat-cache/commit/1c2b1f7 ), [Amila Welihinda](https://github.com/Amila Welihinda), 10/11/2016 23:47:52 + + + - Bumping `circular-son` version ([#10](https://github.com/royriojas/flat-cache/issues/10)) - [4d5e861]( https://github.com/royriojas/flat-cache/commit/4d5e861 ), [Andrea Giammarchi](https://github.com/Andrea Giammarchi), 02/08/2016 07:13:52 + + As mentioned in https://github.com/WebReflection/circular-json/issues/25 `circular-json` wan't rightly implementing the license field. + + Latest version bump changed only that bit so that ESLint should now be happy. +## v1.2.1 +- **Bug Fixes** + - Add missing utils.js file to the package. closes [#8](https://github.com/royriojas/flat-cache/issues/8) - [ec10cf2]( https://github.com/royriojas/flat-cache/commit/ec10cf2 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:18:57 + + +## v1.2.0 +- **Documentation** + - Add documentation about noPrune option - [23e11f9]( https://github.com/royriojas/flat-cache/commit/23e11f9 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:06:49 + + +## v1.0.11 +- **Features** + - Add noPrune option to cache.save() method. closes [#7](https://github.com/royriojas/flat-cache/issues/7) - [2c8016a]( https://github.com/royriojas/flat-cache/commit/2c8016a ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:00:29 + + + - Add json read and write utility based on circular-json - [c31081e]( https://github.com/royriojas/flat-cache/commit/c31081e ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:58:17 + + +- **Bug Fixes** + - Remove UTF16 BOM stripping - [4a41e22]( https://github.com/royriojas/flat-cache/commit/4a41e22 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:18:06 + + Since we control both writing and reading of JSON stream, there no needs + to handle unicode BOM. + - Use circular-json to handle circular references (fix [#5](https://github.com/royriojas/flat-cache/issues/5)) - [cd7aeed]( https://github.com/royriojas/flat-cache/commit/cd7aeed ), [Jean Ponchon](https://github.com/Jean Ponchon), 25/07/2016 11:11:59 + + +- **Tests Related fixes** + - Add missing file from eslint test - [d6fa3c3]( https://github.com/royriojas/flat-cache/commit/d6fa3c3 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:15:51 + + + - Add test for circular json serialization / deserialization - [07d2ddd]( https://github.com/royriojas/flat-cache/commit/07d2ddd ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:36 + + +- **Refactoring** + - Remove unused read-json-sync - [2be1c24]( https://github.com/royriojas/flat-cache/commit/2be1c24 ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:18 + + +- **Build Scripts Changes** + - travis tests on 0.12 and 4x - [3a613fd]( https://github.com/royriojas/flat-cache/commit/3a613fd ), [royriojas](https://github.com/royriojas), 15/11/2015 14:34:40 + + +## v1.0.10 +- **Build Scripts Changes** + - add eslint-fix task - [fd29e52]( https://github.com/royriojas/flat-cache/commit/fd29e52 ), [royriojas](https://github.com/royriojas), 01/11/2015 15:04:08 + + + - make sure the test script also verify beautification and linting of files before running tests - [e94e176]( https://github.com/royriojas/flat-cache/commit/e94e176 ), [royriojas](https://github.com/royriojas), 01/11/2015 11:54:48 + + +- **Other changes** + - add clearAll for cacheDir - [97383d9]( https://github.com/royriojas/flat-cache/commit/97383d9 ), [xieyaowu](https://github.com/xieyaowu), 31/10/2015 21:02:18 + + +## v1.0.9 +- **Bug Fixes** + - wrong default values for changelogx user repo name - [7bb52d1]( https://github.com/royriojas/flat-cache/commit/7bb52d1 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:59:30 + + +## v1.0.8 +- **Build Scripts Changes** + - test against node 4 - [c395b66]( https://github.com/royriojas/flat-cache/commit/c395b66 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:51:39 + + +## v1.0.7 +- **Other changes** + - Move dependencies into devDep - [7e47099]( https://github.com/royriojas/flat-cache/commit/7e47099 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:10:57 + + +- **Documentation** + - Add missing changelog link - [f51197a]( https://github.com/royriojas/flat-cache/commit/f51197a ), [royriojas](https://github.com/royriojas), 11/09/2015 14:48:05 + + +## v1.0.6 +- **Build Scripts Changes** + - Add helpers/code check scripts - [bdb82f3]( https://github.com/royriojas/flat-cache/commit/bdb82f3 ), [royriojas](https://github.com/royriojas), 11/09/2015 14:44:31 + + +## v1.0.5 +- **Documentation** + - better description for the module - [436817f]( https://github.com/royriojas/flat-cache/commit/436817f ), [royriojas](https://github.com/royriojas), 11/09/2015 14:35:33 + + +- **Other changes** + - Update dependencies - [be88aa3]( https://github.com/royriojas/flat-cache/commit/be88aa3 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 13:47:41 + + +## v1.0.4 +- **Refactoring** + - load a cache file using the full filepath - [b8f68c2]( https://github.com/royriojas/flat-cache/commit/b8f68c2 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 04:19:14 + + +- **Documentation** + - Add documentation about `clearAll` and `clearCacheById` - [13947c1]( https://github.com/royriojas/flat-cache/commit/13947c1 ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:44:05 + + +- **Features** + - Add methods to remove the cache documents created - [af40443]( https://github.com/royriojas/flat-cache/commit/af40443 ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:39:27 + + +## v1.0.1 +- **Other changes** + - Update README.md - [c2b6805]( https://github.com/royriojas/flat-cache/commit/c2b6805 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:28:07 + + +## v1.0.0 +- **Refactoring** + - flat-cache v.1.0.0 - [c984274]( https://github.com/royriojas/flat-cache/commit/c984274 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:11:50 + + +- **Other changes** + - Initial commit - [d43cccf]( https://github.com/royriojas/flat-cache/commit/d43cccf ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 01:12:16 + + diff --git a/node_modules/flat-cache/package.json b/node_modules/flat-cache/package.json new file mode 100644 index 0000000..8bc6f87 --- /dev/null +++ b/node_modules/flat-cache/package.json @@ -0,0 +1,84 @@ +{ + "name": "flat-cache", + "version": "3.0.4", + "description": "A stupidly simple key/value storage using files to persist some data", + "repository": "royriojas/flat-cache", + "license": "MIT", + "author": { + "name": "Roy Riojas", + "url": "http://royriojas.com" + }, + "main": "src/cache.js", + "files": [ + "src/cache.js", + "src/del.js", + "src/utils.js" + ], + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "precommit": [ + "npm run verify --silent" + ], + "prepush": [ + "npm run verify --silent" + ], + "scripts": { + "eslint": "eslint --cache --cache-location=node_modules/.cache/ ./src/**/*.js ./test/**/*.js", + "eslint-fix": "npm run eslint -- --fix", + "autofix": "npm run eslint-fix", + "check": "npm run eslint", + "verify": "npm run eslint && npm run test:cache", + "install-hooks": "prepush install && changelogx install-hook && precommit install", + "changelog": "changelogx -f markdown -o ./changelog.md", + "do-changelog": "npm run changelog && git add ./changelog.md && git commit -m 'DOC: Generate changelog' --no-verify", + "pre-v": "npm run verify", + "post-v": "npm run do-changelog && git push --no-verify && git push --tags --no-verify", + "bump-major": "npm run pre-v && npm version major -m 'BLD: Release v%s' && npm run post-v", + "bump-minor": "npm run pre-v && npm version minor -m 'BLD: Release v%s' && npm run post-v", + "bump-patch": "npm run pre-v && npm version patch -m 'BLD: Release v%s' && npm run post-v", + "test:cache": "mocha -R spec test/specs", + "test": "npm run verify --silent", + "cover": "istanbul cover test/runner.js html text-summary", + "watch": "watch-run -i -p 'test/specs/**/*.js' istanbul cover test/runner.js html text-summary" + }, + "keywords": [ + "json cache", + "simple cache", + "file cache", + "key par", + "key value", + "cache" + ], + "changelogx": { + "ignoreRegExp": [ + "BLD: Release", + "DOC: Generate Changelog", + "Generated Changelog" + ], + "issueIDRegExp": "#(\\d+)", + "commitURL": "https://github.com/royriojas/flat-cache/commit/{0}", + "authorURL": "https://github.com/{0}", + "issueIDURL": "https://github.com/royriojas/flat-cache/issues/{0}", + "projectName": "flat-cache" + }, + "devDependencies": { + "chai": "^4.2.0", + "changelogx": "^5.0.6", + "eslint": "^7.13.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-mocha": "^8.0.0", + "eslint-plugin-prettier": "^3.1.4", + "glob-expand": "^0.2.1", + "istanbul": "^0.4.5", + "mocha": "^8.2.1", + "precommit": "^1.2.2", + "prepush": "^3.1.11", + "prettier": "^2.1.2", + "watch-run": "^1.2.5" + }, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } +} diff --git a/node_modules/flat-cache/src/cache.js b/node_modules/flat-cache/src/cache.js new file mode 100644 index 0000000..a58c287 --- /dev/null +++ b/node_modules/flat-cache/src/cache.js @@ -0,0 +1,197 @@ +var path = require('path'); +var fs = require('fs'); +var utils = require('./utils'); +var del = require('./del'); +var writeJSON = utils.writeJSON; + +var cache = { + /** + * Load a cache identified by the given Id. If the element does not exists, then initialize an empty + * cache storage. If specified `cacheDir` will be used as the directory to persist the data to. If omitted + * then the cache module directory `./cache` will be used instead + * + * @method load + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + */ + load: function (docId, cacheDir) { + var me = this; + + me._visited = {}; + me._persisted = {}; + me._pathToFile = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, '../.cache/', docId); + + if (fs.existsSync(me._pathToFile)) { + me._persisted = utils.tryParse(me._pathToFile, {}); + } + }, + + /** + * Load the cache from the provided file + * @method loadFile + * @param {String} pathToFile the path to the file containing the info for the cache + */ + loadFile: function (pathToFile) { + var me = this; + var dir = path.dirname(pathToFile); + var fName = path.basename(pathToFile); + + me.load(fName, dir); + }, + + /** + * Returns the entire persisted object + * @method all + * @returns {*} + */ + all: function () { + return this._persisted; + }, + + keys: function () { + return Object.keys(this._persisted); + }, + /** + * sets a key to a given value + * @method setKey + * @param key {string} the key to set + * @param value {object} the value of the key. Could be any object that can be serialized with JSON.stringify + */ + setKey: function (key, value) { + this._visited[key] = true; + this._persisted[key] = value; + }, + /** + * remove a given key from the cache + * @method removeKey + * @param key {String} the key to remove from the object + */ + removeKey: function (key) { + delete this._visited[key]; // esfmt-ignore-line + delete this._persisted[key]; // esfmt-ignore-line + }, + /** + * Return the value of the provided key + * @method getKey + * @param key {String} the name of the key to retrieve + * @returns {*} the value from the key + */ + getKey: function (key) { + this._visited[key] = true; + return this._persisted[key]; + }, + + /** + * Remove keys that were not accessed/set since the + * last time the `prune` method was called. + * @method _prune + * @private + */ + _prune: function () { + var me = this; + var obj = {}; + + var keys = Object.keys(me._visited); + + // no keys visited for either get or set value + if (keys.length === 0) { + return; + } + + keys.forEach(function (key) { + obj[key] = me._persisted[key]; + }); + + me._visited = {}; + me._persisted = obj; + }, + + /** + * Save the state of the cache identified by the docId to disk + * as a JSON structure + * @param [noPrune=false] {Boolean} whether to remove from cache the non visited files + * @method save + */ + save: function (noPrune) { + var me = this; + + !noPrune && me._prune(); + writeJSON(me._pathToFile, me._persisted); + }, + + /** + * remove the file where the cache is persisted + * @method removeCacheFile + * @return {Boolean} true or false if the file was successfully deleted + */ + removeCacheFile: function () { + return del(this._pathToFile); + }, + /** + * Destroy the file cache and cache content. + * @method destroy + */ + destroy: function () { + var me = this; + me._visited = {}; + me._persisted = {}; + + me.removeCacheFile(); + }, +}; + +module.exports = { + /** + * Alias for create. Should be considered depreacted. Will be removed in next releases + * + * @method load + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + * @returns {cache} cache instance + */ + load: function (docId, cacheDir) { + return this.create(docId, cacheDir); + }, + + /** + * Load a cache identified by the given Id. If the element does not exists, then initialize an empty + * cache storage. + * + * @method create + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + * @returns {cache} cache instance + */ + create: function (docId, cacheDir) { + var obj = Object.create(cache); + obj.load(docId, cacheDir); + return obj; + }, + + createFromFile: function (filePath) { + var obj = Object.create(cache); + obj.loadFile(filePath); + return obj; + }, + /** + * Clear the cache identified by the given id. Caches stored in a different cache directory can be deleted directly + * + * @method clearCache + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param cacheDir {String} the directory where the cache file was written + * @returns {Boolean} true if the cache folder was deleted. False otherwise + */ + clearCacheById: function (docId, cacheDir) { + var filePath = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, '../.cache/', docId); + return del(filePath); + }, + /** + * Remove all cache stored in the cache directory + * @method clearAll + * @returns {Boolean} true if the cache folder was deleted. False otherwise + */ + clearAll: function (cacheDir) { + var filePath = cacheDir ? path.resolve(cacheDir) : path.resolve(__dirname, '../.cache/'); + return del(filePath); + }, +}; diff --git a/node_modules/flat-cache/src/del.js b/node_modules/flat-cache/src/del.js new file mode 100644 index 0000000..8908744 --- /dev/null +++ b/node_modules/flat-cache/src/del.js @@ -0,0 +1,13 @@ +var rimraf = require('rimraf').sync; +var fs = require('fs'); + +module.exports = function del(file) { + if (fs.existsSync(file)) { + //if rimraf doesn't throw then the file has been deleted or didn't exist + rimraf(file, { + glob: false, + }); + return true; + } + return false; +}; diff --git a/node_modules/flat-cache/src/utils.js b/node_modules/flat-cache/src/utils.js new file mode 100644 index 0000000..05f5ac3 --- /dev/null +++ b/node_modules/flat-cache/src/utils.js @@ -0,0 +1,44 @@ +var fs = require('fs'); +var path = require('path'); +var flatted = require('flatted'); + +module.exports = { + tryParse: function (filePath, defaultValue) { + var result; + try { + result = this.readJSON(filePath); + } catch (ex) { + result = defaultValue; + } + return result; + }, + + /** + * Read json file synchronously using flatted + * + * @method readJSON + * @param {String} filePath Json filepath + * @returns {*} parse result + */ + readJSON: function (filePath) { + return flatted.parse( + fs.readFileSync(filePath, { + encoding: 'utf8', + }) + ); + }, + + /** + * Write json file synchronously using circular-json + * + * @method writeJSON + * @param {String} filePath Json filepath + * @param {*} data Object to serialize + */ + writeJSON: function (filePath, data) { + fs.mkdirSync(path.dirname(filePath), { + recursive: true, + }); + fs.writeFileSync(filePath, flatted.stringify(data)); + }, +}; diff --git a/node_modules/flatted/.github/FUNDING.yml b/node_modules/flatted/.github/FUNDING.yml new file mode 100644 index 0000000..d53abd3 --- /dev/null +++ b/node_modules/flatted/.github/FUNDING.yml @@ -0,0 +1,8 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # not working due missing www. +open_collective: # +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +custom: https://www.patreon.com/webreflection diff --git a/node_modules/flatted/.github/workflows/node.js.yml b/node_modules/flatted/.github/workflows/node.js.yml new file mode 100644 index 0000000..73cf8d6 --- /dev/null +++ b/node_modules/flatted/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: build + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test + - run: npm run coverage --if-present + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/flatted/LICENSE b/node_modules/flatted/LICENSE new file mode 100644 index 0000000..506dc47 --- /dev/null +++ b/node_modules/flatted/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2018-2020, Andrea Giammarchi, @WebReflection + +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/flatted/README.md b/node_modules/flatted/README.md new file mode 100644 index 0000000..2e466b6 --- /dev/null +++ b/node_modules/flatted/README.md @@ -0,0 +1,111 @@ +# flatted + +[![Downloads](https://img.shields.io/npm/dm/flatted.svg)](https://www.npmjs.com/package/flatted) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/flatted?branch=main) [![Build Status](https://travis-ci.com/WebReflection/flatted.svg?branch=main)](https://travis-ci.com/WebReflection/flatted) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) ![WebReflection status](https://offline.report/status/webreflection.svg) + +![snow flake](./flatted.jpg) + +**Social Media Photo by [Matt Seymour](https://unsplash.com/@mattseymour) on [Unsplash](https://unsplash.com/)** + +## Announcement 📣 + +There is a standard approach to recursion and more data-types than what JSON allows, and it's part of the [Structured Clone polyfill](https://github.com/ungap/structured-clone/#readme). + +Beside acting as a polyfill, its `@ungap/structured-clone/json` export provides both `stringify` and `parse`, and it's been tested for being faster than *flatted*, but its produced output is also smaller than *flatted* in general. + +The *@ungap/structured-clone* module is, in short, a drop in replacement for *flatted*, but it's not compatible with *flatted* specialized syntax. + +However, if recursion, as well as more data-types, are what you are after, or interesting for your projects/use cases, consider switching to this new module whenever you can 👍 + +- - - + +A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson). + +Now available also for **[PHP](./php/flatted.php)**. + +```js +npm i flatted +``` + +Usable via [CDN](https://unpkg.com/flatted) or as regular module. + +```js +// ESM +import {parse, stringify, toJSON, fromJSON} from 'flatted'; + +// CJS +const {parse, stringify, toJSON, fromJSON} = require('flatted'); + +const a = [{}]; +a[0].a = a; +a.push(a); + +stringify(a); // [["1","0"],{"a":"0"}] +``` + +## toJSON and fromJSON + +If you'd like to implicitly survive JSON serialization, these two helpers helps: + +```js +import {toJSON, fromJSON} from 'flatted'; + +class RecursiveMap extends Map { + static fromJSON(any) { + return new this(fromJSON(any)); + } + toJSON() { + return toJSON([...this.entries()]); + } +} + +const recursive = new RecursiveMap; +const same = {}; +same.same = same; +recursive.set('same', same); + +const asString = JSON.stringify(recursive); +const asMap = RecursiveMap.fromJSON(JSON.parse(asString)); +asMap.get('same') === asMap.get('same').same; +// true +``` + + +## Flatted VS JSON + +As it is for every other specialized format capable of serializing and deserializing circular data, you should never `JSON.parse(Flatted.stringify(data))`, and you should never `Flatted.parse(JSON.stringify(data))`. + +The only way this could work is to `Flatted.parse(Flatted.stringify(data))`, as it is also for _CircularJSON_ or any other, otherwise there's no granted data integrity. + +Also please note this project serializes and deserializes only data compatible with JSON, so that sockets, or anything else with internal classes different from those allowed by JSON standard, won't be serialized and unserialized as expected. + + +### New in V1: Exact same JSON API + + * Added a [reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Syntax) parameter to `.parse(string, reviver)` and revive your own objects. + * Added a [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Syntax) and a `space` parameter to `.stringify(object, replacer, space)` for feature parity with JSON signature. + + +### Compatibility +All ECMAScript engines compatible with `Map`, `Set`, `Object.keys`, and `Array.prototype.reduce` will work, even if polyfilled. + + +### How does it work ? +While stringifying, all Objects, including Arrays, and strings, are flattened out and replaced as unique index. `*` + +Once parsed, all indexes will be replaced through the flattened collection. + +`*` represented as string to avoid conflicts with numbers + +```js +// logic example +var a = [{one: 1}, {two: '2'}]; +a[0].a = a; +// a is the main object, will be at index '0' +// {one: 1} is the second object, index '1' +// {two: '2'} the third, in '2', and it has a string +// which will be found at index '3' + +Flatted.stringify(a); +// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"] +// a[one,two] {one: 1, a} {two: '2'} '2' +``` diff --git a/node_modules/flatted/SPECS.md b/node_modules/flatted/SPECS.md new file mode 100644 index 0000000..c17dfb5 --- /dev/null +++ b/node_modules/flatted/SPECS.md @@ -0,0 +1,94 @@ +# Flatted Specifications + +This document describes operations performed to produce, or parse, the flatted output. + +## stringify(any) => flattedString + +The output is always an `Array` that contains at index `0` the given value. + +If the value is an `Array` or an `Object`, per each property value passed through the callback, return the value as is if it's not an `Array`, an `Object`, or a `string`. + +In case it's an `Array`, an `Object`, or a `string`, return the index as `string`, associated through a `Map`. + +Giving the following example: + +```js +flatted.stringify('a'); // ["a"] +flatted.stringify(['a']); // [["1"],"a"] +flatted.stringify(['a', 1, 'b']); // [["1",1,"2"],"a","b"] +``` + +There is an `input` containing `[array, "a", "b"]`, where the `array` has indexes `"1"` and `"2"` as strings, indexes that point respectively at `"a"` and `"b"` within the input `[array, "a", "b"]`. + +The exact same happens for objects. + +```js +flatted.stringify('a'); // ["a"] +flatted.stringify({a: 'a'}); // [{"a":"1"},"a"] +flatted.stringify({a: 'a', n: 1, b: 'b'}); // [{"a":"1","n":1,"b":"2"},"a","b"] +``` + +Every object, string, or array, encountered during serialization will be stored once as stringified index. + +```js +// per each property/value of the object/array +if (any == null || !/object|string/.test(typeof any)) + return any; +if (!map.has(any)) { + const index = String(arr.length); + arr.push(any); + map.set(any, index); +} +return map.get(any); +``` + +This, performed before going through all properties, grants unique indexes per reference. + +The stringified indexes ensure there won't be conflicts with regularly stored numbers. + +## parse(flattedString) => any + +Everything that is a `string` is wrapped as `new String`, but strings in the array, from index `1` on, is kept as regular `string`. + +```js +const input = JSON.parse('[{"a":"1"},"b"]', Strings).map(strings); +// convert strings primitives into String instances +function Strings(key, value) { + return typeof value === 'string' ? new String(value) : value; +} +// converts String instances into strings primitives +function strings(value) { + return value instanceof String ? String(value) : value; +} +``` + +The `input` array will have a regular `string` at index `1`, but its object at index `0` will have an `instanceof String` as `.a` property. + +That is the key to place back values from the rest of the array, so that per each property of the object at index `0`, if the value is an `instanceof` String, something not serializable via JSON, it means it can be used to retrieve the position of its value from the `input` array. + +If such `value` is an object and it hasn't been parsed yet, add it as parsed and go through all its properties/values. + +```js +// outside any loop ... +const parsed = new Set; + +// ... per each property/value ... +if (value instanceof Primitive) { + const tmp = input[parseInt(value)]; + if (typeof tmp === 'object' && !parsed.has(tmp)) { + parsed.add(tmp); + output[key] = tmp; + if (typeof tmp === 'object' && tmp != null) { + // perform this same logic per + // each nested property/value ... + } + } else { + output[key] = tmp; + } +} else + output[key] = tmp; +``` + +As summary, the whole logic is based on polluting the de-serialization with a kind of variable that is unexpected, hence secure to use as directive to retrieve an index with a value. + +The usage of a `Map` and a `Set` to flag known references/strings as visited/stored makes **flatted** a rock solid, fast, and compact, solution. diff --git a/node_modules/flatted/cjs/index.js b/node_modules/flatted/cjs/index.js new file mode 100644 index 0000000..c2c9486 --- /dev/null +++ b/node_modules/flatted/cjs/index.js @@ -0,0 +1,99 @@ +'use strict'; +/*! (c) 2020 Andrea Giammarchi */ + +const {parse: $parse, stringify: $stringify} = JSON; +const {keys} = Object; + +const Primitive = String; // it could be Number +const primitive = 'string'; // it could be 'number' + +const ignore = {}; +const object = 'object'; + +const noop = (_, value) => value; + +const primitives = value => ( + value instanceof Primitive ? Primitive(value) : value +); + +const Primitives = (_, value) => ( + typeof value === primitive ? new Primitive(value) : value +); + +const revive = (input, parsed, output, $) => { + const lazy = []; + for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) { + const k = ke[y]; + const value = output[k]; + if (value instanceof Primitive) { + const tmp = input[value]; + if (typeof tmp === object && !parsed.has(tmp)) { + parsed.add(tmp); + output[k] = ignore; + lazy.push({k, a: [input, parsed, tmp, $]}); + } + else + output[k] = $.call(output, k, tmp); + } + else if (output[k] !== ignore) + output[k] = $.call(output, k, value); + } + for (let {length} = lazy, i = 0; i < length; i++) { + const {k, a} = lazy[i]; + output[k] = $.call(output, k, revive.apply(null, a)); + } + return output; +}; + +const set = (known, input, value) => { + const index = Primitive(input.push(value) - 1); + known.set(value, index); + return index; +}; + +const parse = (text, reviver) => { + const input = $parse(text, Primitives).map(primitives); + const value = input[0]; + const $ = reviver || noop; + const tmp = typeof value === object && value ? + revive(input, new Set, value, $) : + value; + return $.call({'': tmp}, '', tmp); +}; +exports.parse = parse; + +const stringify = (value, replacer, space) => { + const $ = replacer && typeof replacer === object ? + (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) : + (replacer || noop); + const known = new Map; + const input = []; + const output = []; + let i = +set(known, input, $.call({'': value}, '', value)); + let firstRun = !i; + while (i < input.length) { + firstRun = true; + output[i] = $stringify(input[i++], replace, space); + } + return '[' + output.join(',') + ']'; + function replace(key, value) { + if (firstRun) { + firstRun = !firstRun; + return value; + } + const after = $.call(this, key, value); + switch (typeof after) { + case object: + if (after === null) return after; + case primitive: + return known.get(after) || set(known, input, after); + } + return after; + } +}; +exports.stringify = stringify; + +const toJSON = any => $parse(stringify(any)); +exports.toJSON = toJSON; +const fromJSON = any => parse($stringify(any)); +exports.fromJSON = fromJSON; diff --git a/node_modules/flatted/cjs/package.json b/node_modules/flatted/cjs/package.json new file mode 100644 index 0000000..0292b99 --- /dev/null +++ b/node_modules/flatted/cjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/flatted/es.js b/node_modules/flatted/es.js new file mode 100644 index 0000000..8e4cf0c --- /dev/null +++ b/node_modules/flatted/es.js @@ -0,0 +1,2 @@ +self.Flatted=function(t){"use strict"; +/*! (c) 2020 Andrea Giammarchi */const{parse:e,stringify:n}=JSON,{keys:r}=Object,s=String,o="string",c={},l="object",a=(t,e)=>e,f=t=>t instanceof s?s(t):t,i=(t,e)=>typeof e===o?new s(e):e,u=(t,e,n,o)=>{const a=[];for(let f=r(n),{length:i}=f,u=0;u{const r=s(e.push(n)-1);return t.set(n,r),r},y=(t,n)=>{const r=e(t,i).map(f),s=r[0],o=n||a,c=typeof s===l&&s?u(r,new Set,s,o):s;return o.call({"":c},"",c)},g=(t,e,r)=>{const s=e&&typeof e===l?(t,n)=>""===t||-1y(n(t)),t.parse=y,t.stringify=g,t.toJSON=t=>e(g(t)),t}({}); diff --git a/node_modules/flatted/esm/index.js b/node_modules/flatted/esm/index.js new file mode 100644 index 0000000..9a8c239 --- /dev/null +++ b/node_modules/flatted/esm/index.js @@ -0,0 +1,94 @@ +/*! (c) 2020 Andrea Giammarchi */ + +const {parse: $parse, stringify: $stringify} = JSON; +const {keys} = Object; + +const Primitive = String; // it could be Number +const primitive = 'string'; // it could be 'number' + +const ignore = {}; +const object = 'object'; + +const noop = (_, value) => value; + +const primitives = value => ( + value instanceof Primitive ? Primitive(value) : value +); + +const Primitives = (_, value) => ( + typeof value === primitive ? new Primitive(value) : value +); + +const revive = (input, parsed, output, $) => { + const lazy = []; + for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) { + const k = ke[y]; + const value = output[k]; + if (value instanceof Primitive) { + const tmp = input[value]; + if (typeof tmp === object && !parsed.has(tmp)) { + parsed.add(tmp); + output[k] = ignore; + lazy.push({k, a: [input, parsed, tmp, $]}); + } + else + output[k] = $.call(output, k, tmp); + } + else if (output[k] !== ignore) + output[k] = $.call(output, k, value); + } + for (let {length} = lazy, i = 0; i < length; i++) { + const {k, a} = lazy[i]; + output[k] = $.call(output, k, revive.apply(null, a)); + } + return output; +}; + +const set = (known, input, value) => { + const index = Primitive(input.push(value) - 1); + known.set(value, index); + return index; +}; + +export const parse = (text, reviver) => { + const input = $parse(text, Primitives).map(primitives); + const value = input[0]; + const $ = reviver || noop; + const tmp = typeof value === object && value ? + revive(input, new Set, value, $) : + value; + return $.call({'': tmp}, '', tmp); +}; + +export const stringify = (value, replacer, space) => { + const $ = replacer && typeof replacer === object ? + (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) : + (replacer || noop); + const known = new Map; + const input = []; + const output = []; + let i = +set(known, input, $.call({'': value}, '', value)); + let firstRun = !i; + while (i < input.length) { + firstRun = true; + output[i] = $stringify(input[i++], replace, space); + } + return '[' + output.join(',') + ']'; + function replace(key, value) { + if (firstRun) { + firstRun = !firstRun; + return value; + } + const after = $.call(this, key, value); + switch (typeof after) { + case object: + if (after === null) return after; + case primitive: + return known.get(after) || set(known, input, after); + } + return after; + } +}; + +export const toJSON = any => $parse(stringify(any)); +export const fromJSON = any => parse($stringify(any)); diff --git a/node_modules/flatted/flatted.jpg b/node_modules/flatted/flatted.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8ccee5f829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iAq|V@Eogusvcjmv|4{(N1ze`C^Fe+MPZV)IQ8PYx0Bl1i0J!HK#&& ze7jfb9Cq=JkDd{-56&qn3N)jM||{fq=F*;2z*1WE{QJDglI3rp>og&GI&r>*#v z)_M-sZMw@n1WO~2uhcP>FBdcK##mKiV^L{MGtro2DNq8j2^?oqz=F9U(RLTi%pT+7 z-*7QzE1qK6$GEn*F(?_wnM~Ge7XtD0N{JsX$-Nd0zu;v&kK;+H9Ek22% zdGGLR@F2{01`WdzaRenL{Kf_&)F4XC)W5~S%)iZM8;whx{uhtV7|W@2#lOLB5>+75 z^kN=_9GJm?gi>wI>GYNQE`y!iQOFNeJN_HnV5{2%mWU}iF);;0}7ikQ*FlT=6 zm>AmBDlOtw<^aj@+(CnV$H~`vxPc1Q1s~>LhMlr(X8!>97&ZW-Vudhf0YVE($(X6Y zRkG+pD+P`i?jLf>z92G@#0k2*@L&~hp!;V(jq z^2DX88y&_$ufYJS1WYr#_0RI37_)062ls`=4bHn_RMz-@`yygB}$JoJA?(9FZBrbTY zUp}h{$=?kLWA{%jH@9+b*SJ;f@hEu)Y%3nhF5sRP7HgjO{7j<9%{W@|V3ziz1&<1d zQ*=h42VU4cMXxWP_9rGMgr6QilX}*^=lEeSBhUU+)Q^|=vCJm|zp4>m_8p8&1^)oJ zB>?@E55>go8&ZDfkp42i@+8^u3~|GTCFMHQJ}`I*)xUGe6ArWon7Xli5p%^BgUi5q zU|MX|J~q5!p5cA!FRT*c-Ul@)9vAm2FC#1x$J`Neb3_<6Z?S=)w%dv{dVN63k$2{0 zZ9$r|(rC0hYBrAaONIO@Fyh7T^)6#an56CT#JJQYCVd--QpB(OFb*%~qajRn5WVo- PMI2STBQ|Iz9Z&z+7r!@* literal 0 HcmV?d00001 diff --git a/node_modules/flatted/index.js b/node_modules/flatted/index.js new file mode 100644 index 0000000..9cc9107 --- /dev/null +++ b/node_modules/flatted/index.js @@ -0,0 +1,127 @@ +self.Flatted = (function (exports) { + 'use strict'; + + + + /*! (c) 2020 Andrea Giammarchi */ + var $parse = JSON.parse, + $stringify = JSON.stringify; + var keys = Object.keys; + var Primitive = String; // it could be Number + + var primitive = 'string'; // it could be 'number' + + var ignore = {}; + var object = 'object'; + + var noop = function noop(_, value) { + return value; + }; + + var primitives = function primitives(value) { + return value instanceof Primitive ? Primitive(value) : value; + }; + + var Primitives = function Primitives(_, value) { + return typeof(value) === primitive ? new Primitive(value) : value; + }; + + var revive = function revive(input, parsed, output, $) { + var lazy = []; + + for (var ke = keys(output), length = ke.length, y = 0; y < length; y++) { + var k = ke[y]; + var value = output[k]; + + if (value instanceof Primitive) { + var tmp = input[value]; + + if (typeof(tmp) === object && !parsed.has(tmp)) { + parsed.add(tmp); + output[k] = ignore; + lazy.push({ + k: k, + a: [input, parsed, tmp, $] + }); + } else output[k] = $.call(output, k, tmp); + } else if (output[k] !== ignore) output[k] = $.call(output, k, value); + } + + for (var _length = lazy.length, i = 0; i < _length; i++) { + var _lazy$i = lazy[i], + _k = _lazy$i.k, + a = _lazy$i.a; + output[_k] = $.call(output, _k, revive.apply(null, a)); + } + + return output; + }; + + var set = function set(known, input, value) { + var index = Primitive(input.push(value) - 1); + known.set(value, index); + return index; + }; + + var parse = function parse(text, reviver) { + var input = $parse(text, Primitives).map(primitives); + var value = input[0]; + var $ = reviver || noop; + var tmp = typeof(value) === object && value ? revive(input, new Set(), value, $) : value; + return $.call({ + '': tmp + }, '', tmp); + }; + var stringify = function stringify(value, replacer, space) { + var $ = replacer && typeof(replacer) === object ? function (k, v) { + return k === '' || -1 < replacer.indexOf(k) ? v : void 0; + } : replacer || noop; + var known = new Map(); + var input = []; + var output = []; + var i = +set(known, input, $.call({ + '': value + }, '', value)); + var firstRun = !i; + + while (i < input.length) { + firstRun = true; + output[i] = $stringify(input[i++], replace, space); + } + + return '[' + output.join(',') + ']'; + + function replace(key, value) { + if (firstRun) { + firstRun = !firstRun; + return value; + } + + var after = $.call(this, key, value); + + switch (typeof(after)) { + case object: + if (after === null) return after; + + case primitive: + return known.get(after) || set(known, input, after); + } + + return after; + } + }; + var toJSON = function toJSON(any) { + return $parse(stringify(any)); + }; + var fromJSON = function fromJSON(any) { + return parse($stringify(any)); + }; + + exports.fromJSON = fromJSON; + exports.parse = parse; + exports.stringify = stringify; + exports.toJSON = toJSON; + + return exports; + +})({}); diff --git a/node_modules/flatted/min.js b/node_modules/flatted/min.js new file mode 100644 index 0000000..a822de2 --- /dev/null +++ b/node_modules/flatted/min.js @@ -0,0 +1,2 @@ +self.Flatted=function(n){"use strict"; +/*! (c) 2020 Andrea Giammarchi */var t=JSON.parse,r=JSON.stringify,e=Object.keys,u=String,a="string",f={},i="object",o=function(n,t){return t},c=function(n){return n instanceof u?u(n):n},l=function(n,t){return typeof t===a?new u(t):t},s=function n(t,r,a,o){for(var c=[],l=e(a),s=l.length,p=0;p ./coverage/lcov.info" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/WebReflection/flatted.git" + }, + "keywords": [ + "circular", + "JSON", + "fast", + "parser", + "minimal" + ], + "author": "Andrea Giammarchi", + "license": "ISC", + "bugs": { + "url": "https://github.com/WebReflection/flatted/issues" + }, + "homepage": "https://github.com/WebReflection/flatted#readme", + "devDependencies": { + "@babel/core": "^7.16.0", + "@babel/preset-env": "^7.16.0", + "@ungap/structured-clone": "^0.3.4", + "ascjs": "^5.0.1", + "c8": "^7.10.0", + "circular-json": "^0.5.9", + "circular-json-es6": "^2.0.2", + "drop-babel-typeof": "^1.0.3", + "jsan": "^3.1.13", + "rollup": "^2.59.0", + "rollup-plugin-babel": "^4.4.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^7.0.2", + "terser": "^5.9.0" + }, + "module": "./esm/index.js", + "type": "module", + "exports": { + ".": { + "import": "./esm/index.js", + "default": "./cjs/index.js" + }, + "./package.json": "./package.json" + } +} diff --git a/node_modules/flatted/php/flatted.php b/node_modules/flatted/php/flatted.php new file mode 100644 index 0000000..30585bf --- /dev/null +++ b/node_modules/flatted/php/flatted.php @@ -0,0 +1,156 @@ +value = $value; + } +} + +class Flatted { + + // public utilities + public static function parse($json, $assoc = false, $depth = 512, $options = 0) { + $input = array_map( + 'Flatted::asString', + array_map( + 'Flatted::wrap', + json_decode($json, $assoc, $depth, $options) + ) + ); + $value = &$input[0]; + $set = array(); + $set[] = &$value; + if (is_array($value)) + return Flatted::loop(false, array_keys($value), $input, $set, $value); + if (is_object($value)) + return Flatted::loop(true, Flatted::keys($value), $input, $set, $value); + return $value; + } + + public static function stringify($value, $options = 0, $depth = 512) { + $known = new stdClass; + $known->key = array(); + $known->value = array(); + $input = array(); + $output = array(); + $i = intval(Flatted::index($known, $input, $value)); + while ($i < count($input)) { + $output[$i] = Flatted::transform($known, $input, $input[$i]); + $i++; + } + return json_encode($output, $options, $depth); + } + + // private helpers + private static function asString($value) { + return $value instanceof FlattedString ? $value->value : $value; + } + + private static function index(&$known, &$input, &$value) { + $input[] = &$value; + $index = strval(count($input) - 1); + $known->key[] = &$value; + $known->value[] = &$index; + return $index; + } + + private static function keys(&$value) { + $obj = new ReflectionObject($value); + $props = $obj->getProperties(); + $keys = array(); + foreach ($props as $prop) + $keys[] = $prop->getName(); + return $keys; + } + + private static function loop($obj, $keys, &$input, &$set, &$output) { + foreach ($keys as $key) { + $value = $obj ? $output->$key : $output[$key]; + if ($value instanceof FlattedString) + Flatted::ref($obj, $key, $input[$value->value], $input, $set, $output); + } + return $output; + } + + private static function relate(&$known, &$input, &$value) { + if (is_string($value) || is_array($value) || is_object($value)) { + $key = array_search($value, $known->key, true); + if ($key !== false) + return $known->value[$key]; + return Flatted::index($known, $input, $value); + } + return $value; + } + + private static function ref($obj, &$key, &$value, &$input, &$set, &$output) { + if (is_array($value) && !in_array($value, $set, true)) { + $set[] = $value; + $value = Flatted::loop(false, array_keys($value), $input, $set, $value); + } + elseif (is_object($value) && !in_array($value, $set, true)) { + $set[] = $value; + $value = Flatted::loop(true, Flatted::keys($value), $input, $set, $value); + } + if ($obj) { + $output->$key = &$value; + } + else { + $output[$key] = &$value; + } + } + + private static function transform(&$known, &$input, &$value) { + if (is_array($value)) { + return array_map( + function ($value) use(&$known, &$input) { + return Flatted::relate($known, $input, $value); + }, + $value + ); + } + if (is_object($value)) { + $object = new stdClass; + $keys = Flatted::keys($value); + foreach ($keys as $key) + $object->$key = Flatted::relate($known, $input, $value->$key); + return $object; + } + return $value; + } + + private static function wrap($value) { + if (is_string($value)) { + return new FlattedString($value); + } + if (is_array($value)) { + return array_map('Flatted::wrap', $value); + } + if (is_object($value)) { + $keys = Flatted::keys($value); + foreach ($keys as $key) { + $value->$key = self::wrap($value->$key); + } + return $value; + } + return $value; + } +} +?> \ No newline at end of file diff --git a/node_modules/flatted/types.d.ts b/node_modules/flatted/types.d.ts new file mode 100644 index 0000000..d38b4a1 --- /dev/null +++ b/node_modules/flatted/types.d.ts @@ -0,0 +1,62 @@ +interface Flatted { + /** + * Converts a JavaScript Object Notation (using Flatted encoding) string into an object. + * @param text A valid Flatted string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse( + text: string, + reviver?: (this: any, key: string, value: any) => any + ): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify( + value: any, + replacer?: (this: any, key: string, value: any) => any, + space?: string | number + ): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify( + value: any, + replacer?: (number | string)[] | null, + space?: string | number + ): string; + /** + * Helper to allow explicit conversions with classes. + * @param value The JSON to convert to JavaScript value + */ + fromJSON(value: any): any; + /** + * Helper to allow explicit conversions with classes. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + toJSON(value: any): any; +} + +/** + * Fast and minimal circular JSON parser. + * logic example +```js +var a = [{one: 1}, {two: '2'}]; +a[0].a = a; +// a is the main object, will be at index '0' +// {one: 1} is the second object, index '1' +// {two: '2'} the third, in '2', and it has a string +// which will be found at index '3' +Flatted.stringify(a); +// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"] +// a[one,two] {one: 1, a} {two: '2'} '2' +``` + */ +declare const Flatted: Flatted; +export = Flatted; diff --git a/node_modules/fs.realpath/LICENSE b/node_modules/fs.realpath/LICENSE new file mode 100644 index 0000000..5bd884c --- /dev/null +++ b/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +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. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + Copyright Joyent, Inc. and other Node contributors. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fs.realpath/README.md b/node_modules/fs.realpath/README.md new file mode 100644 index 0000000..a42ceac --- /dev/null +++ b/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/node_modules/fs.realpath/index.js b/node_modules/fs.realpath/index.js new file mode 100644 index 0000000..b09c7c7 --- /dev/null +++ b/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/node_modules/fs.realpath/old.js b/node_modules/fs.realpath/old.js new file mode 100644 index 0000000..b40305e --- /dev/null +++ b/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/node_modules/fs.realpath/package.json b/node_modules/fs.realpath/package.json new file mode 100644 index 0000000..3edc57d --- /dev/null +++ b/node_modules/fs.realpath/package.json @@ -0,0 +1,26 @@ +{ + "name": "fs.realpath", + "version": "1.0.0", + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "test": "tap test/*.js --cov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "files": [ + "old.js", + "index.js" + ] +} diff --git a/node_modules/function.prototype.name/.editorconfig b/node_modules/function.prototype.name/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/function.prototype.name/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/function.prototype.name/.eslintignore b/node_modules/function.prototype.name/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/function.prototype.name/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/function.prototype.name/.eslintrc b/node_modules/function.prototype.name/.eslintrc new file mode 100644 index 0000000..0b7dbb9 --- /dev/null +++ b/node_modules/function.prototype.name/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": [2, { "capIsNewExceptions": ["IsCallable"] }], + }, +} diff --git a/node_modules/function.prototype.name/.github/FUNDING.yml b/node_modules/function.prototype.name/.github/FUNDING.yml new file mode 100644 index 0000000..6a3b00c --- /dev/null +++ b/node_modules/function.prototype.name/.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/function.prototype.name +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/function.prototype.name/.nycrc b/node_modules/function.prototype.name/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/function.prototype.name/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/function.prototype.name/CHANGELOG.md b/node_modules/function.prototype.name/CHANGELOG.md new file mode 100644 index 0000000..38b3ef1 --- /dev/null +++ b/node_modules/function.prototype.name/CHANGELOG.md @@ -0,0 +1,82 @@ +1.1.5 / 2021-10-01 +================= + * [Deps] update `es-abstract` + * [meta] use `prepublishOnly` script for npm 7+ + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `tape` + * [actions] update workflows + * [actions] use `node/install` instead of `node/run`; use `codecov` action + +1.1.4 / 2021-02-22 +================= + * [readme] remove travis badge + * [meta] remove audit-level + * [meta] gitignore coverage output + * [meta] do not publish github action workflow files + * [Deps] update `call-bind`, `es-abstract`, `functions-have-names` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-strict-mode`, `tape` + * [Tests] increase coverage + * [actions] update workflows + +1.1.3 / 2020-11-27 +================= + * [Deps] update `es-abstract`, `functions-have-names`; use `call-bind` where applicable + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `make-arrow-function`, `make-generator-function`; add `aud`, `make-async-function` + * [actions] add "Allow Edits" workflow + * [actions] switch Automatic Rebase workflow to `pull_request_target` event + * [Tests] migrate tests to Github Actions + * [Tests] run `nyc` on all tests + * [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner + * [Tests] only audit prod deps + +1.1.2 / 2019-12-14 +================= + * [Refactor] use `es-abstract` + * [Deps] update `functions-have-names` + * [meta] add `funding` field + * [meta] fix repo capitalization + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` + * [Tests] use shared travis-ci configs + * [actions] add automatic rebasing / merge commit blocking + +1.1.1 / 2019-07-24 +================= + * [Refactor] use `functions-have-names` + * [meta] clean up package.json scripts + * [meta] update links + * [meta] create FUNDING.yml + * [Deps] update `is-callable`, `define-properties` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `covert` + * [Tests] use `eccheck` over `editorconfig-tools` + * [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops + * [Tests] up to `node` `v11.7`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9` + * [Test] remove `jscs` + +1.1.0 / 2017-12-31 +================= + * [New] add `auto` entry point + * [Deps] update `function-bind` + * [Dev Deps] update `uglify-register`, `tape`, `nsp`, `eslint`, `@ljharb/eslint-config`, `@es-shims/api` + * [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS + +1.0.3 / 2017-07-21 +================= + * [Fix] be robust against function name mangling + * [Refactor] move function name detection to separate file + +1.0.2 / 2017-07-14 +================= + * [Refactor] shim: Remove unnecessary `!functionsHaveNames` check + +1.0.1 / 2017-07-11 +================= + * [Fix] in IE 9-11, we must rely on `.call` being available (#13) + * [Fix] ensure that `Function.prototype.name` does not erase the getter + * [Deps] update `is-callable` + * [Dev Deps] add `safe-publish-latest` + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `@es-shims/api` + * [Tests] up to `node` `v8.1`; `v7.10`, `v6.11`, `v4.8`; improve matrix; newer npm fails on older nodes + * [Tests] use `Object` to avoid function name inference in node 7 + +1.0.0 / 2016-02-27 +================= + * Initial release. diff --git a/node_modules/function.prototype.name/LICENSE b/node_modules/function.prototype.name/LICENSE new file mode 100644 index 0000000..44f679a --- /dev/null +++ b/node_modules/function.prototype.name/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Jordan Harband + +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/function.prototype.name/README.md b/node_modules/function.prototype.name/README.md new file mode 100644 index 0000000..64aec9a --- /dev/null +++ b/node_modules/function.prototype.name/README.md @@ -0,0 +1,42 @@ +# function.prototype.name [![Version Badge][2]][1] + +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +An ES2015 spec-compliant `Function.prototype.name` shim. Invoke its "shim" method to shim Function.prototype.name if it is unavailable. +*Note*: `Function#name` requires a true ES5 environment - specifically, one with ES5 getters. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-get-regexp.prototype.flags). + +Most common usage: + +## Example + +```js +var functionName = require('function.prototype.name'); +var assert = require('assert'); + +assert.equal(functionName(function foo() {}), 'foo'); + +functionName.shim(); +assert.equal(function foo() {}.name, 'foo'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/function.prototype.name +[2]: https://versionbadg.es/es-shims/Function.prototype.name.svg +[5]: https://david-dm.org/es-shims/Function.prototype.name.svg +[6]: https://david-dm.org/es-shims/Function.prototype.name +[7]: https://david-dm.org/es-shims/Function.prototype.name/dev-status.svg +[8]: https://david-dm.org/es-shims/Function.prototype.name#info=devDependencies +[11]: https://nodei.co/npm/function.prototype.name.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/function.prototype.name.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/function.prototype.name.svg +[downloads-url]: https://npm-stat.com/charts.html?package=function.prototype.name diff --git a/node_modules/function.prototype.name/auto.js b/node_modules/function.prototype.name/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/function.prototype.name/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/function.prototype.name/helpers/functionsHaveNames.js b/node_modules/function.prototype.name/helpers/functionsHaveNames.js new file mode 100644 index 0000000..0aa8532 --- /dev/null +++ b/node_modules/function.prototype.name/helpers/functionsHaveNames.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('functions-have-names')(); + +// TODO: semver-major, remove diff --git a/node_modules/function.prototype.name/implementation.js b/node_modules/function.prototype.name/implementation.js new file mode 100644 index 0000000..03b4989 --- /dev/null +++ b/node_modules/function.prototype.name/implementation.js @@ -0,0 +1,43 @@ +'use strict'; + +var IsCallable = require('es-abstract/2021/IsCallable'); +var functionsHaveNames = require('functions-have-names')(); +var callBound = require('call-bind/callBound'); +var $functionToString = callBound('Function.prototype.toString'); +var $stringMatch = callBound('String.prototype.match'); + +var classRegex = /^class /; + +var isClass = function isClassConstructor(fn) { + if (IsCallable(fn)) { + return false; + } + if (typeof fn !== 'function') { + return false; + } + try { + var match = $stringMatch($functionToString(fn), classRegex); + return !!match; + } catch (e) {} + return false; +}; + +var regex = /\s*function\s+([^(\s]*)\s*/; + +var functionProto = Function.prototype; + +module.exports = function getName() { + if (!isClass(this) && !IsCallable(this)) { + throw new TypeError('Function.prototype.name sham getter called on non-function'); + } + if (functionsHaveNames) { + return this.name; + } + if (this === functionProto) { + return ''; + } + var str = $functionToString(this); + var match = $stringMatch(str, regex); + var name = match && match[1]; + return name; +}; diff --git a/node_modules/function.prototype.name/index.js b/node_modules/function.prototype.name/index.js new file mode 100644 index 0000000..ee9573a --- /dev/null +++ b/node_modules/function.prototype.name/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(implementation); + +define(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/function.prototype.name/package.json b/node_modules/function.prototype.name/package.json new file mode 100644 index 0000000..300810a --- /dev/null +++ b/node_modules/function.prototype.name/package.json @@ -0,0 +1,80 @@ +{ + "name": "function.prototype.name", + "version": "1.1.5", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "An ES2015 spec-compliant `Function.prototype.name` shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "npm run eccheck", + "lint": "eslint .", + "postlint": "es-shim-api --bound", + "eccheck": "eclint check '*.js' '**/*.js'" + }, + "repository": { + "type": "git", + "url": "git://github.com/es-shims/Function.prototype.name.git" + }, + "keywords": [ + "Function.prototype.name", + "function", + "name", + "ES6", + "ES2015", + "shim", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "devDependencies": { + "@es-shims/api": "^2.2.1", + "@ljharb/eslint-config": "^18.0.0", + "aud": "^1.1.5", + "eclint": "^2.8.1", + "eslint": "^7.32.0", + "for-each": "^0.3.3", + "has-strict-mode": "^1.0.1", + "make-arrow-function": "^1.2.0", + "make-async-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.1", + "uglify-register": "^1.0.1" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/11.6..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/function.prototype.name/polyfill.js b/node_modules/function.prototype.name/polyfill.js new file mode 100644 index 0000000..382fb9b --- /dev/null +++ b/node_modules/function.prototype.name/polyfill.js @@ -0,0 +1,7 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + return implementation; +}; diff --git a/node_modules/function.prototype.name/shim.js b/node_modules/function.prototype.name/shim.js new file mode 100644 index 0000000..587e3e9 --- /dev/null +++ b/node_modules/function.prototype.name/shim.js @@ -0,0 +1,35 @@ +'use strict'; + +var supportsDescriptors = require('define-properties').supportsDescriptors; +var functionsHaveNames = require('functions-have-names')(); +var getPolyfill = require('./polyfill'); +var defineProperty = Object.defineProperty; +var TypeErr = TypeError; + +module.exports = function shimName() { + var polyfill = getPolyfill(); + if (functionsHaveNames) { + return polyfill; + } + if (!supportsDescriptors) { + throw new TypeErr('Shimming Function.prototype.name support requires ES5 property descriptor support.'); + } + var functionProto = Function.prototype; + defineProperty(functionProto, 'name', { + configurable: true, + enumerable: false, + get: function () { + var name = polyfill.call(this); + if (this !== functionProto) { + defineProperty(this, 'name', { + configurable: true, + enumerable: false, + value: name, + writable: false + }); + } + return name; + } + }); + return polyfill; +}; diff --git a/node_modules/function.prototype.name/test/implementation.js b/node_modules/function.prototype.name/test/implementation.js new file mode 100644 index 0000000..7fdf95b --- /dev/null +++ b/node_modules/function.prototype.name/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation), t); + + t.end(); +}); diff --git a/node_modules/function.prototype.name/test/index.js b/node_modules/function.prototype.name/test/index.js new file mode 100644 index 0000000..68e33af --- /dev/null +++ b/node_modules/function.prototype.name/test/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var getName = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('non-functions', function (st) { + st['throws'](function () { getName(); }, TypeError, 'undefined is not a function'); + st['throws'](function () { getName(null); }, TypeError, 'null is not a function'); + st['throws'](function () { getName(true); }, TypeError, 'true is not a function'); + st['throws'](function () { getName(false); }, TypeError, 'false is not a function'); + st['throws'](function () { getName('foo'); }, TypeError, '"foo" is not a function'); + st['throws'](function () { getName([]); }, TypeError, '[] is not a function'); + st['throws'](function () { getName({}); }, TypeError, '{} is not a function'); + st['throws'](function () { getName(/a/g); }, TypeError, '/a/g is not a function'); + st.end(); + }); + + runTests(getName, t); + + t.end(); +}); diff --git a/node_modules/function.prototype.name/test/shimmed.js b/node_modules/function.prototype.name/test/shimmed.js new file mode 100644 index 0000000..c2ed13a --- /dev/null +++ b/node_modules/function.prototype.name/test/shimmed.js @@ -0,0 +1,21 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var supportsDescriptors = require('define-properties').supportsDescriptors; +var isEnumerable = Object.prototype.propertyIsEnumerable; + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.test('enumerability', { skip: !supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Function.prototype, 'name'), 'Function#name is not enumerable'); + et.equal(false, isEnumerable.call(function foo() {}, 'name'), 'a function’s name is not enumerable'); + et.end(); + }); + + runTests(function (fn) { return fn.name; }, t); + + t.end(); +}); diff --git a/node_modules/function.prototype.name/test/tests.js b/node_modules/function.prototype.name/test/tests.js new file mode 100644 index 0000000..323cf41 --- /dev/null +++ b/node_modules/function.prototype.name/test/tests.js @@ -0,0 +1,60 @@ +'use strict'; + +var functionsHaveNames = require('functions-have-names')(); +var arrows = require('make-arrow-function').list(); +var generators = require('make-generator-function')(); +var asyncs = require('make-async-function').list(); +var forEach = require('for-each'); + +var foo = Object(function foo() {}); +var anon = Object(function () {}); +var evalled = Object(Function()); // eslint-disable-line no-new-func + +module.exports = function (getName, t) { + t.test('functions', function (st) { + if (functionsHaveNames) { + st.equal(getName(foo), foo.name, 'foo has name "foo"'); + st.equal(getName(anon), anon.name, 'anonymous function has name of empty string'); + st.equal(getName(evalled), evalled.name, 'eval-d function has name "anonymous" (or empty string)'); + } + st.equal(getName(foo), 'foo', 'foo has name "foo"'); + st.equal(getName(anon), '', 'anonymous function has name of empty string'); + var evalledName = getName(evalled); + st.equal(evalledName === 'anonymous' || evalledName === '', true, 'eval-d function has name "anonymous" (or empty string'); + st.end(); + }); + + t.test('arrow functions', { skip: arrows.length === 0 }, function (st) { + st.equal(true, functionsHaveNames, 'functions have names in any env with arrow functions'); + forEach(arrows, function (arrowFn) { + st.equal(getName(arrowFn), arrowFn.name, 'arrow function name matches for ' + arrowFn); + }); + st.end(); + }); + + t.test('generators', { skip: generators.length === 0 }, function (st) { + st.equal(true, functionsHaveNames, 'functions have names in any env with generator functions'); + forEach(generators, function (genFn) { + st.equal(getName(genFn), genFn.name, 'generator function name matches for ' + genFn); + }); + st.end(); + }); + + t.test('asyncs', { skip: asyncs.length === 0 }, function (st) { + st.equal(true, functionsHaveNames, 'functions have names in any env with async functions'); + forEach(asyncs, function (asyncFn) { + st.equal(getName(asyncFn), asyncFn.name, 'async function name matches for ' + asyncFn); + }); + st.end(); + }); + + t.test('Function.prototype.name', function (st) { + st.equal(getName(function before() {}), 'before', 'function prior to accessing Function.prototype has the right name'); + var protoName = getName(Function.prototype); + // on <= node v2.5, this is "Empty" - otherwise, the empty string + st.equal(protoName === '' || protoName === 'Empty', true, 'Function.prototype has the right name'); + st.equal(getName(function after() {}), 'after', 'function after accessing Function.prototype has the right name'); + + st.end(); + }); +}; diff --git a/node_modules/function.prototype.name/test/uglified.js b/node_modules/function.prototype.name/test/uglified.js new file mode 100644 index 0000000..77733ab --- /dev/null +++ b/node_modules/function.prototype.name/test/uglified.js @@ -0,0 +1,17 @@ +'use strict'; + +var test = require('tape'); +var runTests = require('./tests'); + +test('with uglify', function (t) { + /* eslint global-require: 0 */ + require('uglify-register/api').register({ + exclude: [/\/node_modules\//, /\/test\//], + uglify: { mangle: true } + }); + + var getName = require('../'); + runTests(getName, t); + + t.end(); +}); diff --git a/node_modules/functional-red-black-tree/.npmignore b/node_modules/functional-red-black-tree/.npmignore new file mode 100644 index 0000000..ddc9ab3 --- /dev/null +++ b/node_modules/functional-red-black-tree/.npmignore @@ -0,0 +1,16 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules/* +*.DS_Store \ No newline at end of file diff --git a/node_modules/functional-red-black-tree/LICENSE b/node_modules/functional-red-black-tree/LICENSE new file mode 100644 index 0000000..8ce206a --- /dev/null +++ b/node_modules/functional-red-black-tree/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2013 Mikola Lysenko + +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/functional-red-black-tree/README.md b/node_modules/functional-red-black-tree/README.md new file mode 100644 index 0000000..edd19cb --- /dev/null +++ b/node_modules/functional-red-black-tree/README.md @@ -0,0 +1,237 @@ +functional-red-black-tree +========================= +A [fully persistent](http://en.wikipedia.org/wiki/Persistent_data_structure) [red-black tree](http://en.wikipedia.org/wiki/Red%E2%80%93black_tree) written 100% in JavaScript. Works both in node.js and in the browser via [browserify](http://browserify.org/). + +Functional (or fully presistent) data structures allow for non-destructive updates. So if you insert an element into the tree, it returns a new tree with the inserted element rather than destructively updating the existing tree in place. Doing this requires using extra memory, and if one were naive it could cost as much as reallocating the entire tree. Instead, this data structure saves some memory by recycling references to previously allocated subtrees. This requires using only O(log(n)) additional memory per update instead of a full O(n) copy. + +Some advantages of this is that it is possible to apply insertions and removals to the tree while still iterating over previous versions of the tree. Functional and persistent data structures can also be useful in many geometric algorithms like point location within triangulations or ray queries, and can be used to analyze the history of executing various algorithms. This added power though comes at a cost, since it is generally a bit slower to use a functional data structure than an imperative version. However, if your application needs this behavior then you may consider using this module. + +# Install + + npm install functional-red-black-tree + +# Example + +Here is an example of some basic usage: + +```javascript +//Load the library +var createTree = require("functional-red-black-tree") + +//Create a tree +var t1 = createTree() + +//Insert some items into the tree +var t2 = t1.insert(1, "foo") +var t3 = t2.insert(2, "bar") + +//Remove something +var t4 = t3.remove(1) +``` + + +# API + +```javascript +var createTree = require("functional-red-black-tree") +``` + +## Overview + +- [Tree methods](#tree-methods) + - [`var tree = createTree([compare])`](#var-tree-=-createtreecompare) + - [`tree.keys`](#treekeys) + - [`tree.values`](#treevalues) + - [`tree.length`](#treelength) + - [`tree.get(key)`](#treegetkey) + - [`tree.insert(key, value)`](#treeinsertkey-value) + - [`tree.remove(key)`](#treeremovekey) + - [`tree.find(key)`](#treefindkey) + - [`tree.ge(key)`](#treegekey) + - [`tree.gt(key)`](#treegtkey) + - [`tree.lt(key)`](#treeltkey) + - [`tree.le(key)`](#treelekey) + - [`tree.at(position)`](#treeatposition) + - [`tree.begin`](#treebegin) + - [`tree.end`](#treeend) + - [`tree.forEach(visitor(key,value)[, lo[, hi]])`](#treeforEachvisitorkeyvalue-lo-hi) + - [`tree.root`](#treeroot) +- [Node properties](#node-properties) + - [`node.key`](#nodekey) + - [`node.value`](#nodevalue) + - [`node.left`](#nodeleft) + - [`node.right`](#noderight) +- [Iterator methods](#iterator-methods) + - [`iter.key`](#iterkey) + - [`iter.value`](#itervalue) + - [`iter.node`](#iternode) + - [`iter.tree`](#itertree) + - [`iter.index`](#iterindex) + - [`iter.valid`](#itervalid) + - [`iter.clone()`](#iterclone) + - [`iter.remove()`](#iterremove) + - [`iter.update(value)`](#iterupdatevalue) + - [`iter.next()`](#iternext) + - [`iter.prev()`](#iterprev) + - [`iter.hasNext`](#iterhasnext) + - [`iter.hasPrev`](#iterhasprev) + +## Tree methods + +### `var tree = createTree([compare])` +Creates an empty functional tree + +* `compare` is an optional comparison function, same semantics as array.sort() + +**Returns** An empty tree ordered by `compare` + +### `tree.keys` +A sorted array of all the keys in the tree + +### `tree.values` +An array array of all the values in the tree + +### `tree.length` +The number of items in the tree + +### `tree.get(key)` +Retrieves the value associated to the given key + +* `key` is the key of the item to look up + +**Returns** The value of the first node associated to `key` + +### `tree.insert(key, value)` +Creates a new tree with the new pair inserted. + +* `key` is the key of the item to insert +* `value` is the value of the item to insert + +**Returns** A new tree with `key` and `value` inserted + +### `tree.remove(key)` +Removes the first item with `key` in the tree + +* `key` is the key of the item to remove + +**Returns** A new tree with the given item removed if it exists + +### `tree.find(key)` +Returns an iterator pointing to the first item in the tree with `key`, otherwise `null`. + +### `tree.ge(key)` +Find the first item in the tree whose key is `>= key` + +* `key` is the key to search for + +**Returns** An iterator at the given element. + +### `tree.gt(key)` +Finds the first item in the tree whose key is `> key` + +* `key` is the key to search for + +**Returns** An iterator at the given element + +### `tree.lt(key)` +Finds the last item in the tree whose key is `< key` + +* `key` is the key to search for + +**Returns** An iterator at the given element + +### `tree.le(key)` +Finds the last item in the tree whose key is `<= key` + +* `key` is the key to search for + +**Returns** An iterator at the given element + +### `tree.at(position)` +Finds an iterator starting at the given element + +* `position` is the index at which the iterator gets created + +**Returns** An iterator starting at position + +### `tree.begin` +An iterator pointing to the first element in the tree + +### `tree.end` +An iterator pointing to the last element in the tree + +### `tree.forEach(visitor(key,value)[, lo[, hi]])` +Walks a visitor function over the nodes of the tree in order. + +* `visitor(key,value)` is a callback that gets executed on each node. If a truthy value is returned from the visitor, then iteration is stopped. +* `lo` is an optional start of the range to visit (inclusive) +* `hi` is an optional end of the range to visit (non-inclusive) + +**Returns** The last value returned by the callback + +### `tree.root` +Returns the root node of the tree + + +## Node properties +Each node of the tree has the following properties: + +### `node.key` +The key associated to the node + +### `node.value` +The value associated to the node + +### `node.left` +The left subtree of the node + +### `node.right` +The right subtree of the node + +## Iterator methods + +### `iter.key` +The key of the item referenced by the iterator + +### `iter.value` +The value of the item referenced by the iterator + +### `iter.node` +The value of the node at the iterator's current position. `null` is iterator is node valid. + +### `iter.tree` +The tree associated to the iterator + +### `iter.index` +Returns the position of this iterator in the sequence. + +### `iter.valid` +Checks if the iterator is valid + +### `iter.clone()` +Makes a copy of the iterator + +### `iter.remove()` +Removes the item at the position of the iterator + +**Returns** A new binary search tree with `iter`'s item removed + +### `iter.update(value)` +Updates the value of the node in the tree at this iterator + +**Returns** A new binary search tree with the corresponding node updated + +### `iter.next()` +Advances the iterator to the next position + +### `iter.prev()` +Moves the iterator backward one element + +### `iter.hasNext` +If true, then the iterator is not at the end of the sequence + +### `iter.hasPrev` +If true, then the iterator is not at the beginning of the sequence + +# Credits +(c) 2013 Mikola Lysenko. MIT License \ No newline at end of file diff --git a/node_modules/functional-red-black-tree/bench/test.js b/node_modules/functional-red-black-tree/bench/test.js new file mode 100644 index 0000000..41c5a31 --- /dev/null +++ b/node_modules/functional-red-black-tree/bench/test.js @@ -0,0 +1,11 @@ +"use strict" + +var createTree = require("../rbtree.js") + +var t = createTree() + +var s = Date.now() +for(var i=0; i<100000; ++i) { + t = t.insert(Math.random(), Math.random()) +} +console.log(Date.now() - s) \ No newline at end of file diff --git a/node_modules/functional-red-black-tree/package.json b/node_modules/functional-red-black-tree/package.json new file mode 100644 index 0000000..13d6f27 --- /dev/null +++ b/node_modules/functional-red-black-tree/package.json @@ -0,0 +1,40 @@ +{ + "name": "functional-red-black-tree", + "version": "1.0.1", + "description": "A fully persistent balanced binary search tree", + "main": "rbtree.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "iota-array": "^0.0.1", + "tape": "^2.12.0" + }, + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/mikolalysenko/functional-red-black-tree.git" + }, + "keywords": [ + "functional", + "red", + "black", + "tree", + "binary", + "search", + "balance", + "persistent", + "fully", + "dynamic", + "data", + "structure" + ], + "author": "Mikola Lysenko", + "license": "MIT", + "bugs": { + "url": "https://github.com/mikolalysenko/functional-red-black-tree/issues" + } +} diff --git a/node_modules/functional-red-black-tree/rbtree.js b/node_modules/functional-red-black-tree/rbtree.js new file mode 100644 index 0000000..5a69a40 --- /dev/null +++ b/node_modules/functional-red-black-tree/rbtree.js @@ -0,0 +1,996 @@ +"use strict" + +module.exports = createRBTree + +var RED = 0 +var BLACK = 1 + +function RBNode(color, key, value, left, right, count) { + this._color = color + this.key = key + this.value = value + this.left = left + this.right = right + this._count = count +} + +function cloneNode(node) { + return new RBNode(node._color, node.key, node.value, node.left, node.right, node._count) +} + +function repaint(color, node) { + return new RBNode(color, node.key, node.value, node.left, node.right, node._count) +} + +function recount(node) { + node._count = 1 + (node.left ? node.left._count : 0) + (node.right ? node.right._count : 0) +} + +function RedBlackTree(compare, root) { + this._compare = compare + this.root = root +} + +var proto = RedBlackTree.prototype + +Object.defineProperty(proto, "keys", { + get: function() { + var result = [] + this.forEach(function(k,v) { + result.push(k) + }) + return result + } +}) + +Object.defineProperty(proto, "values", { + get: function() { + var result = [] + this.forEach(function(k,v) { + result.push(v) + }) + return result + } +}) + +//Returns the number of nodes in the tree +Object.defineProperty(proto, "length", { + get: function() { + if(this.root) { + return this.root._count + } + return 0 + } +}) + +//Insert a new item into the tree +proto.insert = function(key, value) { + var cmp = this._compare + //Find point to insert new node at + var n = this.root + var n_stack = [] + var d_stack = [] + while(n) { + var d = cmp(key, n.key) + n_stack.push(n) + d_stack.push(d) + if(d <= 0) { + n = n.left + } else { + n = n.right + } + } + //Rebuild path to leaf node + n_stack.push(new RBNode(RED, key, value, null, null, 1)) + for(var s=n_stack.length-2; s>=0; --s) { + var n = n_stack[s] + if(d_stack[s] <= 0) { + n_stack[s] = new RBNode(n._color, n.key, n.value, n_stack[s+1], n.right, n._count+1) + } else { + n_stack[s] = new RBNode(n._color, n.key, n.value, n.left, n_stack[s+1], n._count+1) + } + } + //Rebalance tree using rotations + //console.log("start insert", key, d_stack) + for(var s=n_stack.length-1; s>1; --s) { + var p = n_stack[s-1] + var n = n_stack[s] + if(p._color === BLACK || n._color === BLACK) { + break + } + var pp = n_stack[s-2] + if(pp.left === p) { + if(p.left === n) { + var y = pp.right + if(y && y._color === RED) { + //console.log("LLr") + p._color = BLACK + pp.right = repaint(BLACK, y) + pp._color = RED + s -= 1 + } else { + //console.log("LLb") + pp._color = RED + pp.left = p.right + p._color = BLACK + p.right = pp + n_stack[s-2] = p + n_stack[s-1] = n + recount(pp) + recount(p) + if(s >= 3) { + var ppp = n_stack[s-3] + if(ppp.left === pp) { + ppp.left = p + } else { + ppp.right = p + } + } + break + } + } else { + var y = pp.right + if(y && y._color === RED) { + //console.log("LRr") + p._color = BLACK + pp.right = repaint(BLACK, y) + pp._color = RED + s -= 1 + } else { + //console.log("LRb") + p.right = n.left + pp._color = RED + pp.left = n.right + n._color = BLACK + n.left = p + n.right = pp + n_stack[s-2] = n + n_stack[s-1] = p + recount(pp) + recount(p) + recount(n) + if(s >= 3) { + var ppp = n_stack[s-3] + if(ppp.left === pp) { + ppp.left = n + } else { + ppp.right = n + } + } + break + } + } + } else { + if(p.right === n) { + var y = pp.left + if(y && y._color === RED) { + //console.log("RRr", y.key) + p._color = BLACK + pp.left = repaint(BLACK, y) + pp._color = RED + s -= 1 + } else { + //console.log("RRb") + pp._color = RED + pp.right = p.left + p._color = BLACK + p.left = pp + n_stack[s-2] = p + n_stack[s-1] = n + recount(pp) + recount(p) + if(s >= 3) { + var ppp = n_stack[s-3] + if(ppp.right === pp) { + ppp.right = p + } else { + ppp.left = p + } + } + break + } + } else { + var y = pp.left + if(y && y._color === RED) { + //console.log("RLr") + p._color = BLACK + pp.left = repaint(BLACK, y) + pp._color = RED + s -= 1 + } else { + //console.log("RLb") + p.left = n.right + pp._color = RED + pp.right = n.left + n._color = BLACK + n.right = p + n.left = pp + n_stack[s-2] = n + n_stack[s-1] = p + recount(pp) + recount(p) + recount(n) + if(s >= 3) { + var ppp = n_stack[s-3] + if(ppp.right === pp) { + ppp.right = n + } else { + ppp.left = n + } + } + break + } + } + } + } + //Return new tree + n_stack[0]._color = BLACK + return new RedBlackTree(cmp, n_stack[0]) +} + + +//Visit all nodes inorder +function doVisitFull(visit, node) { + if(node.left) { + var v = doVisitFull(visit, node.left) + if(v) { return v } + } + var v = visit(node.key, node.value) + if(v) { return v } + if(node.right) { + return doVisitFull(visit, node.right) + } +} + +//Visit half nodes in order +function doVisitHalf(lo, compare, visit, node) { + var l = compare(lo, node.key) + if(l <= 0) { + if(node.left) { + var v = doVisitHalf(lo, compare, visit, node.left) + if(v) { return v } + } + var v = visit(node.key, node.value) + if(v) { return v } + } + if(node.right) { + return doVisitHalf(lo, compare, visit, node.right) + } +} + +//Visit all nodes within a range +function doVisit(lo, hi, compare, visit, node) { + var l = compare(lo, node.key) + var h = compare(hi, node.key) + var v + if(l <= 0) { + if(node.left) { + v = doVisit(lo, hi, compare, visit, node.left) + if(v) { return v } + } + if(h > 0) { + v = visit(node.key, node.value) + if(v) { return v } + } + } + if(h > 0 && node.right) { + return doVisit(lo, hi, compare, visit, node.right) + } +} + + +proto.forEach = function rbTreeForEach(visit, lo, hi) { + if(!this.root) { + return + } + switch(arguments.length) { + case 1: + return doVisitFull(visit, this.root) + break + + case 2: + return doVisitHalf(lo, this._compare, visit, this.root) + break + + case 3: + if(this._compare(lo, hi) >= 0) { + return + } + return doVisit(lo, hi, this._compare, visit, this.root) + break + } +} + +//First item in list +Object.defineProperty(proto, "begin", { + get: function() { + var stack = [] + var n = this.root + while(n) { + stack.push(n) + n = n.left + } + return new RedBlackTreeIterator(this, stack) + } +}) + +//Last item in list +Object.defineProperty(proto, "end", { + get: function() { + var stack = [] + var n = this.root + while(n) { + stack.push(n) + n = n.right + } + return new RedBlackTreeIterator(this, stack) + } +}) + +//Find the ith item in the tree +proto.at = function(idx) { + if(idx < 0) { + return new RedBlackTreeIterator(this, []) + } + var n = this.root + var stack = [] + while(true) { + stack.push(n) + if(n.left) { + if(idx < n.left._count) { + n = n.left + continue + } + idx -= n.left._count + } + if(!idx) { + return new RedBlackTreeIterator(this, stack) + } + idx -= 1 + if(n.right) { + if(idx >= n.right._count) { + break + } + n = n.right + } else { + break + } + } + return new RedBlackTreeIterator(this, []) +} + +proto.ge = function(key) { + var cmp = this._compare + var n = this.root + var stack = [] + var last_ptr = 0 + while(n) { + var d = cmp(key, n.key) + stack.push(n) + if(d <= 0) { + last_ptr = stack.length + } + if(d <= 0) { + n = n.left + } else { + n = n.right + } + } + stack.length = last_ptr + return new RedBlackTreeIterator(this, stack) +} + +proto.gt = function(key) { + var cmp = this._compare + var n = this.root + var stack = [] + var last_ptr = 0 + while(n) { + var d = cmp(key, n.key) + stack.push(n) + if(d < 0) { + last_ptr = stack.length + } + if(d < 0) { + n = n.left + } else { + n = n.right + } + } + stack.length = last_ptr + return new RedBlackTreeIterator(this, stack) +} + +proto.lt = function(key) { + var cmp = this._compare + var n = this.root + var stack = [] + var last_ptr = 0 + while(n) { + var d = cmp(key, n.key) + stack.push(n) + if(d > 0) { + last_ptr = stack.length + } + if(d <= 0) { + n = n.left + } else { + n = n.right + } + } + stack.length = last_ptr + return new RedBlackTreeIterator(this, stack) +} + +proto.le = function(key) { + var cmp = this._compare + var n = this.root + var stack = [] + var last_ptr = 0 + while(n) { + var d = cmp(key, n.key) + stack.push(n) + if(d >= 0) { + last_ptr = stack.length + } + if(d < 0) { + n = n.left + } else { + n = n.right + } + } + stack.length = last_ptr + return new RedBlackTreeIterator(this, stack) +} + +//Finds the item with key if it exists +proto.find = function(key) { + var cmp = this._compare + var n = this.root + var stack = [] + while(n) { + var d = cmp(key, n.key) + stack.push(n) + if(d === 0) { + return new RedBlackTreeIterator(this, stack) + } + if(d <= 0) { + n = n.left + } else { + n = n.right + } + } + return new RedBlackTreeIterator(this, []) +} + +//Removes item with key from tree +proto.remove = function(key) { + var iter = this.find(key) + if(iter) { + return iter.remove() + } + return this +} + +//Returns the item at `key` +proto.get = function(key) { + var cmp = this._compare + var n = this.root + while(n) { + var d = cmp(key, n.key) + if(d === 0) { + return n.value + } + if(d <= 0) { + n = n.left + } else { + n = n.right + } + } + return +} + +//Iterator for red black tree +function RedBlackTreeIterator(tree, stack) { + this.tree = tree + this._stack = stack +} + +var iproto = RedBlackTreeIterator.prototype + +//Test if iterator is valid +Object.defineProperty(iproto, "valid", { + get: function() { + return this._stack.length > 0 + } +}) + +//Node of the iterator +Object.defineProperty(iproto, "node", { + get: function() { + if(this._stack.length > 0) { + return this._stack[this._stack.length-1] + } + return null + }, + enumerable: true +}) + +//Makes a copy of an iterator +iproto.clone = function() { + return new RedBlackTreeIterator(this.tree, this._stack.slice()) +} + +//Swaps two nodes +function swapNode(n, v) { + n.key = v.key + n.value = v.value + n.left = v.left + n.right = v.right + n._color = v._color + n._count = v._count +} + +//Fix up a double black node in a tree +function fixDoubleBlack(stack) { + var n, p, s, z + for(var i=stack.length-1; i>=0; --i) { + n = stack[i] + if(i === 0) { + n._color = BLACK + return + } + //console.log("visit node:", n.key, i, stack[i].key, stack[i-1].key) + p = stack[i-1] + if(p.left === n) { + //console.log("left child") + s = p.right + if(s.right && s.right._color === RED) { + //console.log("case 1: right sibling child red") + s = p.right = cloneNode(s) + z = s.right = cloneNode(s.right) + p.right = s.left + s.left = p + s.right = z + s._color = p._color + n._color = BLACK + p._color = BLACK + z._color = BLACK + recount(p) + recount(s) + if(i > 1) { + var pp = stack[i-2] + if(pp.left === p) { + pp.left = s + } else { + pp.right = s + } + } + stack[i-1] = s + return + } else if(s.left && s.left._color === RED) { + //console.log("case 1: left sibling child red") + s = p.right = cloneNode(s) + z = s.left = cloneNode(s.left) + p.right = z.left + s.left = z.right + z.left = p + z.right = s + z._color = p._color + p._color = BLACK + s._color = BLACK + n._color = BLACK + recount(p) + recount(s) + recount(z) + if(i > 1) { + var pp = stack[i-2] + if(pp.left === p) { + pp.left = z + } else { + pp.right = z + } + } + stack[i-1] = z + return + } + if(s._color === BLACK) { + if(p._color === RED) { + //console.log("case 2: black sibling, red parent", p.right.value) + p._color = BLACK + p.right = repaint(RED, s) + return + } else { + //console.log("case 2: black sibling, black parent", p.right.value) + p.right = repaint(RED, s) + continue + } + } else { + //console.log("case 3: red sibling") + s = cloneNode(s) + p.right = s.left + s.left = p + s._color = p._color + p._color = RED + recount(p) + recount(s) + if(i > 1) { + var pp = stack[i-2] + if(pp.left === p) { + pp.left = s + } else { + pp.right = s + } + } + stack[i-1] = s + stack[i] = p + if(i+1 < stack.length) { + stack[i+1] = n + } else { + stack.push(n) + } + i = i+2 + } + } else { + //console.log("right child") + s = p.left + if(s.left && s.left._color === RED) { + //console.log("case 1: left sibling child red", p.value, p._color) + s = p.left = cloneNode(s) + z = s.left = cloneNode(s.left) + p.left = s.right + s.right = p + s.left = z + s._color = p._color + n._color = BLACK + p._color = BLACK + z._color = BLACK + recount(p) + recount(s) + if(i > 1) { + var pp = stack[i-2] + if(pp.right === p) { + pp.right = s + } else { + pp.left = s + } + } + stack[i-1] = s + return + } else if(s.right && s.right._color === RED) { + //console.log("case 1: right sibling child red") + s = p.left = cloneNode(s) + z = s.right = cloneNode(s.right) + p.left = z.right + s.right = z.left + z.right = p + z.left = s + z._color = p._color + p._color = BLACK + s._color = BLACK + n._color = BLACK + recount(p) + recount(s) + recount(z) + if(i > 1) { + var pp = stack[i-2] + if(pp.right === p) { + pp.right = z + } else { + pp.left = z + } + } + stack[i-1] = z + return + } + if(s._color === BLACK) { + if(p._color === RED) { + //console.log("case 2: black sibling, red parent") + p._color = BLACK + p.left = repaint(RED, s) + return + } else { + //console.log("case 2: black sibling, black parent") + p.left = repaint(RED, s) + continue + } + } else { + //console.log("case 3: red sibling") + s = cloneNode(s) + p.left = s.right + s.right = p + s._color = p._color + p._color = RED + recount(p) + recount(s) + if(i > 1) { + var pp = stack[i-2] + if(pp.right === p) { + pp.right = s + } else { + pp.left = s + } + } + stack[i-1] = s + stack[i] = p + if(i+1 < stack.length) { + stack[i+1] = n + } else { + stack.push(n) + } + i = i+2 + } + } + } +} + +//Removes item at iterator from tree +iproto.remove = function() { + var stack = this._stack + if(stack.length === 0) { + return this.tree + } + //First copy path to node + var cstack = new Array(stack.length) + var n = stack[stack.length-1] + cstack[cstack.length-1] = new RBNode(n._color, n.key, n.value, n.left, n.right, n._count) + for(var i=stack.length-2; i>=0; --i) { + var n = stack[i] + if(n.left === stack[i+1]) { + cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count) + } else { + cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) + } + } + + //Get node + n = cstack[cstack.length-1] + //console.log("start remove: ", n.value) + + //If not leaf, then swap with previous node + if(n.left && n.right) { + //console.log("moving to leaf") + + //First walk to previous leaf + var split = cstack.length + n = n.left + while(n.right) { + cstack.push(n) + n = n.right + } + //Copy path to leaf + var v = cstack[split-1] + cstack.push(new RBNode(n._color, v.key, v.value, n.left, n.right, n._count)) + cstack[split-1].key = n.key + cstack[split-1].value = n.value + + //Fix up stack + for(var i=cstack.length-2; i>=split; --i) { + n = cstack[i] + cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) + } + cstack[split-1].left = cstack[split] + } + //console.log("stack=", cstack.map(function(v) { return v.value })) + + //Remove leaf node + n = cstack[cstack.length-1] + if(n._color === RED) { + //Easy case: removing red leaf + //console.log("RED leaf") + var p = cstack[cstack.length-2] + if(p.left === n) { + p.left = null + } else if(p.right === n) { + p.right = null + } + cstack.pop() + for(var i=0; i 0) { + return this._stack[this._stack.length-1].key + } + return + }, + enumerable: true +}) + +//Returns value +Object.defineProperty(iproto, "value", { + get: function() { + if(this._stack.length > 0) { + return this._stack[this._stack.length-1].value + } + return + }, + enumerable: true +}) + + +//Returns the position of this iterator in the sorted list +Object.defineProperty(iproto, "index", { + get: function() { + var idx = 0 + var stack = this._stack + if(stack.length === 0) { + var r = this.tree.root + if(r) { + return r._count + } + return 0 + } else if(stack[stack.length-1].left) { + idx = stack[stack.length-1].left._count + } + for(var s=stack.length-2; s>=0; --s) { + if(stack[s+1] === stack[s].right) { + ++idx + if(stack[s].left) { + idx += stack[s].left._count + } + } + } + return idx + }, + enumerable: true +}) + +//Advances iterator to next element in list +iproto.next = function() { + var stack = this._stack + if(stack.length === 0) { + return + } + var n = stack[stack.length-1] + if(n.right) { + n = n.right + while(n) { + stack.push(n) + n = n.left + } + } else { + stack.pop() + while(stack.length > 0 && stack[stack.length-1].right === n) { + n = stack[stack.length-1] + stack.pop() + } + } +} + +//Checks if iterator is at end of tree +Object.defineProperty(iproto, "hasNext", { + get: function() { + var stack = this._stack + if(stack.length === 0) { + return false + } + if(stack[stack.length-1].right) { + return true + } + for(var s=stack.length-1; s>0; --s) { + if(stack[s-1].left === stack[s]) { + return true + } + } + return false + } +}) + +//Update value +iproto.update = function(value) { + var stack = this._stack + if(stack.length === 0) { + throw new Error("Can't update empty node!") + } + var cstack = new Array(stack.length) + var n = stack[stack.length-1] + cstack[cstack.length-1] = new RBNode(n._color, n.key, value, n.left, n.right, n._count) + for(var i=stack.length-2; i>=0; --i) { + n = stack[i] + if(n.left === stack[i+1]) { + cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count) + } else { + cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) + } + } + return new RedBlackTree(this.tree._compare, cstack[0]) +} + +//Moves iterator backward one element +iproto.prev = function() { + var stack = this._stack + if(stack.length === 0) { + return + } + var n = stack[stack.length-1] + if(n.left) { + n = n.left + while(n) { + stack.push(n) + n = n.right + } + } else { + stack.pop() + while(stack.length > 0 && stack[stack.length-1].left === n) { + n = stack[stack.length-1] + stack.pop() + } + } +} + +//Checks if iterator is at start of tree +Object.defineProperty(iproto, "hasPrev", { + get: function() { + var stack = this._stack + if(stack.length === 0) { + return false + } + if(stack[stack.length-1].left) { + return true + } + for(var s=stack.length-1; s>0; --s) { + if(stack[s-1].right === stack[s]) { + return true + } + } + return false + } +}) + +//Default comparison function +function defaultCompare(a, b) { + if(a < b) { + return -1 + } + if(a > b) { + return 1 + } + return 0 +} + +//Build a tree +function createRBTree(compare) { + return new RedBlackTree(compare || defaultCompare, null) +} \ No newline at end of file diff --git a/node_modules/functional-red-black-tree/test/test.js b/node_modules/functional-red-black-tree/test/test.js new file mode 100644 index 0000000..fd945d0 --- /dev/null +++ b/node_modules/functional-red-black-tree/test/test.js @@ -0,0 +1,479 @@ +"use strict" + +var makeTree = require("../rbtree.js") +var tape = require("tape") +var util = require("util") +var iota = require("iota-array") + +var COLORS = [ "r", "b", "bb" ] + +function printTree(tree) { + if(!tree) { + return [] + } + return [ COLORS[tree._color], tree.key, printTree(tree.left), printTree(tree.right) ] +} + +function print(t) { + console.log(util.inspect(printTree(t.root), {depth:12})) +} + +//Ensures the red black axioms are satisfied by tree +function checkTree(tree, t) { + if(!tree.root) { + return + } + t.equals(tree.root._color, 1, "root is black") + function checkNode(node) { + if(!node) { + return [1, 0] + } + if(node._color === 0) { + t.assert(!node.left || node.left._color === 1, "children of red node must be black") + t.assert(!node.right || node.right._color === 1, "children of red node must be black") + } else { + t.equals(node._color, 1, "node color must be red or black") + } + if(node.left) { + t.assert(tree._compare(node.left.key, node.key) <= 0, "left tree order invariant") + } + if(node.right) { + t.assert(tree._compare(node.right.key, node.key) >= 0, "right tree order invariant") + } + var cl = checkNode(node.left) + var cr = checkNode(node.right) + t.equals(cl[0], cr[0], "number of black nodes along all paths to root must be constant") + t.equals(cl[1] + cr[1] + 1, node._count, "item count consistency") + return [cl[0] + node._color, cl[1] + cr[1] + 1] + } + var r = checkNode(tree.root) + t.equals(r[1], tree.length, "tree length") +} + +tape("insert()", function(t) { + var t1 = makeTree() + + var u = t1 + var arr = [] + for(var i=20; i>=0; --i) { + var x = i + var next = u.insert(x, true) + checkTree(u, t) + checkTree(next, t) + t.equals(u.length, arr.length) + arr.push(x) + u = next + } + for(var i=-20; i<0; ++i) { + var x = i + var next = u.insert(x, true) + checkTree(u, t) + checkTree(next, t) + arr.sort(function(a,b) { return a-b }) + var ptr = 0 + u.forEach(function(k,v) { + t.equals(k, arr[ptr++]) + }) + t.equals(ptr, arr.length) + arr.push(x) + u = next + } + + var start = u.begin + for(var i=-20, j=0; j<=40; ++i, ++j) { + t.equals(u.at(j).key, i, "checking at()") + t.equals(start.key, i, "checking iter") + t.equals(start.index, j, "checking index") + t.assert(start.valid, "checking valid") + if(j < 40) { + t.assert(start.hasNext, "hasNext()") + } else { + t.assert(!start.hasNext, "eof hasNext()") + } + start.next() + } + t.assert(!start.valid, "invalid eof iterator") + t.assert(!start.hasNext, "hasNext() at eof fail") + t.equals(start.index, 41, "eof index") + + t.end() +}) + +tape("foreach", function(t) { + var u = iota(31).reduce(function(u, k, v) { + return u.insert(k, v) + }, makeTree()) + + //Check basic foreach + var visit_keys = [] + var visit_vals = [] + u.forEach(function(k,v) { + visit_keys.push(k) + visit_vals.push(v) + }) + t.same(visit_keys, u.keys) + t.same(visit_vals, u.values) + + //Check foreach with termination + visit_keys = [] + visit_vals = [] + t.equals(u.forEach(function(k,v) { + if(k === 5) { + return 1000 + } + visit_keys.push(k) + visit_vals.push(v) + }), 1000) + t.same(visit_keys, u.keys.slice(0, 5)) + t.same(visit_vals, u.values.slice(0, 5)) + + //Check half interval foreach + visit_keys = [] + visit_vals = [] + u.forEach(function(k,v) { + visit_keys.push(k) + visit_vals.push(v) + }, 3) + t.same(visit_keys, u.keys.slice(3)) + t.same(visit_vals, u.values.slice(3)) + + //Check half interval foreach with termination + visit_keys = [] + visit_vals = [] + t.equals(u.forEach(function(k,v) { + if(k === 12) { + return 1000 + } + visit_keys.push(k) + visit_vals.push(v) + }, 3), 1000) + t.same(visit_keys, u.keys.slice(3, 12)) + t.same(visit_vals, u.values.slice(3, 12)) + + + //Check interval foreach + visit_keys = [] + visit_vals = [] + u.forEach(function(k,v) { + visit_keys.push(k) + visit_vals.push(v) + }, 3, 15) + t.same(visit_keys, u.keys.slice(3, 15)) + t.same(visit_vals, u.values.slice(3, 15)) + + //Check interval foreach with termination + visit_keys = [] + visit_vals = [] + t.equals(u.forEach(function(k,v) { + if(k === 12) { + return 1000 + } + visit_keys.push(k) + visit_vals.push(v) + }, 3, 15), 1000) + t.same(visit_keys, u.keys.slice(3, 12)) + t.same(visit_vals, u.values.slice(3, 12)) + + t.end() +}) + +function compareIterators(a, b, t) { + t.equals(a.tree, b.tree, "iter trees") + t.equals(a.valid, b.valid, "iter validity") + if(!b.valid) { + return + } + t.equals(a.node, b.node, "iter node") + t.equals(a.key, b.key, "iter key") + t.equals(a.value, b.value, "iter value") + t.equals(a.index, b.index, "iter index") +} + +tape("iterators", function(t) { + var u = iota(20).reduce(function(u, k, v) { + return u.insert(k, v) + }, makeTree()) + + //Try walking forward + var iter = u.begin + var c = iter.clone() + t.ok(iter.hasNext, "must have next at beginneing") + t.ok(!iter.hasPrev, "must not have predecessor") + for(var i=0; i<20; ++i) { + var v = u.at(i) + compareIterators(iter, v, t) + t.equals(iter.index, i) + iter.next() + } + t.ok(!iter.valid, "must be eof iterator") + + //Check if the clone worked + compareIterators(c, u.begin, t) + + //Try walking backward + var iter = u.end + t.ok(!iter.hasNext, "must not have next") + t.ok(iter.hasPrev, "must have predecessor") + for(var i=19; i>=0; --i) { + var v = u.at(i) + compareIterators(iter, v, t) + t.equals(iter.index, i) + iter.prev() + } + t.ok(!iter.valid, "must be eof iterator") + + t.end() +}) + + +tape("remove()", function(t) { + + var sz = [1, 2, 10, 20, 23, 31, 32, 33] + for(var n=0; n b[0]) { return 1 } + return 0 + }) + + var keys = zipped.map(function(v) { return v[0] }) + var values = zipped.map(function(v) { return v[1] }) + + t.same(u.keys, keys) + t.same(u.values, values) + + t.end() +}) + +tape("searching", function(t) { + + var arr = [0, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6 ] + var u = arr.reduce(function(u, k, v) { + return u.insert(k, v) + }, makeTree()) + + + for(var i=0; i 0, "find repeat") + t.ok(u.find(1).index < 5, "find repeat") + + for(var i=0; i[![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does this JS environment support the `name` property on functions? + +## Example + +```js +var functionsHaveNames = require('functions-have-names'); +var assert = require('assert'); + +assert.equal(functionsHaveNames(), true); // will be `false` in IE 6-8 +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/functions-have-names +[npm-version-svg]: https://versionbadg.es/inspect-js/functions-have-names.svg +[deps-svg]: https://david-dm.org/inspect-js/functions-have-names.svg +[deps-url]: https://david-dm.org/inspect-js/functions-have-names +[dev-deps-svg]: https://david-dm.org/inspect-js/functions-have-names/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/functions-have-names#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/functions-have-names.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/functions-have-names.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/functions-have-names.svg +[downloads-url]: https://npm-stat.com/charts.html?package=functions-have-names +[codecov-image]: https://codecov.io/gh/inspect-js/functions-have-names/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/functions-have-names/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/functions-have-names +[actions-url]: https://github.com/inspect-js/functions-have-names/actions diff --git a/node_modules/functions-have-names/index.js b/node_modules/functions-have-names/index.js new file mode 100644 index 0000000..9d699dc --- /dev/null +++ b/node_modules/functions-have-names/index.js @@ -0,0 +1,31 @@ +'use strict'; + +var functionsHaveNames = function functionsHaveNames() { + return typeof function f() {}.name === 'string'; +}; + +var gOPD = Object.getOwnPropertyDescriptor; +if (gOPD) { + try { + gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + gOPD = null; + } +} + +functionsHaveNames.functionsHaveConfigurableNames = function functionsHaveConfigurableNames() { + if (!functionsHaveNames() || !gOPD) { + return false; + } + var desc = gOPD(function () {}, 'name'); + return !!desc && !!desc.configurable; +}; + +var $bind = Function.prototype.bind; + +functionsHaveNames.boundFunctionsHaveNames = function boundFunctionsHaveNames() { + return functionsHaveNames() && typeof $bind === 'function' && function f() {}.bind().name !== ''; +}; + +module.exports = functionsHaveNames; diff --git a/node_modules/functions-have-names/package.json b/node_modules/functions-have-names/package.json new file mode 100644 index 0000000..3a513cb --- /dev/null +++ b/node_modules/functions-have-names/package.json @@ -0,0 +1,55 @@ +{ + "name": "functions-have-names", + "version": "1.2.3", + "description": "Does this JS environment support the `name` property on functions?", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "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)\")\"", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/functions-have-names.git" + }, + "keywords": [ + "function", + "name", + "es5", + "names", + "functions", + "ie" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/functions-have-names/issues" + }, + "homepage": "https://github.com/inspect-js/functions-have-names#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/functions-have-names/test/index.js b/node_modules/functions-have-names/test/index.js new file mode 100644 index 0000000..0d451ce --- /dev/null +++ b/node_modules/functions-have-names/test/index.js @@ -0,0 +1,65 @@ +'use strict'; + +var test = require('tape'); + +var hasNames = require('../'); + +test('named functions', function (t) { + function f() {} // eslint-disable-line func-style + var g = function h() {}; + + t.equal(typeof hasNames, 'function', 'is a function'); + t.equal(hasNames(), f.name === 'f' && g.name === 'h', 'functions have names or not as expected'); + + t.end(); +}); + +var oDP = Object.defineProperty; +if (oDP) { + try { + oDP({}, 'a', { value: 1 }); + } catch (e) { + oDP = null; + } +} + +test('functionsHaveConfigurableNames', function (t) { + t.equal(typeof hasNames.functionsHaveConfigurableNames, 'function', 'is a function'); + + if (hasNames()) { + var fn = function f() {}; + if (oDP) { + try { + oDP(fn, 'name', { configurable: true, value: 'foo' }); + } catch (e) {} + if (fn.name === 'f') { + t.equal(hasNames.functionsHaveConfigurableNames(), false, 'function names are not configurable'); + } else if (fn.name === 'foo') { + t.equal(hasNames.functionsHaveConfigurableNames(), true, 'function names are not configurable'); + } else { + t.fail('functions have names, but something surprising has happened. Please report this!'); + } + } else { + t.equal(hasNames.functionsHaveConfigurableNames(), false, 'function names are not configurable'); + } + } else { + t.equal(hasNames.functionsHaveConfigurableNames(), false, 'functions do not have names'); + } + + t.end(); +}); + +test('boundFunctionsHaveNames', function (t) { + t.equal(typeof hasNames.boundFunctionsHaveNames, 'function', 'is a function'); + + var fn = function f() {}; + if (typeof fn.bind !== 'function') { + t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because .bind does not exist'); + } else if (hasNames()) { + t.equal(hasNames.boundFunctionsHaveNames(), fn.bind().name !== '', 'bound functions have names'); + } else { + t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because none do'); + } + + t.end(); +}); diff --git a/node_modules/get-symbol-description/.eslintignore b/node_modules/get-symbol-description/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/get-symbol-description/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/get-symbol-description/.eslintrc b/node_modules/get-symbol-description/.eslintrc new file mode 100644 index 0000000..e824dab --- /dev/null +++ b/node_modules/get-symbol-description/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/get-symbol-description/.github/FUNDING.yml b/node_modules/get-symbol-description/.github/FUNDING.yml new file mode 100644 index 0000000..499729c --- /dev/null +++ b/node_modules/get-symbol-description/.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/symbol-description +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/get-symbol-description/.nycrc b/node_modules/get-symbol-description/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/get-symbol-description/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/get-symbol-description/CHANGELOG.md b/node_modules/get-symbol-description/CHANGELOG.md new file mode 100644 index 0000000..1e1c079 --- /dev/null +++ b/node_modules/get-symbol-description/CHANGELOG.md @@ -0,0 +1,16 @@ +# 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). + +## v1.0.0 - 2021-08-17 + +### Commits + +- Initial commit: pulled from es-abstract [`6e34a05`](https://github.com/inspect-js/get-symbol-description/commit/6e34a05ef10ce8620078cf4cecbe276c1fc1ae77) +- Initial commit [`3862092`](https://github.com/inspect-js/get-symbol-description/commit/3862092248d8ffa071ec90ec39d73e8be14ba6f1) +- [meta] do not publish github action workflow files [`9d1e2b9`](https://github.com/inspect-js/get-symbol-description/commit/9d1e2b94dd97664da5d0666985a3695c23f45865) +- npm init [`5051b32`](https://github.com/inspect-js/get-symbol-description/commit/5051b3221829f364c44b4d5e9a0c35aab3247f6a) +- Only apps should have lockfiles [`b866d1c`](https://github.com/inspect-js/get-symbol-description/commit/b866d1c4b4029277618d968cfb3cbe00f012d1a7) diff --git a/node_modules/get-symbol-description/LICENSE b/node_modules/get-symbol-description/LICENSE new file mode 100644 index 0000000..7948bc0 --- /dev/null +++ b/node_modules/get-symbol-description/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +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/get-symbol-description/README.md b/node_modules/get-symbol-description/README.md new file mode 100644 index 0000000..c44e72a --- /dev/null +++ b/node_modules/get-symbol-description/README.md @@ -0,0 +1,43 @@ +# get-symbol-description [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible. + +## Example + +```js +var getSymbolDescription = require('get-symbol-description'); +var assert = require('assert'); + +assert(getSymbolDescription(Symbol()) === undefined); +assert(getSymbolDescription(Symbol('')) === ''); // or `undefined`, if in an engine that lacks name inference from concise method +assert(getSymbolDescription(Symbol('foo')) === 'foo'); +assert(getSymbolDescription(Symbol.iterator) === 'Symbol.iterator'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/get-symbol-description +[2]: https://versionbadg.es/inspect-js/get-symbol-description.svg +[5]: https://david-dm.org/inspect-js/get-symbol-description.svg +[6]: https://david-dm.org/inspect-js/get-symbol-description +[7]: https://david-dm.org/inspect-js/get-symbol-description/dev-status.svg +[8]: https://david-dm.org/inspect-js/get-symbol-description#info=devDependencies +[11]: https://nodei.co/npm/get-symbol-description.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/get-symbol-description.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/get-symbol-description.svg +[downloads-url]: https://npm-stat.com/charts.html?package=get-symbol-description +[codecov-image]: https://codecov.io/gh/inspect-js/get-symbol-description/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/get-symbol-description/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/get-symbol-description +[actions-url]: https://github.com/inspect-js/get-symbol-description/actions diff --git a/node_modules/get-symbol-description/getInferredName.js b/node_modules/get-symbol-description/getInferredName.js new file mode 100644 index 0000000..2dab6e7 --- /dev/null +++ b/node_modules/get-symbol-description/getInferredName.js @@ -0,0 +1,10 @@ +'use strict'; + +var getInferredName; +try { + // eslint-disable-next-line no-new-func + getInferredName = Function('s', 'return { [s]() {} }[s].name;'); +} catch (e) {} + +var inferred = function () {}; +module.exports = getInferredName && inferred.name === 'inferred' ? getInferredName : null; diff --git a/node_modules/get-symbol-description/index.js b/node_modules/get-symbol-description/index.js new file mode 100644 index 0000000..05d067f --- /dev/null +++ b/node_modules/get-symbol-description/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBound = require('call-bind/callBound'); + +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true); +var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true); +var symToStr = callBound('Symbol.prototype.toString', true); + +var getInferredName = require('./getInferredName'); + +/* eslint-disable consistent-return */ +module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) { + if (!thisSymbolValue) { + throw new $SyntaxError('Symbols are not supported in this environment'); + } + + // will throw if not a symbol primitive or wrapper object + var sym = thisSymbolValue(symbol); + + if (getInferredName) { + var name = getInferredName(sym); + if (name === '') { + return; + } + return name.slice(1, -1); // name.slice('['.length, -']'.length); + } + + var desc; + if (getGlobalSymbolDescription) { + desc = getGlobalSymbolDescription(sym); + if (typeof desc === 'string') { + return desc; + } + } + + desc = symToStr(sym).slice(7, -1); // str.slice('Symbol('.length, -')'.length); + if (desc) { + return desc; + } +}; diff --git a/node_modules/get-symbol-description/package.json b/node_modules/get-symbol-description/package.json new file mode 100644 index 0000000..24b0e1a --- /dev/null +++ b/node_modules/get-symbol-description/package.json @@ -0,0 +1,71 @@ +{ + "name": "get-symbol-description", + "version": "1.0.0", + "description": "Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./getInferredName": "./getInferredName.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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/get-symbol-description.git" + }, + "keywords": [ + "symbol", + "ecmascript", + "javascript", + "description" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/get-symbol-description/issues" + }, + "homepage": "https://github.com/inspect-js/get-symbol-description#readme", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "es-value-fixtures": "^1.2.1", + "eslint": "^7.32.0", + "evalmd": "^0.0.19", + "foreach": "^2.0.5", + "has": "^1.0.3", + "nyc": "^10.3.2", + "object-inspect": "^1.11.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/get-symbol-description/test/index.js b/node_modules/get-symbol-description/test/index.js new file mode 100644 index 0000000..d5363c2 --- /dev/null +++ b/node_modules/get-symbol-description/test/index.js @@ -0,0 +1,67 @@ +'use strict'; + +var test = require('tape'); +var debug = require('object-inspect'); +var forEach = require('foreach'); +var has = require('has'); +var v = require('es-value-fixtures'); + +var getSymbolDescription = require('../'); +var getInferredName = require('../getInferredName'); + +test('getSymbolDescription', function (t) { + t.test('no symbols', { skip: v.hasSymbols }, function (st) { + st['throws']( + getSymbolDescription, + SyntaxError, + 'requires Symbol support' + ); + + st.end(); + }); + + forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) { + t['throws']( + function () { getSymbolDescription(nonSymbol); }, + v.hasSymbols ? TypeError : SyntaxError, + debug(nonSymbol) + ' is not a Symbol' + ); + }); + + t.test('with symbols', { skip: !v.hasSymbols }, function (st) { + forEach( + [ + [Symbol(), undefined], + [Symbol(undefined), undefined], + [Symbol(null), 'null'], + [Symbol.iterator, 'Symbol.iterator'], + [Symbol('foo'), 'foo'] + ], + function (pair) { + var sym = pair[0]; + var desc = pair[1]; + st.equal(getSymbolDescription(sym), desc, debug(sym) + ' description is ' + debug(desc)); + } + ); + + st.test('only possible when inference or native `Symbol.prototype.description` is supported', { + skip: !getInferredName && !has(Symbol.prototype, 'description') + }, function (s2t) { + s2t.equal(getSymbolDescription(Symbol('')), '', 'Symbol("") description is ""'); + + s2t.end(); + }); + + st.test('only possible when global symbols are supported', { + skip: !has(Symbol, 'for') || !has(Symbol, 'keyFor') + }, function (s2t) { + // eslint-disable-next-line no-restricted-properties + s2t.equal(getSymbolDescription(Symbol['for']('')), '', 'Symbol.for("") description is ""'); + s2t.end(); + }); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/glob-parent/LICENSE b/node_modules/glob-parent/LICENSE new file mode 100644 index 0000000..d701b08 --- /dev/null +++ b/node_modules/glob-parent/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz , Eric Schoffstall and other 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/glob-parent/README.md b/node_modules/glob-parent/README.md new file mode 100644 index 0000000..6ae18a1 --- /dev/null +++ b/node_modules/glob-parent/README.md @@ -0,0 +1,134 @@ +

+ + + +

+ +# glob-parent + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] + +Extract the non-magic parent path from a glob string. + +## Usage + +```js +var globParent = require('glob-parent'); + +globParent('path/to/*.js'); // 'path/to' +globParent('/root/path/to/*.js'); // '/root/path/to' +globParent('/*.js'); // '/' +globParent('*.js'); // '.' +globParent('**/*.js'); // '.' +globParent('path/{to,from}'); // 'path' +globParent('path/!(to|from)'); // 'path' +globParent('path/?(to|from)'); // 'path' +globParent('path/+(to|from)'); // 'path' +globParent('path/*(to|from)'); // 'path' +globParent('path/@(to|from)'); // 'path' +globParent('path/**/*'); // 'path' + +// if provided a non-glob path, returns the nearest dir +globParent('path/foo/bar.js'); // 'path/foo' +globParent('path/foo/'); // 'path/foo' +globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## API + +### `globParent(maybeGlobString, [options])` + +Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. + +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true; +} +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: + +- `?` (question mark) unless used as a path segment alone +- `*` (asterisk) +- `|` (pipe) +- `(` (opening parenthesis) +- `)` (closing parenthesis) +- `{` (opening curly brace) +- `}` (closing curly brace) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/'); // 'foo' +globParent('foo/\\[bar]/'); // 'foo/[bar]' +``` + +## Limitations + +### Braces & Brackets + +This library attempts a quick and imperfect method of determining which path +parts have glob magic without fully parsing/lexing the pattern. There are some +advanced use cases that can trip it up, such as nested braces where the outer +pair is escaped and the inner one contains a path separator. If you find +yourself in the unlikely circumstance of being affected by this or need to +ensure higher-fidelity glob handling in your library, it is recommended that you +pre-process your input with [expand-braces] and/or [expand-brackets]. + +### Windows + +Backslashes are not valid path separators for globs. If a path with backslashes +is provided anyway, for simple cases, glob-parent will replace the path +separator for you and return the non-glob parent path (now with +forward-slashes, which are still valid as Windows path separators). + +This cannot be used in conjunction with escape characters. + +```js +// BAD +globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)' + +// GOOD +globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)' +``` + +If you are using escape characters for a pattern without path parts (i.e. +relative to `cwd`), prefix with `./` to avoid confusing glob-parent. + +```js +// BAD +globParent('foo \\[bar]'); // 'foo ' +globParent('foo \\[bar]*'); // 'foo ' + +// GOOD +globParent('./foo \\[bar]'); // 'foo [bar]' +globParent('./foo \\[bar]*'); // '.' +``` + +## License + +ISC + + +[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/glob-parent +[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square + +[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev +[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square + +[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square + + + +[expand-braces]: https://github.com/jonschlinkert/expand-braces +[expand-brackets]: https://github.com/jonschlinkert/expand-brackets + diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js new file mode 100644 index 0000000..09dde64 --- /dev/null +++ b/node_modules/glob-parent/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isGlob = require('is-glob'); +var pathPosixDirname = require('path').posix.dirname; +var isWin32 = require('os').platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var escaped = /\\([!*?|[\](){}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (isEnclosure(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlobby(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; + +function isEnclosure(str) { + var lastChar = str.slice(-1); + + var enclosureStart; + switch (lastChar) { + case '}': + enclosureStart = '{'; + break; + case ']': + enclosureStart = '['; + break; + default: + return false; + } + + var foundIndex = str.indexOf(enclosureStart); + if (foundIndex < 0) { + return false; + } + + return str.slice(foundIndex + 1, -1).includes(slash); +} + +function isGlobby(str) { + if (/\([^()]+$/.test(str)) { + return true; + } + if (str[0] === '{' || str[0] === '[') { + return true; + } + if (/[^\\][{[]/.test(str)) { + return true; + } + return isGlob(str); +} diff --git a/node_modules/glob-parent/package.json b/node_modules/glob-parent/package.json new file mode 100644 index 0000000..baeab42 --- /dev/null +++ b/node_modules/glob-parent/package.json @@ -0,0 +1,54 @@ +{ + "name": "glob-parent", + "version": "6.0.2", + "description": "Extract the non-magic parent path from a glob string.", + "author": "Gulp Team (https://gulpjs.com/)", + "contributors": [ + "Elan Shanker (https://github.com/es128)", + "Blaine Bublitz " + ], + "repository": "gulpjs/glob-parent", + "license": "ISC", + "engines": { + "node": ">=10.13.0" + }, + "main": "index.js", + "files": [ + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "nyc mocha --async-only" + }, + "dependencies": { + "is-glob": "^4.0.3" + }, + "devDependencies": { + "eslint": "^7.0.0", + "eslint-config-gulp": "^5.0.0", + "expect": "^26.0.1", + "mocha": "^7.1.2", + "nyc": "^15.0.1" + }, + "nyc": { + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": { + "singleQuote": true + }, + "keywords": [ + "glob", + "parent", + "strip", + "path", + "dirname", + "directory", + "base", + "wildcard" + ] +} diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE new file mode 100644 index 0000000..42ca266 --- /dev/null +++ b/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +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. + +## Glob Logo + +Glob's logo created by Tanya Brassie , licensed +under a Creative Commons Attribution-ShareAlike 4.0 International License +https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md new file mode 100644 index 0000000..83f0c83 --- /dev/null +++ b/node_modules/glob/README.md @@ -0,0 +1,378 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![a fun cartoon logo made of glob characters](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. +* `fs` File-system object with Node's `fs` API. By default, the built-in + `fs` module will be used. Set to a volume provided by a library like + `memfs` to avoid using the "real" file-system. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js new file mode 100644 index 0000000..424c46e --- /dev/null +++ b/node_modules/glob/common.js @@ -0,0 +1,238 @@ +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var fs = require("fs") +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasort (a, b) { + return a.localeCompare(b, 'en') +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + self.fs = options.fs || fs + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + // always treat \ in patterns as escapes, not path separators + options.allowWindowsEscape = false + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js new file mode 100644 index 0000000..37a4d7e --- /dev/null +++ b/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + self.fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + self.fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + self.fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return self.fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json new file mode 100644 index 0000000..5940b64 --- /dev/null +++ b/node_modules/glob/package.json @@ -0,0 +1,55 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "glob", + "description": "a little globber", + "version": "7.2.3", + "publishConfig": { + "tag": "v7-legacy" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "memfs": "^3.2.0", + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^15.0.6", + "tick": "0.0.6" + }, + "tap": { + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "jobs": 1 + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "node benchclean.js" + }, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js new file mode 100644 index 0000000..2c4f480 --- /dev/null +++ b/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert.ok(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = this.fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/globals/globals.json b/node_modules/globals/globals.json new file mode 100644 index 0000000..2f2b647 --- /dev/null +++ b/node_modules/globals/globals.json @@ -0,0 +1,1787 @@ +{ + "builtin": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "es5": { + "Array": false, + "Boolean": false, + "constructor": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "propertyIsEnumerable": false, + "RangeError": false, + "ReferenceError": false, + "RegExp": false, + "String": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false + }, + "es2015": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "es2017": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "es2020": { + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "es2021": { + "AggregateError": false, + "Array": false, + "ArrayBuffer": false, + "Atomics": false, + "BigInt": false, + "BigInt64Array": false, + "BigUint64Array": false, + "Boolean": false, + "constructor": false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "FinalizationRegistry": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "globalThis": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "SharedArrayBuffer": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakRef": false, + "WeakSet": false + }, + "browser": { + "AbortController": false, + "AbortSignal": false, + "addEventListener": false, + "alert": false, + "AnalyserNode": false, + "Animation": false, + "AnimationEffectReadOnly": false, + "AnimationEffectTiming": false, + "AnimationEffectTimingReadOnly": false, + "AnimationEvent": false, + "AnimationPlaybackEvent": false, + "AnimationTimeline": false, + "applicationCache": false, + "ApplicationCache": false, + "ApplicationCacheErrorEvent": false, + "atob": false, + "Attr": false, + "Audio": false, + "AudioBuffer": false, + "AudioBufferSourceNode": false, + "AudioContext": false, + "AudioDestinationNode": false, + "AudioListener": false, + "AudioNode": false, + "AudioParam": false, + "AudioProcessingEvent": false, + "AudioScheduledSourceNode": false, + "AudioWorkletGlobalScope": false, + "AudioWorkletNode": false, + "AudioWorkletProcessor": false, + "BarProp": false, + "BaseAudioContext": false, + "BatteryManager": false, + "BeforeUnloadEvent": false, + "BiquadFilterNode": false, + "Blob": false, + "BlobEvent": false, + "blur": false, + "BroadcastChannel": false, + "btoa": false, + "BudgetService": false, + "ByteLengthQueuingStrategy": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "cancelAnimationFrame": false, + "cancelIdleCallback": false, + "CanvasCaptureMediaStreamTrack": false, + "CanvasGradient": false, + "CanvasPattern": false, + "CanvasRenderingContext2D": false, + "ChannelMergerNode": false, + "ChannelSplitterNode": false, + "CharacterData": false, + "clearInterval": false, + "clearTimeout": false, + "clientInformation": false, + "ClipboardEvent": false, + "close": false, + "closed": false, + "CloseEvent": false, + "Comment": false, + "CompositionEvent": false, + "confirm": false, + "console": false, + "ConstantSourceNode": false, + "ConvolverNode": false, + "CountQueuingStrategy": false, + "createImageBitmap": false, + "Credential": false, + "CredentialsContainer": false, + "crypto": false, + "Crypto": false, + "CryptoKey": false, + "CSS": false, + "CSSConditionRule": false, + "CSSFontFaceRule": false, + "CSSGroupingRule": false, + "CSSImportRule": false, + "CSSKeyframeRule": false, + "CSSKeyframesRule": false, + "CSSMatrixComponent": false, + "CSSMediaRule": false, + "CSSNamespaceRule": false, + "CSSPageRule": false, + "CSSPerspective": false, + "CSSRotate": false, + "CSSRule": false, + "CSSRuleList": false, + "CSSScale": false, + "CSSSkew": false, + "CSSSkewX": false, + "CSSSkewY": false, + "CSSStyleDeclaration": false, + "CSSStyleRule": false, + "CSSStyleSheet": false, + "CSSSupportsRule": false, + "CSSTransformValue": false, + "CSSTranslate": false, + "CustomElementRegistry": false, + "customElements": false, + "CustomEvent": false, + "DataTransfer": false, + "DataTransferItem": false, + "DataTransferItemList": false, + "defaultstatus": false, + "defaultStatus": false, + "DelayNode": false, + "DeviceMotionEvent": false, + "DeviceOrientationEvent": false, + "devicePixelRatio": false, + "dispatchEvent": false, + "document": false, + "Document": false, + "DocumentFragment": false, + "DocumentType": false, + "DOMError": false, + "DOMException": false, + "DOMImplementation": false, + "DOMMatrix": false, + "DOMMatrixReadOnly": false, + "DOMParser": false, + "DOMPoint": false, + "DOMPointReadOnly": false, + "DOMQuad": false, + "DOMRect": false, + "DOMRectList": false, + "DOMRectReadOnly": false, + "DOMStringList": false, + "DOMStringMap": false, + "DOMTokenList": false, + "DragEvent": false, + "DynamicsCompressorNode": false, + "Element": false, + "ErrorEvent": false, + "event": false, + "Event": false, + "EventSource": false, + "EventTarget": false, + "external": false, + "fetch": false, + "File": false, + "FileList": false, + "FileReader": false, + "find": false, + "focus": false, + "FocusEvent": false, + "FontFace": false, + "FontFaceSetLoadEvent": false, + "FormData": false, + "frameElement": false, + "frames": false, + "GainNode": false, + "Gamepad": false, + "GamepadButton": false, + "GamepadEvent": false, + "getComputedStyle": false, + "getSelection": false, + "HashChangeEvent": false, + "Headers": false, + "history": false, + "History": false, + "HTMLAllCollection": false, + "HTMLAnchorElement": false, + "HTMLAreaElement": false, + "HTMLAudioElement": false, + "HTMLBaseElement": false, + "HTMLBodyElement": false, + "HTMLBRElement": false, + "HTMLButtonElement": false, + "HTMLCanvasElement": false, + "HTMLCollection": false, + "HTMLContentElement": false, + "HTMLDataElement": false, + "HTMLDataListElement": false, + "HTMLDetailsElement": false, + "HTMLDialogElement": false, + "HTMLDirectoryElement": false, + "HTMLDivElement": false, + "HTMLDListElement": false, + "HTMLDocument": false, + "HTMLElement": false, + "HTMLEmbedElement": false, + "HTMLFieldSetElement": false, + "HTMLFontElement": false, + "HTMLFormControlsCollection": false, + "HTMLFormElement": false, + "HTMLFrameElement": false, + "HTMLFrameSetElement": false, + "HTMLHeadElement": false, + "HTMLHeadingElement": false, + "HTMLHRElement": false, + "HTMLHtmlElement": false, + "HTMLIFrameElement": false, + "HTMLImageElement": false, + "HTMLInputElement": false, + "HTMLLabelElement": false, + "HTMLLegendElement": false, + "HTMLLIElement": false, + "HTMLLinkElement": false, + "HTMLMapElement": false, + "HTMLMarqueeElement": false, + "HTMLMediaElement": false, + "HTMLMenuElement": false, + "HTMLMetaElement": false, + "HTMLMeterElement": false, + "HTMLModElement": false, + "HTMLObjectElement": false, + "HTMLOListElement": false, + "HTMLOptGroupElement": false, + "HTMLOptionElement": false, + "HTMLOptionsCollection": false, + "HTMLOutputElement": false, + "HTMLParagraphElement": false, + "HTMLParamElement": false, + "HTMLPictureElement": false, + "HTMLPreElement": false, + "HTMLProgressElement": false, + "HTMLQuoteElement": false, + "HTMLScriptElement": false, + "HTMLSelectElement": false, + "HTMLShadowElement": false, + "HTMLSlotElement": false, + "HTMLSourceElement": false, + "HTMLSpanElement": false, + "HTMLStyleElement": false, + "HTMLTableCaptionElement": false, + "HTMLTableCellElement": false, + "HTMLTableColElement": false, + "HTMLTableElement": false, + "HTMLTableRowElement": false, + "HTMLTableSectionElement": false, + "HTMLTemplateElement": false, + "HTMLTextAreaElement": false, + "HTMLTimeElement": false, + "HTMLTitleElement": false, + "HTMLTrackElement": false, + "HTMLUListElement": false, + "HTMLUnknownElement": false, + "HTMLVideoElement": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "IdleDeadline": false, + "IIRFilterNode": false, + "Image": false, + "ImageBitmap": false, + "ImageBitmapRenderingContext": false, + "ImageCapture": false, + "ImageData": false, + "indexedDB": false, + "innerHeight": false, + "innerWidth": false, + "InputEvent": false, + "IntersectionObserver": false, + "IntersectionObserverEntry": false, + "Intl": false, + "isSecureContext": false, + "KeyboardEvent": false, + "KeyframeEffect": false, + "KeyframeEffectReadOnly": false, + "length": false, + "localStorage": false, + "location": true, + "Location": false, + "locationbar": false, + "matchMedia": false, + "MediaDeviceInfo": false, + "MediaDevices": false, + "MediaElementAudioSourceNode": false, + "MediaEncryptedEvent": false, + "MediaError": false, + "MediaKeyMessageEvent": false, + "MediaKeySession": false, + "MediaKeyStatusMap": false, + "MediaKeySystemAccess": false, + "MediaList": false, + "MediaMetadata": false, + "MediaQueryList": false, + "MediaQueryListEvent": false, + "MediaRecorder": false, + "MediaSettingsRange": false, + "MediaSource": false, + "MediaStream": false, + "MediaStreamAudioDestinationNode": false, + "MediaStreamAudioSourceNode": false, + "MediaStreamEvent": false, + "MediaStreamTrack": false, + "MediaStreamTrackEvent": false, + "menubar": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "MIDIAccess": false, + "MIDIConnectionEvent": false, + "MIDIInput": false, + "MIDIInputMap": false, + "MIDIMessageEvent": false, + "MIDIOutput": false, + "MIDIOutputMap": false, + "MIDIPort": false, + "MimeType": false, + "MimeTypeArray": false, + "MouseEvent": false, + "moveBy": false, + "moveTo": false, + "MutationEvent": false, + "MutationObserver": false, + "MutationRecord": false, + "name": false, + "NamedNodeMap": false, + "NavigationPreloadManager": false, + "navigator": false, + "Navigator": false, + "NetworkInformation": false, + "Node": false, + "NodeFilter": false, + "NodeIterator": false, + "NodeList": false, + "Notification": false, + "OfflineAudioCompletionEvent": false, + "OfflineAudioContext": false, + "offscreenBuffering": false, + "OffscreenCanvas": true, + "OffscreenCanvasRenderingContext2D": false, + "onabort": true, + "onafterprint": true, + "onanimationend": true, + "onanimationiteration": true, + "onanimationstart": true, + "onappinstalled": true, + "onauxclick": true, + "onbeforeinstallprompt": true, + "onbeforeprint": true, + "onbeforeunload": true, + "onblur": true, + "oncancel": true, + "oncanplay": true, + "oncanplaythrough": true, + "onchange": true, + "onclick": true, + "onclose": true, + "oncontextmenu": true, + "oncuechange": true, + "ondblclick": true, + "ondevicemotion": true, + "ondeviceorientation": true, + "ondeviceorientationabsolute": true, + "ondrag": true, + "ondragend": true, + "ondragenter": true, + "ondragleave": true, + "ondragover": true, + "ondragstart": true, + "ondrop": true, + "ondurationchange": true, + "onemptied": true, + "onended": true, + "onerror": true, + "onfocus": true, + "ongotpointercapture": true, + "onhashchange": true, + "oninput": true, + "oninvalid": true, + "onkeydown": true, + "onkeypress": true, + "onkeyup": true, + "onlanguagechange": true, + "onload": true, + "onloadeddata": true, + "onloadedmetadata": true, + "onloadstart": true, + "onlostpointercapture": true, + "onmessage": true, + "onmessageerror": true, + "onmousedown": true, + "onmouseenter": true, + "onmouseleave": true, + "onmousemove": true, + "onmouseout": true, + "onmouseover": true, + "onmouseup": true, + "onmousewheel": true, + "onoffline": true, + "ononline": true, + "onpagehide": true, + "onpageshow": true, + "onpause": true, + "onplay": true, + "onplaying": true, + "onpointercancel": true, + "onpointerdown": true, + "onpointerenter": true, + "onpointerleave": true, + "onpointermove": true, + "onpointerout": true, + "onpointerover": true, + "onpointerup": true, + "onpopstate": true, + "onprogress": true, + "onratechange": true, + "onrejectionhandled": true, + "onreset": true, + "onresize": true, + "onscroll": true, + "onsearch": true, + "onseeked": true, + "onseeking": true, + "onselect": true, + "onstalled": true, + "onstorage": true, + "onsubmit": true, + "onsuspend": true, + "ontimeupdate": true, + "ontoggle": true, + "ontransitionend": true, + "onunhandledrejection": true, + "onunload": true, + "onvolumechange": true, + "onwaiting": true, + "onwheel": true, + "open": false, + "openDatabase": false, + "opener": false, + "Option": false, + "origin": false, + "OscillatorNode": false, + "outerHeight": false, + "outerWidth": false, + "OverconstrainedError": false, + "PageTransitionEvent": false, + "pageXOffset": false, + "pageYOffset": false, + "PannerNode": false, + "parent": false, + "Path2D": false, + "PaymentAddress": false, + "PaymentRequest": false, + "PaymentRequestUpdateEvent": false, + "PaymentResponse": false, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceLongTaskTiming": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceNavigationTiming": false, + "PerformanceObserver": false, + "PerformanceObserverEntryList": false, + "PerformancePaintTiming": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "PeriodicWave": false, + "Permissions": false, + "PermissionStatus": false, + "personalbar": false, + "PhotoCapabilities": false, + "Plugin": false, + "PluginArray": false, + "PointerEvent": false, + "PopStateEvent": false, + "postMessage": false, + "Presentation": false, + "PresentationAvailability": false, + "PresentationConnection": false, + "PresentationConnectionAvailableEvent": false, + "PresentationConnectionCloseEvent": false, + "PresentationConnectionList": false, + "PresentationReceiver": false, + "PresentationRequest": false, + "print": false, + "ProcessingInstruction": false, + "ProgressEvent": false, + "PromiseRejectionEvent": false, + "prompt": false, + "PushManager": false, + "PushSubscription": false, + "PushSubscriptionOptions": false, + "queueMicrotask": false, + "RadioNodeList": false, + "Range": false, + "ReadableStream": false, + "registerProcessor": false, + "RemotePlayback": false, + "removeEventListener": false, + "Request": false, + "requestAnimationFrame": false, + "requestIdleCallback": false, + "resizeBy": false, + "ResizeObserver": false, + "ResizeObserverEntry": false, + "resizeTo": false, + "Response": false, + "RTCCertificate": false, + "RTCDataChannel": false, + "RTCDataChannelEvent": false, + "RTCDtlsTransport": false, + "RTCIceCandidate": false, + "RTCIceGatherer": false, + "RTCIceTransport": false, + "RTCPeerConnection": false, + "RTCPeerConnectionIceEvent": false, + "RTCRtpContributingSource": false, + "RTCRtpReceiver": false, + "RTCRtpSender": false, + "RTCSctpTransport": false, + "RTCSessionDescription": false, + "RTCStatsReport": false, + "RTCTrackEvent": false, + "screen": false, + "Screen": false, + "screenLeft": false, + "ScreenOrientation": false, + "screenTop": false, + "screenX": false, + "screenY": false, + "ScriptProcessorNode": false, + "scroll": false, + "scrollbars": false, + "scrollBy": false, + "scrollTo": false, + "scrollX": false, + "scrollY": false, + "SecurityPolicyViolationEvent": false, + "Selection": false, + "self": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerRegistration": false, + "sessionStorage": false, + "setInterval": false, + "setTimeout": false, + "ShadowRoot": false, + "SharedWorker": false, + "SourceBuffer": false, + "SourceBufferList": false, + "speechSynthesis": false, + "SpeechSynthesisEvent": false, + "SpeechSynthesisUtterance": false, + "StaticRange": false, + "status": false, + "statusbar": false, + "StereoPannerNode": false, + "stop": false, + "Storage": false, + "StorageEvent": false, + "StorageManager": false, + "structuredClone": false, + "styleMedia": false, + "StyleSheet": false, + "StyleSheetList": false, + "SubtleCrypto": false, + "SVGAElement": false, + "SVGAngle": false, + "SVGAnimatedAngle": false, + "SVGAnimatedBoolean": false, + "SVGAnimatedEnumeration": false, + "SVGAnimatedInteger": false, + "SVGAnimatedLength": false, + "SVGAnimatedLengthList": false, + "SVGAnimatedNumber": false, + "SVGAnimatedNumberList": false, + "SVGAnimatedPreserveAspectRatio": false, + "SVGAnimatedRect": false, + "SVGAnimatedString": false, + "SVGAnimatedTransformList": false, + "SVGAnimateElement": false, + "SVGAnimateMotionElement": false, + "SVGAnimateTransformElement": false, + "SVGAnimationElement": false, + "SVGCircleElement": false, + "SVGClipPathElement": false, + "SVGComponentTransferFunctionElement": false, + "SVGDefsElement": false, + "SVGDescElement": false, + "SVGDiscardElement": false, + "SVGElement": false, + "SVGEllipseElement": false, + "SVGFEBlendElement": false, + "SVGFEColorMatrixElement": false, + "SVGFEComponentTransferElement": false, + "SVGFECompositeElement": false, + "SVGFEConvolveMatrixElement": false, + "SVGFEDiffuseLightingElement": false, + "SVGFEDisplacementMapElement": false, + "SVGFEDistantLightElement": false, + "SVGFEDropShadowElement": false, + "SVGFEFloodElement": false, + "SVGFEFuncAElement": false, + "SVGFEFuncBElement": false, + "SVGFEFuncGElement": false, + "SVGFEFuncRElement": false, + "SVGFEGaussianBlurElement": false, + "SVGFEImageElement": false, + "SVGFEMergeElement": false, + "SVGFEMergeNodeElement": false, + "SVGFEMorphologyElement": false, + "SVGFEOffsetElement": false, + "SVGFEPointLightElement": false, + "SVGFESpecularLightingElement": false, + "SVGFESpotLightElement": false, + "SVGFETileElement": false, + "SVGFETurbulenceElement": false, + "SVGFilterElement": false, + "SVGForeignObjectElement": false, + "SVGGElement": false, + "SVGGeometryElement": false, + "SVGGradientElement": false, + "SVGGraphicsElement": false, + "SVGImageElement": false, + "SVGLength": false, + "SVGLengthList": false, + "SVGLinearGradientElement": false, + "SVGLineElement": false, + "SVGMarkerElement": false, + "SVGMaskElement": false, + "SVGMatrix": false, + "SVGMetadataElement": false, + "SVGMPathElement": false, + "SVGNumber": false, + "SVGNumberList": false, + "SVGPathElement": false, + "SVGPatternElement": false, + "SVGPoint": false, + "SVGPointList": false, + "SVGPolygonElement": false, + "SVGPolylineElement": false, + "SVGPreserveAspectRatio": false, + "SVGRadialGradientElement": false, + "SVGRect": false, + "SVGRectElement": false, + "SVGScriptElement": false, + "SVGSetElement": false, + "SVGStopElement": false, + "SVGStringList": false, + "SVGStyleElement": false, + "SVGSVGElement": false, + "SVGSwitchElement": false, + "SVGSymbolElement": false, + "SVGTextContentElement": false, + "SVGTextElement": false, + "SVGTextPathElement": false, + "SVGTextPositioningElement": false, + "SVGTitleElement": false, + "SVGTransform": false, + "SVGTransformList": false, + "SVGTSpanElement": false, + "SVGUnitTypes": false, + "SVGUseElement": false, + "SVGViewElement": false, + "TaskAttributionTiming": false, + "Text": false, + "TextDecoder": false, + "TextEncoder": false, + "TextEvent": false, + "TextMetrics": false, + "TextTrack": false, + "TextTrackCue": false, + "TextTrackCueList": false, + "TextTrackList": false, + "TimeRanges": false, + "toolbar": false, + "top": false, + "Touch": false, + "TouchEvent": false, + "TouchList": false, + "TrackEvent": false, + "TransitionEvent": false, + "TreeWalker": false, + "UIEvent": false, + "URL": false, + "URLSearchParams": false, + "ValidityState": false, + "visualViewport": false, + "VisualViewport": false, + "VTTCue": false, + "WaveShaperNode": false, + "WebAssembly": false, + "WebGL2RenderingContext": false, + "WebGLActiveInfo": false, + "WebGLBuffer": false, + "WebGLContextEvent": false, + "WebGLFramebuffer": false, + "WebGLProgram": false, + "WebGLQuery": false, + "WebGLRenderbuffer": false, + "WebGLRenderingContext": false, + "WebGLSampler": false, + "WebGLShader": false, + "WebGLShaderPrecisionFormat": false, + "WebGLSync": false, + "WebGLTexture": false, + "WebGLTransformFeedback": false, + "WebGLUniformLocation": false, + "WebGLVertexArrayObject": false, + "WebSocket": false, + "WheelEvent": false, + "window": false, + "Window": false, + "Worker": false, + "WritableStream": false, + "XMLDocument": false, + "XMLHttpRequest": false, + "XMLHttpRequestEventTarget": false, + "XMLHttpRequestUpload": false, + "XMLSerializer": false, + "XPathEvaluator": false, + "XPathExpression": false, + "XPathResult": false, + "XSLTProcessor": false + }, + "worker": { + "addEventListener": false, + "applicationCache": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "Cache": false, + "caches": false, + "clearInterval": false, + "clearTimeout": false, + "close": true, + "console": false, + "fetch": false, + "FileReaderSync": false, + "FormData": false, + "Headers": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "ImageData": false, + "importScripts": true, + "indexedDB": false, + "location": false, + "MessageChannel": false, + "MessagePort": false, + "name": false, + "navigator": false, + "Notification": false, + "onclose": true, + "onconnect": true, + "onerror": true, + "onlanguagechange": true, + "onmessage": true, + "onoffline": true, + "ononline": true, + "onrejectionhandled": true, + "onunhandledrejection": true, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "postMessage": true, + "Promise": false, + "queueMicrotask": false, + "removeEventListener": false, + "Request": false, + "Response": false, + "self": true, + "ServiceWorkerRegistration": false, + "setInterval": false, + "setTimeout": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false, + "WebSocket": false, + "Worker": false, + "WorkerGlobalScope": false, + "XMLHttpRequest": false + }, + "node": { + "__dirname": false, + "__filename": false, + "AbortController": false, + "AbortSignal": false, + "atob": false, + "btoa": false, + "Buffer": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "exports": true, + "fetch": false, + "global": false, + "Intl": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "module": false, + "performance": false, + "process": false, + "queueMicrotask": false, + "require": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false + }, + "nodeBuiltin": { + "AbortController": false, + "AbortSignal": false, + "atob": false, + "btoa": false, + "Buffer": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "fetch": false, + "global": false, + "Intl": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "performance": false, + "process": false, + "queueMicrotask": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false + }, + "commonjs": { + "exports": true, + "global": false, + "module": false, + "require": false + }, + "amd": { + "define": false, + "require": false + }, + "mocha": { + "after": false, + "afterEach": false, + "before": false, + "beforeEach": false, + "context": false, + "describe": false, + "it": false, + "mocha": false, + "run": false, + "setup": false, + "specify": false, + "suite": false, + "suiteSetup": false, + "suiteTeardown": false, + "teardown": false, + "test": false, + "xcontext": false, + "xdescribe": false, + "xit": false, + "xspecify": false + }, + "jasmine": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "expectAsync": false, + "fail": false, + "fdescribe": false, + "fit": false, + "it": false, + "jasmine": false, + "pending": false, + "runs": false, + "spyOn": false, + "spyOnAllFunctions": false, + "spyOnProperty": false, + "waits": false, + "waitsFor": false, + "xdescribe": false, + "xit": false + }, + "jest": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "fdescribe": false, + "fit": false, + "it": false, + "jest": false, + "pit": false, + "require": false, + "test": false, + "xdescribe": false, + "xit": false, + "xtest": false + }, + "qunit": { + "asyncTest": false, + "deepEqual": false, + "equal": false, + "expect": false, + "module": false, + "notDeepEqual": false, + "notEqual": false, + "notOk": false, + "notPropEqual": false, + "notStrictEqual": false, + "ok": false, + "propEqual": false, + "QUnit": false, + "raises": false, + "start": false, + "stop": false, + "strictEqual": false, + "test": false, + "throws": false + }, + "phantomjs": { + "console": true, + "exports": true, + "phantom": true, + "require": true, + "WebPage": true + }, + "couch": { + "emit": false, + "exports": false, + "getRow": false, + "log": false, + "module": false, + "provides": false, + "require": false, + "respond": false, + "send": false, + "start": false, + "sum": false + }, + "rhino": { + "defineClass": false, + "deserialize": false, + "gc": false, + "help": false, + "importClass": false, + "importPackage": false, + "java": false, + "load": false, + "loadClass": false, + "Packages": false, + "print": false, + "quit": false, + "readFile": false, + "readUrl": false, + "runCommand": false, + "seal": false, + "serialize": false, + "spawn": false, + "sync": false, + "toint32": false, + "version": false + }, + "nashorn": { + "__DIR__": false, + "__FILE__": false, + "__LINE__": false, + "com": false, + "edu": false, + "exit": false, + "java": false, + "Java": false, + "javafx": false, + "JavaImporter": false, + "javax": false, + "JSAdapter": false, + "load": false, + "loadWithNewGlobal": false, + "org": false, + "Packages": false, + "print": false, + "quit": false + }, + "wsh": { + "ActiveXObject": false, + "CollectGarbage": false, + "Debug": false, + "Enumerator": false, + "GetObject": false, + "RuntimeObject": false, + "ScriptEngine": false, + "ScriptEngineBuildVersion": false, + "ScriptEngineMajorVersion": false, + "ScriptEngineMinorVersion": false, + "VBArray": false, + "WScript": false, + "WSH": false + }, + "jquery": { + "$": false, + "jQuery": false + }, + "yui": { + "YAHOO": false, + "YAHOO_config": false, + "YUI": false, + "YUI_config": false + }, + "shelljs": { + "cat": false, + "cd": false, + "chmod": false, + "config": false, + "cp": false, + "dirs": false, + "echo": false, + "env": false, + "error": false, + "exec": false, + "exit": false, + "find": false, + "grep": false, + "ln": false, + "ls": false, + "mkdir": false, + "mv": false, + "popd": false, + "pushd": false, + "pwd": false, + "rm": false, + "sed": false, + "set": false, + "target": false, + "tempdir": false, + "test": false, + "touch": false, + "which": false + }, + "prototypejs": { + "$": false, + "$$": false, + "$A": false, + "$break": false, + "$continue": false, + "$F": false, + "$H": false, + "$R": false, + "$w": false, + "Abstract": false, + "Ajax": false, + "Autocompleter": false, + "Builder": false, + "Class": false, + "Control": false, + "Draggable": false, + "Draggables": false, + "Droppables": false, + "Effect": false, + "Element": false, + "Enumerable": false, + "Event": false, + "Field": false, + "Form": false, + "Hash": false, + "Insertion": false, + "ObjectRange": false, + "PeriodicalExecuter": false, + "Position": false, + "Prototype": false, + "Scriptaculous": false, + "Selector": false, + "Sortable": false, + "SortableObserver": false, + "Sound": false, + "Template": false, + "Toggle": false, + "Try": false + }, + "meteor": { + "$": false, + "Accounts": false, + "AccountsClient": false, + "AccountsCommon": false, + "AccountsServer": false, + "App": false, + "Assets": false, + "Blaze": false, + "check": false, + "Cordova": false, + "DDP": false, + "DDPRateLimiter": false, + "DDPServer": false, + "Deps": false, + "EJSON": false, + "Email": false, + "HTTP": false, + "Log": false, + "Match": false, + "Meteor": false, + "Mongo": false, + "MongoInternals": false, + "Npm": false, + "Package": false, + "Plugin": false, + "process": false, + "Random": false, + "ReactiveDict": false, + "ReactiveVar": false, + "Router": false, + "ServiceConfiguration": false, + "Session": false, + "share": false, + "Spacebars": false, + "Template": false, + "Tinytest": false, + "Tracker": false, + "UI": false, + "Utils": false, + "WebApp": false, + "WebAppInternals": false + }, + "mongo": { + "_isWindows": false, + "_rand": false, + "BulkWriteResult": false, + "cat": false, + "cd": false, + "connect": false, + "db": false, + "getHostName": false, + "getMemInfo": false, + "hostname": false, + "ISODate": false, + "listFiles": false, + "load": false, + "ls": false, + "md5sumFile": false, + "mkdir": false, + "Mongo": false, + "NumberInt": false, + "NumberLong": false, + "ObjectId": false, + "PlanCache": false, + "print": false, + "printjson": false, + "pwd": false, + "quit": false, + "removeFile": false, + "rs": false, + "sh": false, + "UUID": false, + "version": false, + "WriteResult": false + }, + "applescript": { + "$": false, + "Application": false, + "Automation": false, + "console": false, + "delay": false, + "Library": false, + "ObjC": false, + "ObjectSpecifier": false, + "Path": false, + "Progress": false, + "Ref": false + }, + "serviceworker": { + "addEventListener": false, + "applicationCache": false, + "atob": false, + "Blob": false, + "BroadcastChannel": false, + "btoa": false, + "Cache": false, + "caches": false, + "CacheStorage": false, + "clearInterval": false, + "clearTimeout": false, + "Client": false, + "clients": false, + "Clients": false, + "close": true, + "console": false, + "ExtendableEvent": false, + "ExtendableMessageEvent": false, + "fetch": false, + "FetchEvent": false, + "FileReaderSync": false, + "FormData": false, + "Headers": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "ImageData": false, + "importScripts": false, + "indexedDB": false, + "location": false, + "MessageChannel": false, + "MessagePort": false, + "name": false, + "navigator": false, + "Notification": false, + "onclose": true, + "onconnect": true, + "onerror": true, + "onfetch": true, + "oninstall": true, + "onlanguagechange": true, + "onmessage": true, + "onmessageerror": true, + "onnotificationclick": true, + "onnotificationclose": true, + "onoffline": true, + "ononline": true, + "onpush": true, + "onpushsubscriptionchange": true, + "onrejectionhandled": true, + "onsync": true, + "onunhandledrejection": true, + "performance": false, + "Performance": false, + "PerformanceEntry": false, + "PerformanceMark": false, + "PerformanceMeasure": false, + "PerformanceNavigation": false, + "PerformanceResourceTiming": false, + "PerformanceTiming": false, + "postMessage": true, + "Promise": false, + "queueMicrotask": false, + "registration": false, + "removeEventListener": false, + "Request": false, + "Response": false, + "self": false, + "ServiceWorker": false, + "ServiceWorkerContainer": false, + "ServiceWorkerGlobalScope": false, + "ServiceWorkerMessageEvent": false, + "ServiceWorkerRegistration": false, + "setInterval": false, + "setTimeout": false, + "skipWaiting": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false, + "WebSocket": false, + "WindowClient": false, + "Worker": false, + "WorkerGlobalScope": false, + "XMLHttpRequest": false + }, + "atomtest": { + "advanceClock": false, + "atom": false, + "fakeClearInterval": false, + "fakeClearTimeout": false, + "fakeSetInterval": false, + "fakeSetTimeout": false, + "resetTimeouts": false, + "waitsForPromise": false + }, + "embertest": { + "andThen": false, + "click": false, + "currentPath": false, + "currentRouteName": false, + "currentURL": false, + "fillIn": false, + "find": false, + "findAll": false, + "findWithAssert": false, + "keyEvent": false, + "pauseTest": false, + "resumeTest": false, + "triggerEvent": false, + "visit": false, + "wait": false + }, + "protractor": { + "$": false, + "$$": false, + "browser": false, + "by": false, + "By": false, + "DartObject": false, + "element": false, + "protractor": false + }, + "shared-node-browser": { + "AbortController": false, + "AbortSignal": false, + "atob": false, + "btoa": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "DOMException": false, + "Event": false, + "EventTarget": false, + "fetch": false, + "Intl": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "performance": false, + "queueMicrotask": false, + "setInterval": false, + "setTimeout": false, + "structuredClone": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false + }, + "webextensions": { + "browser": false, + "chrome": false, + "opr": false + }, + "greasemonkey": { + "cloneInto": false, + "createObjectIn": false, + "exportFunction": false, + "GM": false, + "GM_addElement": false, + "GM_addStyle": false, + "GM_addValueChangeListener": false, + "GM_deleteValue": false, + "GM_download": false, + "GM_getResourceText": false, + "GM_getResourceURL": false, + "GM_getTab": false, + "GM_getTabs": false, + "GM_getValue": false, + "GM_info": false, + "GM_listValues": false, + "GM_log": false, + "GM_notification": false, + "GM_openInTab": false, + "GM_registerMenuCommand": false, + "GM_removeValueChangeListener": false, + "GM_saveTab": false, + "GM_setClipboard": false, + "GM_setValue": false, + "GM_unregisterMenuCommand": false, + "GM_xmlhttpRequest": false, + "unsafeWindow": false + }, + "devtools": { + "$": false, + "$_": false, + "$$": false, + "$0": false, + "$1": false, + "$2": false, + "$3": false, + "$4": false, + "$x": false, + "chrome": false, + "clear": false, + "copy": false, + "debug": false, + "dir": false, + "dirxml": false, + "getEventListeners": false, + "inspect": false, + "keys": false, + "monitor": false, + "monitorEvents": false, + "profile": false, + "profileEnd": false, + "queryObjects": false, + "table": false, + "undebug": false, + "unmonitor": false, + "unmonitorEvents": false, + "values": false + } +} diff --git a/node_modules/globals/index.d.ts b/node_modules/globals/index.d.ts new file mode 100644 index 0000000..a842e4c --- /dev/null +++ b/node_modules/globals/index.d.ts @@ -0,0 +1,6 @@ +import {ReadonlyDeep} from 'type-fest'; +import globalsJson = require('./globals.json'); + +declare const globals: ReadonlyDeep; + +export = globals; diff --git a/node_modules/globals/index.js b/node_modules/globals/index.js new file mode 100644 index 0000000..a951582 --- /dev/null +++ b/node_modules/globals/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = require('./globals.json'); diff --git a/node_modules/globals/license b/node_modules/globals/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/globals/license @@ -0,0 +1,9 @@ +MIT License + +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: + +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/globals/package.json b/node_modules/globals/package.json new file mode 100644 index 0000000..d49ca48 --- /dev/null +++ b/node_modules/globals/package.json @@ -0,0 +1,55 @@ +{ + "name": "globals", + "version": "13.15.0", + "description": "Global identifiers from different JavaScript environments", + "license": "MIT", + "repository": "sindresorhus/globals", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "index.d.ts", + "globals.json" + ], + "keywords": [ + "globals", + "global", + "identifiers", + "variables", + "vars", + "jshint", + "eslint", + "environments" + ], + "dependencies": { + "type-fest": "^0.20.2" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.14.0", + "xo": "^0.36.1" + }, + "xo": { + "ignores": [ + "get-browser-globals.js" + ], + "rules": { + "node/no-unsupported-features/es-syntax": "off" + } + }, + "tsd": { + "compilerOptions": { + "resolveJsonModule": true + } + } +} diff --git a/node_modules/globals/readme.md b/node_modules/globals/readme.md new file mode 100644 index 0000000..0ef22c3 --- /dev/null +++ b/node_modules/globals/readme.md @@ -0,0 +1,56 @@ +# globals + +> Global identifiers from different JavaScript environments + +It's just a [JSON file](globals.json), so use it in any environment. + +This package is used by ESLint. + +**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).** + +## Install + +``` +$ npm install globals +``` + +## Usage + +```js +const globals = require('globals'); + +console.log(globals.browser); +/* +{ + addEventListener: false, + applicationCache: false, + ArrayBuffer: false, + atob: false, + … +} +*/ +``` + +Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. + +For Node.js this package provides two sets of globals: + +- `globals.nodeBuiltin`: Globals available to all code running in Node.js. + These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`. + See: https://nodejs.org/api/globals.html +- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope"). + See: https://nodejs.org/api/modules.html#modules_the_module_scope + +When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. + +--- + +
+ + 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/has-bigints/.eslintrc b/node_modules/has-bigints/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/node_modules/has-bigints/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/has-bigints/.github/FUNDING.yml b/node_modules/has-bigints/.github/FUNDING.yml new file mode 100644 index 0000000..5b597c8 --- /dev/null +++ b/node_modules/has-bigints/.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/has-bigints +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/has-bigints/.nycrc b/node_modules/has-bigints/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/has-bigints/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/has-bigints/CHANGELOG.md b/node_modules/has-bigints/CHANGELOG.md new file mode 100644 index 0000000..ef24d1e --- /dev/null +++ b/node_modules/has-bigints/CHANGELOG.md @@ -0,0 +1,60 @@ +# 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). + +## [v1.0.2](https://github.com/inspect-js/has-bigints/compare/v1.0.1...v1.0.2) - 2022-04-19 + +### Commits + +- [actions] reuse common workflows [`a655b7f`](https://github.com/inspect-js/has-bigints/commit/a655b7f7733ba2de078b3a59a704c2795440d08c) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`730a2e5`](https://github.com/inspect-js/has-bigints/commit/730a2e53d3f5f82ac43a11cb9753b11445d06d58) +- [readme] add github actions/codecov badges; update URLs [`9a83788`](https://github.com/inspect-js/has-bigints/commit/9a8378861917b41ebb360a9d8ab3d39aa33acf7b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`b1edc52`](https://github.com/inspect-js/has-bigints/commit/b1edc522ef6c23556e55b9c81b65fe884d1e2cc4) +- [actions] update codecov uploader [`cbb1bd0`](https://github.com/inspect-js/has-bigints/commit/cbb1bd0eff486070a19283238da6afd33ca73b4b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`8717e6d`](https://github.com/inspect-js/has-bigints/commit/8717e6d6ae6b5010aea1fac5e48dfdfaf35d8c72) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `safe-publish-latest`, `tape` [`5f70eab`](https://github.com/inspect-js/has-bigints/commit/5f70eab763118d40415f13e47446ea5c011fbe18) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`a1446bc`](https://github.com/inspect-js/has-bigints/commit/a1446bc3e806ce3911c73d6fbdd981f461c41019) +- [meta] use `prepublishOnly` script for npm 7+ [`f2dd197`](https://github.com/inspect-js/has-bigints/commit/f2dd19716a06ca7a971644761e864f0435db278e) +- [actions] use checkout v3 [`1ba72f1`](https://github.com/inspect-js/has-bigints/commit/1ba72f19ada076791ff193aca9d8537388d67ddb) +- [Refactor] use a global variable to get the original BigInt instead of a global property [`a7ccfac`](https://github.com/inspect-js/has-bigints/commit/a7ccfac0414e56dadd263fd07c0b5141388df502) +- [actions] skip `npm ls` on older nodes [`62d31e7`](https://github.com/inspect-js/has-bigints/commit/62d31e79658b16391458d0728e0dacbee8694ebb) + +## [v1.0.1](https://github.com/inspect-js/has-bigints/compare/v1.0.0...v1.0.1) - 2020-12-13 + +### Commits + +- [Tests] use shared travis-ci configs [`46a0d6b`](https://github.com/inspect-js/has-bigints/commit/46a0d6be7ed83bd7f5ead11e4eab7fc91570a448) +- [Tests] migrate tests to Github Actions [`91a38fa`](https://github.com/inspect-js/has-bigints/commit/91a38fa4b85a420b8cf4926b3799e6ceb60d8690) +- [meta] do not publish github action workflow files [`69aacba`](https://github.com/inspect-js/has-bigints/commit/69aacba320c1221e7fee1c71bde600bce063f24b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`64e2c08`](https://github.com/inspect-js/has-bigints/commit/64e2c0895b21ac91a137452fd2455932f62a2fc1) +- [Tests] run `nyc` on all tests; use `tape` runner [`8009375`](https://github.com/inspect-js/has-bigints/commit/8009375e5ec9faca6bbc09441002af5c5e59ff20) +- [actions] add automatic rebasing / merge commit blocking [`e599917`](https://github.com/inspect-js/has-bigints/commit/e599917fd1f751c9a6c0daac70acb243f8c3a01d) +- [actions] add "Allow Edits" workflow [`bd0126e`](https://github.com/inspect-js/has-bigints/commit/bd0126eba2d67e9b9d588bced34413f507698154) +- [readme] remove travis badge [`8e02a73`](https://github.com/inspect-js/has-bigints/commit/8e02a73db34827d24d2945f2db822973a0b49925) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `safe-publish-latest` [`95859f2`](https://github.com/inspect-js/has-bigints/commit/95859f28f23f5733481c52a501063802cf64f75b) +- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`0588f41`](https://github.com/inspect-js/has-bigints/commit/0588f415c6cc01d6b34668680044e03b2998e03f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`5b024a6`](https://github.com/inspect-js/has-bigints/commit/5b024a664a8b7d2d2f750a4c11ce20c395b6f12a) +- [meta] add `version` scripts [`4788d61`](https://github.com/inspect-js/has-bigints/commit/4788d61101c009e4e2c1b4d944c263de06192c6a) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`be0e0de`](https://github.com/inspect-js/has-bigints/commit/be0e0de08298dfe483c5d7a2675e5133abeabc53) +- [Dev Deps] update `auto-changelog`; add `aud` [`13a8d1b`](https://github.com/inspect-js/has-bigints/commit/13a8d1bf1f661871d890bfa174de9514f016cdd9) +- [actions] fix action name [`f873d9a`](https://github.com/inspect-js/has-bigints/commit/f873d9a2f10718662528a755b12c61202f4e4afa) +- [meta] add `funding` field [`1b51f49`](https://github.com/inspect-js/has-bigints/commit/1b51f4921df1faf85d2679a0e4ba97ef015a73b7) +- [Dev Deps] update `auto-changelog` [`2322461`](https://github.com/inspect-js/has-bigints/commit/2322461789810434c447439f155eb3ca23eb29fb) +- [Tests] only audit prod deps [`aabdade`](https://github.com/inspect-js/has-bigints/commit/aabdadeaa1e126b91a2fbd82263cc49651ff5e7b) + +## v1.0.0 - 2019-08-10 + +### Commits + +- [Tests] add `.travis.yml` [`9730412`](https://github.com/inspect-js/has-bigints/commit/973041241dc172474bb9457aad41790fe54fec88) +- Initial commit [`65f7c38`](https://github.com/inspect-js/has-bigints/commit/65f7c3889d9a98e214e26d650723cbfc49338463) +- [Tests] add tests [`e374a78`](https://github.com/inspect-js/has-bigints/commit/e374a78033d457badcd47e06752fdec7f62e6c39) +- readme [`5d39092`](https://github.com/inspect-js/has-bigints/commit/5d3909249da442867180fb747eef27543627d250) +- npm init [`1be2e3d`](https://github.com/inspect-js/has-bigints/commit/1be2e3d69db6718901e6845cfc38a07cc46dfd96) +- implementation [`b7bc812`](https://github.com/inspect-js/has-bigints/commit/b7bc8121db1fb1a827625c4cb0608935e3dcbe31) +- [Tests] add linting [`04533be`](https://github.com/inspect-js/has-bigints/commit/04533bef57f60e322238f71f32ee3ae0c988bac4) +- [meta] create FUNDING.yml [`cf824a7`](https://github.com/inspect-js/has-bigints/commit/cf824a7d02e867957d8db17ee0a4c70c8ee5ff23) +- Only apps should have lockfiles [`64e8242`](https://github.com/inspect-js/has-bigints/commit/64e82429f1dca99f624dc971ff13516dee28d353) diff --git a/node_modules/has-bigints/LICENSE b/node_modules/has-bigints/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/node_modules/has-bigints/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +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-bigints/README.md b/node_modules/has-bigints/README.md new file mode 100644 index 0000000..69414e4 --- /dev/null +++ b/node_modules/has-bigints/README.md @@ -0,0 +1,39 @@ +# has-bigints [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Determine if the JS environment has BigInt support. + +## Example + +```js +var hasBigInts = require('has-bigints'); + +hasBigInts() === true; // if the environment has native BigInt support. Not polyfillable, not forgeable. +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-bigints +[npm-version-svg]: https://versionbadg.es/inspect-js/has-bigints.svg +[deps-svg]: https://david-dm.org/inspect-js/has-bigints.svg +[deps-url]: https://david-dm.org/inspect-js/has-bigints +[dev-deps-svg]: https://david-dm.org/inspect-js/has-bigints/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-bigints#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-bigints.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-bigints.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-bigints.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-bigints +[codecov-image]: https://codecov.io/gh/inspect-js/has-bigints/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-bigints/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-bigints +[actions-url]: https://github.com/inspect-js/has-bigints/actions diff --git a/node_modules/has-bigints/index.js b/node_modules/has-bigints/index.js new file mode 100644 index 0000000..8942374 --- /dev/null +++ b/node_modules/has-bigints/index.js @@ -0,0 +1,10 @@ +'use strict'; + +var $BigInt = typeof BigInt !== 'undefined' && BigInt; + +module.exports = function hasNativeBigInts() { + return typeof $BigInt === 'function' + && typeof BigInt === 'function' + && typeof $BigInt(42) === 'bigint' // eslint-disable-line no-magic-numbers + && typeof BigInt(42) === 'bigint'; // eslint-disable-line no-magic-numbers +}; diff --git a/node_modules/has-bigints/package.json b/node_modules/has-bigints/package.json new file mode 100644 index 0000000..6bed9af --- /dev/null +++ b/node_modules/has-bigints/package.json @@ -0,0 +1,54 @@ +{ + "name": "has-bigints", + "version": "1.0.2", + "description": "Determine if the JS environment has BigInt support.", + "main": "index.js", + "scripts": { + "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)\")\"", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/has-bigints.git" + }, + "keywords": [ + "BigInt", + "bigints", + "typeof", + "ES2020" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/has-bigints/issues" + }, + "homepage": "https://github.com/ljharb/has-bigints#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/has-bigints/test/index.js b/node_modules/has-bigints/test/index.js new file mode 100644 index 0000000..efbc98b --- /dev/null +++ b/node_modules/has-bigints/test/index.js @@ -0,0 +1,44 @@ +'use strict'; + +var test = require('tape'); +var hasBigInts = require('..'); + +test('interface', function (t) { + t.equal(typeof hasBigInts, 'function', 'is a function'); + t.equal(typeof hasBigInts(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('BigInts are supported', { skip: !hasBigInts() }, function (t) { + t.equal(typeof BigInt, 'function', 'global BigInt is a function'); + if (typeof BigInt !== 'function') { + return; + } + + t.equal(BigInt(42), BigInt(42), '42n === 42n'); + t['throws']( + function () { BigInt(NaN); }, + RangeError, + 'NaN is not an integer; BigInt(NaN) throws' + ); + + t['throws']( + function () { BigInt(Infinity); }, + RangeError, + 'Infinity is not an integer; BigInt(Infinity) throws' + ); + + t['throws']( + function () { BigInt(1.1); }, + RangeError, + '1.1 is not an integer; BigInt(1.1) throws' + ); + + t.end(); +}); + +test('BigInts are not supported', { skip: hasBigInts() }, function (t) { + t.equal(typeof BigInt, 'undefined', 'global BigInt is undefined'); + + t.end(); +}); diff --git a/node_modules/has-property-descriptors/.eslintrc b/node_modules/has-property-descriptors/.eslintrc new file mode 100644 index 0000000..2fcc002 --- /dev/null +++ b/node_modules/has-property-descriptors/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": ["GetIntrinsic"], + }], + }, +} diff --git a/node_modules/has-property-descriptors/.github/FUNDING.yml b/node_modules/has-property-descriptors/.github/FUNDING.yml new file mode 100644 index 0000000..817aacf --- /dev/null +++ b/node_modules/has-property-descriptors/.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/has-property-descriptors +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/has-property-descriptors/.nycrc b/node_modules/has-property-descriptors/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/has-property-descriptors/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/has-property-descriptors/CHANGELOG.md b/node_modules/has-property-descriptors/CHANGELOG.md new file mode 100644 index 0000000..ae64b47 --- /dev/null +++ b/node_modules/has-property-descriptors/CHANGELOG.md @@ -0,0 +1,16 @@ +# 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). + +## v1.0.0 - 2022-04-14 + +### Commits + +- Initial implementation, tests [`303559f`](https://github.com/inspect-js/has-property-descriptors/commit/303559f2a72dfe7111573a1aec475ed4a184c35a) +- Initial commit [`3a7ca2d`](https://github.com/inspect-js/has-property-descriptors/commit/3a7ca2dc49f1fff0279a28bb16265e7615e14749) +- read me [`dd73dce`](https://github.com/inspect-js/has-property-descriptors/commit/dd73dce09d89d0f7a4a6e3b1e562a506f979a767) +- npm init [`c1e6557`](https://github.com/inspect-js/has-property-descriptors/commit/c1e655779de632d68cb944c50da6b71bcb7b8c85) +- Only apps should have lockfiles [`e72f7c6`](https://github.com/inspect-js/has-property-descriptors/commit/e72f7c68de534b2d273ee665f8b18d4ecc7f70b0) diff --git a/node_modules/has-property-descriptors/LICENSE b/node_modules/has-property-descriptors/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/node_modules/has-property-descriptors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +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-property-descriptors/README.md b/node_modules/has-property-descriptors/README.md new file mode 100644 index 0000000..d81fbd9 --- /dev/null +++ b/node_modules/has-property-descriptors/README.md @@ -0,0 +1,43 @@ +# has-property-descriptors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD. + +## Example + +```js +var hasPropertyDescriptors = require('has-property-descriptors'); +var assert = require('assert'); + +assert.equal(hasPropertyDescriptors(), true); // will be `false` in IE 6-8, and ES5 engines + +// Arrays can not have their length `[[Defined]]` in some engines +assert.equal(hasPropertyDescriptors.hasArrayLengthDefineBug(), false); // will be `true` in Firefox 4-22, and node v0.6 +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-property-descriptors +[npm-version-svg]: https://versionbadg.es/inspect-js/has-property-descriptors.svg +[deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors.svg +[deps-url]: https://david-dm.org/inspect-js/has-property-descriptors +[dev-deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-property-descriptors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-property-descriptors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-property-descriptors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-property-descriptors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-property-descriptors +[codecov-image]: https://codecov.io/gh/inspect-js/has-property-descriptors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-property-descriptors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-property-descriptors +[actions-url]: https://github.com/inspect-js/has-property-descriptors/actions diff --git a/node_modules/has-property-descriptors/index.js b/node_modules/has-property-descriptors/index.js new file mode 100644 index 0000000..8e30683 --- /dev/null +++ b/node_modules/has-property-descriptors/index.js @@ -0,0 +1,33 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + return true; + } catch (e) { + // IE 8 has a broken defineProperty + return false; + } + } + return false; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!hasPropertyDescriptors()) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; diff --git a/node_modules/has-property-descriptors/package.json b/node_modules/has-property-descriptors/package.json new file mode 100644 index 0000000..9404b71 --- /dev/null +++ b/node_modules/has-property-descriptors/package.json @@ -0,0 +1,70 @@ +{ + "name": "has-property-descriptors", + "version": "1.0.0", + "description": "Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "tests-only": "nyc tape 'test/**/*.js'", + "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/has-property-descriptors.git" + }, + "keywords": [ + "property", + "descriptors", + "has", + "environment", + "env", + "defineProperty", + "getOwnPropertyDescriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-property-descriptors/issues" + }, + "homepage": "https://github.com/inspect-js/has-property-descriptors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "evalmd": "^0.0.19", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/has-property-descriptors/test/index.js b/node_modules/has-property-descriptors/test/index.js new file mode 100644 index 0000000..7f02bd3 --- /dev/null +++ b/node_modules/has-property-descriptors/test/index.js @@ -0,0 +1,57 @@ +'use strict'; + +var test = require('tape'); + +var hasPropertyDescriptors = require('../'); + +var sentinel = {}; + +test('hasPropertyDescriptors', function (t) { + t.equal(typeof hasPropertyDescriptors, 'function', 'is a function'); + t.equal(typeof hasPropertyDescriptors.hasArrayLengthDefineBug, 'function', '`hasArrayLengthDefineBug` property is a function'); + + var yes = hasPropertyDescriptors(); + t.test('property descriptors', { skip: !yes }, function (st) { + var o = { a: sentinel }; + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: true, + value: sentinel, + writable: true + }, + 'has expected property descriptor' + ); + + Object.defineProperty(o, 'a', { enumerable: false, writable: false }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: false, + value: sentinel, + writable: false + }, + 'has expected property descriptor after [[Define]]' + ); + + st.end(); + }); + + var arrayBug = hasPropertyDescriptors.hasArrayLengthDefineBug(); + t.test('defining array lengths', { skip: !yes || arrayBug }, function (st) { + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + st.equal(arr.length, 3, 'array starts with length 3'); + + Object.defineProperty(arr, 'length', { value: 5 }); + + st.equal(arr.length, 5, 'array ends with length 5'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/has-tostringtag/.eslintrc b/node_modules/has-tostringtag/.eslintrc new file mode 100644 index 0000000..2d9a66a --- /dev/null +++ b/node_modules/has-tostringtag/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "multiline-comment-style": 0, + } +} diff --git a/node_modules/has-tostringtag/.github/FUNDING.yml b/node_modules/has-tostringtag/.github/FUNDING.yml new file mode 100644 index 0000000..7a450e7 --- /dev/null +++ b/node_modules/has-tostringtag/.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/has-tostringtag +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/has-tostringtag/CHANGELOG.md b/node_modules/has-tostringtag/CHANGELOG.md new file mode 100644 index 0000000..39fb77c --- /dev/null +++ b/node_modules/has-tostringtag/CHANGELOG.md @@ -0,0 +1,20 @@ +# 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). + +## v1.0.0 - 2021-08-05 + +### Commits + +- Tests [`6b6f573`](https://github.com/inspect-js/has-tostringtag/commit/6b6f5734dc2058badb300ff0783efdad95fe1a65) +- Initial commit [`2f8190e`](https://github.com/inspect-js/has-tostringtag/commit/2f8190e799fac32ba9b95a076c0255e01d7ce475) +- [meta] do not publish github action workflow files [`6e08cc4`](https://github.com/inspect-js/has-tostringtag/commit/6e08cc4e0fea7ec71ef66e70734b2af2c4a8b71b) +- readme [`94bed6c`](https://github.com/inspect-js/has-tostringtag/commit/94bed6c9560cbbfda034f8d6c260bb7b0db33c1a) +- npm init [`be67840`](https://github.com/inspect-js/has-tostringtag/commit/be67840ab92ee7adb98bcc65261975543f815fa5) +- Implementation [`c4914ec`](https://github.com/inspect-js/has-tostringtag/commit/c4914ecc51ddee692c85b471ae0a5d8123030fbf) +- [meta] use `auto-changelog` [`4aaf768`](https://github.com/inspect-js/has-tostringtag/commit/4aaf76895ae01d7b739f2b19f967ef2372506cd7) +- Only apps should have lockfiles [`bc4d99e`](https://github.com/inspect-js/has-tostringtag/commit/bc4d99e4bf494afbaa235c5f098df6e642edf724) +- [meta] add `safe-publish-latest` [`6523c05`](https://github.com/inspect-js/has-tostringtag/commit/6523c05c9b87140f3ae74c9daf91633dd9ff4e1f) diff --git a/node_modules/has-tostringtag/LICENSE b/node_modules/has-tostringtag/LICENSE new file mode 100644 index 0000000..7948bc0 --- /dev/null +++ b/node_modules/has-tostringtag/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +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-tostringtag/README.md b/node_modules/has-tostringtag/README.md new file mode 100644 index 0000000..67a5e92 --- /dev/null +++ b/node_modules/has-tostringtag/README.md @@ -0,0 +1,46 @@ +# has-tostringtag [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams. + +## Example + +```js +var hasSymbolToStringTag = require('has-tostringtag'); + +hasSymbolToStringTag() === true; // if the environment has native Symbol.toStringTag support. Not polyfillable, not forgeable. + +var hasSymbolToStringTagKinda = require('has-tostringtag/shams'); +hasSymbolToStringTagKinda() === true; // if the environment has a Symbol.toStringTag sham that mostly follows the spec. +``` + +## Supported Symbol shams + - get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols) + - core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js) + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/has-tostringtag +[2]: https://versionbadg.es/inspect-js/has-tostringtag.svg +[5]: https://david-dm.org/inspect-js/has-tostringtag.svg +[6]: https://david-dm.org/inspect-js/has-tostringtag +[7]: https://david-dm.org/inspect-js/has-tostringtag/dev-status.svg +[8]: https://david-dm.org/inspect-js/has-tostringtag#info=devDependencies +[11]: https://nodei.co/npm/has-tostringtag.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-tostringtag.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-tostringtag.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-tostringtag +[codecov-image]: https://codecov.io/gh/inspect-js/has-tostringtag/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-tostringtag/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-tostringtag +[actions-url]: https://github.com/inspect-js/has-tostringtag/actions diff --git a/node_modules/has-tostringtag/index.js b/node_modules/has-tostringtag/index.js new file mode 100644 index 0000000..d626b7a --- /dev/null +++ b/node_modules/has-tostringtag/index.js @@ -0,0 +1,7 @@ +'use strict'; + +var hasSymbols = require('has-symbols'); + +module.exports = function hasToStringTag() { + return hasSymbols() && typeof Symbol.toStringTag === 'symbol'; +}; diff --git a/node_modules/has-tostringtag/package.json b/node_modules/has-tostringtag/package.json new file mode 100644 index 0000000..9c74d64 --- /dev/null +++ b/node_modules/has-tostringtag/package.json @@ -0,0 +1,84 @@ +{ + "name": "has-tostringtag", + "version": "1.0.0", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.", + "license": "MIT", + "main": "index.js", + "exports": { + ".": "./index.js", + "./shams": "./shams.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", + "test:stock": "nyc node test", + "test:staging": "nyc node --harmony --es-staging test", + "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", + "test:shams:corejs": "nyc node test/shams/core-js.js", + "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js", + "lint": "eslint --ext=js,mjs .", + "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/has-tostringtag.git" + }, + "bugs": { + "url": "https://github.com/inspect-js/has-tostringtag/issues" + }, + "homepage": "https://github.com/inspect-js/has-tostringtag#readme", + "keywords": [ + "javascript", + "ecmascript", + "symbol", + "symbols", + "tostringtag", + "Symbol.toStringTag" + ], + "dependencies": { + "has-symbols": "^1.0.2" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^2.6.12", + "eslint": "^7.32.0", + "get-own-property-symbols": "^0.9.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/has-tostringtag/shams.js b/node_modules/has-tostringtag/shams.js new file mode 100644 index 0000000..8b7e401 --- /dev/null +++ b/node_modules/has-tostringtag/shams.js @@ -0,0 +1,7 @@ +'use strict'; + +var hasSymbols = require('has-symbols/shams'); + +module.exports = function hasToStringTagShams() { + return hasSymbols() && !!Symbol.toStringTag; +}; diff --git a/node_modules/has-tostringtag/test/index.js b/node_modules/has-tostringtag/test/index.js new file mode 100644 index 0000000..0679afd --- /dev/null +++ b/node_modules/has-tostringtag/test/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var test = require('tape'); +var hasSymbolToStringTag = require('../'); +var runSymbolTests = require('./tests'); + +test('interface', function (t) { + t.equal(typeof hasSymbolToStringTag, 'function', 'is a function'); + t.equal(typeof hasSymbolToStringTag(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('Symbol.toStringTag exists', { skip: !hasSymbolToStringTag() }, function (t) { + runSymbolTests(t); + t.end(); +}); + +test('Symbol.toStringTag does not exist', { skip: hasSymbolToStringTag() }, function (t) { + t.equal(typeof Symbol === 'undefined' ? 'undefined' : typeof Symbol.toStringTag, 'undefined', 'global Symbol.toStringTag is undefined'); + t.end(); +}); diff --git a/node_modules/has-tostringtag/test/shams/core-js.js b/node_modules/has-tostringtag/test/shams/core-js.js new file mode 100644 index 0000000..692b86e --- /dev/null +++ b/node_modules/has-tostringtag/test/shams/core-js.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol') { + test('has native Symbol.toStringTag support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol.toStringTag, 'symbol'); + t.end(); + }); + return; +} + +var hasSymbolToStringTag = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling'); + require('core-js/fn/symbol'); + require('core-js/fn/symbol/to-string-tag'); + + require('../tests')(t); + + var hasToStringTagAfter = hasSymbolToStringTag(); + t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js b/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js new file mode 100644 index 0000000..489fe83 --- /dev/null +++ b/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbolToStringTag = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling'); + + require('get-own-property-symbols'); + + require('../tests')(t); + + var hasToStringTagAfter = hasSymbolToStringTag(); + t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/node_modules/has-tostringtag/test/tests.js b/node_modules/has-tostringtag/test/tests.js new file mode 100644 index 0000000..0dae885 --- /dev/null +++ b/node_modules/has-tostringtag/test/tests.js @@ -0,0 +1,14 @@ +'use strict'; + +// eslint-disable-next-line consistent-return +module.exports = function runSymbolTests(t) { + t.equal(typeof Symbol, 'function', 'global Symbol is a function'); + t.ok(Symbol.toStringTag, 'Symbol.toStringTag exists'); + + if (typeof Symbol !== 'function' || !Symbol.toStringTag) { return false; } + + var obj = {}; + obj[Symbol.toStringTag] = 'test'; + + t.equal(Object.prototype.toString.call(obj), '[object test]'); +}; diff --git a/node_modules/ignore/LICENSE-MIT b/node_modules/ignore/LICENSE-MIT new file mode 100644 index 0000000..825533e --- /dev/null +++ b/node_modules/ignore/LICENSE-MIT @@ -0,0 +1,21 @@ +Copyright (c) 2013 Kael Zhang , contributors +http://kael.me/ + +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/ignore/README.md b/node_modules/ignore/README.md new file mode 100644 index 0000000..584508c --- /dev/null +++ b/node_modules/ignore/README.md @@ -0,0 +1,412 @@ + + + + + + + + + + + + + +
LinuxOS XWindowsCoverageDownloads
+ + Build Status + + + Windows Build Status + + + Coverage Status + + + npm module downloads per month +
+ +# ignore + +`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the [.gitignore spec 2.22.1](http://git-scm.com/docs/gitignore). + +`ignore` is used by eslint, gitbook and [many others](https://www.npmjs.com/browse/depended/ignore). + +Pay **ATTENTION** that [`minimatch`](https://www.npmjs.org/package/minimatch) (which used by `fstream-ignore`) does not follow the gitignore spec. + +To filter filenames according to a .gitignore file, I recommend this npm package, `ignore`. + +To parse an `.npmignore` file, you should use `minimatch`, because an `.npmignore` file is parsed by npm using `minimatch` and it does not work in the .gitignore way. + +### Tested on + +`ignore` is fully tested, and has more than **five hundreds** of unit tests. + +- Linux + Node: `0.8` - `7.x` +- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor. + +Actually, `ignore` does not rely on any versions of node specially. + +Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md). + +## Table Of Main Contents + +- [Usage](#usage) +- [`Pathname` Conventions](#pathname-conventions) +- See Also: + - [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules. +- [Upgrade Guide](#upgrade-guide) + +## Install + +```sh +npm i ignore +``` + +## Usage + +```js +import ignore from 'ignore' +const ig = ignore().add(['.abc/*', '!.abc/d/']) +``` + +### Filter the given paths + +```js +const paths = [ + '.abc/a.js', // filtered out + '.abc/d/e.js' // included +] + +ig.filter(paths) // ['.abc/d/e.js'] +ig.ignores('.abc/a.js') // true +``` + +### As the filter function + +```js +paths.filter(ig.createFilter()); // ['.abc/d/e.js'] +``` + +### Win32 paths will be handled + +```js +ig.filter(['.abc\\a.js', '.abc\\d\\e.js']) +// if the code above runs on windows, the result will be +// ['.abc\\d\\e.js'] +``` + +## Why another ignore? + +- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family. + +- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so + - `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations. + - `ignore` don't cares about sub-modules of git projects. + +- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as: + - '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'. + - '`**/foo`' should match '`foo`' anywhere. + - Prevent re-including a file if a parent directory of that file is excluded. + - Handle trailing whitespaces: + - `'a '`(one space) should not match `'a '`(two spaces). + - `'a \ '` matches `'a '` + - All test cases are verified with the result of `git check-ignore`. + +# Methods + +## .add(pattern: string | Ignore): this +## .add(patterns: Array): this + +- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance +- **patterns** `Array` Array of ignore patterns. + +Adds a rule or several rules to the current manager. + +Returns `this` + +Notice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename. + +```js +ignore().add('#abc').ignores('#abc') // false +ignore().add('\#abc').ignores('#abc') // true +``` + +`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file: + +```js +ignore() +.add(fs.readFileSync(filenameOfGitignore).toString()) +.filter(filenames) +``` + +`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance. + +## .addIgnoreFile(path) + +REMOVED in `3.x` for now. + +To upgrade `ignore@2.x` up to `3.x`, use + +```js +import fs from 'fs' + +if (fs.existsSync(filename)) { + ignore().add(fs.readFileSync(filename).toString()) +} +``` + +instead. + +## .filter(paths: Array<Pathname>): Array<Pathname> + +```ts +type Pathname = string +``` + +Filters the given array of pathnames, and returns the filtered array. + +- **paths** `Array.` The array of `pathname`s to be filtered. + +### `Pathname` Conventions: + +#### 1. `Pathname` should be a `path.relative()`d pathname + +`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory, + +```js +// WRONG, an error will be thrown +ig.ignores('./abc') + +// WRONG, for it will never happen, and an error will be thrown +// If the gitignore rule locates at the root directory, +// `'/abc'` should be changed to `'abc'`. +// ``` +// path.relative('/', '/abc') -> 'abc' +// ``` +ig.ignores('/abc') + +// WRONG, that it is an absolute path on Windows, an error will be thrown +ig.ignores('C:\\abc') + +// Right +ig.ignores('abc') + +// Right +ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc' +``` + +In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules. + +Suppose the dir structure is: + +``` +/path/to/your/repo + |-- a + | |-- a.js + | + |-- .b + | + |-- .c + |-- .DS_store +``` + +Then the `paths` might be like this: + +```js +[ + 'a/a.js' + '.b', + '.c/.DS_store' +] +``` + +#### 2. filenames and dirnames + +`node-ignore` does NO `fs.stat` during path matching, so for the example below: + +```js +// First, we add a ignore pattern to ignore a directory +ig.add('config/') + +// `ig` does NOT know if 'config', in the real world, +// is a normal file, directory or something. + +ig.ignores('config') +// `ig` treats `config` as a file, so it returns `false` + +ig.ignores('config/') +// returns `true` +``` + +Specially for people who develop some library based on `node-ignore`, it is important to understand that. + +Usually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory: + +```js +import glob from 'glob' + +glob('**', { + // Adds a / character to directory matches. + mark: true +}, (err, files) => { + if (err) { + return console.error(err) + } + + let filtered = ignore().add(patterns).filter(files) + console.log(filtered) +}) +``` + +## .ignores(pathname: Pathname): boolean + +> new in 3.2.0 + +Returns `Boolean` whether `pathname` should be ignored. + +```js +ig.ignores('.abc/a.js') // true +``` + +## .createFilter() + +Creates a filter function which could filter an array of paths with `Array.prototype.filter`. + +Returns `function(path)` the filter function. + +## .test(pathname: Pathname) since 5.0.0 + +Returns `TestResult` + +```ts +interface TestResult { + ignored: boolean + // true if the `pathname` is finally unignored by some negative pattern + unignored: boolean +} +``` + +- `{ignored: true, unignored: false}`: the `pathname` is ignored +- `{ignored: false, unignored: true}`: the `pathname` is unignored +- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules. + +## static `ignore.isPathValid(pathname): boolean` since 5.0.0 + +Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname). + +This method is **NOT** used to check if an ignore pattern is valid. + +```js +ignore.isPathValid('./foo') // false +``` + +## ignore(options) + +### `options.ignorecase` since 4.0.0 + +Similar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive. + +```js +const ig = ignore({ + ignorecase: false +}) + +ig.add('*.png') + +ig.ignores('*.PNG') // false +``` + +### `options.ignoreCase?: boolean` since 5.2.0 + +Which is alternative to `options.ignoreCase` + +### `options.allowRelativePaths?: boolean` since 5.2.0 + +This option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions). + +However, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior + +```js +ignore({ + allowRelativePaths: true +}).ignores('../foo/bar.js') // And it will not throw +``` + +**** + +# Upgrade Guide + +## Upgrade 4.x -> 5.x + +Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory. + +While `ignore < 5.0.0` did not make sure what the return value was, as well as + +```ts +.ignores(pathname: Pathname): boolean + +.filter(pathnames: Array): Array + +.createFilter(): (pathname: Pathname) => boolean + +.test(pathname: Pathname): {ignored: boolean, unignored: boolean} +``` + +See the convention [here](#1-pathname-should-be-a-pathrelatived-pathname) for details. + +If there are invalid pathnames, the conversion and filtration should be done by users. + +```js +import {isPathValid} from 'ignore' // introduced in 5.0.0 + +const paths = [ + // invalid + ////////////////// + '', + false, + '../foo', + '.', + ////////////////// + + // valid + 'foo' +] +.filter(isValidPath) + +ig.filter(paths) +``` + +## Upgrade 3.x -> 4.x + +Since `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6: + +```js +var ignore = require('ignore/legacy') +``` + +## Upgrade 2.x -> 3.x + +- All `options` of 2.x are unnecessary and removed, so just remove them. +- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed. +- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details. + +**** + +# Collaborators + +- [@whitecolor](https://github.com/whitecolor) *Alex* +- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé* +- [@azproduction](https://github.com/azproduction) *Mikhail Davydov* +- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin* +- [@JanMattner](https://github.com/JanMattner) *Jan Mattner* +- [@ntwb](https://github.com/ntwb) *Stephen Edgar* +- [@kasperisager](https://github.com/kasperisager) *Kasper Isager* +- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders* diff --git a/node_modules/ignore/index.d.ts b/node_modules/ignore/index.d.ts new file mode 100644 index 0000000..520eafa --- /dev/null +++ b/node_modules/ignore/index.d.ts @@ -0,0 +1,61 @@ +type Pathname = string + +interface TestResult { + ignored: boolean + unignored: boolean +} + +export interface Ignore { + /** + * Adds one or several rules to the current manager. + * @param {string[]} patterns + * @returns IgnoreBase + */ + add(patterns: string | Ignore | readonly (string | Ignore)[]): this + + /** + * Filters the given array of pathnames, and returns the filtered array. + * NOTICE that each path here should be a relative path to the root of your repository. + * @param paths the array of paths to be filtered. + * @returns The filtered array of paths + */ + filter(pathnames: readonly Pathname[]): Pathname[] + + /** + * Creates a filter function which could filter + * an array of paths with Array.prototype.filter. + */ + createFilter(): (pathname: Pathname) => boolean + + /** + * Returns Boolean whether pathname should be ignored. + * @param {string} pathname a path to check + * @returns boolean + */ + ignores(pathname: Pathname): boolean + + /** + * Returns whether pathname should be ignored or unignored + * @param {string} pathname a path to check + * @returns TestResult + */ + test(pathname: Pathname): TestResult +} + +interface Options { + ignorecase?: boolean + // For compatibility + ignoreCase?: boolean + allowRelativePaths?: boolean +} + +/** + * Creates new ignore manager. + */ +declare function ignore(options?: Options): Ignore + +declare namespace ignore { + export function isPathValid (pathname: string): boolean +} + +export default ignore diff --git a/node_modules/ignore/index.js b/node_modules/ignore/index.js new file mode 100644 index 0000000..d935eb1 --- /dev/null +++ b/node_modules/ignore/index.js @@ -0,0 +1,603 @@ +// A simple implementation of make-array +function makeArray (subject) { + return Array.isArray(subject) + ? subject + : [subject] +} + +const EMPTY = '' +const SPACE = ' ' +const ESCAPE = '\\' +const REGEX_TEST_BLANK_LINE = /^\s+$/ +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ +const REGEX_SPLITALL_CRLF = /\r?\n/g +// /foo, +// ./foo, +// ../foo, +// . +// .. +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ + +const SLASH = '/' +const KEY_IGNORE = typeof Symbol !== 'undefined' + ? Symbol.for('node-ignore') + /* istanbul ignore next */ + : 'node-ignore' + +const define = (object, key, value) => + Object.defineProperty(object, key, {value}) + +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g + +const RETURN_FALSE = () => false + +// Sanitize the range of a regular expression +// The cases are complicated, see test cases for details +const sanitizeRange = range => range.replace( + REGEX_REGEXP_RANGE, + (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) + ? match + // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : EMPTY +) + +// See fixtures #59 +const cleanRangeBackSlash = slashes => { + const {length} = slashes + return slashes.slice(0, length - length % 2) +} + +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` + +// '`foo/`' should not continue with the '`..`' +const REPLACERS = [ + + // > Trailing spaces are ignored unless they are quoted with backslash ("\") + [ + // (a\ ) -> (a ) + // (a ) -> (a) + // (a \ ) -> (a ) + /\\?\s+$/, + match => match.indexOf('\\') === 0 + ? SPACE + : EMPTY + ], + + // replace (\ ) with ' ' + [ + /\\\s/g, + () => SPACE + ], + + // Escape metacharacters + // which is written down by users but means special for regular expressions. + + // > There are 12 characters with special meanings: + // > - the backslash \, + // > - the caret ^, + // > - the dollar sign $, + // > - the period or dot ., + // > - the vertical bar or pipe symbol |, + // > - the question mark ?, + // > - the asterisk or star *, + // > - the plus sign +, + // > - the opening parenthesis (, + // > - the closing parenthesis ), + // > - and the opening square bracket [, + // > - the opening curly brace {, + // > These special characters are often called "metacharacters". + [ + /[\\$.|*+(){^]/g, + match => `\\${match}` + ], + + [ + // > a question mark (?) matches a single character + /(?!\\)\?/g, + () => '[^/]' + ], + + // leading slash + [ + + // > A leading slash matches the beginning of the pathname. + // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". + // A leading slash matches the beginning of the pathname + /^\//, + () => '^' + ], + + // replace special metacharacter slash after the leading slash + [ + /\//g, + () => '\\/' + ], + + [ + // > A leading "**" followed by a slash means match in all directories. + // > For example, "**/foo" matches file or directory "foo" anywhere, + // > the same as pattern "foo". + // > "**/foo/bar" matches file or directory "bar" anywhere that is directly + // > under directory "foo". + // Notice that the '*'s have been replaced as '\\*' + /^\^*\\\*\\\*\\\//, + + // '**/foo' <-> 'foo' + () => '^(?:.*\\/)?' + ], + + // starting + [ + // there will be no leading '/' + // (which has been replaced by section "leading slash") + // If starts with '**', adding a '^' to the regular expression also works + /^(?=[^^])/, + function startingReplacer () { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) + // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' + + // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^' + } + ], + + // two globstars + [ + // Use lookahead assertions so that we could match more than one `'/**'` + /\\\/\\\*\\\*(?=\\\/|$)/g, + + // Zero, one or several directories + // should not use '*', or it will be replaced by the next replacer + + // Check if it is not the last `'/**'` + (_, index, str) => index + 6 < str.length + + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' + + // case: /** + // > A trailing `"/**"` matches everything inside. + + // #21: everything inside but it should not include the current folder + : '\\/.+' + ], + + // intermediate wildcards + [ + // Never replace escaped '*' + // ignore rule '\*' will match the path '*' + + // 'abc.*/' -> go + // 'abc.*' -> skip this rule + /(^|[^\\]+)\\\*(?=.+)/g, + + // '*.js' matches '.js' + // '*.js' doesn't match 'abc' + (_, p1) => `${p1}[^\\/]*` + ], + + [ + // unescape, revert step 3 except for back slash + // For example, if a user escape a '\\*', + // after step 3, the result will be '\\\\\\*' + /\\\\\\(?=[$.|*+(){^])/g, + () => ESCAPE + ], + + [ + // '\\\\' -> '\\' + /\\\\/g, + () => ESCAPE + ], + + [ + // > The range notation, e.g. [a-zA-Z], + // > can be used to match one of the characters in a range. + + // `\` is escaped by step 3 + /(\\)?\[([^\]/]*?)(\\*)($|\])/g, + (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE + // '\\[bar]' -> '\\\\[bar\\]' + ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` + : close === ']' + ? endEscape.length % 2 === 0 + // A normal case, and it is a range notation + // '[bar]' + // '[bar\\\\]' + ? `[${sanitizeRange(range)}${endEscape}]` + // Invalid range notaton + // '[bar\\]' -> '[bar\\\\]' + : '[]' + : '[]' + ], + + // ending + [ + // 'js' will not match 'js.' + // 'ab' will not match 'abc' + /(?:[^*])$/, + + // WTF! + // https://git-scm.com/docs/gitignore + // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) + // which re-fixes #24, #38 + + // > If there is a separator at the end of the pattern then the pattern + // > will only match directories, otherwise the pattern can match both + // > files and directories. + + // 'js*' will not match 'a.js' + // 'js/' will not match 'a.js' + // 'js' will match 'a.js' and 'a.js/' + match => /\/$/.test(match) + // foo/ will not match 'foo' + ? `${match}$` + // foo matches 'foo' and 'foo/' + : `${match}(?=$|\\/$)` + ], + + // trailing wildcard + [ + /(\^|\\\/)?\\\*$/, + (_, p1) => { + const prefix = p1 + // '\^': + // '/*' does not match EMPTY + // '/*' does not match everything + + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` + + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*' + + return `${prefix}(?=$|\\/$)` + } + ], +] + +// A simple cache, because an ignore rule only has only one certain meaning +const regexCache = Object.create(null) + +// @param {pattern} +const makeRegex = (pattern, ignoreCase) => { + let source = regexCache[pattern] + + if (!source) { + source = REPLACERS.reduce( + (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + pattern + ) + regexCache[pattern] = source + } + + return ignoreCase + ? new RegExp(source, 'i') + : new RegExp(source) +} + +const isString = subject => typeof subject === 'string' + +// > A blank line matches no files, so it can serve as a separator for readability. +const checkPattern = pattern => pattern + && isString(pattern) + && !REGEX_TEST_BLANK_LINE.test(pattern) + + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0 + +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) + +class IgnoreRule { + constructor ( + origin, + pattern, + negative, + regex + ) { + this.origin = origin + this.pattern = pattern + this.negative = negative + this.regex = regex + } +} + +const createRule = (pattern, ignoreCase) => { + const origin = pattern + let negative = false + + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true + pattern = pattern.substr(1) + } + + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') + + const regex = makeRegex(pattern, ignoreCase) + + return new IgnoreRule( + origin, + pattern, + negative, + regex + ) +} + +const throwError = (message, Ctor) => { + throw new Ctor(message) +} + +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow( + `path must be a string, but got \`${originalPath}\``, + TypeError + ) + } + + // We don't know if we should ignore EMPTY, so throw + if (!path) { + return doThrow(`path must not be empty`, TypeError) + } + + // Check if it is a relative path + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d' + return doThrow( + `path should be a ${r} string, but got "${originalPath}"`, + RangeError + ) + } + + return true +} + +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) + +checkPath.isNotRelative = isNotRelative +checkPath.convert = p => p + +class Ignore { + constructor ({ + ignorecase = true, + ignoreCase = ignorecase, + allowRelativePaths = false + } = {}) { + define(this, KEY_IGNORE, true) + + this._rules = [] + this._ignoreCase = ignoreCase + this._allowRelativePaths = allowRelativePaths + this._initCache() + } + + _initCache () { + this._ignoreCache = Object.create(null) + this._testCache = Object.create(null) + } + + _addPattern (pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules) + this._added = true + return + } + + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignoreCase) + this._added = true + this._rules.push(rule) + } + } + + // @param {Array | string | Ignore} pattern + add (pattern) { + this._added = false + + makeArray( + isString(pattern) + ? splitPattern(pattern) + : pattern + ).forEach(this._addPattern, this) + + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache() + } + + return this + } + + // legacy + addPattern (pattern) { + return this.add(pattern) + } + + // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + + // @returns {TestResult} true if a file is ignored + _testOne (path, checkUnignored) { + let ignored = false + let unignored = false + + this._rules.forEach(rule => { + const {negative} = rule + if ( + unignored === negative && ignored !== unignored + || negative && !ignored && !unignored && !checkUnignored + ) { + return + } + + const matched = rule.regex.test(path) + + if (matched) { + ignored = !negative + unignored = negative + } + }) + + return { + ignored, + unignored + } + } + + // @returns {TestResult} + _test (originalPath, cache, checkUnignored, slices) { + const path = originalPath + // Supports nullable path + && checkPath.convert(originalPath) + + checkPath( + path, + originalPath, + this._allowRelativePaths + ? RETURN_FALSE + : throwError + ) + + return this._t(path, cache, checkUnignored, slices) + } + + _t (path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path] + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH) + } + + slices.pop() + + // If the path has no parent directory, just test it + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored) + } + + const parent = this._t( + slices.join(SLASH) + SLASH, + cache, + checkUnignored, + slices + ) + + // If the path contains a parent directory, check the parent first + return cache[path] = parent.ignored + // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent + : this._testOne(path, checkUnignored) + } + + ignores (path) { + return this._test(path, this._ignoreCache, false).ignored + } + + createFilter () { + return path => !this.ignores(path) + } + + filter (paths) { + return makeArray(paths).filter(this.createFilter()) + } + + // @returns {TestResult} + test (path) { + return this._test(path, this._testCache, true) + } +} + +const factory = options => new Ignore(options) + +const isPathValid = path => + checkPath(path && checkPath.convert(path), path, RETURN_FALSE) + +factory.isPathValid = isPathValid + +// Fixes typescript +factory.default = factory + +module.exports = factory + +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( + // Detect `process` so that it can run in browsers. + typeof process !== 'undefined' + && ( + process.env && process.env.IGNORE_TEST_WIN32 + || process.platform === 'win32' + ) +) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) + || /["<>|\u0000-\u001F]+/u.test(str) + ? str + : str.replace(/\\/g, '/') + + checkPath.convert = makePosix + + // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i + checkPath.isNotRelative = path => + REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) + || isNotRelative(path) +} diff --git a/node_modules/ignore/legacy.js b/node_modules/ignore/legacy.js new file mode 100644 index 0000000..b579d6f --- /dev/null +++ b/node_modules/ignore/legacy.js @@ -0,0 +1,498 @@ +"use strict"; + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// A simple implementation of make-array +function makeArray(subject) { + return Array.isArray(subject) ? subject : [subject]; +} + +var EMPTY = ''; +var SPACE = ' '; +var ESCAPE = '\\'; +var REGEX_TEST_BLANK_LINE = /^\s+$/; +var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/; +var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/; +var REGEX_SPLITALL_CRLF = /\r?\n/g; // /foo, +// ./foo, +// ../foo, +// . +// .. + +var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/; +var SLASH = '/'; +var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol["for"]('node-ignore') +/* istanbul ignore next */ +: 'node-ignore'; + +var define = function define(object, key, value) { + return Object.defineProperty(object, key, { + value: value + }); +}; + +var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; + +var RETURN_FALSE = function RETURN_FALSE() { + return false; +}; // Sanitize the range of a regular expression +// The cases are complicated, see test cases for details + + +var sanitizeRange = function sanitizeRange(range) { + return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) { + return from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : EMPTY; + }); +}; // See fixtures #59 + + +var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) { + var length = slashes.length; + return slashes.slice(0, length - length % 2); +}; // > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` +// '`foo/`' should not continue with the '`..`' + + +var REPLACERS = [// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, function (match) { + return match.indexOf('\\') === 0 ? SPACE : EMPTY; +}], // replace (\ ) with ' ' +[/\\\s/g, function () { + return SPACE; +}], // Escape metacharacters +// which is written down by users but means special for regular expressions. +// > There are 12 characters with special meanings: +// > - the backslash \, +// > - the caret ^, +// > - the dollar sign $, +// > - the period or dot ., +// > - the vertical bar or pipe symbol |, +// > - the question mark ?, +// > - the asterisk or star *, +// > - the plus sign +, +// > - the opening parenthesis (, +// > - the closing parenthesis ), +// > - and the opening square bracket [, +// > - the opening curly brace {, +// > These special characters are often called "metacharacters". +[/[\\$.|*+(){^]/g, function (match) { + return "\\".concat(match); +}], [// > a question mark (?) matches a single character +/(?!\\)\?/g, function () { + return '[^/]'; +}], // leading slash +[// > A leading slash matches the beginning of the pathname. +// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +// A leading slash matches the beginning of the pathname +/^\//, function () { + return '^'; +}], // replace special metacharacter slash after the leading slash +[/\//g, function () { + return '\\/'; +}], [// > A leading "**" followed by a slash means match in all directories. +// > For example, "**/foo" matches file or directory "foo" anywhere, +// > the same as pattern "foo". +// > "**/foo/bar" matches file or directory "bar" anywhere that is directly +// > under directory "foo". +// Notice that the '*'s have been replaced as '\\*' +/^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo' +function () { + return '^(?:.*\\/)?'; +}], // starting +[// there will be no leading '/' +// (which has been replaced by section "leading slash") +// If starts with '**', adding a '^' to the regular expression also works +/^(?=[^^])/, function startingReplacer() { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^'; +}], // two globstars +[// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer +// Check if it is not the last `'/**'` +function (_, index, str) { + return index + 6 < str.length // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' // case: /** + // > A trailing `"/**"` matches everything inside. + // #21: everything inside but it should not include the current folder + : '\\/.+'; +}], // intermediate wildcards +[// Never replace escaped '*' +// ignore rule '\*' will match the path '*' +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js' +// '*.js' doesn't match 'abc' +function (_, p1) { + return "".concat(p1, "[^\\/]*"); +}], [// unescape, revert step 3 except for back slash +// For example, if a user escape a '\\*', +// after step 3, the result will be '\\\\\\*' +/\\\\\\(?=[$.|*+(){^])/g, function () { + return ESCAPE; +}], [// '\\\\' -> '\\' +/\\\\/g, function () { + return ESCAPE; +}], [// > The range notation, e.g. [a-zA-Z], +// > can be used to match one of the characters in a range. +// `\` is escaped by step 3 +/(\\)?\[([^\]/]*?)(\\*)($|\])/g, function (match, leadEscape, range, endEscape, close) { + return leadEscape === ESCAPE // '\\[bar]' -> '\\\\[bar\\]' + ? "\\[".concat(range).concat(cleanRangeBackSlash(endEscape)).concat(close) : close === ']' ? endEscape.length % 2 === 0 // A normal case, and it is a range notation + // '[bar]' + // '[bar\\\\]' + ? "[".concat(sanitizeRange(range)).concat(endEscape, "]") // Invalid range notaton + // '[bar\\]' -> '[bar\\\\]' + : '[]' : '[]'; +}], // ending +[// 'js' will not match 'js.' +// 'ab' will not match 'abc' +/(?:[^*])$/, // WTF! +// https://git-scm.com/docs/gitignore +// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) +// which re-fixes #24, #38 +// > If there is a separator at the end of the pattern then the pattern +// > will only match directories, otherwise the pattern can match both +// > files and directories. +// 'js*' will not match 'a.js' +// 'js/' will not match 'a.js' +// 'js' will match 'a.js' and 'a.js/' +function (match) { + return /\/$/.test(match) // foo/ will not match 'foo' + ? "".concat(match, "$") // foo matches 'foo' and 'foo/' + : "".concat(match, "(?=$|\\/$)"); +}], // trailing wildcard +[/(\^|\\\/)?\\\*$/, function (_, p1) { + var prefix = p1 // '\^': + // '/*' does not match EMPTY + // '/*' does not match everything + // '\\\/': + // 'abc/*' does not match 'abc/' + ? "".concat(p1, "[^/]+") // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*'; + return "".concat(prefix, "(?=$|\\/$)"); +}]]; // A simple cache, because an ignore rule only has only one certain meaning + +var regexCache = Object.create(null); // @param {pattern} + +var makeRegex = function makeRegex(pattern, ignoreCase) { + var source = regexCache[pattern]; + + if (!source) { + source = REPLACERS.reduce(function (prev, current) { + return prev.replace(current[0], current[1].bind(pattern)); + }, pattern); + regexCache[pattern] = source; + } + + return ignoreCase ? new RegExp(source, 'i') : new RegExp(source); +}; + +var isString = function isString(subject) { + return typeof subject === 'string'; +}; // > A blank line matches no files, so it can serve as a separator for readability. + + +var checkPattern = function checkPattern(pattern) { + return pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0; +}; + +var splitPattern = function splitPattern(pattern) { + return pattern.split(REGEX_SPLITALL_CRLF); +}; + +var IgnoreRule = function IgnoreRule(origin, pattern, negative, regex) { + _classCallCheck(this, IgnoreRule); + + this.origin = origin; + this.pattern = pattern; + this.negative = negative; + this.regex = regex; +}; + +var createRule = function createRule(pattern, ignoreCase) { + var origin = pattern; + var negative = false; // > An optional prefix "!" which negates the pattern; + + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(1); + } + + pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#'); + var regex = makeRegex(pattern, ignoreCase); + return new IgnoreRule(origin, pattern, negative, regex); +}; + +var throwError = function throwError(message, Ctor) { + throw new Ctor(message); +}; + +var checkPath = function checkPath(path, originalPath, doThrow) { + if (!isString(path)) { + return doThrow("path must be a string, but got `".concat(originalPath, "`"), TypeError); + } // We don't know if we should ignore EMPTY, so throw + + + if (!path) { + return doThrow("path must not be empty", TypeError); + } // Check if it is a relative path + + + if (checkPath.isNotRelative(path)) { + var r = '`path.relative()`d'; + return doThrow("path should be a ".concat(r, " string, but got \"").concat(originalPath, "\""), RangeError); + } + + return true; +}; + +var isNotRelative = function isNotRelative(path) { + return REGEX_TEST_INVALID_PATH.test(path); +}; + +checkPath.isNotRelative = isNotRelative; + +checkPath.convert = function (p) { + return p; +}; + +var Ignore = /*#__PURE__*/function () { + function Ignore() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$ignorecase = _ref.ignorecase, + ignorecase = _ref$ignorecase === void 0 ? true : _ref$ignorecase, + _ref$ignoreCase = _ref.ignoreCase, + ignoreCase = _ref$ignoreCase === void 0 ? ignorecase : _ref$ignoreCase, + _ref$allowRelativePat = _ref.allowRelativePaths, + allowRelativePaths = _ref$allowRelativePat === void 0 ? false : _ref$allowRelativePat; + + _classCallCheck(this, Ignore); + + define(this, KEY_IGNORE, true); + this._rules = []; + this._ignoreCase = ignoreCase; + this._allowRelativePaths = allowRelativePaths; + + this._initCache(); + } + + _createClass(Ignore, [{ + key: "_initCache", + value: function _initCache() { + this._ignoreCache = Object.create(null); + this._testCache = Object.create(null); + } + }, { + key: "_addPattern", + value: function _addPattern(pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules); + this._added = true; + return; + } + + if (checkPattern(pattern)) { + var rule = createRule(pattern, this._ignoreCase); + this._added = true; + + this._rules.push(rule); + } + } // @param {Array | string | Ignore} pattern + + }, { + key: "add", + value: function add(pattern) { + this._added = false; + makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore, + // making the behavior changed. + + if (this._added) { + this._initCache(); + } + + return this; + } // legacy + + }, { + key: "addPattern", + value: function addPattern(pattern) { + return this.add(pattern); + } // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + // @returns {TestResult} true if a file is ignored + + }, { + key: "_testOne", + value: function _testOne(path, checkUnignored) { + var ignored = false; + var unignored = false; + + this._rules.forEach(function (rule) { + var negative = rule.negative; + + if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) { + return; + } + + var matched = rule.regex.test(path); + + if (matched) { + ignored = !negative; + unignored = negative; + } + }); + + return { + ignored: ignored, + unignored: unignored + }; + } // @returns {TestResult} + + }, { + key: "_test", + value: function _test(originalPath, cache, checkUnignored, slices) { + var path = originalPath // Supports nullable path + && checkPath.convert(originalPath); + checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError); + return this._t(path, cache, checkUnignored, slices); + } + }, { + key: "_t", + value: function _t(path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path]; + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH); + } + + slices.pop(); // If the path has no parent directory, just test it + + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored); + } + + var parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices); // If the path contains a parent directory, check the parent first + + + return cache[path] = parent.ignored // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent : this._testOne(path, checkUnignored); + } + }, { + key: "ignores", + value: function ignores(path) { + return this._test(path, this._ignoreCache, false).ignored; + } + }, { + key: "createFilter", + value: function createFilter() { + var _this = this; + + return function (path) { + return !_this.ignores(path); + }; + } + }, { + key: "filter", + value: function filter(paths) { + return makeArray(paths).filter(this.createFilter()); + } // @returns {TestResult} + + }, { + key: "test", + value: function test(path) { + return this._test(path, this._testCache, true); + } + }]); + + return Ignore; +}(); + +var factory = function factory(options) { + return new Ignore(options); +}; + +var isPathValid = function isPathValid(path) { + return checkPath(path && checkPath.convert(path), path, RETURN_FALSE); +}; + +factory.isPathValid = isPathValid; // Fixes typescript + +factory["default"] = factory; +module.exports = factory; // Windows +// -------------------------------------------------------------- + +/* istanbul ignore if */ + +if ( // Detect `process` so that it can run in browsers. +typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { + /* eslint no-control-regex: "off" */ + var makePosix = function makePosix(str) { + return /^\\\\\?\\/.test(str) || /[\0-\x1F"<>\|]+/.test(str) ? str : str.replace(/\\/g, '/'); + }; + + checkPath.convert = makePosix; // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + + var REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i; + + checkPath.isNotRelative = function (path) { + return REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path); + }; +} diff --git a/node_modules/ignore/package.json b/node_modules/ignore/package.json new file mode 100644 index 0000000..45de575 --- /dev/null +++ b/node_modules/ignore/package.json @@ -0,0 +1,71 @@ +{ + "name": "ignore", + "version": "5.2.0", + "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.", + "files": [ + "legacy.js", + "index.js", + "index.d.ts", + "LICENSE-MIT" + ], + "scripts": { + "prepublishOnly": "npm run build", + "build": "babel -o legacy.js index.js", + "test:lint": "eslint .", + "test:tsc": "tsc ./test/ts/simple.ts --lib ES6", + "test:ts": "node ./test/ts/simple.js", + "tap": "tap --reporter classic", + "test:git": "npm run tap test/git-check-ignore.js", + "test:ignore": "npm run tap test/ignore.js", + "test:others": "npm run tap test/others.js", + "test:cases": "npm run tap test/*.js -- --coverage", + "test:only": "npm run test:lint && npm run test:tsc && npm run test:ts && npm run test:cases", + "test": "npm run test:only", + "test:win32": "IGNORE_TEST_WIN32=1 npm run test", + "posttest": "tap --coverage-report=html && codecov" + }, + "repository": { + "type": "git", + "url": "git@github.com:kaelzhang/node-ignore.git" + }, + "keywords": [ + "ignore", + ".gitignore", + "gitignore", + "npmignore", + "rules", + "manager", + "filter", + "regexp", + "regex", + "fnmatch", + "glob", + "asterisks", + "regular-expression" + ], + "author": "kael", + "license": "MIT", + "bugs": { + "url": "https://github.com/kaelzhang/node-ignore/issues" + }, + "devDependencies": { + "@babel/cli": "^7.8.4", + "@babel/core": "^7.9.6", + "@babel/preset-env": "^7.9.6", + "codecov": "^3.7.0", + "debug": "^4.1.1", + "eslint": "^7.0.0", + "eslint-config-ostai": "^3.0.0", + "eslint-plugin-import": "^2.20.2", + "mkdirp": "^1.0.4", + "pre-suf": "^1.1.1", + "rimraf": "^3.0.2", + "spawn-sync": "^2.0.0", + "tap": "^14.10.7", + "tmp": "0.2.1", + "typescript": "^3.9.3" + }, + "engines": { + "node": ">= 4" + } +} diff --git a/node_modules/import-fresh/index.d.ts b/node_modules/import-fresh/index.d.ts new file mode 100644 index 0000000..36d7e20 --- /dev/null +++ b/node_modules/import-fresh/index.d.ts @@ -0,0 +1,30 @@ +/** +Import a module while bypassing the cache. + +@example +``` +// foo.js +let i = 0; +module.exports = () => ++i; + +// index.js +import importFresh = require('import-fresh'); + +require('./foo')(); +//=> 1 + +require('./foo')(); +//=> 2 + +importFresh('./foo')(); +//=> 1 + +importFresh('./foo')(); +//=> 1 + +const foo = importFresh('./foo'); +``` +*/ +declare function importFresh(moduleId: string): T; + +export = importFresh; diff --git a/node_modules/import-fresh/index.js b/node_modules/import-fresh/index.js new file mode 100644 index 0000000..0a4c5d5 --- /dev/null +++ b/node_modules/import-fresh/index.js @@ -0,0 +1,33 @@ +'use strict'; +const path = require('path'); +const resolveFrom = require('resolve-from'); +const parentModule = require('parent-module'); + +module.exports = moduleId => { + if (typeof moduleId !== 'string') { + throw new TypeError('Expected a string'); + } + + const parentPath = parentModule(__filename); + + const cwd = parentPath ? path.dirname(parentPath) : __dirname; + const filePath = resolveFrom(cwd, moduleId); + + const oldModule = require.cache[filePath]; + // Delete itself from module parent + if (oldModule && oldModule.parent) { + let i = oldModule.parent.children.length; + + while (i--) { + if (oldModule.parent.children[i].id === filePath) { + oldModule.parent.children.splice(i, 1); + } + } + } + + delete require.cache[filePath]; // Delete module from cache + + const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step + + return parent === undefined ? require(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require +}; diff --git a/node_modules/import-fresh/license b/node_modules/import-fresh/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/import-fresh/license @@ -0,0 +1,9 @@ +MIT License + +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: + +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/import-fresh/package.json b/node_modules/import-fresh/package.json new file mode 100644 index 0000000..0c09362 --- /dev/null +++ b/node_modules/import-fresh/package.json @@ -0,0 +1,43 @@ +{ + "name": "import-fresh", + "version": "3.3.0", + "description": "Import a module while bypassing the cache", + "license": "MIT", + "repository": "sindresorhus/import-fresh", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava && tsd", + "heapdump": "node heapdump.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "require", + "cache", + "uncache", + "uncached", + "module", + "fresh", + "bypass" + ], + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "devDependencies": { + "ava": "^1.0.1", + "heapdump": "^0.3.12", + "tsd": "^0.7.3", + "xo": "^0.23.0" + } +} diff --git a/node_modules/import-fresh/readme.md b/node_modules/import-fresh/readme.md new file mode 100644 index 0000000..bd14c79 --- /dev/null +++ b/node_modules/import-fresh/readme.md @@ -0,0 +1,48 @@ +# import-fresh + +> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching) + +Useful for testing purposes when you need to freshly import a module. + +## Install + +``` +$ npm install import-fresh +``` + +## Usage + +```js +// foo.js +let i = 0; +module.exports = () => ++i; +``` + +```js +const importFresh = require('import-fresh'); + +require('./foo')(); +//=> 1 + +require('./foo')(); +//=> 2 + +importFresh('./foo')(); +//=> 1 + +importFresh('./foo')(); +//=> 1 +``` + +## import-fresh for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of import-fresh 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-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily diff --git a/node_modules/imurmurhash/README.md b/node_modules/imurmurhash/README.md new file mode 100644 index 0000000..f35b20a --- /dev/null +++ b/node_modules/imurmurhash/README.md @@ -0,0 +1,122 @@ +iMurmurHash.js +============== + +An incremental implementation of the MurmurHash3 (32-bit) hashing algorithm for JavaScript based on [Gary Court's implementation](https://github.com/garycourt/murmurhash-js) with [kazuyukitanimura's modifications](https://github.com/kazuyukitanimura/murmurhash-js). + +This version works significantly faster than the non-incremental version if you need to hash many small strings into a single hash, since string concatenation (to build the single string to pass the non-incremental version) is fairly costly. In one case tested, using the incremental version was about 50% faster than concatenating 5-10 strings and then hashing. + +Installation +------------ + +To use iMurmurHash in the browser, [download the latest version](https://raw.github.com/jensyt/imurmurhash-js/master/imurmurhash.min.js) and include it as a script on your site. + +```html + + +``` + +--- + +To use iMurmurHash in Node.js, install the module using NPM: + +```bash +npm install imurmurhash +``` + +Then simply include it in your scripts: + +```javascript +MurmurHash3 = require('imurmurhash'); +``` + +Quick Example +------------- + +```javascript +// Create the initial hash +var hashState = MurmurHash3('string'); + +// Incrementally add text +hashState.hash('more strings'); +hashState.hash('even more strings'); + +// All calls can be chained if desired +hashState.hash('and').hash('some').hash('more'); + +// Get a result +hashState.result(); +// returns 0xe4ccfe6b +``` + +Functions +--------- + +### MurmurHash3 ([string], [seed]) +Get a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example: + +```javascript +// Use the cached object, calling the function again will return the same +// object (but reset, so the current state would be lost) +hashState = MurmurHash3(); +... + +// Create a new object that can be safely used however you wish. Calling the +// function again will simply return a new state object, and no state loss +// will occur, at the cost of creating more objects. +hashState = new MurmurHash3(); +``` + +Both methods can be mixed however you like if you have different use cases. + +--- + +### MurmurHash3.prototype.hash (string) +Incrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained. + +--- + +### MurmurHash3.prototype.result () +Get the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`. + +```javascript +// Do the whole string at once +MurmurHash3('this is a test string').result(); +// 0x70529328 + +// Do part of the string, get a result, then the other part +var m = MurmurHash3('this is a'); +m.result(); +// 0xbfc4f834 +m.hash(' test string').result(); +// 0x70529328 (same as above) +``` + +--- + +### MurmurHash3.prototype.reset ([seed]) +Reset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained. + +--- + +License (MIT) +------------- +Copyright (c) 2013 Gary Court, Jens Taylor + +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/imurmurhash/imurmurhash.js b/node_modules/imurmurhash/imurmurhash.js new file mode 100644 index 0000000..e63146a --- /dev/null +++ b/node_modules/imurmurhash/imurmurhash.js @@ -0,0 +1,138 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; + + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } + + if (m !== this) { + return m; + } + }; + + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; + + len = key.length; + this.len += len; + + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + } + + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + + if (i >= len) { + break; + } + + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } + + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + + this.h1 = h1; + } + + this.k1 = k1; + return this; + }; + + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; + + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + } + + h1 ^= this.len; + + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; + + return h1 >>> 0; + }; + + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; + + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); + + if (typeof(module) != 'undefined') { + module.exports = MurmurHash3; + } else { + this.MurmurHash3 = MurmurHash3; + } +}()); diff --git a/node_modules/imurmurhash/imurmurhash.min.js b/node_modules/imurmurhash/imurmurhash.min.js new file mode 100644 index 0000000..dc0ee88 --- /dev/null +++ b/node_modules/imurmurhash/imurmurhash.min.js @@ -0,0 +1,12 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}(); \ No newline at end of file diff --git a/node_modules/imurmurhash/package.json b/node_modules/imurmurhash/package.json new file mode 100644 index 0000000..8a93edb --- /dev/null +++ b/node_modules/imurmurhash/package.json @@ -0,0 +1,40 @@ +{ + "name": "imurmurhash", + "version": "0.1.4", + "description": "An incremental implementation of MurmurHash3", + "homepage": "https://github.com/jensyt/imurmurhash-js", + "main": "imurmurhash.js", + "files": [ + "imurmurhash.js", + "imurmurhash.min.js", + "package.json", + "README.md" + ], + "repository": { + "type": "git", + "url": "https://github.com/jensyt/imurmurhash-js" + }, + "bugs": { + "url": "https://github.com/jensyt/imurmurhash-js/issues" + }, + "keywords": [ + "murmur", + "murmurhash", + "murmurhash3", + "hash", + "incremental" + ], + "author": { + "name": "Jens Taylor", + "email": "jensyt@gmail.com", + "url": "https://github.com/homebrewing" + }, + "license": "MIT", + "dependencies": { + }, + "devDependencies": { + }, + "engines": { + "node": ">=0.8.19" + } +} diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +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/inflight/README.md b/node_modules/inflight/README.md new file mode 100644 index 0000000..6dc8929 --- /dev/null +++ b/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js new file mode 100644 index 0000000..48202b3 --- /dev/null +++ b/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json new file mode 100644 index 0000000..6084d35 --- /dev/null +++ b/node_modules/inflight/package.json @@ -0,0 +1,29 @@ +{ + "name": "inflight", + "version": "1.0.6", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "files": [ + "inflight.js" + ], + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.1.2" + }, + "scripts": { + "test": "tap test.js --100" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/inflight.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC" +} diff --git a/node_modules/internal-slot/.editorconfig b/node_modules/internal-slot/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/internal-slot/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/internal-slot/.eslintignore b/node_modules/internal-slot/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/internal-slot/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/internal-slot/.eslintrc b/node_modules/internal-slot/.eslintrc new file mode 100644 index 0000000..cab5bd0 --- /dev/null +++ b/node_modules/internal-slot/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-params": [2, 3], + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + "no-magic-numbers": 0, + "operator-linebreak": [2, "before"], + }, +} diff --git a/node_modules/internal-slot/.github/FUNDING.yml b/node_modules/internal-slot/.github/FUNDING.yml new file mode 100644 index 0000000..8dc96e2 --- /dev/null +++ b/node_modules/internal-slot/.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/internal-slot +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 a single custom sponsorship URL diff --git a/node_modules/internal-slot/.nycrc b/node_modules/internal-slot/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/node_modules/internal-slot/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/internal-slot/CHANGELOG.md b/node_modules/internal-slot/CHANGELOG.md new file mode 100644 index 0000000..3a7a40c --- /dev/null +++ b/node_modules/internal-slot/CHANGELOG.md @@ -0,0 +1,58 @@ +### Changelog + +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +#### [v1.0.3](https://github.com/ljharb/internal-slot/compare/v1.0.2...v1.0.3) + +> 26 January 2021 + +- [Tests] use shared travis-ci configs [`0ef2263`](https://github.com/ljharb/internal-slot/commit/0ef22634fa2269d9df0d784aca3c5748e8eabd3b) +- [Tests] migrate tests to Github Actions [`6253915`](https://github.com/ljharb/internal-slot/commit/6253915d28721df2eda5630849bc6b57647e3ee2) +- [meta] do not publish github action workflow files [`ef94e55`](https://github.com/ljharb/internal-slot/commit/ef94e555727ed6a649ef64010904fe89a468d459) +- [Tests] run `nyc` on all tests; use `tape` runner [`917d6ca`](https://github.com/ljharb/internal-slot/commit/917d6ca630cdcd6b4da9a2c300c6a3abb6e724fe) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`8dcb6fe`](https://github.com/ljharb/internal-slot/commit/8dcb6fe01d6a45e1af17a9dace95ca47c99b4328) +- [actions] add "Allow Edits" workflow [`7aa3e86`](https://github.com/ljharb/internal-slot/commit/7aa3e86edb0149fd882717481885760aeb28474e) +- [Refactor] use `get-intrinsic` instead of `es-abstract`; update `side-channel` [`11ad17d`](https://github.com/ljharb/internal-slot/commit/11ad17d4255adcbc55fd4eca0bf6733bac59f1bf) +- [readme] remove travis badge [`5b75452`](https://github.com/ljharb/internal-slot/commit/5b754523aa07e8f67d0135df75059a18047292bb) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`d531688`](https://github.com/ljharb/internal-slot/commit/d5316880956b4dd83e6b6c9ab48fdd8171a4a268) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`c76fa91`](https://github.com/ljharb/internal-slot/commit/c76fa91a7e623a738e22332bee4e985aea41122e) +- [Dev Deps] update `eslint`, `tape` [`e733ccd`](https://github.com/ljharb/internal-slot/commit/e733ccd68e81c72ef2e02726e001895053de7887) +- [Dev Deps] update `auto-changelog`; add `aud` [`df20bf5`](https://github.com/ljharb/internal-slot/commit/df20bf5d3943a533c20799d8cc1449997e85d53b) +- [meta] fix autochangelog [`e89e6f1`](https://github.com/ljharb/internal-slot/commit/e89e6f1ff9f10f386e6400b586db78ad9c0f1309) +- [Tests] only audit prod deps [`71317b9`](https://github.com/ljharb/internal-slot/commit/71317b95ec6bbd9877807da0c0316ee9f5f30fab) +- [Deps] update `es-abstract` [`c17ccf4`](https://github.com/ljharb/internal-slot/commit/c17ccf45f4cb0d3b7a1536e9cd3a7ff9a7dafd21) +- [Dev Deps] update `tape` [`d81ae03`](https://github.com/ljharb/internal-slot/commit/d81ae030a0e8f58cee00f752601ce60405a93d78) +- [Deps] update `es-abstract` [`b56303b`](https://github.com/ljharb/internal-slot/commit/b56303b4c3af7a510f9f51860895a46fd2e14752) +- [Deps] update `es-abstract` [`9996d1c`](https://github.com/ljharb/internal-slot/commit/9996d1cf3507750c7a6845a2fb0d0f849ea898a1) + +#### [v1.0.2](https://github.com/ljharb/internal-slot/compare/v1.0.1...v1.0.2) + +> 20 December 2019 + +- [Deps] update `es-abstract`, `side-channel` [`5c9df03`](https://github.com/ljharb/internal-slot/commit/5c9df03a25518f5c482cff4e1447a26fa071df9a) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`7820f98`](https://github.com/ljharb/internal-slot/commit/7820f984e523a64ddf3068c4e5631abf61eb1ea4) + +#### [v1.0.1](https://github.com/ljharb/internal-slot/compare/v1.0.0...v1.0.1) + +> 1 December 2019 + +- [Refactor] use `side-channel` package [`d38639f`](https://github.com/ljharb/internal-slot/commit/d38639f0a3cdb5090711179d0e78df857ecbd5d3) +- [actions] add automatic rebasing / merge commit blocking [`74267e6`](https://github.com/ljharb/internal-slot/commit/74267e6e591e18ba39186cb99139d3fd7a757c9f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest` [`b042eef`](https://github.com/ljharb/internal-slot/commit/b042eefc067b830bbd370833f7f21754e802b0b2) +- [Deps] update `es-abstract` [`98cf4e8`](https://github.com/ljharb/internal-slot/commit/98cf4e86c1bfe99eda7b11a8ea70394368f33e4f) + +#### v1.0.0 + +> 20 October 2019 + +- Tests [`b50fa41`](https://github.com/ljharb/internal-slot/commit/b50fa41b6f47aba39ac4cb733658580974a0b00a) +- implementation [`c5a59f3`](https://github.com/ljharb/internal-slot/commit/c5a59f3753677f81aa12a0226d3b1187846d06dd) +- Initial commit [`15ebe4d`](https://github.com/ljharb/internal-slot/commit/15ebe4dc6d46885f67969d64c9c3e705780963f8) +- readme [`382a3f5`](https://github.com/ljharb/internal-slot/commit/382a3f53d8975e6488373a0fc2abcdc7c4c44247) +- npm init [`d5e7c97`](https://github.com/ljharb/internal-slot/commit/d5e7c977ef694e89c245fd11165f63c06a7a5040) +- [meta] add FUNDING.yml [`685b608`](https://github.com/ljharb/internal-slot/commit/685b6087613f6735f4411a558500d92f8a3ec3f2) +- [meta] add `auto-changelog`, `safe-publish-latest` [`f8fdf1c`](https://github.com/ljharb/internal-slot/commit/f8fdf1c3f0c592f71746da6d7f8bea18f8946dda) +- [Tests] add `npm run lint` [`baaaa09`](https://github.com/ljharb/internal-slot/commit/baaaa09ab6e5bc5fcc0e7c76e10c55aa18f4ca7e) +- Only apps should have lockfiles [`dfa7efa`](https://github.com/ljharb/internal-slot/commit/dfa7efa3d5cd23261cb75c2adab6ee3c06790fee) diff --git a/node_modules/internal-slot/LICENSE b/node_modules/internal-slot/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/node_modules/internal-slot/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +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/internal-slot/README.md b/node_modules/internal-slot/README.md new file mode 100644 index 0000000..4716567 --- /dev/null +++ b/node_modules/internal-slot/README.md @@ -0,0 +1,52 @@ +# internal-slot [![Version Badge][npm-version-svg]][package-url] + +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Truly private storage, akin to the JS spec’s concept of internal slots. + +Uses a WeakMap when available; a Map when not; and a regular object in even older engines. Performance and garbage collection behavior will reflect the environment’s capabilities accordingly. + +## Example + +```js +var SLOT = require('internal-slot'); +var assert = require('assert'); + +var o = {}; + +assert.throws(function () { SLOT.assert(o, 'foo'); }); + +assert.equal(SLOT.has(o, 'foo'), false); +assert.equal(SLOT.get(o, 'foo'), undefined); + +SLOT.set(o, 'foo', 42); + +assert.equal(SLOT.has(o, 'foo'), true); +assert.equal(SLOT.get(o, 'foo'), 42); + +assert.doesNotThrow(function () { SLOT.assert(o, 'foo'); }); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/internal-slot +[npm-version-svg]: https://versionbadg.es/ljharb/internal-slot.svg +[deps-svg]: https://david-dm.org/ljharb/internal-slot.svg +[deps-url]: https://david-dm.org/ljharb/internal-slot +[dev-deps-svg]: https://david-dm.org/ljharb/internal-slot/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/internal-slot#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/internal-slot.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/internal-slot.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/internal-slot.svg +[downloads-url]: https://npm-stat.com/charts.html?package=internal-slot diff --git a/node_modules/internal-slot/index.js b/node_modules/internal-slot/index.js new file mode 100644 index 0000000..0ed115b --- /dev/null +++ b/node_modules/internal-slot/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var has = require('has'); +var channel = require('side-channel')(); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var SLOT = { + assert: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + channel.assert(O); + }, + get: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + return slots && slots['$' + slot]; + }, + has: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + return !!slots && has(slots, '$' + slot); + }, + set: function (O, slot, V) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + if (!slots) { + slots = {}; + channel.set(O, slots); + } + slots['$' + slot] = V; + } +}; + +if (Object.freeze) { + Object.freeze(SLOT); +} + +module.exports = SLOT; diff --git a/node_modules/internal-slot/package.json b/node_modules/internal-slot/package.json new file mode 100644 index 0000000..26b03de --- /dev/null +++ b/node_modules/internal-slot/package.json @@ -0,0 +1,63 @@ +{ + "name": "internal-slot", + "version": "1.0.3", + "description": "ES spec-like internal slots", + "main": "index.js", + "scripts": { + "prepublish": "safe-publish-latest", + "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)\")\"", + "pretest": "npm run lint", + "lint": "eslint .", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/internal-slot.git" + }, + "keywords": [ + "internal", + "slot", + "internal slot", + "ecmascript", + "es", + "spec", + "private", + "data", + "private data", + "weakmap" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/internal-slot/issues" + }, + "homepage": "https://github.com/ljharb/internal-slot#readme", + "engines": { + "node": ">= 0.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.5.0", + "aud": "^1.1.3", + "auto-changelog": "^2.2.1", + "eslint": "^7.18.0", + "foreach": "^2.0.5", + "nyc": "^10.3.2", + "object-inspect": "^1.9.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.1.1" + }, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false + } +} diff --git a/node_modules/internal-slot/test/index.js b/node_modules/internal-slot/test/index.js new file mode 100644 index 0000000..de65d45 --- /dev/null +++ b/node_modules/internal-slot/test/index.js @@ -0,0 +1,120 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('foreach'); + +var SLOT = require('../'); + +test('assert', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.assert(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.assert({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + t['throws']( + function () { SLOT.assert({}, 'whatever'); }, + TypeError, + 'nonexistent slot throws' + ); + + var o = {}; + SLOT.set(o, 'x'); + t.doesNotThrow(function () { SLOT.assert(o, 'x'); }, 'existent slot noops'); + + t.end(); +}); + +test('has', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.has(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.has({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = {}; + + t.equal(SLOT.has(o, 'nonexistent'), false, 'nonexistent slot yields false'); + + SLOT.set(o, 'foo'); + t.equal(SLOT.has(o, 'foo'), true, 'existent slot yields true'); + + t.end(); +}); + +test('get', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.get(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.get({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = {}; + t.equal(SLOT.get(o, 'nonexistent'), undefined, 'nonexistent slot is undefined'); + + var v = {}; + SLOT.set(o, 'f', v); + t.equal(SLOT.get(o, 'f'), v, '"get" retrieves value set by "set"'); + + t.end(); +}); + +test('set', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.set(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.set({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = function () {}; + t.equal(SLOT.get(o, 'f'), undefined, 'slot not set'); + + SLOT.set(o, 'f', 42); + t.equal(SLOT.get(o, 'f'), 42, 'slot was set'); + + SLOT.set(o, 'f', Infinity); + t.equal(SLOT.get(o, 'f'), Infinity, 'slot was set again'); + + t.end(); +}); diff --git a/node_modules/is-bigint/.eslintignore b/node_modules/is-bigint/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-bigint/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-bigint/.eslintrc b/node_modules/is-bigint/.eslintrc new file mode 100644 index 0000000..1283fcf --- /dev/null +++ b/node_modules/is-bigint/.eslintrc @@ -0,0 +1,10 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": [2, { "capIsNewExceptions": ["BigInt"] }], + "operator-linebreak": [2, "before"], + }, +} diff --git a/node_modules/is-bigint/.github/FUNDING.yml b/node_modules/is-bigint/.github/FUNDING.yml new file mode 100644 index 0000000..59d03ba --- /dev/null +++ b/node_modules/is-bigint/.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-bigint +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-bigint/.nycrc b/node_modules/is-bigint/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-bigint/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-bigint/CHANGELOG.md b/node_modules/is-bigint/CHANGELOG.md new file mode 100644 index 0000000..c1b0271 --- /dev/null +++ b/node_modules/is-bigint/CHANGELOG.md @@ -0,0 +1,71 @@ +# 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). + +## [v1.0.4](https://github.com/inspect-js/is-bigint/compare/v1.0.3...v1.0.4) - 2021-08-11 + +### Commits + +- [eslint] remove unnecessary eslintrc file [`7220aa5`](https://github.com/inspect-js/is-bigint/commit/7220aa515c51649b48ba57bb77f92d85e27557d8) +- [readme] add github actions/codecov badges [`053a071`](https://github.com/inspect-js/is-bigint/commit/053a07123511eef5a91fd7889ae2d8323fbcf7d7) +- [Deps] add `has-bigints` as a runtime dependency [`0fc3c9d`](https://github.com/inspect-js/is-bigint/commit/0fc3c9d5165f62500ea9c27943cb302df65432f7) +- [Dev Deps] update `tape` [`145f11d`](https://github.com/inspect-js/is-bigint/commit/145f11d1d285d92b3144f48178fe0fb3b2f828d9) + +## [v1.0.3](https://github.com/inspect-js/is-bigint/compare/v1.0.2...v1.0.3) - 2021-08-06 + +### Commits + +- [Tests] use `has-tostringtag` for easier checking of Symbol.toStringTag [`3b44080`](https://github.com/inspect-js/is-bigint/commit/3b440801b69689d907b33184134f00d7e8a35f9f) +- [Dev Deps] update `auto-changelog`, `eslint`, `object-inspect`, `tape` [`e4d4a6c`](https://github.com/inspect-js/is-bigint/commit/e4d4a6c2ab743b52eda906abd1ed4b0608952533) +- [Fix] use `has-bigints` for more robust BigInt detection [`7bb9d7a`](https://github.com/inspect-js/is-bigint/commit/7bb9d7ab42214c12ce25e9f0cfe2af769388c3bb) + +## [v1.0.2](https://github.com/inspect-js/is-bigint/compare/v1.0.1...v1.0.2) - 2021-05-04 + +### Commits + +- [meta] do not publish github action workflow files [`276d677`](https://github.com/inspect-js/is-bigint/commit/276d677d1eac61e990a2f2b523c7cdef70784865) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`cea7fb6`](https://github.com/inspect-js/is-bigint/commit/cea7fb6e882ad7e2f550de2bd9317a4409bcd735) +- [readme] fix repo URLs; remove travis badge [`c8e7c36`](https://github.com/inspect-js/is-bigint/commit/c8e7c3651f3303fddafa61cf29cfbb79ea2d5d4b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `object-inspect`, `tape` [`32f3d90`](https://github.com/inspect-js/is-bigint/commit/32f3d909363045fe5d40dde9e4db354344ab4d50) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `tape` [`c2f20f5`](https://github.com/inspect-js/is-bigint/commit/c2f20f577d84e68b4e3224abb51024fbc4b9b2ba) +- [meta] remove unneeded token; update checkout action [`94e46e9`](https://github.com/inspect-js/is-bigint/commit/94e46e92a1a85ec022c8febf8d5d3c2369b46e97) +- [meta] use `prepublishOnly` script for npm 7+ [`3e663ec`](https://github.com/inspect-js/is-bigint/commit/3e663ecb09bfdc5dbaaa37aaef4adf28b5e49035) + +## [v1.0.1](https://github.com/inspect-js/is-bigint/compare/v1.0.0...v1.0.1) - 2020-11-30 + +### Commits + +- [Tests] use shared travis-ci configs [`28f1211`](https://github.com/inspect-js/is-bigint/commit/28f1211132ad2a6495d816140680fa16c12eb6f3) +- [Tests] migrate tests to Github Actions [`0998c64`](https://github.com/inspect-js/is-bigint/commit/0998c6443d603028f8b988bcdd52d23dbf513031) +- [meta] add `auto-changelog` [`2352de6`](https://github.com/inspect-js/is-bigint/commit/2352de6df8385b256d75ce50c360947243a599f6) +- [Tests] run `nyc` on all tests [`9c16a9a`](https://github.com/inspect-js/is-bigint/commit/9c16a9a5ddaf7c2c578542ab8f00dd4e72eff541) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `tape` [`4cd0edd`](https://github.com/inspect-js/is-bigint/commit/4cd0edd1917f789501291315c9eac5f895fd719e) +- [actions] add automatic rebasing / merge commit blocking [`f0f4b91`](https://github.com/inspect-js/is-bigint/commit/f0f4b91dba029dbca5b3cd27ef91c4fb8e3ec51a) +- [actions] add "Allow Edits" workflow [`7f4f46e`](https://github.com/inspect-js/is-bigint/commit/7f4f46ec07679c00e22287ec55b39ff1e4f809cf) +- [meta] create FUNDING.yml [`2d0cb9a`](https://github.com/inspect-js/is-bigint/commit/2d0cb9ae8ddf635f2c472ce49f95f717f2c432bf) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`0ee110e`](https://github.com/inspect-js/is-bigint/commit/0ee110effdcaa96d90f21a0ec6e625941f77c45a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols`, `object-inspect`, `tape` [`5bb7f3a`](https://github.com/inspect-js/is-bigint/commit/5bb7f3a8de6ec5ee2aa573c22e41884f3d2d1cc3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`d3d67d0`](https://github.com/inspect-js/is-bigint/commit/d3d67d05f8a3f4cb07085811629f56ef872949c3) +- [Dev Deps] update `auto-changelog`, `tape` [`54e270f`](https://github.com/inspect-js/is-bigint/commit/54e270fa29856dba90f86785fa61bffc79a2825d) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`d82bfe7`](https://github.com/inspect-js/is-bigint/commit/d82bfe75c63aeda40f7e473c57f26cea8790ba3a) +- [Dev Deps] update `auto-changelog`; add `aud` [`9c34bd1`](https://github.com/inspect-js/is-bigint/commit/9c34bd1873f08d77c82d8e54ad90c5a1a035e7ea) +- [Tests] add missing `posttest` script [`0690bd9`](https://github.com/inspect-js/is-bigint/commit/0690bd9868d4d8b43424b4224cdbb8659a1c6423) +- [meta] add `funding` field [`7ca36d0`](https://github.com/inspect-js/is-bigint/commit/7ca36d06ebcf6b01a592ecd6758bd2b39c0fb0db) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`5ffa8da`](https://github.com/inspect-js/is-bigint/commit/5ffa8dad9f634891cf739ee118f1b43142b0f01d) +- [Dev Deps] update `eslint` [`8512c2f`](https://github.com/inspect-js/is-bigint/commit/8512c2f29a9267fe8fe19209bcf77df94f127172) +- [Tests] only audit prod deps [`f2147dc`](https://github.com/inspect-js/is-bigint/commit/f2147dc54e72594985e8f6db3932a4f0819dc4db) +- [readme] fix header [`d6eff75`](https://github.com/inspect-js/is-bigint/commit/d6eff75d00471f465768deb92867e878c27733b3) + +## v1.0.0 - 2018-09-20 + +### Commits + +- [Tests] add tests [`847f12a`](https://github.com/inspect-js/is-bigint/commit/847f12af125fcefb75ed3517550feedf7dd73e88) +- Initial commit [`b53f3c6`](https://github.com/inspect-js/is-bigint/commit/b53f3c6754e7fd7a9982ff5b1466c4dc9799dad9) +- readme [`66c15fe`](https://github.com/inspect-js/is-bigint/commit/66c15fe1a0d965b8c78bf3a3bfc289dcfec53ee1) +- Implementation [`c2c0974`](https://github.com/inspect-js/is-bigint/commit/c2c0974397825a2a56e1ea8af0546171309d4805) +- package.json [`98b174c`](https://github.com/inspect-js/is-bigint/commit/98b174c24b070053f0548e58f9b87bc9dbdf922a) +- Only apps should have lockfiles [`a77c74b`](https://github.com/inspect-js/is-bigint/commit/a77c74bd8ca5f058f1e6165ae7b33bb84adef98c) diff --git a/node_modules/is-bigint/LICENSE b/node_modules/is-bigint/LICENSE new file mode 100644 index 0000000..9dd868f --- /dev/null +++ b/node_modules/is-bigint/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Jordan Harband + +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/is-bigint/README.md b/node_modules/is-bigint/README.md new file mode 100644 index 0000000..d64549f --- /dev/null +++ b/node_modules/is-bigint/README.md @@ -0,0 +1,44 @@ +# is-bigint [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 an ES BigInt value? + +## Example + +```js +var isBigInt = require('is-bigint'); +assert(!isBigInt(function () {})); +assert(!isBigInt(null)); +assert(!isBigInt(function* () { yield 42; return Infinity; }); +assert(!isBigInt(Symbol('foo'))); + +assert(isBigInt(1n)); +assert(isBigInt(Object(1n))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-bigint +[2]: https://versionbadg.es/inspect-js/is-bigint.svg +[5]: https://david-dm.org/inspect-js/is-bigint.svg +[6]: https://david-dm.org/inspect-js/is-bigint +[7]: https://david-dm.org/inspect-js/is-bigint/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-bigint#info=devDependencies +[11]: https://nodei.co/npm/is-bigint.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-bigint.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-bigint.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-bigint +[codecov-image]: https://codecov.io/gh/inspect-js/is-bigint/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-bigint/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-bigint +[actions-url]: https://github.com/inspect-js/is-bigint/actions diff --git a/node_modules/is-bigint/index.js b/node_modules/is-bigint/index.js new file mode 100644 index 0000000..8da47d7 --- /dev/null +++ b/node_modules/is-bigint/index.js @@ -0,0 +1,38 @@ +'use strict'; + +var hasBigInts = require('has-bigints')(); + +if (hasBigInts) { + var bigIntValueOf = BigInt.prototype.valueOf; + var tryBigInt = function tryBigIntObject(value) { + try { + bigIntValueOf.call(value); + return true; + } catch (e) { + } + return false; + }; + + module.exports = function isBigInt(value) { + if ( + value === null + || typeof value === 'undefined' + || typeof value === 'boolean' + || typeof value === 'string' + || typeof value === 'number' + || typeof value === 'symbol' + || typeof value === 'function' + ) { + return false; + } + if (typeof value === 'bigint') { + return true; + } + + return tryBigInt(value); + }; +} else { + module.exports = function isBigInt(value) { + return false && value; + }; +} diff --git a/node_modules/is-bigint/package.json b/node_modules/is-bigint/package.json new file mode 100644 index 0000000..850dbd8 --- /dev/null +++ b/node_modules/is-bigint/package.json @@ -0,0 +1,58 @@ +{ + "name": "is-bigint", + "version": "1.0.4", + "description": "Is this value an ES BigInt?", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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-bigint.git" + }, + "keywords": [ + "bigint", + "es", + "integer", + "is" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-bigint/issues" + }, + "homepage": "https://github.com/inspect-js/is-bigint#readme", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^7.32.0", + "has-symbols": "^1.0.2", + "nyc": "^10.3.2", + "object-inspect": "^1.11.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-bigint/test/index.js b/node_modules/is-bigint/test/index.js new file mode 100644 index 0000000..21537d6 --- /dev/null +++ b/node_modules/is-bigint/test/index.js @@ -0,0 +1,81 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var hasBigInts = require('has-bigints')(); +var hasSymbols = require('has-symbols')(); +var hasToStringTag = require('has-tostringtag/shams')(); + +var isBigInt = require('../'); + +var debug = function (v, m) { return inspect(v) + ' ' + m; }; + +var forEach = function (arr, func) { + var i; + for (i = 0; i < arr.length; ++i) { + func(arr[i], i, arr); + } +}; + +test('non-BigInt values', function (t) { + var nonBigInts = [ + true, + false, + Object(true), + Object(false), + null, + undefined, + {}, + [], + /a/g, + 'string', + 42, + new Date(), + function () {}, + NaN + ]; + if (hasSymbols) { + nonBigInts.push(Symbol.iterator, Symbol('foo')); + } + t.plan(nonBigInts.length); + forEach(nonBigInts, function (nonBigInt) { + t.equal(false, isBigInt(nonBigInt), debug(nonBigInt, 'is not a BigInt')); + }); + t.end(); +}); + +test('faked BigInt values', function (t) { + t.test('real BigInt valueOf', { skip: !hasBigInts }, function (st) { + var fakeBigInt = { valueOf: function () { return BigInt(42); } }; + st.equal(false, isBigInt(fakeBigInt), 'object with valueOf returning a BigInt is not a BigInt'); + st.end(); + }); + + t.test('faked @@toStringTag', { skip: !hasBigInts || !hasToStringTag }, function (st) { + var fakeBigInt = { valueOf: function () { return BigInt(42); } }; + fakeBigInt[Symbol.toStringTag] = 'BigInt'; + st.equal(false, isBigInt(fakeBigInt), 'object with fake BigInt @@toStringTag and valueOf returning a BigInt is not a BigInt'); + + var notSoFakeBigInt = { valueOf: function () { return 42; } }; + notSoFakeBigInt[Symbol.toStringTag] = 'BigInt'; + st.equal(false, isBigInt(notSoFakeBigInt), 'object with fake BigInt @@toStringTag and valueOf not returning a BigInt is not a BigInt'); + st.end(); + }); + + var fakeBigIntString = { toString: function () { return '42n'; } }; + t.equal(false, isBigInt(fakeBigIntString), 'object with toString returning 42n is not a BigInt'); + + t.end(); +}); + +test('BigInt support', { skip: !hasBigInts }, function (t) { + forEach([ + Function('return 42n')(), // eslint-disable-line no-new-func + BigInt(42), + Object(BigInt(42)) + ], function (bigInt) { + t.equal(true, isBigInt(bigInt), debug(bigInt, 'is a BigInt')); + }); + + t.end(); +}); diff --git a/node_modules/is-boolean-object/.editorconfig b/node_modules/is-boolean-object/.editorconfig new file mode 100644 index 0000000..8d93cc1 --- /dev/null +++ b/node_modules/is-boolean-object/.editorconfig @@ -0,0 +1,22 @@ +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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[.github/workflows/*.yml] +indent_style = off +indent_size = off +max_line_length = off + +[{CHANGELOG.md,*.json}] +max_line_length = off diff --git a/node_modules/is-boolean-object/.eslintignore b/node_modules/is-boolean-object/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-boolean-object/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-boolean-object/.eslintrc b/node_modules/is-boolean-object/.eslintrc new file mode 100644 index 0000000..a072916 --- /dev/null +++ b/node_modules/is-boolean-object/.eslintrc @@ -0,0 +1,22 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-nested-callbacks": [2, 3] + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "prefer-regex-literals": 0, + }, + }, + { + "files": "test-corejs.js", + "extends": "@ljharb/eslint-config/tests", + }, + ], +} diff --git a/node_modules/is-boolean-object/.github/FUNDING.yml b/node_modules/is-boolean-object/.github/FUNDING.yml new file mode 100644 index 0000000..fd04996 --- /dev/null +++ b/node_modules/is-boolean-object/.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-boolean-object +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-boolean-object/.nycrc b/node_modules/is-boolean-object/.nycrc new file mode 100644 index 0000000..a69aa2d --- /dev/null +++ b/node_modules/is-boolean-object/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test", + "test-corejs.js" + ] +} diff --git a/node_modules/is-boolean-object/CHANGELOG.md b/node_modules/is-boolean-object/CHANGELOG.md new file mode 100644 index 0000000..f789bdb --- /dev/null +++ b/node_modules/is-boolean-object/CHANGELOG.md @@ -0,0 +1,107 @@ +# 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). + +## [v1.1.2](https://github.com/inspect-js/is-boolean-object/compare/v1.1.1...v1.1.2) - 2021-08-05 + +### Commits + +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`6d319ea`](https://github.com/inspect-js/is-boolean-object/commit/6d319eac0ba237f7ba440a1fc4b32d007b1b0cf3) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4f85bef`](https://github.com/inspect-js/is-boolean-object/commit/4f85bef244f8fdd9ab99db0afe0b8fa00c853709) + +## [v1.1.1](https://github.com/inspect-js/is-boolean-object/compare/v1.1.0...v1.1.1) - 2021-05-07 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`7201c41`](https://github.com/inspect-js/is-boolean-object/commit/7201c41fc1fd9d64b51716b80fc63d95064a4a59) +- [Tests] run tests with core-js as well [`9590e61`](https://github.com/inspect-js/is-boolean-object/commit/9590e6135505e2e3f69c6d8785a539fca1b1e594) +- [meta] do not publish github action workflow files [`341472b`](https://github.com/inspect-js/is-boolean-object/commit/341472bbe9855030c7eda9340ee4284244f0a4ad) +- [readme] update repo URLs; remove travis badge [`9fdbbc6`](https://github.com/inspect-js/is-boolean-object/commit/9fdbbc64b2a70ee93fcfd95fc6c94c7ec2bbedd4) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1cd35c9`](https://github.com/inspect-js/is-boolean-object/commit/1cd35c9b9b0b4af203f20bda0d7fd60798e57f99) +- [readme] add actions and codecov badges [`03769fe`](https://github.com/inspect-js/is-boolean-object/commit/03769feb1466f03b1345882ca0e4f8cacbbce9ce) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`db6598c`](https://github.com/inspect-js/is-boolean-object/commit/db6598c4cabcd0ffd2ba9b4525b53907f8b2ff1f) +- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`e0b8a9f`](https://github.com/inspect-js/is-boolean-object/commit/e0b8a9f0fc1290a0a29c75967d56bc1c17eb8d2d) +- [readme] remove defunct testling badge [`986a621`](https://github.com/inspect-js/is-boolean-object/commit/986a6217da7385f7063e1d4e4bf5be2892d00c20) +- [meta] use `prepublishOnly` script for npm 7+ [`7bb3b29`](https://github.com/inspect-js/is-boolean-object/commit/7bb3b2902008ca07af4185ca98bc41b3222d579f) +- [Deps] update `call-bind` [`3af6a71`](https://github.com/inspect-js/is-boolean-object/commit/3af6a71e1004c79567630ac9944b9f2cc184ac77) +- [meta] do not publish corejs test file [`d911f03`](https://github.com/inspect-js/is-boolean-object/commit/d911f0368b6922645d15b9e28f3ed92e1badcef4) +- [actions] update workflows [`9bb3d90`](https://github.com/inspect-js/is-boolean-object/commit/9bb3d9015f377280324b162a3062d21936707216) + +## [v1.1.0](https://github.com/inspect-js/is-boolean-object/compare/v1.0.1...v1.1.0) - 2020-12-05 + +### Commits + +- [Tests] migrate tests to Github Actions [`6cdb652`](https://github.com/inspect-js/is-boolean-object/commit/6cdb652add3c6e44c2f7fe07c5ca4c0d14ddc2c1) +- [Tests] run `nyc` on all tests [`9a33076`](https://github.com/inspect-js/is-boolean-object/commit/9a33076d14869bf5120a6ca3903bcb9a008cf2e5) +- [Tests] add .editorconfig [`bb401c0`](https://github.com/inspect-js/is-boolean-object/commit/bb401c084416b010d64e0c5a74465b37addab31f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`5cb2405`](https://github.com/inspect-js/is-boolean-object/commit/5cb24052ca84d840e929f05cd1fe6c03b85ec032) +- [Robustness] use `call-bind` to avoid a dependency on `.call` [`76d87ae`](https://github.com/inspect-js/is-boolean-object/commit/76d87ae74235a9995d39bcf5783c04c744c34520) +- [actions] add "Allow Edits" workflow [`337206a`](https://github.com/inspect-js/is-boolean-object/commit/337206af74bd7c340bc938ab6dc0535c08490b3d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`11f0481`](https://github.com/inspect-js/is-boolean-object/commit/11f0481efca28a241a35d384e2a302b1bcdc9a37) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`b9602c8`](https://github.com/inspect-js/is-boolean-object/commit/b9602c8ca11be138722187c1fb0a5b25a57a4edc) +- [Dev Deps] update `auto-changelog`, `tape`; add `aud` [`999e9e2`](https://github.com/inspect-js/is-boolean-object/commit/999e9e224d4eec8b20fc9c3431e9ba42caad79c9) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`bbb6728`](https://github.com/inspect-js/is-boolean-object/commit/bbb6728b9410f9d3e2d266523a477127e5e4c16f) + +## [v1.0.1](https://github.com/inspect-js/is-boolean-object/compare/v1.0.0...v1.0.1) - 2019-12-18 + +### Commits + +- [Tests] use shared travis-ci configs [`a1778b8`](https://github.com/inspect-js/is-boolean-object/commit/a1778b81ab4fe4479176de854e4e233cc441f183) +- Update `eslint`; use my personal shared `eslint` config. [`2c42c50`](https://github.com/inspect-js/is-boolean-object/commit/2c42c50a0654044b6c7e2a4ab18227e8c275464b) +- [Tests] remove `jscs` [`3807025`](https://github.com/inspect-js/is-boolean-object/commit/380702504fabc47fe22f61c4847379023d31a657) +- [Tests] up to `node` `v8.4`, `v7.10`, `v6.11`, `v5.12`, `v4.8`; improve matrix; newer npm breaks in older node; improve scripts. [`a02b986`](https://github.com/inspect-js/is-boolean-object/commit/a02b98682b285de09e2c5a895627771d6a7f552c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is`, `jscs`, `nsp`, `semver`, `tape` [`d9030a9`](https://github.com/inspect-js/is-boolean-object/commit/d9030a99b8e274c76ae5f23f31d9d085a7e25272) +- Update `eslint`, `nsp` [`a1b6388`](https://github.com/inspect-js/is-boolean-object/commit/a1b6388fabd0de51a02c567953826344ef05890c) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`17a0fd3`](https://github.com/inspect-js/is-boolean-object/commit/17a0fd391e32635ec3434baca0d062f8abeeb592) +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`0b1818f`](https://github.com/inspect-js/is-boolean-object/commit/0b1818fdcaebc6133e515dfe3b5a8930b38999b5) +- [meta] remove unused Makefile and associated utilities [`33dc0ae`](https://github.com/inspect-js/is-boolean-object/commit/33dc0ae35a03e91f81b1bb3db5ba763dacadbfa2) +- Update `covert`, `jscs`, `eslint`, `semver` [`7e513c1`](https://github.com/inspect-js/is-boolean-object/commit/7e513c12998a651c14f62b3ecfb7215a5cc5ee8f) +- [Tests] up to `node` `v11.4`, `v10.14`, `v8.14`, `v6.15` [`992b849`](https://github.com/inspect-js/is-boolean-object/commit/992b84933760e0fe6ba2cee74ad7fff507f28128) +- [meta] add `auto-changelog` [`63d71b8`](https://github.com/inspect-js/is-boolean-object/commit/63d71b8beb9aeb77cab3d2db2cf643f1b8b1a55c) +- Update `tape`, `eslint`, `semver` [`76aea69`](https://github.com/inspect-js/is-boolean-object/commit/76aea699fb315ac460799182d707c388b4a4e017) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a6cbec0`](https://github.com/inspect-js/is-boolean-object/commit/a6cbec09940b6f2c7cf366526a94c0c4756508f5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace`, `semver`, `tape`; add `safe-publish-latest` [`7cf6bb0`](https://github.com/inspect-js/is-boolean-object/commit/7cf6bb05ba7bac504df680dd9ca625fba6dccb5a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` [`57d713c`](https://github.com/inspect-js/is-boolean-object/commit/57d713cca2ccbbbf1da1142ee5e8236d12551f76) +- [actions] add automatic rebasing / merge commit blocking [`f7a2bdb`](https://github.com/inspect-js/is-boolean-object/commit/f7a2bdb905e07d75c65593359f81bfeda9fe9826) +- [meta] create FUNDING.yml [`9765e73`](https://github.com/inspect-js/is-boolean-object/commit/9765e738cccdd5ff6c89b21324119a2bf4064fbd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is`, `replace`, `semver`, `tape` [`5c16b56`](https://github.com/inspect-js/is-boolean-object/commit/5c16b56a5a2d36c6a70c1bd396b3a6c931f655db) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`5717aad`](https://github.com/inspect-js/is-boolean-object/commit/5717aadd8b0e8c76ccb194d1845ad8cc120f29c6) +- [Dev Deps] update `is`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`80b924d`](https://github.com/inspect-js/is-boolean-object/commit/80b924dd270188e1e928f4141078bee14d810e9b) +- [Dev Deps] update `jscs` [`2e5479e`](https://github.com/inspect-js/is-boolean-object/commit/2e5479e56b6d33288582cfe8c254ca081e79500c) +- Test up to `io.js` `v2.2` [`93379a4`](https://github.com/inspect-js/is-boolean-object/commit/93379a4b48ba719113006ab08bbe6679c8a27293) +- [Tests] remove `nsp`; use `npm audit`; allow to fail for now [`36ae30a`](https://github.com/inspect-js/is-boolean-object/commit/36ae30acffe4a892ea0882a793b8a90f09d08fdf) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`ef76976`](https://github.com/inspect-js/is-boolean-object/commit/ef76976db22f2867fca2ee377fdbc9da81f0d142) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`a1182bd`](https://github.com/inspect-js/is-boolean-object/commit/a1182bd99e5d31e113107241f0d697e71b27bf7b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`4f79b47`](https://github.com/inspect-js/is-boolean-object/commit/4f79b474f0643fd2c9dbc863949a61cf01255b6f) +- [Tests] up to `node` `v10.3` [`5e96464`](https://github.com/inspect-js/is-boolean-object/commit/5e96464fc08eacc45f5f58fe7800ddbc45e40cea) +- [Dev Deps] update `eslint`, `nsp`, `semver`, `tape` [`e1eb3fa`](https://github.com/inspect-js/is-boolean-object/commit/e1eb3fad8bad65140db3bd2381bb3bea6a9c6242) +- Only apps should have lockfiles. [`c7f301f`](https://github.com/inspect-js/is-boolean-object/commit/c7f301ff368f9e04f7f64a2ce9b6ae1aec803e69) +- [meta] add `funding` field [`fad0366`](https://github.com/inspect-js/is-boolean-object/commit/fad03662becea5db7cef29d816d173ad771be86a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`80d39d9`](https://github.com/inspect-js/is-boolean-object/commit/80d39d90205d3bb564acb80b0625e90c267347fd) +- [Tests] use `eclint` instead of `editorconfig-tools` [`980e91b`](https://github.com/inspect-js/is-boolean-object/commit/980e91b186a728f77366ba16b7bebc813b9cc3b0) +- [Dev Deps] Update `tape`, `eslint` [`9960830`](https://github.com/inspect-js/is-boolean-object/commit/9960830876a3672686c569fde3d43bb7983955f1) +- Test up to `io.js` `v3.0` [`a3c3cd0`](https://github.com/inspect-js/is-boolean-object/commit/a3c3cd087d7fcefbf4f3525c05f4cee3b6e5b0ef) +- [Dev Deps] update `tape` [`217fbd6`](https://github.com/inspect-js/is-boolean-object/commit/217fbd6bb2989f9304ad95cd49697da7fe03b8d5) +- [Tests] only audit prod deps [`89284ee`](https://github.com/inspect-js/is-boolean-object/commit/89284ee17dce1d044df0ca9e006072f25742bbaf) +- [Performance] only use toStringTag code path when the value has that property [`2863bc5`](https://github.com/inspect-js/is-boolean-object/commit/2863bc5b72680f05ace8e66fddcf48966b942d55) +- [Dev Deps] update `replace` [`53e72a5`](https://github.com/inspect-js/is-boolean-object/commit/53e72a5ceca5b3a82e6407829f9227df9df6d329) +- [Enhancement] slight optimization for `null` [`a90a3c4`](https://github.com/inspect-js/is-boolean-object/commit/a90a3c4464d0300e23384d96fb4281b55b7fd723) +- [Dev Deps] update `tape` [`9377bd5`](https://github.com/inspect-js/is-boolean-object/commit/9377bd5110e99d8ec550f24ef3f6ead62a8f1f50) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`3085530`](https://github.com/inspect-js/is-boolean-object/commit/30855304841854f79e406372f524efe4bc7d8c04) +- Test on `io.js` `v2.4` [`8af335c`](https://github.com/inspect-js/is-boolean-object/commit/8af335ca82a0eeba4a0a593775e4caf744834ec4) +- Test on `io.js` `v2.3` [`1eb3424`](https://github.com/inspect-js/is-boolean-object/commit/1eb3424bef528551f5c99a754281a51d92e40ab1) + +## v1.0.0 - 2015-04-28 + +### Commits + +- Dotfiles [`6b9b998`](https://github.com/inspect-js/is-boolean-object/commit/6b9b998bb238a32d4829c9f9bf274e5ca15023ee) +- `make release` [`d5e50b3`](https://github.com/inspect-js/is-boolean-object/commit/d5e50b33a3cd8d8abe7de8ae36e2944c24ce76ba) +- package.json [`117676a`](https://github.com/inspect-js/is-boolean-object/commit/117676a48609e636d4257c1b35c695ff20939211) +- Read me [`ef327a7`](https://github.com/inspect-js/is-boolean-object/commit/ef327a74c7f73e64cfa3c20a9620ef7accf8b762) +- Initial commit [`2346886`](https://github.com/inspect-js/is-boolean-object/commit/2346886252b9637c1af6851a3fc2cbc98bc986aa) +- Tests [`67211f8`](https://github.com/inspect-js/is-boolean-object/commit/67211f8bff1a49e5df219935765b83573c097353) +- Implementation [`2d88bd6`](https://github.com/inspect-js/is-boolean-object/commit/2d88bd6e1ef0f07f5a639775eb89f3b78e12eb65) diff --git a/node_modules/is-boolean-object/LICENSE b/node_modules/is-boolean-object/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-boolean-object/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-boolean-object/README.md b/node_modules/is-boolean-object/README.md new file mode 100644 index 0000000..a77f3e9 --- /dev/null +++ b/node_modules/is-boolean-object/README.md @@ -0,0 +1,57 @@ +# is-boolean-object [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isBoolean = require('is-boolean-object'); +var assert = require('assert'); + +assert.notOk(isBoolean(undefined)); +assert.notOk(isBoolean(null)); +assert.notOk(isBoolean('foo')); +assert.notOk(isBoolean(function () {})); +assert.notOk(isBoolean([])); +assert.notOk(isBoolean({})); +assert.notOk(isBoolean(/a/g)); +assert.notOk(isBoolean(new RegExp('a', 'g'))); +assert.notOk(isBoolean(new Date())); +assert.notOk(isBoolean(42)); +assert.notOk(isBoolean(NaN)); +assert.notOk(isBoolean(Infinity)); + +assert.ok(isBoolean(new Boolean(42))); +assert.ok(isBoolean(false)); +assert.ok(isBoolean(Object(false))); +assert.ok(isBoolean(true)); +assert.ok(isBoolean(Object(true))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-boolean-object +[2]: https://versionbadg.es/inspect-js/is-boolean-object.svg +[5]: https://david-dm.org/inspect-js/is-boolean-object.svg +[6]: https://david-dm.org/inspect-js/is-boolean-object +[7]: https://david-dm.org/inspect-js/is-boolean-object/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-boolean-object#info=devDependencies +[11]: https://nodei.co/npm/is-boolean-object.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-boolean-object.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-boolean-object.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-boolean-object +[codecov-image]: https://codecov.io/gh/inspect-js/is-boolean-object/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-boolean-object/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-boolean-object +[actions-url]: https://github.com/inspect-js/is-boolean-object/actions diff --git a/node_modules/is-boolean-object/index.js b/node_modules/is-boolean-object/index.js new file mode 100644 index 0000000..e1011f6 --- /dev/null +++ b/node_modules/is-boolean-object/index.js @@ -0,0 +1,26 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var $boolToStr = callBound('Boolean.prototype.toString'); +var $toString = callBound('Object.prototype.toString'); + +var tryBooleanObject = function booleanBrandCheck(value) { + try { + $boolToStr(value); + return true; + } catch (e) { + return false; + } +}; +var boolClass = '[object Boolean]'; +var hasToStringTag = require('has-tostringtag/shams')(); + +module.exports = function isBoolean(value) { + if (typeof value === 'boolean') { + return true; + } + if (value === null || typeof value !== 'object') { + return false; + } + return hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass; +}; diff --git a/node_modules/is-boolean-object/package.json b/node_modules/is-boolean-object/package.json new file mode 100644 index 0000000..06196f6 --- /dev/null +++ b/node_modules/is-boolean-object/package.json @@ -0,0 +1,87 @@ +{ + "name": "is-boolean-object", + "version": "1.1.2", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only && npm run test:harmony && npm run test:corejs", + "tests-only": "nyc tape 'test/**/*.js'", + "test:harmony": "node --harmony --es-staging test", + "test:corejs": "nyc tape test-corejs.js", + "posttest": "aud --production", + "prelint": "npm run eccheck", + "lint": "eslint --ext=js,mjs .", + "eccheck": "eclint check $(git ls-files)", + "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://github.com/inspect-js/is-boolean-object.git" + }, + "keywords": [ + "Boolean", + "ES6", + "toStringTag", + "@@toStringTag", + "Boolean object", + "true", + "false", + "is-boolean" + ], + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", + "eclint": "^2.8.1", + "eslint": "^7.32.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "testling": { + "files": "test.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-boolean-object/test/index.js b/node_modules/is-boolean-object/test/index.js new file mode 100644 index 0000000..cd4c44f --- /dev/null +++ b/node_modules/is-boolean-object/test/index.js @@ -0,0 +1,48 @@ +'use strict'; + +var test = require('tape'); +var isBoolean = require('../'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('not Booleans', function (t) { + t.test('primitives', function (st) { + st.notOk(isBoolean(), 'undefined is not Boolean'); + st.notOk(isBoolean(null), 'null is not Boolean'); + st.notOk(isBoolean(0), '0 is not Boolean'); + st.notOk(isBoolean(NaN), 'NaN is not Boolean'); + st.notOk(isBoolean(Infinity), 'Infinity is not Boolean'); + st.notOk(isBoolean('foo'), 'string is not Boolean'); + st.end(); + }); + + t.test('objects', function (st) { + st.notOk(isBoolean(Object(42)), 'number object is not Boolean'); + st.notOk(isBoolean([]), 'array is not Boolean'); + st.notOk(isBoolean({}), 'object is not Boolean'); + st.notOk(isBoolean(function () {}), 'function is not Boolean'); + st.notOk(isBoolean(/a/g), 'regex literal is not Boolean'); + st.notOk(isBoolean(new RegExp('a', 'g')), 'regex object is not Boolean'); + st.notOk(isBoolean(new Date()), 'new Date() is not Boolean'); + st.end(); + }); + + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var fakeBoolean = { + toString: function () { return 'true'; }, + valueOf: function () { return true; } + }; + fakeBoolean[Symbol.toStringTag] = 'Boolean'; + t.notOk(isBoolean(fakeBoolean), 'fake Boolean with @@toStringTag "Boolean" is not Boolean'); + t.end(); +}); + +test('Booleans', function (t) { + t.ok(isBoolean(true), 'true is Boolean'); + t.ok(isBoolean(false), 'false is Boolean'); + t.ok(isBoolean(Object(true)), 'Object(true) is Boolean'); + t.ok(isBoolean(Object(false)), 'Object(false) is Boolean'); + t.end(); +}); diff --git a/node_modules/is-callable/.editorconfig b/node_modules/is-callable/.editorconfig new file mode 100644 index 0000000..87f2333 --- /dev/null +++ b/node_modules/is-callable/.editorconfig @@ -0,0 +1,26 @@ +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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 +max_line_length = off + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[coverage*/**/*] +indent_style = off +indent_size = off +max_line_length = off diff --git a/node_modules/is-callable/.eslintignore b/node_modules/is-callable/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-callable/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-callable/.eslintrc b/node_modules/is-callable/.eslintrc new file mode 100644 index 0000000..631b8f3 --- /dev/null +++ b/node_modules/is-callable/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "max-statements": [2, 14], + "max-statements-per-line": [2, { "max": 2 }], + "operator-linebreak": [2, "before"], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "no-throw-literal": 0, + }, + }, + ], +} diff --git a/node_modules/is-callable/.github/FUNDING.yml b/node_modules/is-callable/.github/FUNDING.yml new file mode 100644 index 0000000..0fdebd0 --- /dev/null +++ b/node_modules/is-callable/.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-callable +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-callable/.istanbul.yml b/node_modules/is-callable/.istanbul.yml new file mode 100644 index 0000000..9affe0b --- /dev/null +++ b/node_modules/is-callable/.istanbul.yml @@ -0,0 +1,47 @@ +verbose: false +instrumentation: + root: . + extensions: + - .js + - .jsx + default-excludes: true + excludes: [] + variable: __coverage__ + compact: true + preserve-comments: false + complete-copy: false + save-baseline: false + baseline-file: ./coverage/coverage-baseline.raw.json + include-all-sources: false + include-pid: false + es-modules: false + auto-wrap: false +reporting: + print: summary + reports: + - html + dir: ./coverage + summarizer: pkg + report-config: {} + watermarks: + statements: [50, 80] + functions: [50, 80] + branches: [50, 80] + lines: [50, 80] +hooks: + hook-run-in-context: false + post-require-hook: null + handle-sigint: false +check: + global: + statements: 100 + lines: 100 + branches: 100 + functions: 100 + excludes: [] + each: + statements: 100 + lines: 100 + branches: 100 + functions: 100 + excludes: [] diff --git a/node_modules/is-callable/.nycrc b/node_modules/is-callable/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-callable/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-callable/CHANGELOG.md b/node_modules/is-callable/CHANGELOG.md new file mode 100644 index 0000000..0427308 --- /dev/null +++ b/node_modules/is-callable/CHANGELOG.md @@ -0,0 +1,108 @@ +1.2.4 / 2021-08-05 +================= + * [Fix] use `has-tostringtag` approach to behave correctly in the presence of symbol shams + * [readme] fix repo URLs + * [readme] add actions and codecov badges + * [readme] remove defunct badges + * [meta] ignore eclint checking coverage output + * [meta] use `prepublishOnly` script for npm 7+ + * [actions] use `node/install` instead of `node/run`; use `codecov` action + * [actions] remove unused workflow file + * [Tests] run `nyc` on all tests; use `tape` runner + * [Tests] use `available-typed-arrays`, `for-each`, `has-symbols`, `object-inspect` + * [Dev Deps] update `available-typed-arrays`, `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` + +1.2.3 / 2021-01-31 +================= + * [Fix] `document.all` is callable (do not use `document.all`!) + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` + * [Tests] migrate tests to Github Actions + * [actions] add "Allow Edits" workflow + * [actions] switch Automatic Rebase workflow to `pull_request_target` event + +1.2.2 / 2020-09-21 +================= + * [Fix] include actual fix from 579179e + * [Dev Deps] update `eslint` + +1.2.1 / 2020-09-09 +================= + * [Fix] phantomjs‘ Reflect.apply does not throw properly on a bad array-like + * [Dev Deps] update `eslint`, `@ljharb/eslint-config` + * [meta] fix eclint error + +1.2.0 / 2020-06-02 +================= + * [New] use `Reflect.apply`‑based callability detection + * [readme] add install instructions (#55) + * [meta] only run `aud` on prod deps + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `make-arrow-function`, `make-generator-function`; add `aud`, `safe-publish-latest`, `make-async-function` + * [Tests] add tests for function proxies (#53, #25) + +1.1.5 / 2019-12-18 +================= + * [meta] remove unused Makefile and associated utilities + * [meta] add `funding` field; add FUNDING.yml + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `semver`, `tape`, `covert`, `rimraf` + * [Tests] use shared travis configs + * [Tests] use `eccheck` over `editorconfig-tools` + * [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops + * [Tests] remove `jscs` + * [actions] add automatic rebasing / merge commit blocking + +1.1.4 / 2018-07-02 +================= + * [Fix] improve `class` and arrow function detection (#30, #31) + * [Tests] on all latest node minors; improve matrix + * [Dev Deps] update all dev deps + +1.1.3 / 2016-02-27 +================= + * [Fix] ensure “class “ doesn’t screw up “class” detection + * [Tests] up to `node` `v5.7`, `v4.3` + * [Dev Deps] update to `eslint` v2, `@ljharb/eslint-config`, `jscs` + +1.1.2 / 2016-01-15 +================= + * [Fix] Make sure comments don’t screw up “class” detection (#4) + * [Tests] up to `node` `v5.3` + * [Tests] Add `parallelshell`, run both `--es-staging` and stock tests at once + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Refactor] convert `isNonES6ClassFn` into `isES6ClassFn` + +1.1.1 / 2015-11-30 +================= + * [Fix] do not throw when a non-function has a function in its [[Prototype]] (#2) + * [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `jscs`, `nsp`, `semver` + * [Tests] up to `node` `v5.1` + * [Tests] no longer allow node 0.8 to fail. + * [Tests] fix npm upgrades in older nodes + +1.1.0 / 2015-10-02 +================= + * [Fix] Some browsers report TypedArray constructors as `typeof object` + * [New] return false for "class" constructors, when possible. + * [Tests] up to `io.js` `v3.3`, `node` `v4.1` + * [Dev Deps] update `eslint`, `editorconfig-tools`, `nsp`, `tape`, `semver`, `jscs`, `covert`, `make-arrow-function` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + +1.0.4 / 2015-01-30 +================= + * If @@toStringTag is not present, use the old-school Object#toString test. + +1.0.3 / 2015-01-29 +================= + * Add tests to ensure arrow functions are callable. + * Refactor to aid optimization of non-try/catch code. + +1.0.2 / 2015-01-29 +================= + * Fix broken package.json + +1.0.1 / 2015-01-29 +================= + * Add early exit for typeof not "function" + +1.0.0 / 2015-01-29 +================= + * Initial release. diff --git a/node_modules/is-callable/LICENSE b/node_modules/is-callable/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-callable/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-callable/README.md b/node_modules/is-callable/README.md new file mode 100644 index 0000000..8f3dced --- /dev/null +++ b/node_modules/is-callable/README.md @@ -0,0 +1,67 @@ +# is-callable [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag. + +## Example + +```js +var isCallable = require('is-callable'); +var assert = require('assert'); + +assert.notOk(isCallable(undefined)); +assert.notOk(isCallable(null)); +assert.notOk(isCallable(false)); +assert.notOk(isCallable(true)); +assert.notOk(isCallable([])); +assert.notOk(isCallable({})); +assert.notOk(isCallable(/a/g)); +assert.notOk(isCallable(new RegExp('a', 'g'))); +assert.notOk(isCallable(new Date())); +assert.notOk(isCallable(42)); +assert.notOk(isCallable(NaN)); +assert.notOk(isCallable(Infinity)); +assert.notOk(isCallable(new Number(42))); +assert.notOk(isCallable('foo')); +assert.notOk(isCallable(Object('foo'))); + +assert.ok(isCallable(function () {})); +assert.ok(isCallable(function* () {})); +assert.ok(isCallable(x => x * x)); +``` + +## Install + +Install with + +``` +npm install is-callable +``` + +## Tests + +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-callable +[2]: https://versionbadg.es/inspect-js/is-callable.svg +[5]: https://david-dm.org/inspect-js/is-callable.svg +[6]: https://david-dm.org/inspect-js/is-callable +[7]: https://david-dm.org/inspect-js/is-callable/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-callable#info=devDependencies +[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-callable.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-callable.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-callable +[codecov-image]: https://codecov.io/gh/inspect-js/is-callable/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-callable/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-callable +[actions-url]: https://github.com/inspect-js/is-callable/actions diff --git a/node_modules/is-callable/index.js b/node_modules/is-callable/index.js new file mode 100644 index 0000000..86c9771 --- /dev/null +++ b/node_modules/is-callable/index.js @@ -0,0 +1,74 @@ +'use strict'; + +var fnToStr = Function.prototype.toString; +var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; +var badArrayLike; +var isCallableMarker; +if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { + try { + badArrayLike = Object.defineProperty({}, 'length', { + get: function () { + throw isCallableMarker; + } + }); + isCallableMarker = {}; + // eslint-disable-next-line no-throw-literal + reflectApply(function () { throw 42; }, null, badArrayLike); + } catch (_) { + if (_ !== isCallableMarker) { + reflectApply = null; + } + } +} else { + reflectApply = null; +} + +var constructorRegex = /^\s*class\b/; +var isES6ClassFn = function isES6ClassFunction(value) { + try { + var fnStr = fnToStr.call(value); + return constructorRegex.test(fnStr); + } catch (e) { + return false; // not a function + } +}; + +var tryFunctionObject = function tryFunctionToStr(value) { + try { + if (isES6ClassFn(value)) { return false; } + fnToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var fnClass = '[object Function]'; +var genClass = '[object GeneratorFunction]'; +var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` +/* globals document: false */ +var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {}; + +module.exports = reflectApply + ? function isCallable(value) { + if (value === documentDotAll) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (typeof value === 'function' && !value.prototype) { return true; } + try { + reflectApply(value, null, badArrayLike); + } catch (e) { + if (e !== isCallableMarker) { return false; } + } + return !isES6ClassFn(value); + } + : function isCallable(value) { + if (value === documentDotAll) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (typeof value === 'function' && !value.prototype) { return true; } + if (hasToStringTag) { return tryFunctionObject(value); } + if (isES6ClassFn(value)) { return false; } + var strClass = toStr.call(value); + return strClass === fnClass || strClass === genClass; + }; diff --git a/node_modules/is-callable/package.json b/node_modules/is-callable/package.json new file mode 100644 index 0000000..5722447 --- /dev/null +++ b/node_modules/is-callable/package.json @@ -0,0 +1,92 @@ +{ + "name": "is-callable", + "version": "1.2.4", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent lint", + "test": "npm run tests-only --", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "eclint check *", + "lint": "eslint ." + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/is-callable.git" + }, + "keywords": [ + "Function", + "function", + "callable", + "generator", + "generator function", + "arrow", + "arrow function", + "ES6", + "toStringTag", + "@@toStringTag" + ], + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "available-typed-arrays": "^1.0.4", + "eclint": "^2.8.1", + "es-value-fixtures": "^1.2.1", + "eslint": "^7.32.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", + "make-arrow-function": "^1.2.0", + "make-async-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "nyc": "^10.3.2", + "object-inspect": "^1.11.0", + "rimraf": "^2.7.1", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "greenkeeper": { + "ignore": [ + "rimraf" + ] + } +} diff --git a/node_modules/is-callable/test/index.js b/node_modules/is-callable/test/index.js new file mode 100644 index 0000000..a3c348c --- /dev/null +++ b/node_modules/is-callable/test/index.js @@ -0,0 +1,170 @@ +'use strict'; + +/* globals Proxy */ +/* eslint no-magic-numbers: 1 */ + +var test = require('tape'); +var isCallable = require('../'); +var hasToStringTag = require('has-tostringtag/shams')(); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var typedArrayNames = require('available-typed-arrays')(); +var generators = require('make-generator-function')(); +var arrows = require('make-arrow-function').list(); +var asyncs = require('make-async-function').list(); +var weirdlyCommentedArrowFn; +try { + /* eslint-disable no-new-func */ + weirdlyCommentedArrowFn = Function('return cl/*/**/=>/**/ass - 1;')(); + /* eslint-enable no-new-func */ +} catch (e) { /**/ } + +var noop = function () {}; +var classFake = function classFake() { }; // eslint-disable-line func-name-matching +var returnClass = function () { return ' class '; }; +var return3 = function () { return 3; }; +/* for coverage */ +noop(); +classFake(); +returnClass(); +return3(); +/* end for coverage */ + +var proxy; +if (typeof Proxy === 'function') { + try { + proxy = new Proxy(function () {}, {}); + // for coverage + proxy(); + String(proxy); + } catch (_) { + // If `Reflect` is supported, then `Function.prototype.toString` isn't used for callability detection. + if (typeof Reflect !== 'object') { + // Older engines throw a `TypeError` when `Function.prototype.toString` is called on a Proxy object. + proxy = null; + } + } +} + +var invokeFunction = function invokeFunctionString(str) { + var result; + try { + /* eslint-disable no-new-func */ + var fn = Function(str); + /* eslint-enable no-new-func */ + result = fn(); + } catch (e) {} + return result; +}; + +var classConstructor = invokeFunction('"use strict"; return class Foo {}'); + +var commentedClass = invokeFunction('"use strict"; return class/*kkk*/\n//blah\n Bar\n//blah\n {}'); +var commentedClassOneLine = invokeFunction('"use strict"; return class/**/A{}'); +var classAnonymous = invokeFunction('"use strict"; return class{}'); +var classAnonymousCommentedOneLine = invokeFunction('"use strict"; return class/*/*/{}'); + +test('not callables', function (t) { + t.notOk(isCallable(), 'implicit undefined is not callable'); + + forEach(v.nonFunctions.concat([ + Object(42), + Object('foo'), + NaN, + [], + /a/g, + new RegExp('a', 'g'), + new Date() + ]), function (nonFunction) { + t.equal(isCallable(nonFunction), false, inspect(nonFunction) + ' is not callable'); + }); + + t.test('non-function with function in its [[Prototype]] chain', function (st) { + var Foo = function Bar() {}; + Foo.prototype = noop; + st.equal(isCallable(Foo), true, 'sanity check: Foo is callable'); + st.equal(isCallable(new Foo()), false, 'instance of Foo is not callable'); + st.end(); + }); + + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var fakeFunction = { + toString: function () { return String(return3); }, + valueOf: return3 + }; + fakeFunction[Symbol.toStringTag] = 'Function'; + t.equal(String(fakeFunction), String(return3)); + t.equal(Number(fakeFunction), return3()); + t.notOk(isCallable(fakeFunction), 'fake Function with @@toStringTag "Function" is not callable'); + t.end(); +}); + +test('Functions', function (t) { + t.ok(isCallable(noop), 'function is callable'); + t.ok(isCallable(classFake), 'function with name containing "class" is callable'); + t.ok(isCallable(returnClass), 'function with string " class " is callable'); + t.ok(isCallable(isCallable), 'isCallable is callable'); + t.end(); +}); + +test('Typed Arrays', { skip: typedArrayNames.length === 0 }, function (st) { + forEach(typedArrayNames, function (typedArray) { + st.ok(isCallable(global[typedArray]), typedArray + ' is callable'); + }); + st.end(); +}); + +test('Generators', { skip: generators.length === 0 }, function (t) { + forEach(generators, function (genFn) { + t.ok(isCallable(genFn), 'generator function ' + genFn + ' is callable'); + }); + t.end(); +}); + +test('Arrow functions', { skip: arrows.length === 0 }, function (t) { + forEach(arrows, function (arrowFn) { + t.ok(isCallable(arrowFn), 'arrow function ' + arrowFn + ' is callable'); + }); + t.ok(isCallable(weirdlyCommentedArrowFn), 'weirdly commented arrow functions are callable'); + t.end(); +}); + +test('"Class" constructors', { skip: !classConstructor || !commentedClass || !commentedClassOneLine || !classAnonymous }, function (t) { + t.notOk(isCallable(classConstructor), 'class constructors are not callable'); + t.notOk(isCallable(commentedClass), 'class constructors with comments in the signature are not callable'); + t.notOk(isCallable(commentedClassOneLine), 'one-line class constructors with comments in the signature are not callable'); + t.notOk(isCallable(classAnonymous), 'anonymous class constructors are not callable'); + t.notOk(isCallable(classAnonymousCommentedOneLine), 'anonymous one-line class constructors with comments in the signature are not callable'); + t.end(); +}); + +test('`async function`s', { skip: asyncs.length === 0 }, function (t) { + forEach(asyncs, function (asyncFn) { + t.ok(isCallable(asyncFn), '`async function` ' + asyncFn + ' is callable'); + }); + t.end(); +}); + +test('proxies of functions', { skip: !proxy }, function (t) { + t.ok(isCallable(proxy), 'proxies of functions are callable'); + t.end(); +}); + +test('throwing functions', function (t) { + t.plan(1); + + var thrower = function (a) { return a.b; }; + t.ok(isCallable(thrower), 'a function that throws is callable'); +}); + +/* globals document: false */ +test('document.all', { skip: typeof document !== 'object' }, function (t) { + t.notOk(isCallable(document), 'document is not callable'); + t.ok(isCallable(document.all), 'document.all is callable'); + + t.end(); +}); diff --git a/node_modules/is-core-module/.eslintrc b/node_modules/is-core-module/.eslintrc new file mode 100644 index 0000000..f2e0726 --- /dev/null +++ b/node_modules/is-core-module/.eslintrc @@ -0,0 +1,18 @@ +{ + "extends": "@ljharb", + "root": true, + "rules": { + "func-style": 1, + }, + "overrides": [ + { + "files": "test/**", + "rules": { + "global-require": 0, + "max-depth": 0, + "max-lines-per-function": 0, + "no-negated-condition": 0, + }, + }, + ], +} diff --git a/node_modules/is-core-module/.nycrc b/node_modules/is-core-module/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-core-module/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-core-module/CHANGELOG.md b/node_modules/is-core-module/CHANGELOG.md new file mode 100644 index 0000000..1f4d1d6 --- /dev/null +++ b/node_modules/is-core-module/CHANGELOG.md @@ -0,0 +1,136 @@ +# 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.9.0](https://github.com/inspect-js/is-core-module/compare/v2.8.1...v2.9.0) - 2022-04-19 + +### Commits + +- [New] add `node:test`, in node 18+ [`f853eca`](https://github.com/inspect-js/is-core-module/commit/f853eca801d0a7d4e1dbb670f1b6d9837d9533c5) +- [Tests] use `mock-property` [`03b3644`](https://github.com/inspect-js/is-core-module/commit/03b3644dff4417f4ba5a7d0aa0138f5f6b3e5c46) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`7c0e2d0`](https://github.com/inspect-js/is-core-module/commit/7c0e2d06ed2a89acf53abe2ab34d703ed5b03455) +- [meta] simplify "exports" [`d6ed201`](https://github.com/inspect-js/is-core-module/commit/d6ed201eba7fbba0e59814a9050fc49a6e9878c8) + +## [v2.8.1](https://github.com/inspect-js/is-core-module/compare/v2.8.0...v2.8.1) - 2022-01-05 + +### Commits + +- [actions] reuse common workflows [`cd2cf9b`](https://github.com/inspect-js/is-core-module/commit/cd2cf9b3b66c8d328f65610efe41e9325db7716d) +- [Fix] update node 0.4 results [`062195d`](https://github.com/inspect-js/is-core-module/commit/062195d89f0876a88b95d378b43f7fcc1205bc5b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0790b62`](https://github.com/inspect-js/is-core-module/commit/0790b6222848c6167132f9f73acc3520fa8d1298) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7d139a6`](https://github.com/inspect-js/is-core-module/commit/7d139a6d767709eabf0a0251e074ec1fb230c06e) +- [Tests] run `nyc` in `tests-only`, not `test` [`780e8a0`](https://github.com/inspect-js/is-core-module/commit/780e8a049951c71cf78b1707f0871c48a28bde14) + +## [v2.8.0](https://github.com/inspect-js/is-core-module/compare/v2.7.0...v2.8.0) - 2021-10-14 + +### Commits + +- [actions] update codecov uploader [`0cfe94e`](https://github.com/inspect-js/is-core-module/commit/0cfe94e106a7d005ea03e008c0a21dec13a77904) +- [New] add `readline/promises` to node v17+ [`4f78c30`](https://github.com/inspect-js/is-core-module/commit/4f78c3008b1b58b4db6dc91d99610b1bc859da7e) +- [Tests] node ^14.18 supports `node:` prefixes for CJS [`43e2f17`](https://github.com/inspect-js/is-core-module/commit/43e2f177452cea2f0eaf34f61b5407217bbdb6f4) + +## [v2.7.0](https://github.com/inspect-js/is-core-module/compare/v2.6.0...v2.7.0) - 2021-09-27 + +### Commits + +- [New] node `v14.18` added `node:`-prefixed core modules to `require` [`6d943ab`](https://github.com/inspect-js/is-core-module/commit/6d943abe81382b9bbe344384d80fbfebe1cc0526) +- [Tests] add coverage for Object.prototype pollution [`c6baf5f`](https://github.com/inspect-js/is-core-module/commit/c6baf5f942311a1945c1af41167bb80b84df2af7) +- [Dev Deps] update `@ljharb/eslint-config` [`6717f00`](https://github.com/inspect-js/is-core-module/commit/6717f000d063ea57beb772bded36c2f056ac404c) +- [eslint] fix linter warning [`594c10b`](https://github.com/inspect-js/is-core-module/commit/594c10bb7d39d7eb00925c90924199ff596184b2) +- [meta] add `sideEffects` flag [`c32cfa5`](https://github.com/inspect-js/is-core-module/commit/c32cfa5195632944c4dd4284a142b8476e75be13) + +## [v2.6.0](https://github.com/inspect-js/is-core-module/compare/v2.5.0...v2.6.0) - 2021-08-17 + +### Commits + +- [Dev Deps] update `eslint`, `tape` [`6cc928f`](https://github.com/inspect-js/is-core-module/commit/6cc928f8a4bba66aeeccc4f6beeac736d4bd3081) +- [New] add `stream/consumers` to node `>= 16.7` [`a1a423e`](https://github.com/inspect-js/is-core-module/commit/a1a423e467e4cc27df180234fad5bab45943e67d) +- [Refactor] Remove duplicated `&&` operand [`86faea7`](https://github.com/inspect-js/is-core-module/commit/86faea738213a2433c62d1098488dc9314dca832) +- [Tests] include prereleases [`a4da7a6`](https://github.com/inspect-js/is-core-module/commit/a4da7a6abf7568e2aa4fd98e69452179f1850963) + +## [v2.5.0](https://github.com/inspect-js/is-core-module/compare/v2.4.0...v2.5.0) - 2021-07-12 + +### Commits + +- [Dev Deps] update `auto-changelog`, `eslint` [`6334cc9`](https://github.com/inspect-js/is-core-module/commit/6334cc94f3af7469685bd8f236740991baaf2705) +- [New] add `stream/web` to node v16.5+ [`17ac59b`](https://github.com/inspect-js/is-core-module/commit/17ac59b662d63e220a2e5728625f005c24f177b2) + +## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09 + +### Commits + +- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8) +- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f) +- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c) +- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57) + +## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24 + +### Commits + +- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a) +- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9) +- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed) +- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8) +- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7) +- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c) + +## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26 + +### Commits + +- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426) +- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b) +- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72) +- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3) + +## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04 + +### Commits + +- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4) +- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec) + +## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29 + +### Commits + +- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd) +- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b) +- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348) +- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496) +- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63) +- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a) +- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697) +- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9) +- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6) +- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655) +- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65) + +## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28 + +### Commits + +- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2) + +## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28 + +### Commits + +- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac) +- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027) + +## v1.0.0 - 2014-09-28 + +### Commits + +- init [`48e5e76`](https://github.com/inspect-js/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 0000000..2e50287 --- /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 0000000..062d906 --- /dev/null +++ b/node_modules/is-core-module/README.md @@ -0,0 +1,40 @@ +# is-core-module [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 +[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 +[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module +[actions-url]: https://github.com/inspect-js/is-core-module/actions diff --git a/node_modules/is-core-module/core.json b/node_modules/is-core-module/core.json new file mode 100644 index 0000000..058584b --- /dev/null +++ b/node_modules/is-core-module/core.json @@ -0,0 +1,153 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "node:test": ">= 18", + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/node_modules/is-core-module/index.js b/node_modules/is-core-module/index.js new file mode 100644 index 0000000..f9637e0 --- /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 + : 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 0000000..80ce9f5 --- /dev/null +++ b/node_modules/is-core-module/package.json @@ -0,0 +1,65 @@ +{ + "name": "is-core-module", + "version": "2.9.0", + "description": "Is this specifier a node.js core module?", + "main": "index.js", + "sideEffects": false, + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "mock-property": "^1.0.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} 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 0000000..4385b20 --- /dev/null +++ b/node_modules/is-core-module/test/index.js @@ -0,0 +1,133 @@ +'use strict'; + +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); +var mockProperty = require('mock-property'); + +var isCore = require('../'); +var data = require('../core.json'); + +var supportsNodePrefix = semver.satisfies(process.versions.node, '^14.18 || >= 16', { includePrerelease: true }); + +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' + ); + if (mod.slice(0, 5) !== 'node:') { + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } + } + } + } + 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' + ]; + // see https://github.com/nodejs/node/issues/42785 + if (semver.satisfies(process.version, '>= 18')) { + libs = libs.concat('node:test'); + } + 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' + ); + if (mod.slice(0, 5) !== 'node:') { + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } + } + } + } + } + st.end(); + }); + + t.test('Object.prototype pollution', function (st) { + var nonKey = 'not a core module'; + st.teardown(mockProperty(Object.prototype, 'fs', { value: false })); + st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' })); + st.teardown(mockProperty(Object.prototype, 'http', { value: data.http })); + st.teardown(mockProperty(Object.prototype, nonKey, { value: true })); + + st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies'); + st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies'); + st.equal(isCore('http'), true, 'path is a core module even if Object.prototype matches data'); + st.equal(isCore(nonKey), false, '"' + nonKey + '" is not a core module even if Object.prototype lies'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/is-date-object/.editorconfig b/node_modules/is-date-object/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/is-date-object/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/is-date-object/.eslintignore b/node_modules/is-date-object/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-date-object/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-date-object/.eslintrc b/node_modules/is-date-object/.eslintrc new file mode 100644 index 0000000..1228f97 --- /dev/null +++ b/node_modules/is-date-object/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements": [2, 12] + } +} diff --git a/node_modules/is-date-object/.github/FUNDING.yml b/node_modules/is-date-object/.github/FUNDING.yml new file mode 100644 index 0000000..9cfa9fd --- /dev/null +++ b/node_modules/is-date-object/.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-date-object +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-date-object/.nycrc b/node_modules/is-date-object/.nycrc new file mode 100644 index 0000000..a69aa2d --- /dev/null +++ b/node_modules/is-date-object/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test", + "test-corejs.js" + ] +} diff --git a/node_modules/is-date-object/CHANGELOG.md b/node_modules/is-date-object/CHANGELOG.md new file mode 100644 index 0000000..49f624a --- /dev/null +++ b/node_modules/is-date-object/CHANGELOG.md @@ -0,0 +1,114 @@ +# 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). + +## [v1.0.5](https://github.com/inspect-js/is-date-object/compare/v1.0.4...v1.0.5) - 2021-08-05 + +### Commits + +- [meta] remove `.jscs.json` [`31c731c`](https://github.com/inspect-js/is-date-object/commit/31c731c5efc5b1b86e6426d904373dc6225b929f) +- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`17a6df4`](https://github.com/inspect-js/is-date-object/commit/17a6df4a3ab9bcb1395a638ced14f571f9549427) +- [Dev Deps] update `eslint`, `auto-changelog`, `tape` [`79db3af`](https://github.com/inspect-js/is-date-object/commit/79db3af1a745042a0a11e03c7dd7db910b5e0d01) + +## [v1.0.4](https://github.com/inspect-js/is-date-object/compare/v1.0.3...v1.0.4) - 2021-05-07 + +### Commits + +- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`8943a4a`](https://github.com/inspect-js/is-date-object/commit/8943a4a5035b3f2c8cee9a5edabb55579c16983d) +- [readme] make all URLs https [`1d4d6cd`](https://github.com/inspect-js/is-date-object/commit/1d4d6cd37365c3a36f98e3f82cfe6262227437db) +- [Dev Deps] update `eslint` [`a7abeaa`](https://github.com/inspect-js/is-date-object/commit/a7abeaa2409d3a34fccebcb5b362e0b90d0a8883) + +## [v1.0.3](https://github.com/inspect-js/is-date-object/compare/v1.0.2...v1.0.3) - 2021-05-05 + +### Commits + +- [Tests] migrate tests to Github Actions [`023504f`](https://github.com/inspect-js/is-date-object/commit/023504f4d48fc8788ff52ee525a1d9ec74fa7df5) +- [readme] add actions and codecov badges [`e63305f`](https://github.com/inspect-js/is-date-object/commit/e63305f2fb9ff3eb0dab7e0716585507a4f95a75) +- [meta] do not publish github action workflow files [`017d906`](https://github.com/inspect-js/is-date-object/commit/017d90679b6b1c16b398c0157904f91f56160219) +- [Tests] run `nyc` on all tests [`0376b6f`](https://github.com/inspect-js/is-date-object/commit/0376b6fb7a0ffcc42107c3c579ba0b3ab635b9e4) +- [readme] fix repo URLs; remove defunct badges [`1c148c6`](https://github.com/inspect-js/is-date-object/commit/1c148c6cb6eb0892b3186e814df3367dabb9732d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`c7a3f54`](https://github.com/inspect-js/is-date-object/commit/c7a3f54a207a6056ffafaa58178889ea1b1b77f7) +- [actions] add "Allow Edits" workflow [`e79b5b2`](https://github.com/inspect-js/is-date-object/commit/e79b5b25c173c3201e8b42a614d5f12c48b74a86) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`da28980`](https://github.com/inspect-js/is-date-object/commit/da28980c5fe86528585b2a420319ca8fc35f763a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`5cabae9`](https://github.com/inspect-js/is-date-object/commit/5cabae9f00bf458a470bde68b734540b8ab78c3b) +- [readme] add actions and codecov badges [`33dfb88`](https://github.com/inspect-js/is-date-object/commit/33dfb881b7abf668cd3bf956e2947a1ece552f25) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`745eb04`](https://github.com/inspect-js/is-date-object/commit/745eb0462ef3838df65f41f4a95453cc4f0aa06e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`466c62b`](https://github.com/inspect-js/is-date-object/commit/466c62b45af5a5a83963f6ef8617da887b0ab272) +- [actions] use checkout v2; remove unneeded env [`ff87a16`](https://github.com/inspect-js/is-date-object/commit/ff87a161e36d76d081d70933bf801a357c3b25fe) +- [Dev Deps] update `auto-changelog`, `tape` [`93188f5`](https://github.com/inspect-js/is-date-object/commit/93188f58e4b2c2b5e978a61a45380101d01f9838) +- [meta] use `prepublishOnly` script for npm 7+ [`1d0e3ea`](https://github.com/inspect-js/is-date-object/commit/1d0e3ea672971f02bb48c88b49079789ab41f574) +- [actions] update workflows [`4d1a235`](https://github.com/inspect-js/is-date-object/commit/4d1a2358de35a9fbe23a1dee10735748ed276301) +- [Dev Deps] update `auto-changelog`; add `aud` [`67be59a`](https://github.com/inspect-js/is-date-object/commit/67be59aa3c0ba44b982aaefb7e42adfb14eb279b) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`a6661c2`](https://github.com/inspect-js/is-date-object/commit/a6661c26af701a7782f6e06ad1b34587ce2b09bc) +- [Tests] only audit prod deps [`dd4a47f`](https://github.com/inspect-js/is-date-object/commit/dd4a47f8bcf82c3090826d890a7766f50d6f7af9) + +## [v1.0.2](https://github.com/inspect-js/is-date-object/compare/v1.0.1...v1.0.2) - 2019-12-18 + +### Commits + +- [Tests] use shared travis-ci configs [`8a378b8`](https://github.com/inspect-js/is-date-object/commit/8a378b8fd6a4202fffc9ec193aca02efe937bc35) +- [Tests] on all node minors; use `nvm install-latest-npm`; fix scripts; improve matrix [`6e97a21`](https://github.com/inspect-js/is-date-object/commit/6e97a21276cf448ce424fb9ea13edd4587f289f1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is`, `jscs`, `nsp`, `semver`, `tape` [`8472b90`](https://github.com/inspect-js/is-date-object/commit/8472b90f82e5153c22e7a8a7726a5cc6110e93d7) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9` [`ae73e38`](https://github.com/inspect-js/is-date-object/commit/ae73e3890df7da0bc4449088e30340cb4df3294d) +- [meta] add `auto-changelog` [`82f8f47`](https://github.com/inspect-js/is-date-object/commit/82f8f473a6ee45e2b66810cb743e0122c18381c5) +- [meta] remove unused Makefile and associated utilities [`788a2cd`](https://github.com/inspect-js/is-date-object/commit/788a2cdfd0bc8f1903967219897f6d00c4c6a26b) +- [Tests] up to `node` `v11.4`, `v10.14`, `v8.14`, `v6.15` [`b9caf7c`](https://github.com/inspect-js/is-date-object/commit/b9caf7c814e5e2549454cb444f8b739f9ce1a388) +- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v8.15`, `v6.17`; use `nvm install-latest-npm` [`cda0abc`](https://github.com/inspect-js/is-date-object/commit/cda0abc04a21c9b5ec72eabd010155c988032056) +- [Tests] up to `node` `v12.10`, `v10.16`, `v8.16` [`49bc482`](https://github.com/inspect-js/is-date-object/commit/49bc482fd9f71436b663c07144083a8423697299) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `semver`, `tape`; add `safe-publish-latest` [`f77fec4`](https://github.com/inspect-js/is-date-object/commit/f77fec48057e156b2276b4c14cf303306116b9f6) +- [actions] add automatic rebasing / merge commit blocking [`68605fc`](https://github.com/inspect-js/is-date-object/commit/68605fcb6bc0341ff0aae14a94bf5d18e1bc73be) +- [meta] create FUNDING.yml [`4f82d88`](https://github.com/inspect-js/is-date-object/commit/4f82d88e1e6ac1b97f0ce96aa0aa057ad758a581) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`3cbf28a`](https://github.com/inspect-js/is-date-object/commit/3cbf28a185ced940cfce8a09fa8479cc83575876) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config@`, `is`, `semver`, `tape` [`abf9fb0`](https://github.com/inspect-js/is-date-object/commit/abf9fb0d55ef0697e64e888d74f2e5fe53d7cdcb) +- [Tests] switch from `nsp` to `npm audit` [`6543c7d`](https://github.com/inspect-js/is-date-object/commit/6543c7d559d1fb79215b46c8b79e0e3e2a83f5de) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`ba5d2d7`](https://github.com/inspect-js/is-date-object/commit/ba5d2d7fc0975d7c03b8f2b7f43a09af93e365ba) +- [Dev Deps] update `eslint`, `nsp`, `semver`, `tape` [`c1e3525`](https://github.com/inspect-js/is-date-object/commit/c1e3525afa76a696f7cf1b58aab7f55d220b2c20) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`14e4824`](https://github.com/inspect-js/is-date-object/commit/14e4824188c85207ed3b86627b09e9f64b135db7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` [`68ead64`](https://github.com/inspect-js/is-date-object/commit/68ead64a07e0de282ea3cd38e12cc8b0e0f6d3cd) +- [Dev Deps] update `eslint`, semver`, `tape`, `semver` [`f55453f`](https://github.com/inspect-js/is-date-object/commit/f55453f200903277465d7e9307a9c49120a4f419) +- Only apps should have lockfiles [`6c848eb`](https://github.com/inspect-js/is-date-object/commit/6c848eba982cc58053d4cca08c01f12a433f3695) +- [Tests] remove `jscs` [`3fd3a62`](https://github.com/inspect-js/is-date-object/commit/3fd3a62121607ad074b7fc977f3fc6575b66f755) +- [Dev Deps] update `eslint`, `tape` [`77d3130`](https://github.com/inspect-js/is-date-object/commit/77d3130a0039e5dae24c17de790dd510c265edc6) +- [meta] add `funding` field [`9ef6d58`](https://github.com/inspect-js/is-date-object/commit/9ef6d5888bf829a5812b3b091dc99839d48c355e) + +## [v1.0.1](https://github.com/inspect-js/is-date-object/compare/v1.0.0...v1.0.1) - 2015-09-27 + +### Commits + +- Update `tape`, `semver`, `eslint`; use my personal shared `eslint` config. [`731aa13`](https://github.com/inspect-js/is-date-object/commit/731aa134b0b8dc84e302d0b2264a415cb456ccab) +- Update `is`, `tape`, `covert`, `jscs`, `editorconfig-tools`, `nsp`, `eslint`, `semver` [`53e43a6`](https://github.com/inspect-js/is-date-object/commit/53e43a627dd01757cf3d469599f3dffd9d72b150) +- Update `eslint` [`d2fc304`](https://github.com/inspect-js/is-date-object/commit/d2fc3046f087b0026448ffde0cf46b1f741cbd4e) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`c9568df`](https://github.com/inspect-js/is-date-object/commit/c9568df228fa698dc6fcc9553b5d612e7ee427aa) +- Test on latest `node` and `io.js` versions. [`a21d537`](https://github.com/inspect-js/is-date-object/commit/a21d537562166ebd18bde3a262fd157dd774ae17) +- Update `nsp`, `eslint`, `semver` [`9e1d908`](https://github.com/inspect-js/is-date-object/commit/9e1d9087c0c79c34fcb2abfc701cdfa1efcb327c) +- Update `covert`, `jscs`, `eslint`, `semver` [`f198f6b`](https://github.com/inspect-js/is-date-object/commit/f198f6b997912da10a3d821a089e1581edc730a0) +- [Dev Deps] update `tape`, `jscs`, `eslint` [`ab9bdbb`](https://github.com/inspect-js/is-date-object/commit/ab9bdbbc189cef033346508db47cd1feb04a69d3) +- If `@@toStringTag` is not present, use the old-school `Object#toString` test. [`c03afce`](https://github.com/inspect-js/is-date-object/commit/c03afce001368b29eb929900075749b113a252c8) +- [Dev Deps] update `jscs`, `nsp`, `tape`, `eslint`, `@ljharb/eslint-config` [`9d94ccb`](https://github.com/inspect-js/is-date-object/commit/9d94ccbab4160d2fa649123e37951d86b69a8b15) +- [Dev Deps] update `is`, `eslint`, `@ljharb/eslint-config`, `semver` [`35cbff7`](https://github.com/inspect-js/is-date-object/commit/35cbff7f7c8216fbb79c799f74b2336eaf0d726a) +- Test up to `io.js` `v2.3` [`be5d11e`](https://github.com/inspect-js/is-date-object/commit/be5d11e7ebd9473d7ae554179b3769082485f6f4) +- [Tests] on `io.js` `v3.3`, up to `node` `v4.1` [`20221a3`](https://github.com/inspect-js/is-date-object/commit/20221a34858d2b21e23bdc2c08df23f0bc08d11e) +- [Tests] up to `io.js` `v3.2 ` [`7009b4a`](https://github.com/inspect-js/is-date-object/commit/7009b4a9999e14eacbdf6068afd82f478473f007) +- Test on `io.js` `v2.1` [`68b29b1`](https://github.com/inspect-js/is-date-object/commit/68b29b19a07e6589a7ca37ab764be28f144ac88e) +- Remove `editorconfig-tools` [`8d3972c`](https://github.com/inspect-js/is-date-object/commit/8d3972c1795fdcfd337680e11ab610e4885fb079) +- [Dev Deps] update `tape` [`204945d`](https://github.com/inspect-js/is-date-object/commit/204945d8658a3513ca6315ddf795e4034adb4545) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`7bff214`](https://github.com/inspect-js/is-date-object/commit/7bff214dcb2317b96219921476f990814afbb401) +- Test on `io.js` `v2.5` [`92f7bd6`](https://github.com/inspect-js/is-date-object/commit/92f7bd6747e3259b0ddc9c287876f46a9cd4c270) +- Test on `io.js` `v2.4` [`ebb34bf`](https://github.com/inspect-js/is-date-object/commit/ebb34bf1f58949768063f86ac012f1ca5d7cf6d9) +- Fix tests for faked @@toStringTag [`3b9c26c`](https://github.com/inspect-js/is-date-object/commit/3b9c26c15040af6a87f8d77ce6c85a7bef7a4304) +- Test on `io.js` `v3.0` [`5eedf4b`](https://github.com/inspect-js/is-date-object/commit/5eedf4bea76380a08813fd0977469c2480302a82) + +## v1.0.0 - 2015-01-28 + +### Commits + +- Dotfiles. [`5b6a929`](https://github.com/inspect-js/is-date-object/commit/5b6a9298c6f70882e78e66d64c9c019f85790f52) +- `make release` [`e8d40ce`](https://github.com/inspect-js/is-date-object/commit/e8d40ceca85acd0aa4b2753faa6e41c0c54cf6c3) +- package.json [`a107259`](https://github.com/inspect-js/is-date-object/commit/a1072591ea510a2998298be6cef827b123f4643f) +- Read me [`eb92695`](https://github.com/inspect-js/is-date-object/commit/eb92695664bdee8fc49891cd73aa2f41075f53cb) +- Initial commit [`4fc7755`](https://github.com/inspect-js/is-date-object/commit/4fc7755ff12f1d7a55cf841d486bf6b2350fe5a0) +- Tests. [`b6f432f`](https://github.com/inspect-js/is-date-object/commit/b6f432fb6801c5ff8d89cfec7601d59478e23dd1) +- Implementation. [`dd0fd96`](https://github.com/inspect-js/is-date-object/commit/dd0fd96c4016a66cec7cd59db0fde37c2ef3cdb5) diff --git a/node_modules/is-date-object/LICENSE b/node_modules/is-date-object/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-date-object/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-date-object/README.md b/node_modules/is-date-object/README.md new file mode 100644 index 0000000..1c084ad --- /dev/null +++ b/node_modules/is-date-object/README.md @@ -0,0 +1,52 @@ +# is-date-object [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isDate = require('is-date-object'); +var assert = require('assert'); + +assert.notOk(isDate(undefined)); +assert.notOk(isDate(null)); +assert.notOk(isDate(false)); +assert.notOk(isDate(true)); +assert.notOk(isDate(42)); +assert.notOk(isDate('foo')); +assert.notOk(isDate(function () {})); +assert.notOk(isDate([])); +assert.notOk(isDate({})); +assert.notOk(isDate(/a/g)); +assert.notOk(isDate(new RegExp('a', 'g'))); + +assert.ok(isDate(new Date())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-date-object +[2]: https://versionbadg.es/inspect-js/is-date-object.svg +[5]: https://david-dm.org/inspect-js/is-date-object.svg +[6]: https://david-dm.org/inspect-js/is-date-object +[7]: https://david-dm.org/inspect-js/is-date-object/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-date-object#info=devDependencies +[11]: https://nodei.co/npm/is-date-object.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-date-object.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-date-object.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-date-object +[codecov-image]: https://codecov.io/gh/inspect-js/is-date-object/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-date-object/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-date-object +[actions-url]: https://github.com/inspect-js/is-date-object/actions diff --git a/node_modules/is-date-object/index.js b/node_modules/is-date-object/index.js new file mode 100644 index 0000000..11628f3 --- /dev/null +++ b/node_modules/is-date-object/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var getDay = Date.prototype.getDay; +var tryDateObject = function tryDateGetDayCall(value) { + try { + getDay.call(value); + return true; + } catch (e) { + return false; + } +}; + +var toStr = Object.prototype.toString; +var dateClass = '[object Date]'; +var hasToStringTag = require('has-tostringtag/shams')(); + +module.exports = function isDateObject(value) { + if (typeof value !== 'object' || value === null) { + return false; + } + return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; +}; diff --git a/node_modules/is-date-object/package.json b/node_modules/is-date-object/package.json new file mode 100644 index 0000000..7b32ed8 --- /dev/null +++ b/node_modules/is-date-object/package.json @@ -0,0 +1,79 @@ +{ + "name": "is-date-object", + "version": "1.0.5", + "author": "Jordan Harband", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only && npm run test:corejs", + "tests-only": "nyc tape 'test/**/*.js'", + "test:corejs": "nyc tape test-corejs.js", + "posttest": "aud --production", + "lint": "eslint .", + "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://github.com/inspect-js/is-date-object.git" + }, + "keywords": [ + "Date", + "ES6", + "toStringTag", + "@@toStringTag", + "Date object" + ], + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^3.12.0", + "eslint": "^7.32.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-date-object/test/index.js b/node_modules/is-date-object/test/index.js new file mode 100644 index 0000000..5279dad --- /dev/null +++ b/node_modules/is-date-object/test/index.js @@ -0,0 +1,36 @@ +'use strict'; + +var test = require('tape'); +var isDate = require('../'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('not Dates', function (t) { + t.notOk(isDate(), 'undefined is not Date'); + t.notOk(isDate(null), 'null is not Date'); + t.notOk(isDate(false), 'false is not Date'); + t.notOk(isDate(true), 'true is not Date'); + t.notOk(isDate(42), 'number is not Date'); + t.notOk(isDate('foo'), 'string is not Date'); + t.notOk(isDate([]), 'array is not Date'); + t.notOk(isDate({}), 'object is not Date'); + t.notOk(isDate(function () {}), 'function is not Date'); + t.notOk(isDate(/a/g), 'regex literal is not Date'); + t.notOk(isDate(new RegExp('a', 'g')), 'regex object is not Date'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var realDate = new Date(); + var fakeDate = { + toString: function () { return String(realDate); }, + valueOf: function () { return realDate.getTime(); } + }; + fakeDate[Symbol.toStringTag] = 'Date'; + t.notOk(isDate(fakeDate), 'fake Date with @@toStringTag "Date" is not Date'); + t.end(); +}); + +test('Dates', function (t) { + t.ok(isDate(new Date()), 'new Date() is Date'); + t.end(); +}); diff --git a/node_modules/is-extglob/LICENSE b/node_modules/is-extglob/LICENSE new file mode 100644 index 0000000..842218c --- /dev/null +++ b/node_modules/is-extglob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert + +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/is-extglob/README.md b/node_modules/is-extglob/README.md new file mode 100644 index 0000000..0416af5 --- /dev/null +++ b/node_modules/is-extglob/README.md @@ -0,0 +1,107 @@ +# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) + +> Returns true if a string has an extglob. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-extglob +``` + +## Usage + +```js +var isExtglob = require('is-extglob'); +``` + +**True** + +```js +isExtglob('?(abc)'); +isExtglob('@(abc)'); +isExtglob('!(abc)'); +isExtglob('*(abc)'); +isExtglob('+(abc)'); +``` + +**False** + +Escaped extglobs: + +```js +isExtglob('\\?(abc)'); +isExtglob('\\@(abc)'); +isExtglob('\\!(abc)'); +isExtglob('\\*(abc)'); +isExtglob('\\+(abc)'); +``` + +Everything else... + +```js +isExtglob('foo.js'); +isExtglob('!foo.js'); +isExtglob('*.js'); +isExtglob('**/abc.js'); +isExtglob('abc/*.js'); +isExtglob('abc/(aaa|bbb).js'); +isExtglob('abc/[a-z].js'); +isExtglob('abc/{a,b}.js'); +isExtglob('abc/?.js'); +isExtglob('abc.js'); +isExtglob('abc/def/ghi.js'); +``` + +## History + +**v2.0** + +Adds support for escaping. Escaped exglobs no longer return true. + +## About + +### Related projects + +* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/node_modules/is-extglob/index.js b/node_modules/is-extglob/index.js new file mode 100644 index 0000000..c1d986f --- /dev/null +++ b/node_modules/is-extglob/index.js @@ -0,0 +1,20 @@ +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; diff --git a/node_modules/is-extglob/package.json b/node_modules/is-extglob/package.json new file mode 100644 index 0000000..7a90836 --- /dev/null +++ b/node_modules/is-extglob/package.json @@ -0,0 +1,69 @@ +{ + "name": "is-extglob", + "description": "Returns true if a string has an extglob.", + "version": "2.1.1", + "homepage": "https://github.com/jonschlinkert/is-extglob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/is-extglob", + "bugs": { + "url": "https://github.com/jonschlinkert/is-extglob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-glob", + "is-glob", + "micromatch" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/is-glob/LICENSE b/node_modules/is-glob/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/is-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +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/is-glob/README.md b/node_modules/is-glob/README.md new file mode 100644 index 0000000..740724b --- /dev/null +++ b/node_modules/is-glob/README.md @@ -0,0 +1,206 @@ +# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/github/workflow/status/micromatch/is-glob/dev)](https://github.com/micromatch/is-glob/actions) + +> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-glob +``` + +You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). + +## Usage + +```js +var isGlob = require('is-glob'); +``` + +### Default behavior + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js'); +isGlob('*.js'); +isGlob('**/abc.js'); +isGlob('abc/*.js'); +isGlob('abc/(aaa|bbb).js'); +isGlob('abc/[a-z].js'); +isGlob('abc/{a,b}.js'); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js'); +isGlob('abc/!(a).js'); +isGlob('abc/+(a).js'); +isGlob('abc/*(a).js'); +isGlob('abc/?(a).js'); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('abc/\\@(a).js'); +isGlob('abc/\\!(a).js'); +isGlob('abc/\\+(a).js'); +isGlob('abc/\\*(a).js'); +isGlob('abc/\\?(a).js'); +isGlob('\\!foo.js'); +isGlob('\\*.js'); +isGlob('\\*\\*/abc.js'); +isGlob('abc/\\*.js'); +isGlob('abc/\\(aaa|bbb).js'); +isGlob('abc/\\[a-z].js'); +isGlob('abc/\\{a,b}.js'); +//=> false +``` + +Patterns that do not have glob patterns return `false`: + +```js +isGlob('abc.js'); +isGlob('abc/def/ghi.js'); +isGlob('foo.js'); +isGlob('abc/@.js'); +isGlob('abc/+.js'); +isGlob('abc/?.js'); +isGlob(); +isGlob(null); +//=> false +``` + +Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): + +```js +isGlob(['**/*.js']); +isGlob(['foo.js']); +//=> false +``` + +### Option strict + +When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that +some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js', {strict: false}); +isGlob('*.js', {strict: false}); +isGlob('**/abc.js', {strict: false}); +isGlob('abc/*.js', {strict: false}); +isGlob('abc/(aaa|bbb).js', {strict: false}); +isGlob('abc/[a-z].js', {strict: false}); +isGlob('abc/{a,b}.js', {strict: false}); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js', {strict: false}); +isGlob('abc/!(a).js', {strict: false}); +isGlob('abc/+(a).js', {strict: false}); +isGlob('abc/*(a).js', {strict: false}); +isGlob('abc/?(a).js', {strict: false}); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('\\!foo.js', {strict: false}); +isGlob('\\*.js', {strict: false}); +isGlob('\\*\\*/abc.js', {strict: false}); +isGlob('abc/\\*.js', {strict: false}); +isGlob('abc/\\(aaa|bbb).js', {strict: false}); +isGlob('abc/\\[a-z].js', {strict: false}); +isGlob('abc/\\{a,b}.js', {strict: false}); +//=> false +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") +* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") +* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") +* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 47 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [doowb](https://github.com/doowb) | +| 1 | [phated](https://github.com/phated) | +| 1 | [danhper](https://github.com/danhper) | +| 1 | [paulmillr](https://github.com/paulmillr) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/node_modules/is-glob/index.js b/node_modules/is-glob/index.js new file mode 100644 index 0000000..620f563 --- /dev/null +++ b/node_modules/is-glob/index.js @@ -0,0 +1,150 @@ +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = require('is-extglob'); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } + + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var check = strictCheck; + + // optionally relax check + if (options && options.strict === false) { + check = relaxedCheck; + } + + return check(str); +}; diff --git a/node_modules/is-glob/package.json b/node_modules/is-glob/package.json new file mode 100644 index 0000000..858af03 --- /dev/null +++ b/node_modules/is-glob/package.json @@ -0,0 +1,81 @@ +{ + "name": "is-glob", + "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", + "version": "4.0.3", + "homepage": "https://github.com/micromatch/is-glob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Daniel Perez (https://tuvistavie.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "micromatch/is-glob", + "bugs": { + "url": "https://github.com/micromatch/is-glob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha && node benchmark.js" + }, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "layout": "default", + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assemble", + "base", + "update", + "verb" + ] + }, + "reflinks": [ + "assemble", + "bach", + "base", + "composer", + "gulp", + "has-glob", + "is-valid-glob", + "micromatch", + "npm", + "scaffold", + "verb", + "vinyl" + ] + } +} diff --git a/node_modules/is-negative-zero/.editorconfig b/node_modules/is-negative-zero/.editorconfig new file mode 100644 index 0000000..aaac325 --- /dev/null +++ b/node_modules/is-negative-zero/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/node_modules/is-negative-zero/.eslintignore b/node_modules/is-negative-zero/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-negative-zero/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-negative-zero/.eslintrc b/node_modules/is-negative-zero/.eslintrc new file mode 100644 index 0000000..f858c0a --- /dev/null +++ b/node_modules/is-negative-zero/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "no-magic-numbers": 0 + } +} diff --git a/node_modules/is-negative-zero/.github/FUNDING.yml b/node_modules/is-negative-zero/.github/FUNDING.yml new file mode 100644 index 0000000..e34502b --- /dev/null +++ b/node_modules/is-negative-zero/.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-negative-zero +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-negative-zero/.nycrc b/node_modules/is-negative-zero/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-negative-zero/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-negative-zero/CHANGELOG.md b/node_modules/is-negative-zero/CHANGELOG.md new file mode 100644 index 0000000..d00e726 --- /dev/null +++ b/node_modules/is-negative-zero/CHANGELOG.md @@ -0,0 +1,136 @@ +# 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.2](https://github.com/inspect-js/is-negative-zero/compare/v2.0.1...v2.0.2) - 2021-12-10 + +### Commits + +- [actions] reuse common workflows [`ece923d`](https://github.com/inspect-js/is-negative-zero/commit/ece923d6b50820b7832150957774047da43d1743) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`3a26f43`](https://github.com/inspect-js/is-negative-zero/commit/3a26f435434bbfb8a254ddd32d6079bf50263121) +- [meta] do not publish workflow files [`2cea0c2`](https://github.com/inspect-js/is-negative-zero/commit/2cea0c20c7f8b167bb6064f916f3285642bf5ab1) +- [readme] add github actions/codecov badges; update URLs [`0c0be3e`](https://github.com/inspect-js/is-negative-zero/commit/0c0be3eb148ccf9d764e8ed515ef0e1d0ffeed9d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`a93d16e`](https://github.com/inspect-js/is-negative-zero/commit/a93d16eddf46cad6bc9b71a92968ce758e6f4ea4) +- [meta] create FUNDING.yml [`b4f425e`](https://github.com/inspect-js/is-negative-zero/commit/b4f425e49edb8c4aa1efa6ba34c2d5c1150b2a26) +- [actions] update codecov uploader [`7999db3`](https://github.com/inspect-js/is-negative-zero/commit/7999db3bff3f0f9cc729529940b9077a586822e2) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `safe-publish-latest`, `tape` [`140e4d9`](https://github.com/inspect-js/is-negative-zero/commit/140e4d95eda9ad821608c28a5f705d84a906096d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`23a8b6d`](https://github.com/inspect-js/is-negative-zero/commit/23a8b6d257cea0b8a608b2319739562ecbc6ba75) +- [readme] add actions and codecov badges [`fe92126`](https://github.com/inspect-js/is-negative-zero/commit/fe9212634346ced7a45905d958cb85d129e4c10b) +- [readme] fix repo URLs [`50c428e`](https://github.com/inspect-js/is-negative-zero/commit/50c428e423e5861a6c231440b8b3e746cbf6230f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`688155f`](https://github.com/inspect-js/is-negative-zero/commit/688155ff0214da72cbafa4c438c3b9629265d82b) +- [meta] use `prepublishOnly` script for npm 7+ [`83171f9`](https://github.com/inspect-js/is-negative-zero/commit/83171f9131aed266f475d7a3283d9c2fc77e1436) +- [actions] update workflows [`e9823db`](https://github.com/inspect-js/is-negative-zero/commit/e9823db3054887d8bb5b3f2c8f698b93cdce7d82) + +## [v2.0.1](https://github.com/inspect-js/is-negative-zero/compare/v2.0.0...v2.0.1) - 2020-12-04 + +### Commits + +- [Tests] use shared travis-ci configs [`5b92482`](https://github.com/inspect-js/is-negative-zero/commit/5b92482ed26e55e1aafcc6b6310d279958af8204) +- [Tests] up to `node` `v11.7`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.16`, `v5.12`, `v4.9`; use `nvm install-latest-npm`; fix test scripts [`0f5d2f8`](https://github.com/inspect-js/is-negative-zero/commit/0f5d2f85ea7fe83de47f39b6b35e489b866d88a7) +- [Tests] migrate tests to Github Actions [`b80f05a`](https://github.com/inspect-js/is-negative-zero/commit/b80f05adb11a6a3232860fb50272b101aacb504f) +- [Tests] remove `jscs` [`7ccaf41`](https://github.com/inspect-js/is-negative-zero/commit/7ccaf4100281b614d61d7c9122e6f87943a89295) +- [meta] add missing changelog [`992bdde`](https://github.com/inspect-js/is-negative-zero/commit/992bddee362cbae71f2cdfd8666f4774b252412e) +- [readme] fix repo URLs; remove defunct badges [`80fd18d`](https://github.com/inspect-js/is-negative-zero/commit/80fd18d2b0191321afe0e1b572200e4c025eb664) +- [Tests] run `nyc` on all tests [`df26f14`](https://github.com/inspect-js/is-negative-zero/commit/df26f14b0b854d82b0d3ca7b4949811c9f151357) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`d7723aa`](https://github.com/inspect-js/is-negative-zero/commit/d7723aa70e5b478adc36d98e1338abe741c1906a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`9fdaabe`](https://github.com/inspect-js/is-negative-zero/commit/9fdaabecfdb25e6e860e5007a91b60ee0f20734f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`f07eeb2`](https://github.com/inspect-js/is-negative-zero/commit/f07eeb2740037c53f270e95d2f62edc051cafc56) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`bd5c751`](https://github.com/inspect-js/is-negative-zero/commit/bd5c751fa4850ba8726dc1c197ed6c843a227b05) +- [actions] add automatic rebasing / merge commit blocking [`5666a91`](https://github.com/inspect-js/is-negative-zero/commit/5666a917db6bdcee63c0a3e28e5e281359975abc) +- [meta] add `auto-changelog` [`f70fb2b`](https://github.com/inspect-js/is-negative-zero/commit/f70fb2b5b9ea53dc52729310717553648292189e) +- [actions] add "Allow Edits" workflow [`2b040a8`](https://github.com/inspect-js/is-negative-zero/commit/2b040a87d362f17d8cab2b0d48058b80e426ad4e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`09e2e53`](https://github.com/inspect-js/is-negative-zero/commit/09e2e537390225c1d1a6912be64267eaec6ea367) +- [Tests] use `npm audit` instead of `nsp` [`7df2669`](https://github.com/inspect-js/is-negative-zero/commit/7df2669013ac9328d424e9d8c82a53a0458f0888) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`4ff97c5`](https://github.com/inspect-js/is-negative-zero/commit/4ff97c5891c7a241a91c03fb54bd83e78570ef22) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`9e8cb7b`](https://github.com/inspect-js/is-negative-zero/commit/9e8cb7bca46d325ecf202187c0fde7da8722bcab) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`70b9888`](https://github.com/inspect-js/is-negative-zero/commit/70b988802a99c84ab7eb8da287bb8ff0efc5c055) +- [Dev Deps] update `jscs` [`59d0c42`](https://github.com/inspect-js/is-negative-zero/commit/59d0c42131020b74e68fd444798b9a3bf247fb2d) +- Add `npm run security` [`eb418ed`](https://github.com/inspect-js/is-negative-zero/commit/eb418ed7e79216808c206388fbd360cc7a75655f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`86a758d`](https://github.com/inspect-js/is-negative-zero/commit/86a758d42eb7d17a18f7f584c337d8820b842758) +- Only apps should have lockfiles [`a0ab621`](https://github.com/inspect-js/is-negative-zero/commit/a0ab6215590bf6adb3eaf1ff9e7c036d72e807ec) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`5c51349`](https://github.com/inspect-js/is-negative-zero/commit/5c513498fc5a8b2fd06f5e0c1b38b8e93c3477ac) +- [meta] add `funding` field [`1d0b2f4`](https://github.com/inspect-js/is-negative-zero/commit/1d0b2f43bf5bf75176859a440346b3e338ee510e) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`9b12367`](https://github.com/inspect-js/is-negative-zero/commit/9b12367706f1c269a3df406c8e2c211558671a15) +- [Dev Deps] update `auto-changelog`, `tape` [`6d98b8d`](https://github.com/inspect-js/is-negative-zero/commit/6d98b8d1f512c3844d4062215c793070084d1164) +- [Dev Deps] Update `tape`, `eslint` [`a258cdb`](https://github.com/inspect-js/is-negative-zero/commit/a258cdb86691725482d1d43a1f9e7953c3c6733f) +- [Dev Deps] update `auto-changelog`; add `aud` [`2ca2afb`](https://github.com/inspect-js/is-negative-zero/commit/2ca2afb9efef4ebc8b3c19046ab1ab3ad516ea9a) +- Test up to `io.js` `v3.0` [`1254ae8`](https://github.com/inspect-js/is-negative-zero/commit/1254ae80b7706616331ac914654d7a17bff31039) +- [Dev Deps] update `auto-changelog` [`4b54722`](https://github.com/inspect-js/is-negative-zero/commit/4b547228fceaae8f9eccabc9ad8a49046492348d) +- [Tests] only audit prod deps [`86d298b`](https://github.com/inspect-js/is-negative-zero/commit/86d298b56db90f81617ee5d942476eda34afb374) +- [Dev Deps] update `tape` [`3a47e27`](https://github.com/inspect-js/is-negative-zero/commit/3a47e2730f889539f666ef0eb09a93fb9c80bfd1) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`128d9bd`](https://github.com/inspect-js/is-negative-zero/commit/128d9bd4c12385fb5e478ac3dd3138fa4360a777) + +## [v2.0.0](https://github.com/inspect-js/is-negative-zero/compare/v1.0.0...v2.0.0) - 2015-07-24 + +### Commits + +- Update `tape`, `eslint`; use my personal shared `eslint` config. [`648d002`](https://github.com/inspect-js/is-negative-zero/commit/648d0029b177886428a11b07307f233ae2d3175b) +- Add `npm run eslint` [`5a52d80`](https://github.com/inspect-js/is-negative-zero/commit/5a52d80ab052e377044b9b181991a32afaaa3090) +- Using my standard jscs.json file [`5a667d9`](https://github.com/inspect-js/is-negative-zero/commit/5a667d9f8b7402ca3bd134080cd4435b5c7f1462) +- Adding `npm run lint` [`9a85ed9`](https://github.com/inspect-js/is-negative-zero/commit/9a85ed934da65d8733a38bf6ad3c89fd62115194) +- Update `tape`, `covert`, `jscs` [`c6cd3a6`](https://github.com/inspect-js/is-negative-zero/commit/c6cd3a64ea5b98100e10537549f50a9eeadc30ec) +- Update `eslint` [`e9c9b6e`](https://github.com/inspect-js/is-negative-zero/commit/e9c9b6e9623f021b7f3ae4091bf9ea2571ab02b4) +- Test on latest `io.js` [`2f7c8a9`](https://github.com/inspect-js/is-negative-zero/commit/2f7c8a9d174066400c072841d7bcf02cf90f8ebf) +- Adding license and downloads badges [`717087a`](https://github.com/inspect-js/is-negative-zero/commit/717087a013b4cfc9dc7847d3d4a64faf19341be4) +- Remove Number type coercion. [`481295d`](https://github.com/inspect-js/is-negative-zero/commit/481295dbd09dbf81d196dc77382f1b92f534de3f) +- Test up to `io.js` `v2.1` [`139a84a`](https://github.com/inspect-js/is-negative-zero/commit/139a84a3dbdec29682044c6e7ac884a7382ae6e1) +- Update `eslint` [`2f5fbfb`](https://github.com/inspect-js/is-negative-zero/commit/2f5fbfbc436ccd8676fc36fcd9f0edcdda33a1e7) +- Update `eslint` [`53cb4c5`](https://github.com/inspect-js/is-negative-zero/commit/53cb4c5eccecdf2d874e78e5c38cca762ed76a9d) +- Test on `io.js` `v2.2` [`98a1824`](https://github.com/inspect-js/is-negative-zero/commit/98a1824c86366f8a03cf303f46acecd67409f94b) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`772d6cd`](https://github.com/inspect-js/is-negative-zero/commit/772d6cdf397e6fc1b26e5ed5f279d07a5ead6df8) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`3e6147e`](https://github.com/inspect-js/is-negative-zero/commit/3e6147ebb5ecdfda4a2bffa441572fe017c7bb73) +- Use SVG badges instead of PNG [`d986cb4`](https://github.com/inspect-js/is-negative-zero/commit/d986cb450e5bd4f373041255b69e18f47c252a1e) +- Update `tape`, `jscs` [`9f9d7e7`](https://github.com/inspect-js/is-negative-zero/commit/9f9d7e751bcf4ceeed8e36e75e31d29c76326b3f) +- Update `jscs` [`079eaf6`](https://github.com/inspect-js/is-negative-zero/commit/079eaf699d53e7e32c54e5233259a00f5f494d9a) +- Update `tape`, `jscs` [`cffe3fc`](https://github.com/inspect-js/is-negative-zero/commit/cffe3fc17c6bfaa6996bf7402446b160631a04b3) +- Update `tape`, `jscs` [`3a16616`](https://github.com/inspect-js/is-negative-zero/commit/3a166165ae8770d59c296794d28547379cebec58) +- Use consistent quotes [`9509a81`](https://github.com/inspect-js/is-negative-zero/commit/9509a8110027b12c5762ba48d03b649a921847d5) +- Test on `io.js` `v2.4` [`a9150a3`](https://github.com/inspect-js/is-negative-zero/commit/a9150a3397db339d992e9e4e6ddb52d1237fd617) +- Test on `io.js` `v2.3` [`36d7acf`](https://github.com/inspect-js/is-negative-zero/commit/36d7acf5bb9193a2b35585e2c49ae8be9f45a55e) +- Lock covert to v1.0.0. [`29d8917`](https://github.com/inspect-js/is-negative-zero/commit/29d89171c3aad69ace372edbf641ec3a5468c760) +- Updating jscs [`fe09c8a`](https://github.com/inspect-js/is-negative-zero/commit/fe09c8a6d16c637ecd83a9a8a7f6192faef0754a) +- Updating jscs [`5877bc7`](https://github.com/inspect-js/is-negative-zero/commit/5877bc7c2ed44c1ecc5d31e1c484c523450722d8) +- Running linter as part of tests [`9e77756`](https://github.com/inspect-js/is-negative-zero/commit/9e777563905f511d915ec7257e2637811b911bd6) +- Updating covert [`520a695`](https://github.com/inspect-js/is-negative-zero/commit/520a695164465b88c76860a638baafd4192bce5c) + +## [v1.0.0](https://github.com/inspect-js/is-negative-zero/compare/v0.1.1...v1.0.0) - 2014-08-08 + +### Commits + +- Updating tape [`31d1942`](https://github.com/inspect-js/is-negative-zero/commit/31d19422ecd9d453677851a9d5a8d9372a16fb39) +- Updating tape [`e7143bf`](https://github.com/inspect-js/is-negative-zero/commit/e7143bf3b67d8881b1b6ee0444637647d7bb1d2b) + +## [v0.1.1](https://github.com/inspect-js/is-negative-zero/compare/v0.1.0...v0.1.1) - 2014-05-13 + +### Merged + +- Simplify code [`#1`](https://github.com/inspect-js/is-negative-zero/pull/1) + +### Commits + +- Adding a trailing newline [`61fb37f`](https://github.com/inspect-js/is-negative-zero/commit/61fb37f677e871cca53d9309e765d808ddddfd5a) + +## [v0.1.0](https://github.com/inspect-js/is-negative-zero/compare/v0.0.0...v0.1.0) - 2014-05-13 + +### Commits + +- Make sure old and unstable nodes don't break Travis [`f627215`](https://github.com/inspect-js/is-negative-zero/commit/f627215527a95dc1ca014600650e00f15fe122c5) +- Updating deps [`b502f48`](https://github.com/inspect-js/is-negative-zero/commit/b502f48e807d7671cb07e2ca247ae2daa62e4165) +- Oops, negative numbers were negative zero! [`746cb97`](https://github.com/inspect-js/is-negative-zero/commit/746cb975d82c0fa0c5058e8e031807f9afcfd6db) +- Updating covert [`99ef4ed`](https://github.com/inspect-js/is-negative-zero/commit/99ef4ed97d2f76f2a5afbef029bf794f1b5bcffa) +- Updating tape [`ee9cfc2`](https://github.com/inspect-js/is-negative-zero/commit/ee9cfc2fd0039bdb65b6493ce0b8e47d18aa17cd) +- Testing on node 0.6 again [`6a9bf0a`](https://github.com/inspect-js/is-negative-zero/commit/6a9bf0a09e210cca09c7a8a225d08ef1e6789b5a) + +## v0.0.0 - 2014-01-19 + +### Commits + +- package.json [`8411d92`](https://github.com/inspect-js/is-negative-zero/commit/8411d92ec787fd522a1b5e65154ae88e9024a23f) +- read me [`5c8bf3c`](https://github.com/inspect-js/is-negative-zero/commit/5c8bf3ce4867dbf2997ef01ea6b712aa294ec959) +- Initial commit [`c06f7dc`](https://github.com/inspect-js/is-negative-zero/commit/c06f7dcf926f5b35ba678787a0f16cdd7b544054) +- Tests. [`5c554d4`](https://github.com/inspect-js/is-negative-zero/commit/5c554d405bfb323a7413fde395d8dc39c5316356) +- Travis CI [`334d000`](https://github.com/inspect-js/is-negative-zero/commit/334d000941fc926493cc7dbdb4e5f7ae481a311b) +- Implementation. [`4ef4491`](https://github.com/inspect-js/is-negative-zero/commit/4ef449189c36d471d283e40aa20a8ebfa4985882) diff --git a/node_modules/is-negative-zero/LICENSE b/node_modules/is-negative-zero/LICENSE new file mode 100644 index 0000000..47b7b50 --- /dev/null +++ b/node_modules/is-negative-zero/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +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/is-negative-zero/README.md b/node_modules/is-negative-zero/README.md new file mode 100644 index 0000000..e8193a4 --- /dev/null +++ b/node_modules/is-negative-zero/README.md @@ -0,0 +1,54 @@ +# is-negative-zero [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Is this value negative zero? === will lie to you. + +## Example + +```js +var isNegativeZero = require('is-negative-zero'); +var assert = require('assert'); + +assert.notOk(isNegativeZero(undefined)); +assert.notOk(isNegativeZero(null)); +assert.notOk(isNegativeZero(false)); +assert.notOk(isNegativeZero(true)); +assert.notOk(isNegativeZero(0)); +assert.notOk(isNegativeZero(42)); +assert.notOk(isNegativeZero(Infinity)); +assert.notOk(isNegativeZero(-Infinity)); +assert.notOk(isNegativeZero(NaN)); +assert.notOk(isNegativeZero('foo')); +assert.notOk(isNegativeZero(function () {})); +assert.notOk(isNegativeZero([])); +assert.notOk(isNegativeZero({})); + +assert.ok(isNegativeZero(-0)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/is-negative-zero +[npm-version-svg]: https://versionbadg.es/inspect-js/is-negative-zero.svg +[deps-svg]: https://david-dm.org/inspect-js/is-negative-zero.svg +[deps-url]: https://david-dm.org/inspect-js/is-negative-zero +[dev-deps-svg]: https://david-dm.org/inspect-js/is-negative-zero/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/is-negative-zero#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/is-negative-zero.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-negative-zero.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-negative-zero.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-negative-zero +[codecov-image]: https://codecov.io/gh/inspect-js/is-negative-zero/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-negative-zero/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-negative-zero +[actions-url]: https://github.com/inspect-js/is-negative-zero/actions diff --git a/node_modules/is-negative-zero/index.js b/node_modules/is-negative-zero/index.js new file mode 100644 index 0000000..400e5d1 --- /dev/null +++ b/node_modules/is-negative-zero/index.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function isNegativeZero(number) { + return number === 0 && (1 / number) === -Infinity; +}; + diff --git a/node_modules/is-negative-zero/package.json b/node_modules/is-negative-zero/package.json new file mode 100644 index 0000000..d0aa3d9 --- /dev/null +++ b/node_modules/is-negative-zero/package.json @@ -0,0 +1,79 @@ +{ + "name": "is-negative-zero", + "version": "2.0.2", + "description": "Is this value negative zero? === will lie to you", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", + "lint": "eslint --ext=js,mjs .", + "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://github.com/inspect-js/is-negative-zero.git" + }, + "bugs": { + "url": "https://github.com/inspect-js/is-negative-zero/issues" + }, + "homepage": "https://github.com/inspect-js/is-negative-zero", + "keywords": [ + "is", + "negative", + "zero", + "negative zero", + "number", + "positive", + "0", + "-0" + ], + "devDependencies": { + "@ljharb/eslint-config": "^20.0.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^8.4.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.3.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..12.0", + "opera/15.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-negative-zero/test/index.js b/node_modules/is-negative-zero/test/index.js new file mode 100644 index 0000000..8fd7d16 --- /dev/null +++ b/node_modules/is-negative-zero/test/index.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); +var isNegativeZero = require('../'); + +test('not negative zero', function (t) { + t.notOk(isNegativeZero(), 'undefined is not negative zero'); + t.notOk(isNegativeZero(null), 'null is not negative zero'); + t.notOk(isNegativeZero(false), 'false is not negative zero'); + t.notOk(isNegativeZero(true), 'true is not negative zero'); + t.notOk(isNegativeZero(0), 'positive zero is not negative zero'); + t.notOk(isNegativeZero(Infinity), 'Infinity is not negative zero'); + t.notOk(isNegativeZero(-Infinity), '-Infinity is not negative zero'); + t.notOk(isNegativeZero(NaN), 'NaN is not negative zero'); + t.notOk(isNegativeZero('foo'), 'string is not negative zero'); + t.notOk(isNegativeZero([]), 'array is not negative zero'); + t.notOk(isNegativeZero({}), 'object is not negative zero'); + t.notOk(isNegativeZero(function () {}), 'function is not negative zero'); + t.notOk(isNegativeZero(-1), '-1 is not negative zero'); + + t.end(); +}); + +test('negative zero', function (t) { + t.ok(isNegativeZero(-0), 'negative zero is negative zero'); + t.end(); +}); + diff --git a/node_modules/is-number-object/.editorconfig b/node_modules/is-number-object/.editorconfig new file mode 100644 index 0000000..4e36aee --- /dev/null +++ b/node_modules/is-number-object/.editorconfig @@ -0,0 +1,23 @@ +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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[CHANGELOG.md] +max_line_length = off diff --git a/node_modules/is-number-object/.eslintrc b/node_modules/is-number-object/.eslintrc new file mode 100644 index 0000000..c7933f4 --- /dev/null +++ b/node_modules/is-number-object/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + }, + + "overrides": [ + { + "files": "test-core-js.js", + "extends": "@ljharb/eslint-config/tests", + }, + ], +} diff --git a/node_modules/is-number-object/.github/FUNDING.yml b/node_modules/is-number-object/.github/FUNDING.yml new file mode 100644 index 0000000..17f4dc5 --- /dev/null +++ b/node_modules/is-number-object/.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-number-object +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-number-object/.nycrc b/node_modules/is-number-object/.nycrc new file mode 100644 index 0000000..a69aa2d --- /dev/null +++ b/node_modules/is-number-object/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test", + "test-corejs.js" + ] +} diff --git a/node_modules/is-number-object/CHANGELOG.md b/node_modules/is-number-object/CHANGELOG.md new file mode 100644 index 0000000..028b484 --- /dev/null +++ b/node_modules/is-number-object/CHANGELOG.md @@ -0,0 +1,125 @@ +# 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). + +## [v1.0.7](https://github.com/inspect-js/is-number-object/compare/v1.0.6...v1.0.7) - 2022-04-01 + +### Commits + +- [actions] reuse common workflows [`8f9a1b0`](https://github.com/inspect-js/is-number-object/commit/8f9a1b040a435a5c5d12150952d0e6f96d4f713a) +- [meta] better `eccheck` command [`9dc8dff`](https://github.com/inspect-js/is-number-object/commit/9dc8dff273e4d0b954fd4f2a2eacc849d321b646) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `safe-publish-latest`, `tape` [`c50ecbf`](https://github.com/inspect-js/is-number-object/commit/c50ecbfc7577c69324fca4d2b40dd354c5156be9) +- [actions] update codecov uploader [`f1a2560`](https://github.com/inspect-js/is-number-object/commit/f1a2560d4a996abea90f7a792069a35359869b67) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `core-js`, `tape` [`4b06ace`](https://github.com/inspect-js/is-number-object/commit/4b06aceeba2ebf0887af020aa89caad8950e5f47) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `core-js`, `tape` [`3dc0e8b`](https://github.com/inspect-js/is-number-object/commit/3dc0e8b0fcc96a9bc9936e9a62a523fe67bafca5) +- [meta] add `bugs`/`homepage` package.json fields [`d7e0bcf`](https://github.com/inspect-js/is-number-object/commit/d7e0bcf1fe1b4a48d6500266c8b4058c854fecba) + +## [v1.0.6](https://github.com/inspect-js/is-number-object/compare/v1.0.5...v1.0.6) - 2021-08-05 + +### Commits + +- [Tests] run tests with core-js as well [`5177312`](https://github.com/inspect-js/is-number-object/commit/51773120b18e27bfe8a3bd228ef2e21f5802f338) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`ca2b31d`](https://github.com/inspect-js/is-number-object/commit/ca2b31d81c5d7d9b11e812dee58cd627a6d634e2) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`50950f9`](https://github.com/inspect-js/is-number-object/commit/50950f962a4b1188c478f6034194d7eb4314c884) + +## [v1.0.5](https://github.com/inspect-js/is-number-object/compare/v1.0.4...v1.0.5) - 2021-05-07 + +### Commits + +- [Tests] migrate tests to Github Actions [`9666737`](https://github.com/inspect-js/is-number-object/commit/96667372f8e36f70516218f86318f957f8c175ad) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`7815ce2`](https://github.com/inspect-js/is-number-object/commit/7815ce21cb5662c2d1651b3ec302f186aa8a016b) +- [meta] do not publish github action workflow files [`80ccb75`](https://github.com/inspect-js/is-number-object/commit/80ccb7509f91732675b018cc1a636d649a92889e) +- [Tests] run `nyc` on all tests [`c9ffb74`](https://github.com/inspect-js/is-number-object/commit/c9ffb74443690ef22f9aa7dd35855fd1e3be5184) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`7e84161`](https://github.com/inspect-js/is-number-object/commit/7e84161d089c87ef42e3639ac1889642624ebd28) +- [readme] add actions and codecov badges [`0c5ec7a`](https://github.com/inspect-js/is-number-object/commit/0c5ec7aa87dac27bdcda2365124c3aa0ccf9c278) +- [actions] add Require Allow Edits workflow [`dd0fb74`](https://github.com/inspect-js/is-number-object/commit/dd0fb74b2ecb630ea7778a6f06dcc017323a3c1d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape` [`2d36f80`](https://github.com/inspect-js/is-number-object/commit/2d36f809a7b9896958b0b0f3b69be0067caedb45) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`77d3140`](https://github.com/inspect-js/is-number-object/commit/77d3140557d483e467ce070b21bf384e9a7562d5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`75d4abf`](https://github.com/inspect-js/is-number-object/commit/75d4abf34168e69d73f621c696a16179ddc0873c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`0c2a917`](https://github.com/inspect-js/is-number-object/commit/0c2a917e4802b102888759fad912bd9faa5587f7) +- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`8b6ebc4`](https://github.com/inspect-js/is-number-object/commit/8b6ebc489db14a0c369214e081413f326fc0d598) +- [Dev Deps] update `auto-changelog`, `tape`; add `aud` [`62045fc`](https://github.com/inspect-js/is-number-object/commit/62045fcaddb9e4d3ef81068e99d07d21cd62023b) +- [actions] use checkout v2; remove unneeded env [`d48cd06`](https://github.com/inspect-js/is-number-object/commit/d48cd06720ea71f278a6d35c6f0a8ec04242a58f) +- [meta] use `prepublishOnly` script for npm 7+ [`827ab0d`](https://github.com/inspect-js/is-number-object/commit/827ab0d52d25f46d232ae7442ece270dec2de1df) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`bfed500`](https://github.com/inspect-js/is-number-object/commit/bfed500e6cc3cd3b9e7ffea78429c59857035791) +- [meta] remove explicit audit level config [`ce23e5e`](https://github.com/inspect-js/is-number-object/commit/ce23e5e49fbebe190267d8c99ddfd880a963b7ee) +- [meta] gitignore coverage output [`f1ad981`](https://github.com/inspect-js/is-number-object/commit/f1ad98106549c1c88322d8cb206068ea4c5bd424) + +## [v1.0.4](https://github.com/inspect-js/is-number-object/compare/v1.0.3...v1.0.4) - 2019-12-18 + +### Commits + +- [Tests] use shared travis-ci configs [`792b5aa`](https://github.com/inspect-js/is-number-object/commit/792b5aa5e7313ddf5507f7283bb7d5d5c646b11b) +- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v5.12`, `v4.9`; use `nvm install-latest-npm` [`dc66db7`](https://github.com/inspect-js/is-number-object/commit/dc66db7dd1eca0263f6602597eb40601519e912e) +- Update `eslint`, `tape`, `semver`; use my personal shared `eslint` config [`7660fed`](https://github.com/inspect-js/is-number-object/commit/7660fed03a7060eb5c91e74b9a17303d4fac1056) +- [Tests] remove `jscs` [`f1fee97`](https://github.com/inspect-js/is-number-object/commit/f1fee97423478bcc653c844fadda55138d9b9a54) +- [meta] add `auto-changelog` [`4b1c225`](https://github.com/inspect-js/is-number-object/commit/4b1c2253770eb18761a1e8b157772028d6f742c4) +- [meta] remove unused Makefile and associated utilities [`379b979`](https://github.com/inspect-js/is-number-object/commit/379b9793d9c61d7889e53bd9de9578dca9964ebc) +- Update `covert`, `jscs`, `eslint`, `semver` [`16d2af8`](https://github.com/inspect-js/is-number-object/commit/16d2af82a6c93aee614f7a4b2c468411c743e95f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `is`, `replace`, `semver`, `tape` [`21c0f04`](https://github.com/inspect-js/is-number-object/commit/21c0f0431984b87443c6acb9f003368feb7b4368) +- Update `is`, `tape`, `covert`, `jscs`, `editorconfig-tools`, `nsp`, `eslint`, `semver`. Add `replace`. Use `^` instead of `~`. [`19d6ee3`](https://github.com/inspect-js/is-number-object/commit/19d6ee3a3d4a87764d57316804fd8b882ba5197c) +- Update `eslint` [`d32754b`](https://github.com/inspect-js/is-number-object/commit/d32754bcca0033e01eba531c4353d1239e992203) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace` [`1df8165`](https://github.com/inspect-js/is-number-object/commit/1df8165dd63d9f2f78ccb78e905d0a6b3e302884) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`675372b`](https://github.com/inspect-js/is-number-object/commit/675372b115fb20b5034f40bcbb5560c6c0512746) +- [readme] clean up readme; remove testling; fix repo URLs [`80e29c4`](https://github.com/inspect-js/is-number-object/commit/80e29c4d6d0811fc361e95ee83b81280bf3ae3f5) +- [Tests] up to `node` `v12.7`, `v10.16`, `v8.16` [`287a968`](https://github.com/inspect-js/is-number-object/commit/287a9687b1fc3d091ec231c06f19a19ff7b0e8f6) +- Test on latest `iojs` and `node` versions. [`11c98a2`](https://github.com/inspect-js/is-number-object/commit/11c98a23b232cb21c7daab797fd63875c2970681) +- [actions] add automatic rebasing / merge commit blocking [`022d026`](https://github.com/inspect-js/is-number-object/commit/022d026129df445f239ba2ecd8d47a2786242d75) +- [meta] create FUNDING.yml [`7f52710`](https://github.com/inspect-js/is-number-object/commit/7f527107168aad7108b7c262d295dcf44e03214d) +- [Dev Deps] update `is`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`bc8cd50`](https://github.com/inspect-js/is-number-object/commit/bc8cd508fe4440168f9b049be3ddf93c56c06c49) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`1f9200b`](https://github.com/inspect-js/is-number-object/commit/1f9200b7c56840dc23eeeca5d0ee4f64a0446e08) +- [Tests] up to `node` `v12.11` [`706d50a`](https://github.com/inspect-js/is-number-object/commit/706d50a779b90feb3f4d2ae88d8189d19b913073) +- [Dev Deps] update `jscs` [`e3591a4`](https://github.com/inspect-js/is-number-object/commit/e3591a445b1af25d46632eafea51efa07b4eb6dc) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`baf4ee7`](https://github.com/inspect-js/is-number-object/commit/baf4ee749fb65ec12e9cab102e77aa0e14312109) +- Update `nsp`, `eslint` [`61b18d5`](https://github.com/inspect-js/is-number-object/commit/61b18d5b44542fddf4950534d506b20d8c8b1f44) +- Update `eslint`, `semver` [`52e61bd`](https://github.com/inspect-js/is-number-object/commit/52e61bd4334c0a1afacd147fd0bc1e2c1be10df5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols`; add `safe-publish-latest` [`79db7f6`](https://github.com/inspect-js/is-number-object/commit/79db7f610d2bcf5f0d6e8ca834f7402504101072) +- Only apps should have lockfiles [`677b9b4`](https://github.com/inspect-js/is-number-object/commit/677b9b4fb6ad9d7b984cb0f89c8b5a6df143b29a) +- Test on `io.js` `v2.2` [`e8a38b2`](https://github.com/inspect-js/is-number-object/commit/e8a38b2fe73b841b0ed55d9f60573d460a4f2a62) +- [meta] add `funding` field [`85315e7`](https://github.com/inspect-js/is-number-object/commit/85315e75c119a2aef70a766f2ddc1079b64d006b) +- [Dev Deps] update `eslint`, `tape` [`f3581aa`](https://github.com/inspect-js/is-number-object/commit/f3581aaea310546f6ee4612990468d39f058d320) +- [Tests] use `eclint` instead of `editorconfig-tools` [`7b53680`](https://github.com/inspect-js/is-number-object/commit/7b5368071000eb1c715aeeee5ff47ffdbee9fe5c) +- [Dev Deps] update `semver`, `tape` [`d6b524a`](https://github.com/inspect-js/is-number-object/commit/d6b524ac2e8c0240c436cbe8828671e383d51fd5) +- [Dev Deps] Update `tape`, `eslint` [`be19203`](https://github.com/inspect-js/is-number-object/commit/be19203dee0aa70ff8f09823bf880a38b824e1ed) +- Test up to `io.js` `v2.1` [`feb7ba6`](https://github.com/inspect-js/is-number-object/commit/feb7ba63a0816f1d36419ce240f96e9b4e4c90ba) +- Test up to `io.js` `v3.0` [`7be1f0a`](https://github.com/inspect-js/is-number-object/commit/7be1f0a25dc59b6606be9ee1ace38cb7039a59d2) +- [Dev Deps] update `tape` [`d9a2318`](https://github.com/inspect-js/is-number-object/commit/d9a2318bc82477e9321e961def11e28d364e5562) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`a6cd411`](https://github.com/inspect-js/is-number-object/commit/a6cd411c6bd92691a48b52683afce584c2c6b21b) +- Test on `io.js` `v2.4` [`46c2e7f`](https://github.com/inspect-js/is-number-object/commit/46c2e7f2ce8ad7f8ab3c1da827d93fc2780eff06) +- Test on `io.js` `v2.3` [`9c344b0`](https://github.com/inspect-js/is-number-object/commit/9c344b0df83628908a1f776a3f2e5fc4fae1d4d2) +- Fix tests for faked @@toStringTag [`f8c446e`](https://github.com/inspect-js/is-number-object/commit/f8c446e9fc320c23807717356e259529f494b9f3) + +## [v1.0.3](https://github.com/inspect-js/is-number-object/compare/v1.0.2...v1.0.3) - 2015-01-29 + +### Commits + +- If @@toStringTag is not present, use the old-school Object#toString test. [`9b2a4df`](https://github.com/inspect-js/is-number-object/commit/9b2a4df6ccf903e89198d4244eeb7f47a7056327) + +## [v1.0.2](https://github.com/inspect-js/is-number-object/compare/v1.0.1...v1.0.2) - 2015-01-29 + +### Commits + +- Improve optimizability of the non-try/catch part. [`7e6be2f`](https://github.com/inspect-js/is-number-object/commit/7e6be2fd2346557fc81bd544ac8745021c50e266) +- Fix package.json [`4f2ebea`](https://github.com/inspect-js/is-number-object/commit/4f2ebeae09c45e1eefeb2c10a011ff2ef0aca921) + +## [v1.0.1](https://github.com/inspect-js/is-number-object/compare/v1.0.0...v1.0.1) - 2015-01-29 + +### Commits + +- Use Object() instead of new Number() [`1aaa746`](https://github.com/inspect-js/is-number-object/commit/1aaa746c26878a0f698aabea4d88215311f2a38d) +- Add early exits for typeof number, or typeof not "object". [`eae4337`](https://github.com/inspect-js/is-number-object/commit/eae43375d3f88e04bb10eabd954e5a6b66ad5305) + +## v1.0.0 - 2015-01-28 + +### Commits + +- Dotfiles. [`9c74e3e`](https://github.com/inspect-js/is-number-object/commit/9c74e3eb2b10398d4022de7c4015531e874f06c8) +- `make release` [`a99e5ae`](https://github.com/inspect-js/is-number-object/commit/a99e5aeb3995a7d543fc5833722bc02011fabad6) +- package.json [`4fed9ef`](https://github.com/inspect-js/is-number-object/commit/4fed9ef7c35ccfc45ca8acd3c92c9cb91c7daa6d) +- Read me [`c91d6ba`](https://github.com/inspect-js/is-number-object/commit/c91d6ba00de79eaaac5fec7c9d8866d61d0abb62) +- Initial commit [`629fb96`](https://github.com/inspect-js/is-number-object/commit/629fb969f076e0802c799b368c7b02556bb0750e) +- Tests. [`a39de62`](https://github.com/inspect-js/is-number-object/commit/a39de624785cc204ed7c0ea5518f1c878870ceb1) +- Implementation. [`aedd91e`](https://github.com/inspect-js/is-number-object/commit/aedd91e6fc23f00852ad1266b6c19f32b7f93a22) diff --git a/node_modules/is-number-object/LICENSE b/node_modules/is-number-object/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-number-object/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-number-object/README.md b/node_modules/is-number-object/README.md new file mode 100644 index 0000000..a5f1e5b --- /dev/null +++ b/node_modules/is-number-object/README.md @@ -0,0 +1,55 @@ +# is-number-object [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isNumber = require('is-number-object'); +var assert = require('assert'); + +assert.notOk(isNumber(undefined)); +assert.notOk(isNumber(null)); +assert.notOk(isNumber(false)); +assert.notOk(isNumber(true)); +assert.notOk(isNumber('foo')); +assert.notOk(isNumber(function () {})); +assert.notOk(isNumber([])); +assert.notOk(isNumber({})); +assert.notOk(isNumber(/a/g)); +assert.notOk(isNumber(new RegExp('a', 'g'))); +assert.notOk(isNumber(new Date())); + +assert.ok(isNumber(42)); +assert.ok(isNumber(NaN)); +assert.ok(isNumber(Infinity)); +assert.ok(isNumber(new Number(42))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-number-object +[2]: https://versionbadg.es/inspect-js/is-number-object.svg +[5]: https://david-dm.org/inspect-js/is-number-object.svg +[6]: https://david-dm.org/inspect-js/is-number-object +[7]: https://david-dm.org/inspect-js/is-number-object/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-number-object#info=devDependencies +[11]: https://nodei.co/npm/is-number-object.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-number-object.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-number-object.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-number-object +[codecov-image]: https://codecov.io/gh/inspect-js/is-number-object/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-number-object/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-number-object +[actions-url]: https://github.com/inspect-js/is-number-object/actions diff --git a/node_modules/is-number-object/index.js b/node_modules/is-number-object/index.js new file mode 100644 index 0000000..9107c31 --- /dev/null +++ b/node_modules/is-number-object/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var numToStr = Number.prototype.toString; +var tryNumberObject = function tryNumberObject(value) { + try { + numToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var numClass = '[object Number]'; +var hasToStringTag = require('has-tostringtag/shams')(); + +module.exports = function isNumberObject(value) { + if (typeof value === 'number') { + return true; + } + if (typeof value !== 'object') { + return false; + } + return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass; +}; diff --git a/node_modules/is-number-object/package.json b/node_modules/is-number-object/package.json new file mode 100644 index 0000000..2c8b16d --- /dev/null +++ b/node_modules/is-number-object/package.json @@ -0,0 +1,85 @@ +{ + "name": "is-number-object", + "version": "1.0.7", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test:corejs": "nyc tape test-corejs.js", + "test": "npm run tests-only && npm run test:corejs", + "posttest": "aud --production", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "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://github.com/inspect-js/is-number-object.git" + }, + "keywords": [ + "Number", + "ES6", + "toStringTag", + "@@toStringTag", + "Number object" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-number-object/issues" + }, + "homepage": "https://github.com/inspect-js/is-number-object#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.2.3", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "core-js": "^3.21.1", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "has-tostringtag": "^1.0.0" + } +} diff --git a/node_modules/is-number-object/test/index.js b/node_modules/is-number-object/test/index.js new file mode 100644 index 0000000..bca48b2 --- /dev/null +++ b/node_modules/is-number-object/test/index.js @@ -0,0 +1,38 @@ +'use strict'; + +var test = require('tape'); +var isNumber = require('../'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('not Numbers', function (t) { + t.notOk(isNumber(), 'undefined is not Number'); + t.notOk(isNumber(null), 'null is not Number'); + t.notOk(isNumber(false), 'false is not Number'); + t.notOk(isNumber(true), 'true is not Number'); + t.notOk(isNumber('foo'), 'string is not Number'); + t.notOk(isNumber([]), 'array is not Number'); + t.notOk(isNumber({}), 'object is not Number'); + t.notOk(isNumber(function () {}), 'function is not Number'); + t.notOk(isNumber(/a/g), 'regex literal is not Number'); + t.notOk(isNumber(new RegExp('a', 'g')), 'regex object is not Number'); + t.notOk(isNumber(new Date()), 'new Date() is not Number'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var fakeNumber = { + toString: function () { return '7'; }, + valueOf: function () { return 42; } + }; + fakeNumber[Symbol.toStringTag] = 'Number'; + t.notOk(isNumber(fakeNumber), 'fake Number with @@toStringTag "Number" is not Number'); + t.end(); +}); + +test('Numbers', function (t) { + t.ok(isNumber(42), 'number is Number'); + t.ok(isNumber(Object(42)), 'number object is Number'); + t.ok(isNumber(NaN), 'NaN is Number'); + t.ok(isNumber(Infinity), 'Infinity is Number'); + t.end(); +}); diff --git a/node_modules/is-regex/.editorconfig b/node_modules/is-regex/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/is-regex/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/is-regex/.eslintignore b/node_modules/is-regex/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-regex/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-regex/.eslintrc b/node_modules/is-regex/.eslintrc new file mode 100644 index 0000000..1f6f127 --- /dev/null +++ b/node_modules/is-regex/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": [1], + "operator-linebreak": [2, "before"], + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "globals": { + "Proxy": false, + }, + }, + ], +} diff --git a/node_modules/is-regex/.nycrc b/node_modules/is-regex/.nycrc new file mode 100644 index 0000000..a69aa2d --- /dev/null +++ b/node_modules/is-regex/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test", + "test-corejs.js" + ] +} diff --git a/node_modules/is-regex/CHANGELOG.md b/node_modules/is-regex/CHANGELOG.md new file mode 100644 index 0000000..b7496b2 --- /dev/null +++ b/node_modules/is-regex/CHANGELOG.md @@ -0,0 +1,197 @@ +# 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). + +## [v1.1.4](https://github.com/inspect-js/is-regex/compare/v1.1.3...v1.1.4) - 2021-08-05 + +### Commits + +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4b17cad`](https://github.com/inspect-js/is-regex/commit/4b17cad8496b1ae621b18335fa3afe94d0c65e83) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`2dad4af`](https://github.com/inspect-js/is-regex/commit/2dad4afffa15f07cbbf7675b77d1f650c92652c4) + +## [v1.1.3](https://github.com/inspect-js/is-regex/compare/v1.1.2...v1.1.3) - 2021-05-07 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`c681ab9`](https://github.com/inspect-js/is-regex/commit/c681ab99c07f8b3b7ae5f652b3105a30bce94f69) +- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`ca019fd`](https://github.com/inspect-js/is-regex/commit/ca019fdb828dc7d32e323213403ac9995d8604e3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`605a66f`](https://github.com/inspect-js/is-regex/commit/605a66f278900f1c8ae9d1dfcec31e5f61b10ad3) +- [readme] add actions and codecov badges [`8d7c6f0`](https://github.com/inspect-js/is-regex/commit/8d7c6f0e007bd982f21b958e0abc98b8a84e2a24) +- [meta] use `prepublishOnly` script for npm 7+ [`8e50e91`](https://github.com/inspect-js/is-regex/commit/8e50e91f51aa5038745526710ef2e030527982a7) +- [Deps] update `has-symbols` [`4742c81`](https://github.com/inspect-js/is-regex/commit/4742c81260c3db9a8c9ef57110981fb6175f58e0) + +## [v1.1.2](https://github.com/inspect-js/is-regex/compare/v1.1.1...v1.1.2) - 2021-02-01 + +### Commits + +- [Tests] migrate tests to Github Actions [`cc1686e`](https://github.com/inspect-js/is-regex/commit/cc1686e25f446ca6948f43b3f180d6e55e31fb4e) +- [readme] fix repo URLs; remove travis badge [`d1d1da6`](https://github.com/inspect-js/is-regex/commit/d1d1da647bb4e91589606f12470cd27a47b3bb81) +- [meta] do not publish github action workflow files [`9f84b99`](https://github.com/inspect-js/is-regex/commit/9f84b993a995f057b4d2d097ef47b1ff9c84115d) +- [Tests] run `nyc` on all tests [`c37aab9`](https://github.com/inspect-js/is-regex/commit/c37aab9d332c4834b08ada94736c45ab1d39cd2f) +- [Robustness] use `call-bind` [`fbb61bf`](https://github.com/inspect-js/is-regex/commit/fbb61bf3e19ccc178e6ed1e0d7ab9cc7c7167393) +- [actions] add "Allow Edits" workflow [`9022b53`](https://github.com/inspect-js/is-regex/commit/9022b53cb05b0f105cd179800cf96e055b249f08) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`d60f28f`](https://github.com/inspect-js/is-regex/commit/d60f28f7f2fb21dade7bce302b3e0246206423d3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`2c35c43`](https://github.com/inspect-js/is-regex/commit/2c35c437edf3eeb37129eea2404d8f465d27620f) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`1009e25`](https://github.com/inspect-js/is-regex/commit/1009e259d49a63753dc6e79e2b876a30c00c6de6) +- [meta] gitignore coverage output [`3b5fa9e`](https://github.com/inspect-js/is-regex/commit/3b5fa9ed2882c65ee81dff979f79f1a2751d3772) +- [actions] update workflows [`1843ef6`](https://github.com/inspect-js/is-regex/commit/1843ef65b8b8c24a44e91bc4ed5ee60dffc31c2d) + +## [v1.1.1](https://github.com/inspect-js/is-regex/compare/v1.1.0...v1.1.1) - 2020-08-03 + +### Commits + +- [Performance] Re-add lastIndex check to improve performance [`d8495cd`](https://github.com/inspect-js/is-regex/commit/d8495cd22d475ddca250818921b6088f631c1972) +- [Dev Deps] update `auto-changelog`, `eslint` [`778fa6b`](https://github.com/inspect-js/is-regex/commit/778fa6b9d2b182ee6d73993e103532855e956f85) + +## [v1.1.0](https://github.com/inspect-js/is-regex/compare/v1.0.5...v1.1.0) - 2020-06-03 + +### Commits + +- [New] use `badStringifier`‑based RegExp detection [`31eff67`](https://github.com/inspect-js/is-regex/commit/31eff673243d65c3d6c05848c0eb52f5380f1be3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`fc91458`](https://github.com/inspect-js/is-regex/commit/fc914588187b8bb00d8d792c84f06a6e15d883c1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`d43ed83`](https://github.com/inspect-js/is-regex/commit/d43ed83db54ea727bb0b1b77a50af79d1edb8a6d) +- [Dev Deps] update `auto-changelog`, `tape`; add `aud` [`56647d1`](https://github.com/inspect-js/is-regex/commit/56647d196be34ef3c118ad67726e75169fbcb875) +- [meta] only run `aud` on prod deps [`e0865b8`](https://github.com/inspect-js/is-regex/commit/e0865b8360b0ac1b9d17b7b81ae5f339e5c9036b) + +## [v1.0.5](https://github.com/inspect-js/is-regex/compare/v1.0.4...v1.0.5) - 2019-12-15 + +### Commits + +- [Tests] use shared travis-ci configs [`af728b2`](https://github.com/inspect-js/is-regex/commit/af728b21c5cc9e41234fb4015594bffdcfff597c) +- [Tests] remove `jscs` [`1b8cfe8`](https://github.com/inspect-js/is-regex/commit/1b8cfe8cfb14820c196775f19d370276e4034791) +- [meta] add `auto-changelog` [`c3131d8`](https://github.com/inspect-js/is-regex/commit/c3131d8ab5d06ea5fa05a4bb2ad28bbfb81668ad) +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`, `v4.8`; newer npm fails on older nodes [`660b658`](https://github.com/inspect-js/is-regex/commit/660b6585d1a9607dbdae879b70ce2f6a5684616c) +- [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS [`7c25218`](https://github.com/inspect-js/is-regex/commit/7c25218d540ab17c18e4ae333677c5725806a778) +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`fa95547`](https://github.com/inspect-js/is-regex/commit/fa955478950a5ba0a920010d5daaa29487500b30) +- [meta] remove unused Makefile and associated utilities [`9fd2a29`](https://github.com/inspect-js/is-regex/commit/9fd2a29dc57ed125f3d61e94f6254a9dd8ee0044) +- [Tests] up to `node` `v11.3`, `v10.14`, `v8.14`, `v6.15` [`7f2ac41`](https://github.com/inspect-js/is-regex/commit/7f2ac41ef5dc4d53bfe2fb1c24486c688a2537bd) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9` [`6fa2b0f`](https://github.com/inspect-js/is-regex/commit/6fa2b0fe171a5b02086a06679a92d989e83a8b8e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`697e1de`](https://github.com/inspect-js/is-regex/commit/697e1de1c9e69f08e591cc0040d81fdbbde6fe4e) +- [actions] add automatic rebasing / merge commit blocking [`ad86dc9`](https://github.com/inspect-js/is-regex/commit/ad86dc97a52e4f66fbfb3b8c9c78da3963588b54) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `jscs`, `nsp`, `replace`, `semver`, `tape` [`5c99c8e`](https://github.com/inspect-js/is-regex/commit/5c99c8e384d5ce2ef434be5853c301477cf35456) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace`, `semver`, `tape` [`bb63686`](https://github.com/inspect-js/is-regex/commit/bb63686a9d0fc586d121549cf484da95edec3b0a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config@`, `replace`, `semver`, `tape` [`ddf3670`](https://github.com/inspect-js/is-regex/commit/ddf36705e5f7bd29832721e4a23abf06195032c6) +- [Dev Deps] update `tape`, `nsp`, `eslint`, `@ljharb/eslint-config` [`e7b5a62`](https://github.com/inspect-js/is-regex/commit/e7b5a626eef3b9648c7d52d4620ce2e2a98a9ab8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`c803db5`](https://github.com/inspect-js/is-regex/commit/c803db5cd94cf9e0a559617adbc1e4c9d22007ff) +- [Tests] switch from `nsp` to `npm audit` [`b7239be`](https://github.com/inspect-js/is-regex/commit/b7239be9da263a0f7066f79d087eaf700a9613e9) +- [Dev Deps] update `eslint`, `nsp`, `semver`, `tape` [`347ee6c`](https://github.com/inspect-js/is-regex/commit/347ee6c67ba0f56b03f21a5abe743658f6515963) +- Only apps should have lockfiles. [`3866575`](https://github.com/inspect-js/is-regex/commit/38665755ecf028061f15816059e26023890a0dc7) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`d099a39`](https://github.com/inspect-js/is-regex/commit/d099a3943eb7e156a3e64fb8b74e11d7c83a4bec) +- [meta] add `funding` field [`741aecd`](https://github.com/inspect-js/is-regex/commit/741aecd92cd49868b3606c8cc99ce299e5f3c7d5) +- [Tests] use `eclint` instead of `editorconfig-tools` [`bc6aa75`](https://github.com/inspect-js/is-regex/commit/bc6aa7539e506788709b96f7bf3d7549850a81c3) +- [Tests] on `node` `v10.1` [`262226f`](https://github.com/inspect-js/is-regex/commit/262226f08fa34dff9a8dffd16daabb3dc6e262eb) +- [Dev Deps] update `eslint` [`31fd719`](https://github.com/inspect-js/is-regex/commit/31fd719dd59a6111ca710cdb0d19a8adadf9b8c6) +- [Deps] update `has` [`e9e25a3`](https://github.com/inspect-js/is-regex/commit/e9e25a3de7e89faaa6aadf5010477074140e8218) +- [Dev Deps] update `replace` [`aeeb968`](https://github.com/inspect-js/is-regex/commit/aeeb968bf5a4fc07f0fa6905f2c699fc563b6c32) +- [Tests] set audit level [`2a6290e`](https://github.com/inspect-js/is-regex/commit/2a6290e78b58bf14b734d7998fe53b4a84db5e44) +- [Tests] remove `nsp` [`fc74c2b`](https://github.com/inspect-js/is-regex/commit/fc74c2bb6970a7f3280abe6eff3b492d77d89c9f) + +## [v1.0.4](https://github.com/inspect-js/is-regex/compare/v1.0.3...v1.0.4) - 2017-02-18 + +### Fixed + +- [Fix] ensure that `lastIndex` is not mutated [`#3`](https://github.com/inspect-js/is-regex/issues/3) + +### Commits + +- Update `eslint`, `tape`, `semver`; use my personal shared `eslint` config [`c4a41c3`](https://github.com/inspect-js/is-regex/commit/c4a41c3a8203a3919b01cd0d1b577daadf30a452) +- [Tests] on all node minors; improve test matrix [`58d7508`](https://github.com/inspect-js/is-regex/commit/58d7508a36eb92bd76717486b9e78bde502ffe3e) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`7290076`](https://github.com/inspect-js/is-regex/commit/729007606e9ed162953d1f5812c37eb06c554ec2) +- Update `covert`, `jscs`, `eslint`, `semver` [`dabc729`](https://github.com/inspect-js/is-regex/commit/dabc729cfc4458264c6f7642004d41dd5c214bfd) +- Update `eslint` [`a946b05`](https://github.com/inspect-js/is-regex/commit/a946b051159396b4311c564880f96e3d00e8b8e2) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`1744dde`](https://github.com/inspect-js/is-regex/commit/1744dde77526841f216fa2c1c866c5a82b1638c0) +- [Refactor] when try/catch is needed, bail early if the value lacks an own `lastIndex` data property. [`288ad93`](https://github.com/inspect-js/is-regex/commit/288ad93dbfed9f6828de20de67105ee6d6504425) +- Update `editorconfig-tools`, `eslint`, `semver`, `replace` [`4d895c6`](https://github.com/inspect-js/is-regex/commit/4d895c68a0cdbb5803185928963c15147aad0404) +- Update `eslint`, `tape`, `semver` [`f387f03`](https://github.com/inspect-js/is-regex/commit/f387f03b260b56372bfca301d4e79c4067633854) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`55e480f`](https://github.com/inspect-js/is-regex/commit/55e480f407cafb6c21a6c32aef04ccaa3ba4216c) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`89d9528`](https://github.com/inspect-js/is-regex/commit/89d95285b364913ebcd8ac7e0872570fe009a5d3) +- [Dev Deps] update `jscs` [`eb222a8`](https://github.com/inspect-js/is-regex/commit/eb222a8435e59909354f3700fd4880e4ce1cb13e) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`c65429c`](https://github.com/inspect-js/is-regex/commit/c65429cea0366508c10ad2ab773af7b83a34fc81) +- Update `nsp`, `eslint` [`c60fbd8`](https://github.com/inspect-js/is-regex/commit/c60fbd8680f7fb3508ec3c5be8ebb788672516c8) +- Update `eslint`, `semver` [`6a62116`](https://github.com/inspect-js/is-regex/commit/6a621168c63616bf004ca8b1f885b4eb8a58a3e5) +- [Tests] on `node` `v7.5`, `v4.7` [`e764651`](https://github.com/inspect-js/is-regex/commit/e764651336f5da5e239e9fe8869f3a3201c19d2b) +- Test up to `io.js` `v2.1` [`3bf326a`](https://github.com/inspect-js/is-regex/commit/3bf326a9bcd530fd16c9fc806e249a68e25ab7e3) +- Test on the latest `io.js` versions. [`693d047`](https://github.com/inspect-js/is-regex/commit/693d0477631c5d7671f6c99eca5594ffffa75771) +- [Refactor] use an early return instead of a ternary. [`31eaca2`](https://github.com/inspect-js/is-regex/commit/31eaca28b7d0aaac0599fe7a569b93b842f8ab16) +- Test on `io.js` `v2.2` [`c18c55a`](https://github.com/inspect-js/is-regex/commit/c18c55aee6358d70531f935e98851e42b698d93c) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`a1c237d`](https://github.com/inspect-js/is-regex/commit/a1c237d35f880fe0bcbc9275254611a6a2300aaf) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`aa3ea0f`](https://github.com/inspect-js/is-regex/commit/aa3ea0f148af31d75f7ef8a800412729d82def04) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`d97831d`](https://github.com/inspect-js/is-regex/commit/d97831d0e2ccd3d00d1f7354b7f81e2575f90953) +- [Dev Deps] Update `tape`, `eslint` [`95e6def`](https://github.com/inspect-js/is-regex/commit/95e6defe3178c45dc9df16e474e558979d5f5c05) +- Update `eslint`, `nsp` [`3844c93`](https://github.com/inspect-js/is-regex/commit/3844c935cfe7c52fae0dc74d27e884c417cb4616) +- Update `tape`, `jscs` [`0d6dac8`](https://github.com/inspect-js/is-regex/commit/0d6dac818ed251910171965932f021291919e770) +- Fix tests for faked @@toStringTag [`2ebef9f`](https://github.com/inspect-js/is-regex/commit/2ebef9f0759843e9a063de7a512b46e3e7daea7e) +- Test up to `io.js` `v3.0` [`ec1d2d4`](https://github.com/inspect-js/is-regex/commit/ec1d2d44481fa0fa11448527da8030c99fe47a12) +- [Refactor] bail earlier when the value is falsy. [`a9e333e`](https://github.com/inspect-js/is-regex/commit/a9e333e2ac8912ca05b7e31d30e4eea683c0da4b) +- [Dev Deps] update `tape` [`8cdcaae`](https://github.com/inspect-js/is-regex/commit/8cdcaae07be8c790cdb99849e6076ea7702a4c84) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`281c4ef`](https://github.com/inspect-js/is-regex/commit/281c4efeb71c86dd380e741bcaee3f7dbf956151) +- Test on `io.js` `v2.4` [`4d54c68`](https://github.com/inspect-js/is-regex/commit/4d54c68a81b5332a3b76259d8aa8f514be5efd13) +- Test on `io.js` `v2.3` [`23170f5`](https://github.com/inspect-js/is-regex/commit/23170f5cae632d0377de73bd2febc53db8aebbc9) +- Test on `iojs-v1.6` [`4487ad0`](https://github.com/inspect-js/is-regex/commit/4487ad0194a5684223bfa2690da4e0a441f7132a) + +## [v1.0.3](https://github.com/inspect-js/is-regex/compare/v1.0.2...v1.0.3) - 2015-01-29 + +### Commits + +- Update npm run scripts. [`dc528dd`](https://github.com/inspect-js/is-regex/commit/dc528dd25e775089bc0a3f5a8f7ae7ffc4cdf52a) +- Add toStringTag tests. [`f48a83a`](https://github.com/inspect-js/is-regex/commit/f48a83a78720b78ab60ca586c16f6f3dbcfec825) +- If @@toStringTag is not present, use the old-school Object#toString test. [`50b0ffd`](https://github.com/inspect-js/is-regex/commit/50b0ffd9c7fdbd54aee8cde1b07e680ae84f6a0d) + +## [v1.0.2](https://github.com/inspect-js/is-regex/compare/v1.0.1...v1.0.2) - 2015-01-29 + +### Commits + +- `make release` [`a1de7ec`](https://github.com/inspect-js/is-regex/commit/a1de7eca4cecc8015fd27804669f8fc61bd16a68) +- Improve optimization by separating the try/catch, and bailing out early when not typeof "object". [`5ab7632`](https://github.com/inspect-js/is-regex/commit/5ab76322a348487fa8b16761e83f6824c3c27d11) + +## [v1.0.1](https://github.com/inspect-js/is-regex/compare/v1.0.0...v1.0.1) - 2015-01-28 + +### Commits + +- Using my standard jscs.json file [`1f1733a`](https://github.com/inspect-js/is-regex/commit/1f1733ac8433cdcceb25356f86b74136a4477cb9) +- Adding `npm run lint` [`51ea70f`](https://github.com/inspect-js/is-regex/commit/51ea70fa7e461d022f611c195f343ea8d0333d71) +- Use RegExp#exec to test if something is a regex, which works even with ES6 @@toStringTag. [`042c8c7`](https://github.com/inspect-js/is-regex/commit/042c8c734faade9015932b61f1e8ea4f3a93b1b3) +- Adding license and downloads badges [`366d619`](https://github.com/inspect-js/is-regex/commit/366d61965d3a4119126e78e09b2166bbcddd0c5a) +- Use SVG badges instead of PNG [`6a32e4f`](https://github.com/inspect-js/is-regex/commit/6a32e4fc87d7d3a3787b800dd033c9293aead6df) +- Update `tape`, `jscs` [`f1b9462`](https://github.com/inspect-js/is-regex/commit/f1b9462f86d1b69de07176e7f277f668757ba964) +- Update `jscs` [`1bff23f`](https://github.com/inspect-js/is-regex/commit/1bff23ff0fe88c8263e8bf04cf99e290af96d5b0) +- Update `tape`, `jscs` [`c22ea2e`](https://github.com/inspect-js/is-regex/commit/c22ea2e7967f45618deed01ff5ea483f918be216) +- Update `tape`, `jscs` [`b0479db`](https://github.com/inspect-js/is-regex/commit/b0479db99a1b1b872d1618fb0a71f0c74a78b29b) +- Use consistent quotes [`1a6e347`](https://github.com/inspect-js/is-regex/commit/1a6e34730d9270f3f20519139faa4c4e6ec2e1f5) +- Make travis builds faster. [`090a4ea`](https://github.com/inspect-js/is-regex/commit/090a4ea7c5fa709d108d596e3bc304e6ce973dec) +- Update `tape` [`7d76129`](https://github.com/inspect-js/is-regex/commit/7d7612928bdd43230fbd835db71797249ca24f35) +- Lock covert to v1.0.0. [`9a90b03`](https://github.com/inspect-js/is-regex/commit/9a90b03fb390e66f874223a34c58ba2bb109edd3) +- Updating tape [`bfbc7f5`](https://github.com/inspect-js/is-regex/commit/bfbc7f593a007acd0411152bbb55f724dc4ca935) +- Updating jscs [`13ad511`](https://github.com/inspect-js/is-regex/commit/13ad511d80cd67300c2c0c5387fc4b3b423e2768) +- Updating jscs [`cda1945`](https://github.com/inspect-js/is-regex/commit/cda1945d603dfe99e24d5a909a931d366451bc4d) +- Updating jscs [`de96c99`](https://github.com/inspect-js/is-regex/commit/de96c99d4bf5787df671de6df9138b6547a6545b) +- Running linter as part of tests [`2cb6567`](https://github.com/inspect-js/is-regex/commit/2cb656733b1ed0af14ad11fb584006d22de0c69d) +- Updating covert [`a56ae74`](https://github.com/inspect-js/is-regex/commit/a56ae74ec8d5f0473295a8b10519a18580f16624) +- Updating tape [`ffe47f7`](https://github.com/inspect-js/is-regex/commit/ffe47f7fe9cf6d16896b4bdc286bd1d0805d5c49) + +## [v1.0.0](https://github.com/inspect-js/is-regex/compare/v0.0.0...v1.0.0) - 2014-05-19 + +### Commits + +- Make sure old and unstable nodes don't break Travis [`05da747`](https://github.com/inspect-js/is-regex/commit/05da7478f960dc131ec3ad864e27e8c6b7d74a80) +- toString is a reserved var name in old Opera [`885c48c`](https://github.com/inspect-js/is-regex/commit/885c48c120f921a55f1842b0607d3e7875379821) +- Updating deps [`2ca0e79`](https://github.com/inspect-js/is-regex/commit/2ca0e79a2443ca34d85e8b2ea2e26f55855b74a7) +- Updating tape. [`9678435`](https://github.com/inspect-js/is-regex/commit/96784355611deb0c23b9064be774216d76e3e457) +- Updating covert [`c3bb898`](https://github.com/inspect-js/is-regex/commit/c3bb8985a422e3e0c81f9c43899b6c19a72c755f) +- Updating tape [`7811708`](https://github.com/inspect-js/is-regex/commit/78117089688258b8f939b397b37897b5b3e30f74) +- Testing on node 0.6 again [`dec36ae`](https://github.com/inspect-js/is-regex/commit/dec36ae58a39a3f80e832b702c3e19406363c160) +- Run code coverage as part of tests [`e6f4ebe`](https://github.com/inspect-js/is-regex/commit/e6f4ebec26894543747603f2cb360e839f2ca290) + +## v0.0.0 - 2014-01-15 + +### Commits + +- package.json [`aa60d43`](https://github.com/inspect-js/is-regex/commit/aa60d43d2c8adb9fdd47f5898e5e1e570bd238d8) +- read me [`861e944`](https://github.com/inspect-js/is-regex/commit/861e944de88e84010eaa662ea9ea9f17c90cff8c) +- Initial commit [`d0cdd71`](https://github.com/inspect-js/is-regex/commit/d0cdd71a637d8490b7ee3eaaf75c7e31d0f9242f) +- Tests. [`b533f74`](https://github.com/inspect-js/is-regex/commit/b533f741a88dff002790fb7af054b2a74e72d4da) +- Implementation. [`3c9a8c0`](https://github.com/inspect-js/is-regex/commit/3c9a8c06994003cdfffeb3620f251f4c4cae7755) +- Travis CI [`742c440`](https://github.com/inspect-js/is-regex/commit/742c4407015f9108875fd108fde137f5245e9e7a) diff --git a/node_modules/is-regex/LICENSE b/node_modules/is-regex/LICENSE new file mode 100644 index 0000000..47b7b50 --- /dev/null +++ b/node_modules/is-regex/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +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/is-regex/README.md b/node_modules/is-regex/README.md new file mode 100644 index 0000000..d61332b --- /dev/null +++ b/node_modules/is-regex/README.md @@ -0,0 +1,52 @@ +# is-regex [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 value a JS regex? +This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isRegex = require('is-regex'); +var assert = require('assert'); + +assert.notOk(isRegex(undefined)); +assert.notOk(isRegex(null)); +assert.notOk(isRegex(false)); +assert.notOk(isRegex(true)); +assert.notOk(isRegex(42)); +assert.notOk(isRegex('foo')); +assert.notOk(isRegex(function () {})); +assert.notOk(isRegex([])); +assert.notOk(isRegex({})); + +assert.ok(isRegex(/a/g)); +assert.ok(isRegex(new RegExp('a', 'g'))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-regex +[2]: https://versionbadg.es/inspect-js/is-regex.svg +[5]: https://david-dm.org/inspect-js/is-regex.svg +[6]: https://david-dm.org/inspect-js/is-regex +[7]: https://david-dm.org/inspect-js/is-regex/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-regex#info=devDependencies +[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-regex.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-regex.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-regex +[codecov-image]: https://codecov.io/gh/inspect-js/is-regex/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-regex/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-regex +[actions-url]: https://github.com/inspect-js/is-regex/actions diff --git a/node_modules/is-regex/index.js b/node_modules/is-regex/index.js new file mode 100644 index 0000000..19780f4 --- /dev/null +++ b/node_modules/is-regex/index.js @@ -0,0 +1,58 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var hasToStringTag = require('has-tostringtag/shams')(); +var has; +var $exec; +var isRegexMarker; +var badStringifier; + +if (hasToStringTag) { + has = callBound('Object.prototype.hasOwnProperty'); + $exec = callBound('RegExp.prototype.exec'); + isRegexMarker = {}; + + var throwRegexMarker = function () { + throw isRegexMarker; + }; + badStringifier = { + toString: throwRegexMarker, + valueOf: throwRegexMarker + }; + + if (typeof Symbol.toPrimitive === 'symbol') { + badStringifier[Symbol.toPrimitive] = throwRegexMarker; + } +} + +var $toString = callBound('Object.prototype.toString'); +var gOPD = Object.getOwnPropertyDescriptor; +var regexClass = '[object RegExp]'; + +module.exports = hasToStringTag + // eslint-disable-next-line consistent-return + ? function isRegex(value) { + if (!value || typeof value !== 'object') { + return false; + } + + var descriptor = gOPD(value, 'lastIndex'); + var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); + if (!hasLastIndexDataProperty) { + return false; + } + + try { + $exec(value, badStringifier); + } catch (e) { + return e === isRegexMarker; + } + } + : function isRegex(value) { + // In older browsers, typeof regex incorrectly returns 'function' + if (!value || (typeof value !== 'object' && typeof value !== 'function')) { + return false; + } + + return $toString(value) === regexClass; + }; diff --git a/node_modules/is-regex/package.json b/node_modules/is-regex/package.json new file mode 100644 index 0000000..094fd41 --- /dev/null +++ b/node_modules/is-regex/package.json @@ -0,0 +1,86 @@ +{ + "name": "is-regex", + "version": "1.1.4", + "description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only && npm run test:harmony", + "tests-only": "nyc node test", + "test:harmony": "nyc node --harmony --es-staging test", + "test:corejs": "nyc tape test-corejs.js", + "posttest": "npx aud --production", + "lint": "eslint .", + "eccheck": "eclint check *.js **/*.js > /dev/null", + "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://github.com/inspect-js/is-regex.git" + }, + "bugs": { + "url": "https://github.com/inspect-js/is-regex/issues" + }, + "homepage": "https://github.com/inspect-js/is-regex", + "keywords": [ + "regex", + "regexp", + "is", + "regular expression", + "regular", + "expression" + ], + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", + "eclint": "^2.8.1", + "eslint": "^7.32.0", + "foreach": "^2.0.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-regex/test/index.js b/node_modules/is-regex/test/index.js new file mode 100644 index 0000000..f6c0802 --- /dev/null +++ b/node_modules/is-regex/test/index.js @@ -0,0 +1,104 @@ +'use strict'; + +var hasToStringTag = require('has-tostringtag/shams')(); +var forEach = require('foreach'); +var test = require('tape'); +var isRegex = require('..'); + +test('not regexes', function (t) { + t.notOk(isRegex(), 'undefined is not regex'); + t.notOk(isRegex(null), 'null is not regex'); + t.notOk(isRegex(false), 'false is not regex'); + t.notOk(isRegex(true), 'true is not regex'); + t.notOk(isRegex(42), 'number is not regex'); + t.notOk(isRegex('foo'), 'string is not regex'); + t.notOk(isRegex([]), 'array is not regex'); + t.notOk(isRegex({}), 'object is not regex'); + t.notOk(isRegex(function () {}), 'function is not regex'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var regex = /a/g; + var fakeRegex = { + toString: function () { return String(regex); }, + valueOf: function () { return regex; } + }; + fakeRegex[Symbol.toStringTag] = 'RegExp'; + t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex'); + t.end(); +}); + +test('regexes', function (t) { + t.ok(isRegex(/a/g), 'regex literal is regex'); + t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex'); + t.end(); +}); + +test('does not mutate regexes', function (t) { + t.test('lastIndex is a marker object', function (st) { + var regex = /a/; + var marker = {}; + regex.lastIndex = marker; + st.equal(regex.lastIndex, marker, 'lastIndex is the marker object'); + st.ok(isRegex(regex), 'is regex'); + st.equal(regex.lastIndex, marker, 'lastIndex is the marker object after isRegex'); + st.end(); + }); + + t.test('lastIndex is nonzero', function (st) { + var regex = /a/; + regex.lastIndex = 3; + st.equal(regex.lastIndex, 3, 'lastIndex is 3'); + st.ok(isRegex(regex), 'is regex'); + st.equal(regex.lastIndex, 3, 'lastIndex is 3 after isRegex'); + st.end(); + }); + + t.end(); +}); + +test('does not perform operations observable to Proxies', { skip: typeof Proxy !== 'function' }, function (t) { + var Handler = function () { + this.trapCalls = []; + }; + + forEach([ + 'defineProperty', + 'deleteProperty', + 'get', + 'getOwnPropertyDescriptor', + 'getPrototypeOf', + 'has', + 'isExtensible', + 'ownKeys', + 'preventExtensions', + 'set', + 'setPrototypeOf' + ], function (trapName) { + Handler.prototype[trapName] = function () { + this.trapCalls.push(trapName); + return Reflect[trapName].apply(Reflect, arguments); + }; + }); + + t.test('proxy of object', function (st) { + var handler = new Handler(); + var proxy = new Proxy({ lastIndex: 0 }, handler); + + st.equal(isRegex(proxy), false, 'proxy of plain object is not regex'); + st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered'); + st.end(); + }); + + t.test('proxy of RegExp instance', function (st) { + var handler = new Handler(); + var proxy = new Proxy(/a/, handler); + + st.equal(isRegex(proxy), false, 'proxy of RegExp instance is not regex'); + st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/is-shared-array-buffer/.eslintignore b/node_modules/is-shared-array-buffer/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-shared-array-buffer/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-shared-array-buffer/.eslintrc b/node_modules/is-shared-array-buffer/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/node_modules/is-shared-array-buffer/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/is-shared-array-buffer/.github/FUNDING.yml b/node_modules/is-shared-array-buffer/.github/FUNDING.yml new file mode 100644 index 0000000..61db3c4 --- /dev/null +++ b/node_modules/is-shared-array-buffer/.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-shared-array-buffer +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-shared-array-buffer/.nycrc b/node_modules/is-shared-array-buffer/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-shared-array-buffer/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-shared-array-buffer/CHANGELOG.md b/node_modules/is-shared-array-buffer/CHANGELOG.md new file mode 100644 index 0000000..6536f8f --- /dev/null +++ b/node_modules/is-shared-array-buffer/CHANGELOG.md @@ -0,0 +1,44 @@ +# 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). + +## [v1.0.2](https://github.com/inspect-js/is-shared-array-buffer/compare/v1.0.1...v1.0.2) - 2022-04-01 + +### Commits + +- [actions] reuse common workflows [`48d01e6`](https://github.com/inspect-js/is-shared-array-buffer/commit/48d01e690f76c92f5c9072fbcb9b6215402db8a7) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`7b0e12a`](https://github.com/inspect-js/is-shared-array-buffer/commit/7b0e12a4e8f5db8eac586be68c879119a4a12e7a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`8d57a8e`](https://github.com/inspect-js/is-shared-array-buffer/commit/8d57a8e1d9ce093f04f83e196ca7c80a02617939) +- [readme] update URLs [`dca4d27`](https://github.com/inspect-js/is-shared-array-buffer/commit/dca4d27d35352309da5abb4feb584158004008cf) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`2a7bb99`](https://github.com/inspect-js/is-shared-array-buffer/commit/2a7bb990610d7f6c058bdae7f21c49cc7276848f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`389c6db`](https://github.com/inspect-js/is-shared-array-buffer/commit/389c6db4311a85a84fd4cb75646f26023b0c1685) +- [actions] update codecov uploader [`b9661f9`](https://github.com/inspect-js/is-shared-array-buffer/commit/b9661f9ac2e1e002372b9b1e136faca837a6647f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect` [`f99cd48`](https://github.com/inspect-js/is-shared-array-buffer/commit/f99cd4827e23bc893ed711cbffe28f3e51a4d401) +- [readme] add actions and codecov badges [`9515ed2`](https://github.com/inspect-js/is-shared-array-buffer/commit/9515ed2184a3ed1ce913b92b5092884dad5ac794) +- [Fix] add missing `call-bind` dependency [`cff5358`](https://github.com/inspect-js/is-shared-array-buffer/commit/cff53582740f9f053ec67e1acbf2bafc83bdb7b5) +- [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ [`ba0b719`](https://github.com/inspect-js/is-shared-array-buffer/commit/ba0b7190a42d4290d31a5fce215e874da573dd77) + +## [v1.0.1](https://github.com/inspect-js/is-shared-array-buffer/compare/v1.0.0...v1.0.1) - 2021-03-04 + +### Commits + +- [readme] fix repo URLs [`37c38f3`](https://github.com/inspect-js/is-shared-array-buffer/commit/37c38f347392da177197dd2fd518b61240a56203) + +## v1.0.0 - 2021-03-04 + +### Commits + +- [Tests] add tests [`9c7b806`](https://github.com/inspect-js/is-shared-array-buffer/commit/9c7b806ab1528814308a7420f8198644f55c916f) +- Initial commit [`4e65c5e`](https://github.com/inspect-js/is-shared-array-buffer/commit/4e65c5ecdaa255162bc6507de4ff98cea2472e3b) +- [meta] do not publish github action workflow files [`ac3693d`](https://github.com/inspect-js/is-shared-array-buffer/commit/ac3693db8ec26db5444ef4b46aa38a81e8841d30) +- readme [`7a984d0`](https://github.com/inspect-js/is-shared-array-buffer/commit/7a984d0db73b77943f6731098134e3351a36793b) +- npm init [`a586c99`](https://github.com/inspect-js/is-shared-array-buffer/commit/a586c99316f3c8ae4fd5125621ea933e97a1bf1b) +- [actions] add automatic rebasing / merge commit blocking [`184fe62`](https://github.com/inspect-js/is-shared-array-buffer/commit/184fe622680d523e89ac322fa1a52dbba46a8fc0) +- Implementation [`207e26d`](https://github.com/inspect-js/is-shared-array-buffer/commit/207e26d1128930f28384cb213b38d69fd52bbd7c) +- [meta] create `FUNDING.yml`; add "funding" field [`3cad3fc`](https://github.com/inspect-js/is-shared-array-buffer/commit/3cad3fc9509f91fbc71e84565529f53a94d538d4) +- [meta] add auto-changelog [`31f1f2c`](https://github.com/inspect-js/is-shared-array-buffer/commit/31f1f2cbcd616d6c09089d62198d5cc775053324) +- [Tests] add `npm run lint` [`2e5146e`](https://github.com/inspect-js/is-shared-array-buffer/commit/2e5146e18f44533382a781fa09a50d4f47caa0e5) +- Only apps should have lockfiles [`7b2adfa`](https://github.com/inspect-js/is-shared-array-buffer/commit/7b2adfad6dcd95271ab6ba34658a9a1a21dbeacf) diff --git a/node_modules/is-shared-array-buffer/LICENSE b/node_modules/is-shared-array-buffer/LICENSE new file mode 100644 index 0000000..7948bc0 --- /dev/null +++ b/node_modules/is-shared-array-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +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/is-shared-array-buffer/README.md b/node_modules/is-shared-array-buffer/README.md new file mode 100644 index 0000000..c2b6710 --- /dev/null +++ b/node_modules/is-shared-array-buffer/README.md @@ -0,0 +1,58 @@ +# is-shared-array-buffer [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Is this value a JS SharedArrayBuffer? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag. + +## Example + +```js +var assert = require('assert'); +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +assert(!isSharedArrayBuffer(function () {})); +assert(!isSharedArrayBuffer(null)); +assert(!isSharedArrayBuffer(function* () { yield 42; return Infinity; }); +assert(!isSharedArrayBuffer(Symbol('foo'))); +assert(!isSharedArrayBuffer(1n)); +assert(!isSharedArrayBuffer(Object(1n))); + +assert(!isSharedArrayBuffer(new Set())); +assert(!isSharedArrayBuffer(new WeakSet())); +assert(!isSharedArrayBuffer(new Map())); +assert(!isSharedArrayBuffer(new WeakMap())); +assert(!isSharedArrayBuffer(new WeakRef({}))); +assert(!isSharedArrayBuffer(new FinalizationRegistry(() => {}))); +assert(!isSharedArrayBuffer(new ArrayBuffer())); + +assert(isSharedArrayBuffer(new SharedArrayBuffer())); + +class MySharedArrayBuffer extends SharedArrayBuffer {} +assert(isSharedArrayBuffer(new MySharedArrayBuffer())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/is-shared-array-buffer +[npm-version-svg]: https://versionbadg.es/inspect-js/is-shared-array-buffer.svg +[deps-svg]: https://david-dm.org/inspect-js/is-shared-array-buffer.svg +[deps-url]: https://david-dm.org/inspect-js/is-shared-array-buffer +[dev-deps-svg]: https://david-dm.org/inspect-js/is-shared-array-buffer/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/is-shared-array-buffer#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/is-shared-array-buffer.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-shared-array-buffer.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-shared-array-buffer.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-shared-array-buffer +[codecov-image]: https://codecov.io/gh/inspect-js/is-shared-array-buffer/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-shared-array-buffer/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-shared-array-buffer +[actions-url]: https://github.com/inspect-js/is-shared-array-buffer/actions diff --git a/node_modules/is-shared-array-buffer/index.js b/node_modules/is-shared-array-buffer/index.js new file mode 100644 index 0000000..8704304 --- /dev/null +++ b/node_modules/is-shared-array-buffer/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true); + +module.exports = $byteLength + ? function isSharedArrayBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + try { + $byteLength(obj); + return true; + } catch (e) { + return false; + } + } + : function isSharedArrayBuffer(obj) { // eslint-disable-line no-unused-vars + return false; + }; diff --git a/node_modules/is-shared-array-buffer/package.json b/node_modules/is-shared-array-buffer/package.json new file mode 100644 index 0000000..511a9f6 --- /dev/null +++ b/node_modules/is-shared-array-buffer/package.json @@ -0,0 +1,70 @@ +{ + "name": "is-shared-array-buffer", + "version": "1.0.2", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Is this value a JS SharedArrayBuffer?", + "license": "MIT", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=.js,.mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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-shared-array-buffer.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "is", + "sharedarraybuffer", + "shared", + "array", + "buffer" + ], + "bugs": { + "url": "https://github.com/inspect-js/is-shared-array-buffer/issues" + }, + "homepage": "https://github.com/inspect-js/is-shared-array-buffer#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.2.3", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.2.1", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "nyc": "^10.3.2", + "object-inspect": "^1.12.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.2" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "call-bind": "^1.0.2" + } +} diff --git a/node_modules/is-shared-array-buffer/test/index.js b/node_modules/is-shared-array-buffer/test/index.js new file mode 100644 index 0000000..9bc2c56 --- /dev/null +++ b/node_modules/is-shared-array-buffer/test/index.js @@ -0,0 +1,27 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); + +var isSharedArrayBuffer = require('..'); + +test('isSharedArrayBuffer', function (t) { + t.equal(typeof isSharedArrayBuffer, 'function', 'is a function'); + + var nonSABs = v.primitives.concat(v.objects); + forEach(nonSABs, function (nonSAB) { + t.equal(isSharedArrayBuffer(nonSAB), false, inspect(nonSAB) + ' is not a SharedArrayBuffer'); + }); + + t.test('actual SharedArrayBuffer instances', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) { + var sab = new SharedArrayBuffer(); + + st.equal(isSharedArrayBuffer(sab), true, inspect(sab) + ' is a SharedArrayBuffer'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/is-string/.eslintignore b/node_modules/is-string/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-string/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-string/.eslintrc b/node_modules/is-string/.eslintrc new file mode 100644 index 0000000..5bf1191 --- /dev/null +++ b/node_modules/is-string/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "max-statements": [2, 15] + }, + + "overrides": [ + { + "files": ["test.js"], + "rules": { + "no-magic-numbers": 0, + }, + }, + ], +} diff --git a/node_modules/is-string/.github/FUNDING.yml b/node_modules/is-string/.github/FUNDING.yml new file mode 100644 index 0000000..519746b --- /dev/null +++ b/node_modules/is-string/.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-string +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-string/.nycrc b/node_modules/is-string/.nycrc new file mode 100644 index 0000000..a69aa2d --- /dev/null +++ b/node_modules/is-string/.nycrc @@ -0,0 +1,10 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test", + "test-corejs.js" + ] +} diff --git a/node_modules/is-string/CHANGELOG.md b/node_modules/is-string/CHANGELOG.md new file mode 100644 index 0000000..6f62043 --- /dev/null +++ b/node_modules/is-string/CHANGELOG.md @@ -0,0 +1,114 @@ +# 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). + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +## [v1.0.7](https://github.com/inspect-js/is-string/compare/v1.0.6...v1.0.7) - 2021-08-05 + +### Commits + +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`d973ffd`](https://github.com/inspect-js/is-string/commit/d973ffd2268e10c0e2cd4f0c57ecf8ce0a8d8578) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4bfaabf`](https://github.com/inspect-js/is-string/commit/4bfaabf877e874ca21d2c44be26f13add8ee2761) + +## [v1.0.6](https://github.com/inspect-js/is-string/compare/v1.0.5...v1.0.6) - 2021-05-07 + +### Commits + +- [Tests] migrate tests to Github Actions [`c7790c8`](https://github.com/inspect-js/is-string/commit/c7790c89e5077251fe7ca32ac29eeee02f1b2751) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`1e52bbd`](https://github.com/inspect-js/is-string/commit/1e52bbd19b1608f6932c0335d9981824584c3186) +- [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`83337eb`](https://github.com/inspect-js/is-string/commit/83337ebf55308b7bb9c1befae420760e0f8d8016) +- [meta] do not publish github action workflow files [`b25aea2`](https://github.com/inspect-js/is-string/commit/b25aea2e8a53ed9e9090cf96481590cdc00a0957) +- [readme] update badges [`759ccd9`](https://github.com/inspect-js/is-string/commit/759ccd94de4a2000231a179f91af6b5c12c11e00) +- [Tests] run `nyc` on all tests [`dc02f70`](https://github.com/inspect-js/is-string/commit/dc02f7080c355f0d24368c1622db09f7cc30cdbd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `tape`; add `aud` [`a0f76fa`](https://github.com/inspect-js/is-string/commit/a0f76fa1990bb580948f9e2daa89bdcda3fae7f0) +- [actions] add "Allow Edits" workflow [`9ec3902`](https://github.com/inspect-js/is-string/commit/9ec390295b4faef7744d2b579c1050be66168cb7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`57fbe21`](https://github.com/inspect-js/is-string/commit/57fbe215da83a3b601855a9c6543ad1a96de5702) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`191e55f`](https://github.com/inspect-js/is-string/commit/191e55ff1fa782654ffcce2df922e23345b56690) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`1ea2b81`](https://github.com/inspect-js/is-string/commit/1ea2b81e866775a7890e75c44c742204124aa354) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`105d1b9`](https://github.com/inspect-js/is-string/commit/105d1b9851e366ef23c2a27d4064e0d36da25939) +- [Dev Deps] update `auto-changelog`, `tape`; add `aud` [`114cfad`](https://github.com/inspect-js/is-string/commit/114cfad854d8860421f847cd99a3bdb8ef1353dc) +- [meta] use `prepublishOnly` script for npm 7+ [`fc38f26`](https://github.com/inspect-js/is-string/commit/fc38f26adb486f50880c5771d145ab2bffb6247a) +- [meta] gitignore coverage output [`3419127`](https://github.com/inspect-js/is-string/commit/34191278f1fa09ba4da801a6fd7a32e31050e759) +- [actions] update rebase action to use checkout v2 [`334eca0`](https://github.com/inspect-js/is-string/commit/334eca02d40f4cf7dc15a8e7d5ff06852028abb5) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`7a332e9`](https://github.com/inspect-js/is-string/commit/7a332e963f1ab717fafa671e0fa8a1b20c53d861) +- [meta] remove explicit audit level config [`04630b1`](https://github.com/inspect-js/is-string/commit/04630b1b535084322ddeae8efb79a8810d7cf325) + +## [v1.0.5](https://github.com/inspect-js/is-string/compare/v1.0.4...v1.0.5) - 2019-12-18 + +### Commits + +- [Tests] use shared travis-ci configs [`4121d6b`](https://github.com/inspect-js/is-string/commit/4121d6b168ae1d54a81791ee6877f9813cab6253) +- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v5.12`, `v4.9`; use `nvm install-latest-npm` [`e7a3e89`](https://github.com/inspect-js/is-string/commit/e7a3e89ccb9638d73f45dbcb2a42e509bd3153c4) +- Update `eslint`, `tape`, `semver`; use my personal shared `eslint` config [`6c380a7`](https://github.com/inspect-js/is-string/commit/6c380a70011714370e754fa0df95f56cdcaa3e60) +- [Tests] remove `jscs` [`3d49592`](https://github.com/inspect-js/is-string/commit/3d49592b9880fcb1a23b67286445281131a553e3) +- Update `is`, `tape`, `covert`, `jscs`, `editorconfig-tools`, `eslint`, `nsp`, `semver`. [`cc6983d`](https://github.com/inspect-js/is-string/commit/cc6983d06bc98f4ae9b7c9439d5d73c7318d8acd) +- [meta] add `auto-changelog` [`b857897`](https://github.com/inspect-js/is-string/commit/b85789723ce3a7064536598e0fcdd495257c6134) +- [meta] remove unused Makefile and associated utilities [`3f0f51c`](https://github.com/inspect-js/is-string/commit/3f0f51cbae1f97dbe1466eee88d105b3df0d2f0a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is`, `covert`, `tape`, `semver` [`9d4a95e`](https://github.com/inspect-js/is-string/commit/9d4a95e4473fe8195501878525b5af5948aa45c9) +- Update `eslint` [`e861b4b`](https://github.com/inspect-js/is-string/commit/e861b4bc71f5390670aebdff91119a1f8aeeb88a) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`172e2dd`](https://github.com/inspect-js/is-string/commit/172e2dd1a0b9eb042bcb9a80ff5e774a90ff0695) +- Test on `node` and `io.js` latest. [`fd426cd`](https://github.com/inspect-js/is-string/commit/fd426cd18b22b0d0e1731598125393dcfe0c5704) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` [`23bdf83`](https://github.com/inspect-js/is-string/commit/23bdf83cf42138eba09f45bd0b040b069f9839d4) +- [actions] add automatic rebasing / merge commit blocking [`96153c0`](https://github.com/inspect-js/is-string/commit/96153c0d687a7fda2261f4c02add5d0b41e8aed7) +- [meta] create FUNDING.yml [`66ae246`](https://github.com/inspect-js/is-string/commit/66ae246d6cdaa4ccbc21f7c144b672139b8ccef6) +- [Dev Deps] update `is`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`817361a`](https://github.com/inspect-js/is-string/commit/817361a9673cd1ec9854b52578a980159f7d8701) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `semver`, `tape` [`fc35d3f`](https://github.com/inspect-js/is-string/commit/fc35d3feb40921bb22e1639903cb7f2fab77814b) +- [Dev Deps] update `jscs` [`886767e`](https://github.com/inspect-js/is-string/commit/886767e04e5ad59ac0bc926a87233cc8546c8b4f) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`3410922`](https://github.com/inspect-js/is-string/commit/341092203c11a3b92eee55a7ecb7b8265e8fcecd) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`4d6c73b`](https://github.com/inspect-js/is-string/commit/4d6c73b507bcd39050ef71e554069f72fc5b222a) +- Update `nsp`, `eslint` [`b11de49`](https://github.com/inspect-js/is-string/commit/b11de4910beee1ffe1e67fbe25ec6707ca796b27) +- Update `eslint`, `semver` [`0777977`](https://github.com/inspect-js/is-string/commit/0777977757a85a1db75831d03a14b4b1fde05d7e) +- Only apps should have lockfiles [`78b49ff`](https://github.com/inspect-js/is-string/commit/78b49ffd04d4cd8c57d9e7b485421fbf3641b41b) +- [meta] add `funding` field [`81328a6`](https://github.com/inspect-js/is-string/commit/81328a6ef3eee989164127e4c0c82f1da73d3567) +- [Dev Deps] update `eslint`, `tape` [`fc9a225`](https://github.com/inspect-js/is-string/commit/fc9a225b27935f7c9c2704281d7fddd3614d3cb8) +- [Tests] use `eclint` instead of `editorconfig-tools` [`59c2c61`](https://github.com/inspect-js/is-string/commit/59c2c610dbd8e8ca1e4aa3fa9c9f93205cab9b07) +- [Dev Deps] Update `tape`, `eslint` [`a429816`](https://github.com/inspect-js/is-string/commit/a429816688e23c81948b4ae72324c26c27849b7c) +- Test on `io.js` `v2.2` [`08b476e`](https://github.com/inspect-js/is-string/commit/08b476ed0734a70e3091c04ddd2f173a2df21eb2) +- Test up to `io.js` `v3.0` [`22637ef`](https://github.com/inspect-js/is-string/commit/22637ef9e0030533df85cf1992fc099a88b1924c) +- [meta] add `safe-publish-latest` [`20ccb48`](https://github.com/inspect-js/is-string/commit/20ccb48fd85f0245eb893507d00003090da020d0) +- [Dev Deps] update `tape` [`06b58a0`](https://github.com/inspect-js/is-string/commit/06b58a048c2a820e5611ad2bd9ddfbe893295a57) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`ea7cf84`](https://github.com/inspect-js/is-string/commit/ea7cf849b952c924d1687a302098251a7b827c80) +- Test on `io.js` `v2.4` [`66ec3ea`](https://github.com/inspect-js/is-string/commit/66ec3ea390b364583a792799b53857fd186ccc88) +- Test on `io.js` `v2.3` [`ca6e796`](https://github.com/inspect-js/is-string/commit/ca6e796f16ec433b88962162fde8012f28e18f1e) +- Fix tests for faked @@toStringTag [`3cce832`](https://github.com/inspect-js/is-string/commit/3cce8329133dfd233987359df151018b3b136be1) + +## [v1.0.4](https://github.com/inspect-js/is-string/compare/v1.0.3...v1.0.4) - 2015-01-29 + +### Commits + +- If @@toStringTag is not present, use the old-school Object#toString test. [`30675ec`](https://github.com/inspect-js/is-string/commit/30675ecb5c5cc43873918661a414a1d0f8b77325) + +## [v1.0.3](https://github.com/inspect-js/is-string/compare/v1.0.2...v1.0.3) - 2015-01-29 + +### Commits + +- Refactor to aid optimization of non-try/catch code. [`9b2772a`](https://github.com/inspect-js/is-string/commit/9b2772abe09ba8cbaa631322cc226ee906d2db22) + +## [v1.0.2](https://github.com/inspect-js/is-string/compare/v1.0.1...v1.0.2) - 2015-01-29 + +### Commits + +- Fix broken package.json [`dc921d3`](https://github.com/inspect-js/is-string/commit/dc921d332b64e4041162f04e4712b0dc687863a5) + +## [v1.0.1](https://github.com/inspect-js/is-string/compare/v1.0.0...v1.0.1) - 2015-01-29 + +### Commits + +- Fix eslint config. [`c4e05bd`](https://github.com/inspect-js/is-string/commit/c4e05bd171da6002d432e451fd48912db8b048e0) +- Add early exits for typeof "string", or typeof not "object". [`82f41d3`](https://github.com/inspect-js/is-string/commit/82f41d36a599bc6a06152792c84c7683e412c513) + +## v1.0.0 - 2015-01-29 + +### Commits + +- Dotfiles. [`45bc9dd`](https://github.com/inspect-js/is-string/commit/45bc9dd60201722344986a6c7536be9ea9ccefbf) +- `make release` [`23707f5`](https://github.com/inspect-js/is-string/commit/23707f5ecfdf00afb0e57c06ac07f7f49cdeb606) +- package.json [`575ad81`](https://github.com/inspect-js/is-string/commit/575ad811c61b156cfbcc60ff61947183c6ebe6a2) +- Read me [`3f67c9a`](https://github.com/inspect-js/is-string/commit/3f67c9a0725f811845d38646a19322895cd03981) +- Initial commit [`2c26a7a`](https://github.com/inspect-js/is-string/commit/2c26a7a2e41dec77be2c59d5847f29a6ab7c0b29) +- Tests. [`38c987b`](https://github.com/inspect-js/is-string/commit/38c987b8513b0ac03b0897e0fce7de8135d4ee0f) +- Implementation. [`0471d59`](https://github.com/inspect-js/is-string/commit/0471d59078d7f3f77619913ec21c57c0af27114c) diff --git a/node_modules/is-string/LICENSE b/node_modules/is-string/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-string/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-string/README.md b/node_modules/is-string/README.md new file mode 100644 index 0000000..d9d7edf --- /dev/null +++ b/node_modules/is-string/README.md @@ -0,0 +1,56 @@ +# is-string [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isString = require('is-string'); +var assert = require('assert'); + +assert.notOk(isString(undefined)); +assert.notOk(isString(null)); +assert.notOk(isString(false)); +assert.notOk(isString(true)); +assert.notOk(isString(function () {})); +assert.notOk(isString([])); +assert.notOk(isString({})); +assert.notOk(isString(/a/g)); +assert.notOk(isString(new RegExp('a', 'g'))); +assert.notOk(isString(new Date())); +assert.notOk(isString(42)); +assert.notOk(isString(NaN)); +assert.notOk(isString(Infinity)); +assert.notOk(isString(new Number(42))); + +assert.ok(isString('foo')); +assert.ok(isString(Object('foo'))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-string +[2]: https://versionbadg.es/inspect-js/is-string.svg +[5]: https://david-dm.org/inspect-js/is-string.svg +[6]: https://david-dm.org/inspect-js/is-string +[7]: https://david-dm.org/inspect-js/is-string/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-string#info=devDependencies +[11]: https://nodei.co/npm/is-string.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-string.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-string.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-string +[codecov-image]: https://codecov.io/gh/inspect-js/is-string/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-string/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-string +[actions-url]: https://github.com/inspect-js/is-string/actions diff --git a/node_modules/is-string/index.js b/node_modules/is-string/index.js new file mode 100644 index 0000000..f44f7bb --- /dev/null +++ b/node_modules/is-string/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var strValue = String.prototype.valueOf; +var tryStringObject = function tryStringObject(value) { + try { + strValue.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var strClass = '[object String]'; +var hasToStringTag = require('has-tostringtag/shams')(); + +module.exports = function isString(value) { + if (typeof value === 'string') { + return true; + } + if (typeof value !== 'object') { + return false; + } + return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; +}; diff --git a/node_modules/is-string/package.json b/node_modules/is-string/package.json new file mode 100644 index 0000000..9b36548 --- /dev/null +++ b/node_modules/is-string/package.json @@ -0,0 +1,81 @@ +{ + "name": "is-string", + "version": "1.0.7", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test:corejs": "nyc tape test-corejs.js", + "test": "npm run tests-only && npm run test:corejs", + "posttest": "npx aud --production", + "lint": "eslint .", + "eccheck": "eclint check *.js **/*.js > /dev/null", + "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://github.com/ljharb/is-string.git" + }, + "keywords": [ + "String", + "string", + "ES6", + "toStringTag", + "@@toStringTag", + "String object" + ], + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", + "eclint": "^2.8.1", + "eslint": "^7.32.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false + } +} diff --git a/node_modules/is-string/test/index.js b/node_modules/is-string/test/index.js new file mode 100644 index 0000000..5239dfa --- /dev/null +++ b/node_modules/is-string/test/index.js @@ -0,0 +1,39 @@ +'use strict'; + +var test = require('tape'); +var isString = require('../'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('not Strings', function (t) { + t.notOk(isString(), 'undefined is not String'); + t.notOk(isString(null), 'null is not String'); + t.notOk(isString(false), 'false is not String'); + t.notOk(isString(true), 'true is not String'); + t.notOk(isString([]), 'array is not String'); + t.notOk(isString({}), 'object is not String'); + t.notOk(isString(function () {}), 'function is not String'); + t.notOk(isString(/a/g), 'regex literal is not String'); + t.notOk(isString(new RegExp('a', 'g')), 'regex object is not String'); + t.notOk(isString(new Date()), 'new Date() is not String'); + t.notOk(isString(42), 'number is not String'); + t.notOk(isString(Object(42)), 'number object is not String'); + t.notOk(isString(NaN), 'NaN is not String'); + t.notOk(isString(Infinity), 'Infinity is not String'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var fakeString = { + toString: function () { return '7'; }, + valueOf: function () { return '42'; } + }; + fakeString[Symbol.toStringTag] = 'String'; + t.notOk(isString(fakeString), 'fake String with @@toStringTag "String" is not String'); + t.end(); +}); + +test('Strings', function (t) { + t.ok(isString('foo'), 'string primitive is String'); + t.ok(isString(Object('foo')), 'string object is String'); + t.end(); +}); diff --git a/node_modules/is-symbol/.editorconfig b/node_modules/is-symbol/.editorconfig new file mode 100644 index 0000000..eaa2141 --- /dev/null +++ b/node_modules/is-symbol/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/is-symbol/.eslintignore b/node_modules/is-symbol/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-symbol/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-symbol/.eslintrc b/node_modules/is-symbol/.eslintrc new file mode 100644 index 0000000..046dd07 --- /dev/null +++ b/node_modules/is-symbol/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "overrides": [ + { + "files": "test/**", + "rules": { + "no-restricted-properties": 0, + }, + }, + ], +} diff --git a/node_modules/is-symbol/.github/FUNDING.yml b/node_modules/is-symbol/.github/FUNDING.yml new file mode 100644 index 0000000..a65600e --- /dev/null +++ b/node_modules/is-symbol/.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-symbol +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-symbol/.nycrc b/node_modules/is-symbol/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-symbol/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-symbol/CHANGELOG.md b/node_modules/is-symbol/CHANGELOG.md new file mode 100644 index 0000000..ce8dd99 --- /dev/null +++ b/node_modules/is-symbol/CHANGELOG.md @@ -0,0 +1,113 @@ +# 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). + +## [v1.0.4](https://github.com/inspect-js/is-symbol/compare/v1.0.3...v1.0.4) - 2021-05-08 + +### Commits + +- [Tests] migrate tests to Github Actions [`997d43c`](https://github.com/inspect-js/is-symbol/commit/997d43c091d1f8d3a2b3d7dfb17a73cdc5a75dde) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`fe0ccb7`](https://github.com/inspect-js/is-symbol/commit/fe0ccb7b7b64e74e095ef782dcc1d24d6c4b0be4) +- [meta] remove unused Makefile and associated utilities [`3ab2748`](https://github.com/inspect-js/is-symbol/commit/3ab2748ab6c2de21fc24f131bb880c68ba0b7b34) +- [meta] do not publish github action workflow files [`f20fafe`](https://github.com/inspect-js/is-symbol/commit/f20fafeb21585c7b4871ea19f104fd7696734fe8) +- [Tests] run `nyc` on all tests [`5c332fc`](https://github.com/inspect-js/is-symbol/commit/5c332fc92cecbed4a2041bc0c52b991b4a593f34) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c5a58a8`](https://github.com/inspect-js/is-symbol/commit/c5a58a8bea390a9b02e1c8c4aac30c223370297b) +- [readme] fix repo URLs; remove travis badge [`bcd9258`](https://github.com/inspect-js/is-symbol/commit/bcd9258d161fe709148fcc47962df3372c544727) +- [actions] add "Allow Edits" workflow [`33ae2d3`](https://github.com/inspect-js/is-symbol/commit/33ae2d3940e9daa6003a84c232874ee558b2fb44) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`e53def0`](https://github.com/inspect-js/is-symbol/commit/e53def0b77c38cbfae87fd8bbfd78953b845ea94) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect` [`ae36504`](https://github.com/inspect-js/is-symbol/commit/ae365048c0c1b13457faa78658b80561f5a0bcd0) +- [readme] add actions and codecov badges [`aae7f09`](https://github.com/inspect-js/is-symbol/commit/aae7f09bd59d36df69d3b66d9b351c39fe072330) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`d993fae`](https://github.com/inspect-js/is-symbol/commit/d993fae6d89856d4ab7818874be597249cb8a8cc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`51808a5`](https://github.com/inspect-js/is-symbol/commit/51808a55f272023201f40a59b2459ec6305bf73a) +- [Dev Deps] update `auto-changelog`, `tape` [`c90040f`](https://github.com/inspect-js/is-symbol/commit/c90040f0aeded8d0071a78d5cd593b385f8828ee) +- [Dev Deps] update `eslint`, `tape` [`9fee159`](https://github.com/inspect-js/is-symbol/commit/9fee159403d499a5ed2f5cb5db03747d09ab1766) +- [meta] use `prepublishOnly` script for npm 7+ [`b166afc`](https://github.com/inspect-js/is-symbol/commit/b166afc3ae3c6d11721a9558ddb112a28261688d) +- [meta] gitignore coverage output [`4a0fe3a`](https://github.com/inspect-js/is-symbol/commit/4a0fe3aa074b933074fcc231ce739005e1fec195) +- [actions] update workflows [`fbcbc9e`](https://github.com/inspect-js/is-symbol/commit/fbcbc9eb5bfe2cf9a77d5bd86bb1dece8e5f81d0) +- [Dev Deps] update `auto-changelog`; add `aud` [`e66ab98`](https://github.com/inspect-js/is-symbol/commit/e66ab989e48b81b48bd443d35dba0071950c5d7a) +- [Deps] update `has-symbols` [`6ce7de5`](https://github.com/inspect-js/is-symbol/commit/6ce7de53c866c068de2c28d97b3a64cf6d5f6a76) +- [actions] update rebase action to use checkout v2 [`1173c79`](https://github.com/inspect-js/is-symbol/commit/1173c79914076d73aec9aebc22dce4122e7bd3ae) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`94a6348`](https://github.com/inspect-js/is-symbol/commit/94a6348f6274eac9bf4c5a6057b4f6120fc7d1d1) +- [Tests] only audit prod deps [`0692681`](https://github.com/inspect-js/is-symbol/commit/06926811fa029fe0fded5d0af4553a7808c143d1) +- [meta] do not publish .nvmrc file [`ed47833`](https://github.com/inspect-js/is-symbol/commit/ed478333c72384f8dbeb51e5fd501238f52a4972) + +## [v1.0.3](https://github.com/inspect-js/is-symbol/compare/v1.0.2...v1.0.3) - 2019-11-20 + +### Commits + +- [Tests] use shared travis-ci configs [`034afdd`](https://github.com/inspect-js/is-symbol/commit/034afdd677c1b72b76751f3e5131acc927a32916) +- [Tests] remove `jscs` [`0c026a0`](https://github.com/inspect-js/is-symbol/commit/0c026a06815e46a33a8a5b4b1be8965d32d38e5c) +- [meta] add `auto-changelog` [`9a1776b`](https://github.com/inspect-js/is-symbol/commit/9a1776bb49f3e6ac12a5b3a447edcc651216891b) +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`23a6db4`](https://github.com/inspect-js/is-symbol/commit/23a6db49a338d19eab19d876745513820bb6a9dc) +- [Tests] up to `node` `v11.7`, `v10.15`, `v8.15`, `v6.16` [`892d92e`](https://github.com/inspect-js/is-symbol/commit/892d92e7c40f3c0577583a98134106181c38bb7e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `semver`, `tape` [`c2e6d6a`](https://github.com/inspect-js/is-symbol/commit/c2e6d6a71f839522bbd124b7419f5fc42ffff6d3) +- [readme] fix repo URLs [`655c288`](https://github.com/inspect-js/is-symbol/commit/655c288a815856e647dba4b6049b1743cec3533c) +- [actions] add automatic rebasing / merge commit blocking [`97b1229`](https://github.com/inspect-js/is-symbol/commit/97b12296bf8fa1ce0c6121bf3de56c413da10aae) +- [meta] add FUNDING.yml [`94c64a3`](https://github.com/inspect-js/is-symbol/commit/94c64a367a1c34f960cf6007fc65cfbbcba34ba3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape`, `semver` [`71ab543`](https://github.com/inspect-js/is-symbol/commit/71ab543e09b820378362f4f66248addd410c6388) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `semver`, `tape` [`c6212f9`](https://github.com/inspect-js/is-symbol/commit/c6212f94e28622c94bb37189ffc241ee88b5b1dd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `object-inspect` [`91bc802`](https://github.com/inspect-js/is-symbol/commit/91bc802e18e63f4e8230ee0148302ce849e2f733) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`8cbe69c`](https://github.com/inspect-js/is-symbol/commit/8cbe69c3fafe9cfbe7d27f710c88d02d2d2c6a00) +- [Tests] use `npm audit` instead of `nsp` [`741b51d`](https://github.com/inspect-js/is-symbol/commit/741b51dac868f6b22736c204910d257bcf4d5044) +- [meta] add `funding` field [`65b58d1`](https://github.com/inspect-js/is-symbol/commit/65b58d1e9fc572712d462d615e6b2418627d8fb9) +- [Deps] update `has-symbols` [`9cb5b2a`](https://github.com/inspect-js/is-symbol/commit/9cb5b2a9a3b89e8e0246be8df4fff3f5ceac7309) + +## [v1.0.2](https://github.com/inspect-js/is-symbol/compare/v1.0.1...v1.0.2) - 2018-09-20 + +### Commits + +- Update `eslint`, `tape`, `semver`; use my personal shared `eslint` config [`e86aaea`](https://github.com/inspect-js/is-symbol/commit/e86aaea8d81356801ecfc60540523e9b809a55f4) +- [Tests] on all node minors; improve test matrix [`50bc07f`](https://github.com/inspect-js/is-symbol/commit/50bc07f2ff73e5499b02a61f0a00ea48a84ae213) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `semver`, `eslint`, `@ljharb/eslint-config` [`45e17bd`](https://github.com/inspect-js/is-symbol/commit/45e17bdf145846f30122348a94c5e506b90836ba) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`44402cb`](https://github.com/inspect-js/is-symbol/commit/44402cb82d4499e947b48b31b14667d1ebe7e2b4) +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`, `v4.8`; improve matrix; old npm breaks on newer nodes [`9047c23`](https://github.com/inspect-js/is-symbol/commit/9047c232857ecb80551a21cc0b1cc4c91d28da1f) +- Update `tape`, `covert`, `jscs`, `semver` [`d57d1ce`](https://github.com/inspect-js/is-symbol/commit/d57d1ce3fc0b740885a1ed5c0738d4a27b29ab07) +- Add `npm run eslint` [`0d75a66`](https://github.com/inspect-js/is-symbol/commit/0d75a6638ad6f7ff7d5bc958531a6328fb13e3fe) +- Update `eslint` [`042fb3a`](https://github.com/inspect-js/is-symbol/commit/042fb3aec590f0c0d205b15812b285ad95cfff6b) +- [Refactor] use `has-symbols` and `object-inspect` [`129bc68`](https://github.com/inspect-js/is-symbol/commit/129bc68dd619b789b9956ac9b63b46257ee1060c) +- [Tests] up to `node` `v10.11`, `v8.12` [`c1822e8`](https://github.com/inspect-js/is-symbol/commit/c1822e84d6cc0cee9f1c2893e91b1aa999ad41db) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`089d2cf`](https://github.com/inspect-js/is-symbol/commit/089d2cf7cad87b75aa534769af11524ad2e79080) +- [Tests] up to `node` `v8.4`; newer npm breaks on older node [`05ce701`](https://github.com/inspect-js/is-symbol/commit/05ce701e3c1be8b3266ffac49806832e410491c1) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`241e6a6`](https://github.com/inspect-js/is-symbol/commit/241e6a655c0e19e9dcf0ae88e7fddd4cde394c5c) +- Test on latest `node` and `io.js` versions. [`5c8d5de`](https://github.com/inspect-js/is-symbol/commit/5c8d5deb9b7c01a8cdf959082a3d619c19751b0a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `semver`, `tape` [`06047bf`](https://github.com/inspect-js/is-symbol/commit/06047bf72b20a66c0b455e80856b2d00b1910391) +- [Dev Deps] update `jscs`, `nsp`, `semver`, `eslint`, `@ljharb/eslint-config` [`9d25dd7`](https://github.com/inspect-js/is-symbol/commit/9d25dd79347c89f98207a3bad39f667f1f8a410e) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`ce173bd`](https://github.com/inspect-js/is-symbol/commit/ce173bda6e146907e3061a0e70463107d955de35) +- Update `nsp`, `eslint` [`29e5214`](https://github.com/inspect-js/is-symbol/commit/29e52140fac2049b4a32e175787bb3b184a1dd72) +- Update `semver`, `eslint` [`53be884`](https://github.com/inspect-js/is-symbol/commit/53be884c2811f7a4452581003d9cdaf6f9bddd3c) +- [Dev Deps] update `eslint`, `nsp`, `semver`, `tape` [`3bd149c`](https://github.com/inspect-js/is-symbol/commit/3bd149c869c099b07104b06c0692755a01f8298c) +- [Dev Deps] update `jscs` [`69b4231`](https://github.com/inspect-js/is-symbol/commit/69b4231632b170e5ddb350db2f0c59e6cad6f548) +- Test up to `io.js` `v2.1` [`0b61ac7`](https://github.com/inspect-js/is-symbol/commit/0b61ac7ac4de390296aeefb9395549592ea87da4) +- [Dev Deps] update `tape` [`5e1b200`](https://github.com/inspect-js/is-symbol/commit/5e1b2008c910bcdabee299a1ac599143ea07c3f9) +- Only apps should have lockfiles. [`a191ff5`](https://github.com/inspect-js/is-symbol/commit/a191ff5f0320fc16db42fdaa40f0c21d4326255e) +- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`97c87ef`](https://github.com/inspect-js/is-symbol/commit/97c87ef52b966f211e231092a54ef6ed05c99a26) +- Test on `io.js` `v2.2` [`42560e4`](https://github.com/inspect-js/is-symbol/commit/42560e466e17cbbb9fa71c0121f4bbbcf266c887) +- [Dev Deps] Update `tape`, `eslint` [`149b2f2`](https://github.com/inspect-js/is-symbol/commit/149b2f20bde92b2da12ccfeb8988beb2dc95c37c) +- [Tests] fix test messages [`28bd1ed`](https://github.com/inspect-js/is-symbol/commit/28bd1eda310590e13ada19cbd718c85c25d8a0c5) +- Test up to `io.js` `v3.0` [`c0dcc98`](https://github.com/inspect-js/is-symbol/commit/c0dcc98313d17151ec043e5452df306618be865e) +- `node` now supports Symbols now. [`d1853ad`](https://github.com/inspect-js/is-symbol/commit/d1853adf6369ab9d4c4516bdb032c2e42f52f90a) +- [Dev Deps] update `tape` [`f7a6575`](https://github.com/inspect-js/is-symbol/commit/f7a6575fbdef13abcc412c63d22b56943ed85969) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`aae9c6a`](https://github.com/inspect-js/is-symbol/commit/aae9c6a724578659976ea74e11ec9fe35608607b) +- Test on `io.js` `v2.4` [`ab8f449`](https://github.com/inspect-js/is-symbol/commit/ab8f4492115270cc00a479915b02ac1bac75dfed) +- Test on `io.js` `v2.3` [`58ce871`](https://github.com/inspect-js/is-symbol/commit/58ce871674e857955b333aa057eeecd68b40e988) + +## [v1.0.1](https://github.com/inspect-js/is-symbol/compare/v1.0.0...v1.0.1) - 2015-01-26 + +### Commits + +- Correct package description. [`f4d15b9`](https://github.com/inspect-js/is-symbol/commit/f4d15b928b4b754b097a84f7c3ceac73c486aceb) + +## v1.0.0 - 2015-01-24 + +### Commits + +- Dotfiles. [`5d9a744`](https://github.com/inspect-js/is-symbol/commit/5d9a7441f724630070e9bd74a995191cafa1064b) +- Tests. [`8af5663`](https://github.com/inspect-js/is-symbol/commit/8af56631950dcee48b36f517837273193a6ba119) +- `make release` [`6293446`](https://github.com/inspect-js/is-symbol/commit/629344654a72e7fc8059607d6a86c64b002c3e5d) +- package.json [`7d4082c`](https://github.com/inspect-js/is-symbol/commit/7d4082ca9502118e70d24f526704d45a1a7f2067) +- Initial commit [`cbb179f`](https://github.com/inspect-js/is-symbol/commit/cbb179f677bd3dcb56ac5e3f0a7a9af503fd8952) +- Read me. [`099a775`](https://github.com/inspect-js/is-symbol/commit/099a775e7e751706283ae1cab7a8635c094773a9) +- Implementation. [`cb51248`](https://github.com/inspect-js/is-symbol/commit/cb51248eedaf55e0b8ad7dacdab179db2d76e96e) diff --git a/node_modules/is-symbol/LICENSE b/node_modules/is-symbol/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/is-symbol/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/is-symbol/README.md b/node_modules/is-symbol/README.md new file mode 100644 index 0000000..5432594 --- /dev/null +++ b/node_modules/is-symbol/README.md @@ -0,0 +1,45 @@ +# is-symbol [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![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 an ES6 Symbol value? + +## Example + +```js +var isSymbol = require('is-symbol'); +assert(!isSymbol(function () {})); +assert(!isSymbol(null)); +assert(!isSymbol(function* () { yield 42; return Infinity; }); + +assert(isSymbol(Symbol.iterator)); +assert(isSymbol(Symbol('foo'))); +assert(isSymbol(Symbol.for('foo'))); +assert(isSymbol(Object(Symbol('foo')))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-symbol +[2]: https://versionbadg.es/inspect-js/is-symbol.svg +[5]: https://david-dm.org/inspect-js/is-symbol.svg +[6]: https://david-dm.org/inspect-js/is-symbol +[7]: https://david-dm.org/inspect-js/is-symbol/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-symbol#info=devDependencies +[11]: https://nodei.co/npm/is-symbol.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-symbol.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-symbol.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-symbol +[codecov-image]: https://codecov.io/gh/inspect-js/is-symbol/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-symbol/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-symbol +[actions-url]: https://github.com/inspect-js/is-symbol/actions diff --git a/node_modules/is-symbol/index.js b/node_modules/is-symbol/index.js new file mode 100644 index 0000000..3d653e2 --- /dev/null +++ b/node_modules/is-symbol/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var toStr = Object.prototype.toString; +var hasSymbols = require('has-symbols')(); + +if (hasSymbols) { + var symToStr = Symbol.prototype.toString; + var symStringRegex = /^Symbol\(.*\)$/; + var isSymbolObject = function isRealSymbolObject(value) { + if (typeof value.valueOf() !== 'symbol') { + return false; + } + return symStringRegex.test(symToStr.call(value)); + }; + + module.exports = function isSymbol(value) { + if (typeof value === 'symbol') { + return true; + } + if (toStr.call(value) !== '[object Symbol]') { + return false; + } + try { + return isSymbolObject(value); + } catch (e) { + return false; + } + }; +} else { + + module.exports = function isSymbol(value) { + // this environment does not support Symbols. + return false && value; + }; +} diff --git a/node_modules/is-symbol/package.json b/node_modules/is-symbol/package.json new file mode 100644 index 0000000..4472b17 --- /dev/null +++ b/node_modules/is-symbol/package.json @@ -0,0 +1,77 @@ +{ + "name": "is-symbol", + "version": "1.0.4", + "description": "Determine if a value is an ES6 Symbol or not.", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx aud --production", + "lint": "eslint .", + "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://github.com/inspect-js/is-symbol.git" + }, + "keywords": [ + "symbol", + "es6", + "is", + "Symbol" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-symbol/issues" + }, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.2.1", + "eslint": "^7.26.0", + "nyc": "^10.3.2", + "object-inspect": "^1.10.3", + "safe-publish-latest": "^1.1.4", + "tape": "^5.2.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-symbol/test/index.js b/node_modules/is-symbol/test/index.js new file mode 100644 index 0000000..e01f035 --- /dev/null +++ b/node_modules/is-symbol/test/index.js @@ -0,0 +1,92 @@ +'use strict'; + +var test = require('tape'); +var isSymbol = require('../index'); + +var forEach = function (arr, func) { + var i; + for (i = 0; i < arr.length; ++i) { + func(arr[i], i, arr); + } +}; + +var hasSymbols = require('has-symbols')(); +var inspect = require('object-inspect'); +var debug = function (v, m) { return inspect(v) + ' ' + m; }; + +test('non-symbol values', function (t) { + var nonSymbols = [ + true, + false, + Object(true), + Object(false), + null, + undefined, + {}, + [], + /a/g, + 'string', + 42, + new Date(), + function () {}, + NaN + ]; + t.plan(nonSymbols.length); + forEach(nonSymbols, function (nonSymbol) { + t.equal(false, isSymbol(nonSymbol), debug(nonSymbol, 'is not a symbol')); + }); + t.end(); +}); + +test('faked symbol values', function (t) { + t.test('real symbol valueOf', { skip: !hasSymbols }, function (st) { + var fakeSymbol = { valueOf: function () { return Symbol('foo'); } }; + st.equal(false, isSymbol(fakeSymbol), 'object with valueOf returning a symbol is not a symbol'); + st.end(); + }); + + t.test('faked @@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (st) { + var fakeSymbol = { valueOf: function () { return Symbol('foo'); } }; + fakeSymbol[Symbol.toStringTag] = 'Symbol'; + st.equal(false, isSymbol(fakeSymbol), 'object with fake Symbol @@toStringTag and valueOf returning a symbol is not a symbol'); + var notSoFakeSymbol = { valueOf: function () { return 42; } }; + notSoFakeSymbol[Symbol.toStringTag] = 'Symbol'; + st.equal(false, isSymbol(notSoFakeSymbol), 'object with fake Symbol @@toStringTag and valueOf not returning a symbol is not a symbol'); + st.end(); + }); + + var fakeSymbolString = { toString: function () { return 'Symbol(foo)'; } }; + t.equal(false, isSymbol(fakeSymbolString), 'object with toString returning Symbol(foo) is not a symbol'); + + t.end(); +}); + +test('Symbol support', { skip: !hasSymbols }, function (t) { + t.test('well-known Symbols', function (st) { + var isWellKnown = function filterer(name) { + return name !== 'for' && name !== 'keyFor' && !(name in filterer); + }; + var wellKnownSymbols = Object.getOwnPropertyNames(Symbol).filter(isWellKnown); + wellKnownSymbols.forEach(function (name) { + var sym = Symbol[name]; + st.equal(true, isSymbol(sym), debug(sym, ' is a symbol')); + }); + st.end(); + }); + + t.test('user-created symbols', function (st) { + var symbols = [ + Symbol(), + Symbol('foo'), + Symbol['for']('foo'), + Object(Symbol('object')) + ]; + symbols.forEach(function (sym) { + st.equal(true, isSymbol(sym), debug(sym, ' is a symbol')); + }); + st.end(); + }); + + t.end(); +}); + diff --git a/node_modules/is-weakref/.eslintignore b/node_modules/is-weakref/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/is-weakref/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/is-weakref/.eslintrc b/node_modules/is-weakref/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/node_modules/is-weakref/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/is-weakref/.github/FUNDING.yml b/node_modules/is-weakref/.github/FUNDING.yml new file mode 100644 index 0000000..a9ccddf --- /dev/null +++ b/node_modules/is-weakref/.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-weakref +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-weakref/.nycrc b/node_modules/is-weakref/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/is-weakref/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/is-weakref/CHANGELOG.md b/node_modules/is-weakref/CHANGELOG.md new file mode 100644 index 0000000..573938d --- /dev/null +++ b/node_modules/is-weakref/CHANGELOG.md @@ -0,0 +1,54 @@ +# 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). + +## [v1.0.2](https://github.com/inspect-js/is-weakref/compare/v1.0.1...v1.0.2) - 2021-12-10 + +### Commits + +- [actions] reuse common workflows [`2375b1f`](https://github.com/inspect-js/is-weakref/commit/2375b1f9798b08c7af98481bbb38b4105835dacf) +- [meta] do not publish workflow files [`4c1be42`](https://github.com/inspect-js/is-weakref/commit/4c1be423afacabf2f3aa9e8bf02f668bdeaf3a20) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`7ec78ce`](https://github.com/inspect-js/is-weakref/commit/7ec78ce58c7553469eee97ae82fe147dfccde611) +- [readme] update URLs [`6306f09`](https://github.com/inspect-js/is-weakref/commit/6306f09a7df388150fb1d0b855b6f9e60165a457) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`7a1601e`](https://github.com/inspect-js/is-weakref/commit/7a1601e93ae50a791751a96d33073f5e65f3d3c9) +- [readme] add actions and codecov badges [`67ecd14`](https://github.com/inspect-js/is-weakref/commit/67ecd14b8b0192456932d1d54838accbf90ff5c0) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`1a5013b`](https://github.com/inspect-js/is-weakref/commit/1a5013bddcb9edc23025571810f9a2eebda53683) +- [actions] update codecov uploader [`b57b037`](https://github.com/inspect-js/is-weakref/commit/b57b037a547f3ecfa3d3f079a8015ec005c7181b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`da49017`](https://github.com/inspect-js/is-weakref/commit/da49017800d628c9bcd2f094d49783d6ee649c50) +- [meta] simplify "exports" [`9b88835`](https://github.com/inspect-js/is-weakref/commit/9b8883585506c135a3fcb9f55d0944a13b4eb3e6) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`c7e77f4`](https://github.com/inspect-js/is-weakref/commit/c7e77f495308f3385adfaa1f4ac78a2632e0bcde) +- [Dev Deps] update `eslint` [`417b29e`](https://github.com/inspect-js/is-weakref/commit/417b29e7ceacebe24aef15422544443f4b59e181) +- [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ [`b1b99f4`](https://github.com/inspect-js/is-weakref/commit/b1b99f45e0977d10f8472e9272e48a696145c2b1) +- [Deps] update `call-bind` [`aea342e`](https://github.com/inspect-js/is-weakref/commit/aea342e9e301deeb938e62b92a37cf991c5f7dbc) +- [actions] update workflows [`786c2d3`](https://github.com/inspect-js/is-weakref/commit/786c2d3dd4486acec09786220d3dd9fd48e70e93) + +## [v1.0.1](https://github.com/inspect-js/is-weakref/compare/v1.0.0...v1.0.1) - 2020-12-04 + +### Commits + +- [Tests] migrate tests to Github Actions [`05b4faa`](https://github.com/inspect-js/is-weakref/commit/05b4faa167c67f42c792e35c07adcb6b87e7dea0) +- [Tests] run `nyc` on all tests [`8df2e4b`](https://github.com/inspect-js/is-weakref/commit/8df2e4bd66bb6b7d55f389f28e6bb167fe1deb5a) +- [actions] add "Allow Edits" workflow [`4a716b8`](https://github.com/inspect-js/is-weakref/commit/4a716b8fcc025fe889a0f09ccaee7a9f748b1c66) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect` [`be23cf3`](https://github.com/inspect-js/is-weakref/commit/be23cf305f46db8b1c8a26d1c74b096fdba00056) +- [Refactor] use `call-bind` instead of `es-abstract` [`a933a96`](https://github.com/inspect-js/is-weakref/commit/a933a9643ddf7cddfd9f9f3cf44d675cc4c86ce5) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4473ed2`](https://github.com/inspect-js/is-weakref/commit/4473ed2e73fed47cd2fa42b8d9cac17e941d2c08) +- [readme] remove travis badge [`bd3bfcd`](https://github.com/inspect-js/is-weakref/commit/bd3bfcd2c187099d2215232a7621fb960e1e2807) + +## v1.0.0 - 2020-08-01 + +### Commits + +- Initial commit [`dd86394`](https://github.com/inspect-js/is-weakref/commit/dd86394d7da000724c6e17c79077879c381e9ea3) +- readme [`f4defca`](https://github.com/inspect-js/is-weakref/commit/f4defcac48d1d99b019b596ab26bd868de1adfe9) +- Tests [`13d8139`](https://github.com/inspect-js/is-weakref/commit/13d8139dedf424239daf357261c39d3f8c33d662) +- npm init [`55a2bb7`](https://github.com/inspect-js/is-weakref/commit/55a2bb7c53b893396a51da969e352702cafe9a0e) +- Implementation [`1ec84e3`](https://github.com/inspect-js/is-weakref/commit/1ec84e36de4315d44c8da540faa27836832bb0f3) +- [meta] add auto-changelog [`ab9ce44`](https://github.com/inspect-js/is-weakref/commit/ab9ce44be717312c5221bf3d2f3f6d2dd8c6ac88) +- [actions] add automatic rebasing / merge commit blocking [`3d3f4d5`](https://github.com/inspect-js/is-weakref/commit/3d3f4d54bed6e455b2a0d0f20c87d454bf78af26) +- [meta] add "funding"; create `FUNDING.yml` [`f35ef3d`](https://github.com/inspect-js/is-weakref/commit/f35ef3de16eb06447acf3c39bdc164ba0e7bdf45) +- [Tests] add `npm run lint` [`af2123d`](https://github.com/inspect-js/is-weakref/commit/af2123d4754c14f7befa66ba01e1d72858723651) +- [Tests] use shared travis-ci configs [`042b4de`](https://github.com/inspect-js/is-weakref/commit/042b4dec08d882ae9137f4ad05ae24a1457da0f8) +- Only apps should have lockfiles [`fcae604`](https://github.com/inspect-js/is-weakref/commit/fcae604cb1422faae9311dd4219032895c0a9a2e) diff --git a/node_modules/is-weakref/LICENSE b/node_modules/is-weakref/LICENSE new file mode 100644 index 0000000..707437b --- /dev/null +++ b/node_modules/is-weakref/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +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/is-weakref/README.md b/node_modules/is-weakref/README.md new file mode 100644 index 0000000..abbb978 --- /dev/null +++ b/node_modules/is-weakref/README.md @@ -0,0 +1,52 @@ +# is-weakref [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Is this value a JS WeakRef? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isWeakRef = require('is-weakref'); +assert(!isWeakRef(function () {})); +assert(!isWeakRef(null)); +assert(!isWeakRef(function* () { yield 42; return Infinity; }); +assert(!isWeakRef(Symbol('foo'))); +assert(!isWeakRef(1n)); +assert(!isWeakRef(Object(1n))); + +assert(!isWeakRef(new Set())); +assert(!isWeakRef(new WeakSet())); +assert(!isWeakRef(new Map())); +assert(!isWeakRef(new WeakMap())); + +assert(isWeakRef(new WeakRef({}))); + +class MyWeakRef extends WeakRef {} +assert(isWeakRef(new MyWeakRef({}))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/is-weakref +[npm-version-svg]: https://versionbadg.es/inspect-js/is-weakref.svg +[deps-svg]: https://david-dm.org/inspect-js/is-weakref.svg +[deps-url]: https://david-dm.org/inspect-js/is-weakref +[dev-deps-svg]: https://david-dm.org/inspect-js/is-weakref/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/is-weakref#info=devDependencies +[license-image]: https://img.shields.io/npm/l/is-weakref.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-weakref.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-weakref +[codecov-image]: https://codecov.io/gh/inspect-js/is-weakref/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-weakref/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-weakref +[actions-url]: https://github.com/inspect-js/is-weakref/actions diff --git a/node_modules/is-weakref/index.js b/node_modules/is-weakref/index.js new file mode 100644 index 0000000..90769f8 --- /dev/null +++ b/node_modules/is-weakref/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $deref = callBound('WeakRef.prototype.deref', true); + +module.exports = typeof WeakRef === 'undefined' + ? function isWeakRef(value) { // eslint-disable-line no-unused-vars + return false; + } + : function isWeakRef(value) { + if (!value || typeof value !== 'object') { + return false; + } + try { + $deref(value); + return true; + } catch (e) { + return false; + } + }; diff --git a/node_modules/is-weakref/package.json b/node_modules/is-weakref/package.json new file mode 100644 index 0000000..2d2a6e2 --- /dev/null +++ b/node_modules/is-weakref/package.json @@ -0,0 +1,63 @@ +{ + "name": "is-weakref", + "version": "1.0.2", + "description": "Is this value a JS WeakRef? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "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)\")\"", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/is-weakref.git" + }, + "keywords": [ + "weakref", + "weak", + "ref", + "finalization", + "finalization registry" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-weakref/issues" + }, + "homepage": "https://github.com/inspect-js/is-weakref#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.0.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^8.4.1", + "for-each": "^0.3.3", + "nyc": "^10.3.2", + "object-inspect": "^1.11.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.3.2" + }, + "dependencies": { + "call-bind": "^1.0.2" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/is-weakref/test/index.js b/node_modules/is-weakref/test/index.js new file mode 100644 index 0000000..c1c5b6f --- /dev/null +++ b/node_modules/is-weakref/test/index.js @@ -0,0 +1,26 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('for-each'); + +var isWeakRef = require('..'); + +test('isWeakRef', function (t) { + t.equal(typeof isWeakRef, 'function', 'is a function'); + + var nonWeakRefs = [undefined, null, true, false, 42, 0, Infinity, NaN, /a/g, function () {}, {}, []]; + forEach(nonWeakRefs, function (nonWeakRef) { + t.equal(isWeakRef(nonWeakRef), false, inspect(nonWeakRef) + ' is not a WeakRef'); + }); + + t.test('actual WeakRefs', { skip: typeof WeakRef === 'undefined' }, function (st) { + var ref = new WeakRef({}); + + st.equal(isWeakRef(ref), true, inspect(ref) + ' is a WeakRef'); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/isexe/.npmignore b/node_modules/isexe/.npmignore new file mode 100644 index 0000000..c1cb757 --- /dev/null +++ b/node_modules/isexe/.npmignore @@ -0,0 +1,2 @@ +.nyc_output/ +coverage/ diff --git a/node_modules/isexe/LICENSE b/node_modules/isexe/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/isexe/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/isexe/README.md b/node_modules/isexe/README.md new file mode 100644 index 0000000..35769e8 --- /dev/null +++ b/node_modules/isexe/README.md @@ -0,0 +1,51 @@ +# isexe + +Minimal module to check if a file is executable, and a normal file. + +Uses `fs.stat` and tests against the `PATHEXT` environment variable on +Windows. + +## USAGE + +```javascript +var isexe = require('isexe') +isexe('some-file-name', function (err, isExe) { + if (err) { + console.error('probably file does not exist or something', err) + } else if (isExe) { + console.error('this thing can be run') + } else { + console.error('cannot be run') + } +}) + +// same thing but synchronous, throws errors +var isExe = isexe.sync('some-file-name') + +// treat errors as just "not executable" +isexe('maybe-missing-file', { ignoreErrors: true }, callback) +var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true }) +``` + +## API + +### `isexe(path, [options], [callback])` + +Check if the path is executable. If no callback provided, and a +global `Promise` object is available, then a Promise will be returned. + +Will raise whatever errors may be raised by `fs.stat`, unless +`options.ignoreErrors` is set to true. + +### `isexe.sync(path, [options])` + +Same as `isexe` but returns the value and throws any errors raised. + +### Options + +* `ignoreErrors` Treat all errors as "no, this is not executable", but + don't raise them. +* `uid` Number to use as the user id +* `gid` Number to use as the group id +* `pathExt` List of path extensions to use instead of `PATHEXT` + environment variable on Windows. diff --git a/node_modules/isexe/index.js b/node_modules/isexe/index.js new file mode 100644 index 0000000..553fb32 --- /dev/null +++ b/node_modules/isexe/index.js @@ -0,0 +1,57 @@ +var fs = require('fs') +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = require('./windows.js') +} else { + core = require('./mode.js') +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} diff --git a/node_modules/isexe/mode.js b/node_modules/isexe/mode.js new file mode 100644 index 0000000..1995ea4 --- /dev/null +++ b/node_modules/isexe/mode.js @@ -0,0 +1,41 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} diff --git a/node_modules/isexe/package.json b/node_modules/isexe/package.json new file mode 100644 index 0000000..e452689 --- /dev/null +++ b/node_modules/isexe/package.json @@ -0,0 +1,31 @@ +{ + "name": "isexe", + "version": "2.0.0", + "description": "Minimal module to check if a file is executable.", + "main": "index.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "mkdirp": "^0.5.1", + "rimraf": "^2.5.0", + "tap": "^10.3.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/isexe.git" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/isaacs/isexe/issues" + }, + "homepage": "https://github.com/isaacs/isexe#readme" +} diff --git a/node_modules/isexe/test/basic.js b/node_modules/isexe/test/basic.js new file mode 100644 index 0000000..d926df6 --- /dev/null +++ b/node_modules/isexe/test/basic.js @@ -0,0 +1,221 @@ +var t = require('tap') +var fs = require('fs') +var path = require('path') +var fixture = path.resolve(__dirname, 'fixtures') +var meow = fixture + '/meow.cat' +var mine = fixture + '/mine.cat' +var ours = fixture + '/ours.cat' +var fail = fixture + '/fail.false' +var noent = fixture + '/enoent.exe' +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') + +var isWindows = process.platform === 'win32' +var hasAccess = typeof fs.access === 'function' +var winSkip = isWindows && 'windows' +var accessSkip = !hasAccess && 'no fs.access function' +var hasPromise = typeof Promise === 'function' +var promiseSkip = !hasPromise && 'no global Promise' + +function reset () { + delete require.cache[require.resolve('../')] + return require('../') +} + +t.test('setup fixtures', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n') + fs.chmodSync(meow, parseInt('0755', 8)) + fs.writeFileSync(fail, '#!/usr/bin/env false\n') + fs.chmodSync(fail, parseInt('0644', 8)) + fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n') + fs.chmodSync(mine, parseInt('0744', 8)) + fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n') + fs.chmodSync(ours, parseInt('0754', 8)) + t.end() +}) + +t.test('promise', { skip: promiseSkip }, function (t) { + var isexe = reset() + t.test('meow async', function (t) { + isexe(meow).then(function (is) { + t.ok(is) + t.end() + }) + }) + t.test('fail async', function (t) { + isexe(fail).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.test('noent async', function (t) { + isexe(noent).catch(function (er) { + t.ok(er) + t.end() + }) + }) + t.test('noent ignore async', function (t) { + isexe(noent, { ignoreErrors: true }).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.end() +}) + +t.test('no promise', function (t) { + global.Promise = null + var isexe = reset() + t.throws('try to meow a promise', function () { + isexe(meow) + }) + t.end() +}) + +t.test('access', { skip: accessSkip || winSkip }, function (t) { + runTest(t) +}) + +t.test('mode', { skip: winSkip }, function (t) { + delete fs.access + delete fs.accessSync + var isexe = reset() + t.ok(isexe.sync(ours, { uid: 0, gid: 0 })) + t.ok(isexe.sync(mine, { uid: 0, gid: 0 })) + runTest(t) +}) + +t.test('windows', function (t) { + global.TESTING_WINDOWS = true + var pathExt = '.EXE;.CAT;.CMD;.COM' + t.test('pathExt option', function (t) { + runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' }) + }) + t.test('pathExt env', function (t) { + process.env.PATHEXT = pathExt + runTest(t) + }) + t.test('no pathExt', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: '', skipFail: true }) + }) + t.test('pathext with empty entry', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: ';' + pathExt, skipFail: true }) + }) + t.end() +}) + +t.test('cleanup', function (t) { + rimraf.sync(fixture) + t.end() +}) + +function runTest (t, options) { + var isexe = reset() + + var optionsIgnore = Object.create(options || {}) + optionsIgnore.ignoreErrors = true + + if (!options || !options.skipFail) { + t.notOk(isexe.sync(fail, options)) + } + t.notOk(isexe.sync(noent, optionsIgnore)) + if (!options) { + t.ok(isexe.sync(meow)) + } else { + t.ok(isexe.sync(meow, options)) + } + + t.ok(isexe.sync(mine, options)) + t.ok(isexe.sync(ours, options)) + t.throws(function () { + isexe.sync(noent, options) + }) + + t.test('meow async', function (t) { + if (!options) { + isexe(meow, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } else { + isexe(meow, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } + }) + + t.test('mine async', function (t) { + isexe(mine, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + t.test('ours async', function (t) { + isexe(ours, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + if (!options || !options.skipFail) { + t.test('fail async', function (t) { + isexe(fail, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + } + + t.test('noent async', function (t) { + isexe(noent, options, function (er, is) { + t.ok(er) + t.notOk(is) + t.end() + }) + }) + + t.test('noent ignore async', function (t) { + isexe(noent, optionsIgnore, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.test('directory is not executable', function (t) { + isexe(__dirname, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.end() +} diff --git a/node_modules/isexe/windows.js b/node_modules/isexe/windows.js new file mode 100644 index 0000000..3499673 --- /dev/null +++ b/node_modules/isexe/windows.js @@ -0,0 +1,42 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} diff --git a/node_modules/js-yaml/CHANGELOG.md b/node_modules/js-yaml/CHANGELOG.md new file mode 100644 index 0000000..ff2375e --- /dev/null +++ b/node_modules/js-yaml/CHANGELOG.md @@ -0,0 +1,616 @@ +# 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). + + +## [4.1.0] - 2021-04-15 +### Added +- Types are now exported as `yaml.types.XXX`. +- Every type now has `options` property with original arguments kept as they were + (see `yaml.types.int.options` as an example). + +### Changed +- `Schema.extend()` now keeps old type order in case of conflicts + (e.g. Schema.extend([ a, b, c ]).extend([ b, a, d ]) is now ordered as `abcd` instead of `cbad`). + + +## [4.0.0] - 2021-01-03 +### Changed +- Check [migration guide](migrate_v3_to_v4.md) to see details for all breaking changes. +- Breaking: "unsafe" tags `!!js/function`, `!!js/regexp`, `!!js/undefined` are + moved to [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) package. +- Breaking: removed `safe*` functions. Use `load`, `loadAll`, `dump` + instead which are all now safe by default. +- `yaml.DEFAULT_SAFE_SCHEMA` and `yaml.DEFAULT_FULL_SCHEMA` are removed, use + `yaml.DEFAULT_SCHEMA` instead. +- `yaml.Schema.create(schema, tags)` is removed, use `schema.extend(tags)` instead. +- `!!binary` now always mapped to `Uint8Array` on load. +- Reduced nesting of `/lib` folder. +- Parse numbers according to YAML 1.2 instead of YAML 1.1 (`01234` is now decimal, + `0o1234` is octal, `1:23` is parsed as string instead of base60). +- `dump()` no longer quotes `:`, `[`, `]`, `(`, `)` except when necessary, #470, #557. +- Line and column in exceptions are now formatted as `(X:Y)` instead of + `at line X, column Y` (also present in compact format), #332. +- Code snippet created in exceptions now contains multiple lines with line numbers. +- `dump()` now serializes `undefined` as `null` in collections and removes keys with + `undefined` in mappings, #571. +- `dump()` with `skipInvalid=true` now serializes invalid items in collections as null. +- Custom tags starting with `!` are now dumped as `!tag` instead of `!`, #576. +- Custom tags starting with `tag:yaml.org,2002:` are now shorthanded using `!!`, #258. + +### Added +- Added `.mjs` (es modules) support. +- Added `quotingType` and `forceQuotes` options for dumper to configure + string literal style, #290, #529. +- Added `styles: { '!!null': 'empty' }` option for dumper + (serializes `{ foo: null }` as "`foo: `"), #570. +- Added `replacer` option (similar to option in JSON.stringify), #339. +- Custom `Tag` can now handle all tags or multiple tags with the same prefix, #385. + +### Fixed +- Astral characters are no longer encoded by `dump()`, #587. +- "duplicate mapping key" exception now points at the correct column, #452. +- Extra commas in flow collections (e.g. `[foo,,bar]`) now throw an exception + instead of producing null, #321. +- `__proto__` key no longer overrides object prototype, #164. +- Removed `bower.json`. +- Tags are now url-decoded in `load()` and url-encoded in `dump()` + (previously usage of custom non-ascii tags may have led to invalid YAML that can't be parsed). +- Anchors now work correctly with empty nodes, #301. +- Fix incorrect parsing of invalid block mapping syntax, #418. +- Throw an error if block sequence/mapping indent contains a tab, #80. + + +## [3.14.1] - 2020-12-07 +### Security +- Fix possible code execution in (already unsafe) `.load()` (in &anchor). + + +## [3.14.0] - 2020-05-22 +### Changed +- Support `safe/loadAll(input, options)` variant of call. +- CI: drop outdated nodejs versions. +- Dev deps bump. + +### Fixed +- Quote `=` in plain scalars #519. +- Check the node type for `!` tag in case user manually specifies it. +- Verify that there are no null-bytes in input. +- Fix wrong quote position when writing condensed flow, #526. + + +## [3.13.1] - 2019-04-05 +### Security +- Fix possible code execution in (already unsafe) `.load()`, #480. + + +## [3.13.0] - 2019-03-20 +### Security +- Security fix: `safeLoad()` can hang when arrays with nested refs + used as key. Now throws exception for nested arrays. #475. + + +## [3.12.2] - 2019-02-26 +### Fixed +- Fix `noArrayIndent` option for root level, #468. + + +## [3.12.1] - 2019-01-05 +### Added +- Added `noArrayIndent` option, #432. + + +## [3.12.0] - 2018-06-02 +### Changed +- Support arrow functions without a block statement, #421. + + +## [3.11.0] - 2018-03-05 +### Added +- Add arrow functions suport for `!!js/function`. + +### Fixed +- Fix dump in bin/octal/hex formats for negative integers, #399. + + +## [3.10.0] - 2017-09-10 +### Fixed +- Fix `condenseFlow` output (quote keys for sure, instead of spaces), #371, #370. +- Dump astrals as codepoints instead of surrogate pair, #368. + + +## [3.9.1] - 2017-07-08 +### Fixed +- Ensure stack is present for custom errors in node 7.+, #351. + + +## [3.9.0] - 2017-07-08 +### Added +- Add `condenseFlow` option (to create pretty URL query params), #346. + +### Fixed +- Support array return from safeLoadAll/loadAll, #350. + + +## [3.8.4] - 2017-05-08 +### Fixed +- Dumper: prevent space after dash for arrays that wrap, #343. + + +## [3.8.3] - 2017-04-05 +### Fixed +- Should not allow numbers to begin and end with underscore, #335. + + +## [3.8.2] - 2017-03-02 +### Fixed +- Fix `!!float 123` (integers) parse, #333. +- Don't allow leading zeros in floats (except 0, 0.xxx). +- Allow positive exponent without sign in floats. + + +## [3.8.1] - 2017-02-07 +### Changed +- Maintenance: update browserified build. + + +## [3.8.0] - 2017-02-07 +### Fixed +- Fix reported position for `duplicated mapping key` errors. + Now points to block start instead of block end. + (#243, thanks to @shockey). + + +## [3.7.0] - 2016-11-12 +### Added +- Support polymorphism for tags (#300, thanks to @monken). + +### Fixed +- Fix parsing of quotes followed by newlines (#304, thanks to @dplepage). + + +## [3.6.1] - 2016-05-11 +### Fixed +- Fix output cut on a pipe, #286. + + +## [3.6.0] - 2016-04-16 +### Fixed +- Dumper rewrite, fix multiple bugs with trailing `\n`. + Big thanks to @aepsilon! +- Loader: fix leading/trailing newlines in block scalars, @aepsilon. + + +## [3.5.5] - 2016-03-17 +### Fixed +- Date parse fix: don't allow dates with on digit in month and day, #268. + + +## [3.5.4] - 2016-03-09 +### Added +- `noCompatMode` for dumper, to disable quoting YAML 1.1 values. + + +## [3.5.3] - 2016-02-11 +### Changed +- Maintenance release. + + +## [3.5.2] - 2016-01-11 +### Changed +- Maintenance: missed comma in bower config. + + +## [3.5.1] - 2016-01-11 +### Changed +- Removed `inherit` dependency, #239. +- Better browserify workaround for esprima load. +- Demo rewrite. + + +## [3.5.0] - 2016-01-10 +### Fixed +- Dumper. Fold strings only, #217. +- Dumper. `norefs` option, to clone linked objects, #229. +- Loader. Throw a warning for duplicate keys, #166. +- Improved browserify support (mark `esprima` & `Buffer` excluded). + + +## [3.4.6] - 2015-11-26 +### Changed +- Use standalone `inherit` to keep browserified files clear. + + +## [3.4.5] - 2015-11-23 +### Added +- Added `lineWidth` option to dumper. + + +## [3.4.4] - 2015-11-21 +### Fixed +- Fixed floats dump (missed dot for scientific format), #220. +- Allow non-printable characters inside quoted scalars, #192. + + +## [3.4.3] - 2015-10-10 +### Changed +- Maintenance release - deps bump (esprima, argparse). + + +## [3.4.2] - 2015-09-09 +### Fixed +- Fixed serialization of duplicated entries in sequences, #205. + Thanks to @vogelsgesang. + + +## [3.4.1] - 2015-09-05 +### Fixed +- Fixed stacktrace handling in generated errors, for browsers (FF/IE). + + +## [3.4.0] - 2015-08-23 +### Changed +- Don't throw on warnings anymore. Use `onWarning` option to catch. +- Throw error on unknown tags (was warning before). +- Reworked internals of error class. + +### Fixed +- Fixed multiline keys dump, #197. Thanks to @tcr. +- Fixed heading line breaks in some scalars (regression). + + +## [3.3.1] - 2015-05-13 +### Added +- Added `.sortKeys` dumper option, thanks to @rjmunro. + +### Fixed +- Fixed astral characters support, #191. + + +## [3.3.0] - 2015-04-26 +### Changed +- Significantly improved long strings formatting in dumper, thanks to @isaacs. +- Strip BOM if exists. + + +## [3.2.7] - 2015-02-19 +### Changed +- Maintenance release. +- Updated dependencies. +- HISTORY.md -> CHANGELOG.md + + +## [3.2.6] - 2015-02-07 +### Fixed +- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE). +- Fixed demo dates dump (#113, thanks to @Hypercubed). + + +## [3.2.5] - 2014-12-28 +### Fixed +- Fixed resolving of all built-in types on empty nodes. +- Fixed invalid warning on empty lines within quoted scalars and flow collections. +- Fixed bug: Tag on an empty node didn't resolve in some cases. + + +## [3.2.4] - 2014-12-19 +### Fixed +- Fixed resolving of !!null tag on an empty node. + + +## [3.2.3] - 2014-11-08 +### Fixed +- Implemented dumping of objects with circular and cross references. +- Partially fixed aliasing of constructed objects. (see issue #141 for details) + + +## [3.2.2] - 2014-09-07 +### Fixed +- Fixed infinite loop on unindented block scalars. +- Rewritten base64 encode/decode in binary type, to keep code licence clear. + + +## [3.2.1] - 2014-08-24 +### Fixed +- Nothig new. Just fix npm publish error. + + +## [3.2.0] - 2014-08-24 +### Added +- Added input piping support to CLI. + +### Fixed +- Fixed typo, that could cause hand on initial indent (#139). + + +## [3.1.0] - 2014-07-07 +### Changed +- 1.5x-2x speed boost. +- Removed deprecated `require('xxx.yml')` support. +- Significant code cleanup and refactoring. +- Internal API changed. If you used custom types - see updated examples. + Others are not affected. +- Even if the input string has no trailing line break character, + it will be parsed as if it has one. +- Added benchmark scripts. +- Moved bower files to /dist folder +- Bugfixes. + + +## [3.0.2] - 2014-02-27 +### Fixed +- Fixed bug: "constructor" string parsed as `null`. + + +## [3.0.1] - 2013-12-22 +### Fixed +- Fixed parsing of literal scalars. (issue #108) +- Prevented adding unnecessary spaces in object dumps. (issue #68) +- Fixed dumping of objects with very long (> 1024 in length) keys. + + +## [3.0.0] - 2013-12-16 +### Changed +- Refactored code. Changed API for custom types. +- Removed output colors in CLI, dump json by default. +- Removed big dependencies from browser version (esprima, buffer). Load `esprima` manually, if `!!js/function` needed. `!!bin` now returns Array in browser +- AMD support. +- Don't quote dumped strings because of `-` & `?` (if not first char). +- __Deprecated__ loading yaml files via `require()`, as not recommended + behaviour for node. + + +## [2.1.3] - 2013-10-16 +### Fixed +- Fix wrong loading of empty block scalars. + + +## [2.1.2] - 2013-10-07 +### Fixed +- Fix unwanted line breaks in folded scalars. + + +## [2.1.1] - 2013-10-02 +### Fixed +- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 +- Fixed reader bug in JSON-like sequences/mappings. + + +## [2.1.0] - 2013-06-05 +### Added +- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), + JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). +- Add `skipInvalid` dumper option. + +### Changed +- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` + and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. +- Use `safeLoad` for `require` extension. + +### Fixed +- Bug fix: export `NIL` constant from the public interface. + + +## [2.0.5] - 2013-04-26 +### Security +- Close security issue in !!js/function constructor. + Big thanks to @nealpoole for security audit. + + +## [2.0.4] - 2013-04-08 +### Changed +- Updated .npmignore to reduce package size + + +## [2.0.3] - 2013-02-26 +### Fixed +- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) + + +## [2.0.2] - 2013-02-15 +### Fixed +- Fixed input validation: tabs are printable characters. + + +## [2.0.1] - 2013-02-09 +### Fixed +- Fixed error, when options not passed to function cass + + +## [2.0.0] - 2013-02-09 +### Changed +- Full rewrite. New architecture. Fast one-stage parsing. +- Changed custom types API. +- Added YAML dumper. + + +## [1.0.3] - 2012-11-05 +### Fixed +- Fixed utf-8 files loading. + + +## [1.0.2] - 2012-08-02 +### Fixed +- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. +- Fix timstamps incorectly parsed in local time when no time part specified. + + +## [1.0.1] - 2012-07-07 +### Fixed +- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. +- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. + + +## [1.0.0] - 2012-07-01 +### Changed +- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. + Fixes #42. +- `require(filename)` now returns a single document and throws an Error if + file contains more than one document. +- CLI was merged back from js-yaml.bin + + +## [0.3.7] - 2012-02-28 +### Fixed +- Fix export of `addConstructor()`. Closes #39. + + +## [0.3.6] - 2012-02-22 +### Changed +- Removed AMD parts - too buggy to use. Need help to rewrite from scratch + +### Fixed +- Removed YUI compressor warning (renamed `double` variable). Closes #40. + + +## [0.3.5] - 2012-01-10 +### Fixed +- Workagound for .npmignore fuckup under windows. Thanks to airportyh. + + +## [0.3.4] - 2011-12-24 +### Fixed +- Fixes str[] for oldIEs support. +- Adds better has change support for browserified demo. +- improves compact output of Error. Closes #33. + + +## [0.3.3] - 2011-12-20 +### Added +- adds `compact` stringification of Errors. + +### Changed +- jsyaml executable moved to separate module. + + +## [0.3.2] - 2011-12-16 +### Added +- Added jsyaml executable. +- Added !!js/function support. Closes #12. + +### Fixed +- Fixes ug with block style scalars. Closes #26. +- All sources are passing JSLint now. +- Fixes bug in Safari. Closes #28. +- Fixes bug in Opers. Closes #29. +- Improves browser support. Closes #20. + + +## [0.3.1] - 2011-11-18 +### Added +- Added AMD support for browserified version. +- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. +- Added !!js/regexp and !!js/undefined types. Partially solves #12. + +### Changed +- Wrapped browserified js-yaml into closure. + +### Fixed +- Fixed the resolvement of non-specific tags. Closes #17. +- Fixed !!set mapping. +- Fixed month parse in dates. Closes #19. + + +## [0.3.0] - 2011-11-09 +### Added +- Added browserified version. Closes #13. +- Added live demo of browserified version. +- Ported some of the PyYAML tests. See #14. + +### Fixed +- Removed JS.Class dependency. Closes #3. +- Fixed timestamp bug when fraction was given. + + +## [0.2.2] - 2011-11-06 +### Fixed +- Fixed crash on docs without ---. Closes #8. +- Fixed multiline string parse +- Fixed tests/comments for using array as key + + +## [0.2.1] - 2011-11-02 +### Fixed +- Fixed short file read (<4k). Closes #9. + + +## [0.2.0] - 2011-11-02 +### Changed +- First public release + + +[4.1.0]: https://github.com/nodeca/js-yaml/compare/4.0.0...4.1.0 +[4.0.0]: https://github.com/nodeca/js-yaml/compare/3.14.0...4.0.0 +[3.14.0]: https://github.com/nodeca/js-yaml/compare/3.13.1...3.14.0 +[3.13.1]: https://github.com/nodeca/js-yaml/compare/3.13.0...3.13.1 +[3.13.0]: https://github.com/nodeca/js-yaml/compare/3.12.2...3.13.0 +[3.12.2]: https://github.com/nodeca/js-yaml/compare/3.12.1...3.12.2 +[3.12.1]: https://github.com/nodeca/js-yaml/compare/3.12.0...3.12.1 +[3.12.0]: https://github.com/nodeca/js-yaml/compare/3.11.0...3.12.0 +[3.11.0]: https://github.com/nodeca/js-yaml/compare/3.10.0...3.11.0 +[3.10.0]: https://github.com/nodeca/js-yaml/compare/3.9.1...3.10.0 +[3.9.1]: https://github.com/nodeca/js-yaml/compare/3.9.0...3.9.1 +[3.9.0]: https://github.com/nodeca/js-yaml/compare/3.8.4...3.9.0 +[3.8.4]: https://github.com/nodeca/js-yaml/compare/3.8.3...3.8.4 +[3.8.3]: https://github.com/nodeca/js-yaml/compare/3.8.2...3.8.3 +[3.8.2]: https://github.com/nodeca/js-yaml/compare/3.8.1...3.8.2 +[3.8.1]: https://github.com/nodeca/js-yaml/compare/3.8.0...3.8.1 +[3.8.0]: https://github.com/nodeca/js-yaml/compare/3.7.0...3.8.0 +[3.7.0]: https://github.com/nodeca/js-yaml/compare/3.6.1...3.7.0 +[3.6.1]: https://github.com/nodeca/js-yaml/compare/3.6.0...3.6.1 +[3.6.0]: https://github.com/nodeca/js-yaml/compare/3.5.5...3.6.0 +[3.5.5]: https://github.com/nodeca/js-yaml/compare/3.5.4...3.5.5 +[3.5.4]: https://github.com/nodeca/js-yaml/compare/3.5.3...3.5.4 +[3.5.3]: https://github.com/nodeca/js-yaml/compare/3.5.2...3.5.3 +[3.5.2]: https://github.com/nodeca/js-yaml/compare/3.5.1...3.5.2 +[3.5.1]: https://github.com/nodeca/js-yaml/compare/3.5.0...3.5.1 +[3.5.0]: https://github.com/nodeca/js-yaml/compare/3.4.6...3.5.0 +[3.4.6]: https://github.com/nodeca/js-yaml/compare/3.4.5...3.4.6 +[3.4.5]: https://github.com/nodeca/js-yaml/compare/3.4.4...3.4.5 +[3.4.4]: https://github.com/nodeca/js-yaml/compare/3.4.3...3.4.4 +[3.4.3]: https://github.com/nodeca/js-yaml/compare/3.4.2...3.4.3 +[3.4.2]: https://github.com/nodeca/js-yaml/compare/3.4.1...3.4.2 +[3.4.1]: https://github.com/nodeca/js-yaml/compare/3.4.0...3.4.1 +[3.4.0]: https://github.com/nodeca/js-yaml/compare/3.3.1...3.4.0 +[3.3.1]: https://github.com/nodeca/js-yaml/compare/3.3.0...3.3.1 +[3.3.0]: https://github.com/nodeca/js-yaml/compare/3.2.7...3.3.0 +[3.2.7]: https://github.com/nodeca/js-yaml/compare/3.2.6...3.2.7 +[3.2.6]: https://github.com/nodeca/js-yaml/compare/3.2.5...3.2.6 +[3.2.5]: https://github.com/nodeca/js-yaml/compare/3.2.4...3.2.5 +[3.2.4]: https://github.com/nodeca/js-yaml/compare/3.2.3...3.2.4 +[3.2.3]: https://github.com/nodeca/js-yaml/compare/3.2.2...3.2.3 +[3.2.2]: https://github.com/nodeca/js-yaml/compare/3.2.1...3.2.2 +[3.2.1]: https://github.com/nodeca/js-yaml/compare/3.2.0...3.2.1 +[3.2.0]: https://github.com/nodeca/js-yaml/compare/3.1.0...3.2.0 +[3.1.0]: https://github.com/nodeca/js-yaml/compare/3.0.2...3.1.0 +[3.0.2]: https://github.com/nodeca/js-yaml/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/nodeca/js-yaml/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/nodeca/js-yaml/compare/2.1.3...3.0.0 +[2.1.3]: https://github.com/nodeca/js-yaml/compare/2.1.2...2.1.3 +[2.1.2]: https://github.com/nodeca/js-yaml/compare/2.1.1...2.1.2 +[2.1.1]: https://github.com/nodeca/js-yaml/compare/2.1.0...2.1.1 +[2.1.0]: https://github.com/nodeca/js-yaml/compare/2.0.5...2.1.0 +[2.0.5]: https://github.com/nodeca/js-yaml/compare/2.0.4...2.0.5 +[2.0.4]: https://github.com/nodeca/js-yaml/compare/2.0.3...2.0.4 +[2.0.3]: https://github.com/nodeca/js-yaml/compare/2.0.2...2.0.3 +[2.0.2]: https://github.com/nodeca/js-yaml/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/nodeca/js-yaml/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/nodeca/js-yaml/compare/1.0.3...2.0.0 +[1.0.3]: https://github.com/nodeca/js-yaml/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/nodeca/js-yaml/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/nodeca/js-yaml/compare/1.0.0...1.0.1 +[1.0.0]: https://github.com/nodeca/js-yaml/compare/0.3.7...1.0.0 +[0.3.7]: https://github.com/nodeca/js-yaml/compare/0.3.6...0.3.7 +[0.3.6]: https://github.com/nodeca/js-yaml/compare/0.3.5...0.3.6 +[0.3.5]: https://github.com/nodeca/js-yaml/compare/0.3.4...0.3.5 +[0.3.4]: https://github.com/nodeca/js-yaml/compare/0.3.3...0.3.4 +[0.3.3]: https://github.com/nodeca/js-yaml/compare/0.3.2...0.3.3 +[0.3.2]: https://github.com/nodeca/js-yaml/compare/0.3.1...0.3.2 +[0.3.1]: https://github.com/nodeca/js-yaml/compare/0.3.0...0.3.1 +[0.3.0]: https://github.com/nodeca/js-yaml/compare/0.2.2...0.3.0 +[0.2.2]: https://github.com/nodeca/js-yaml/compare/0.2.1...0.2.2 +[0.2.1]: https://github.com/nodeca/js-yaml/compare/0.2.0...0.2.1 +[0.2.0]: https://github.com/nodeca/js-yaml/releases/tag/0.2.0 diff --git a/node_modules/js-yaml/LICENSE b/node_modules/js-yaml/LICENSE new file mode 100644 index 0000000..09d3a29 --- /dev/null +++ b/node_modules/js-yaml/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2011-2015 by Vitaly Puzrin + +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/js-yaml/README.md b/node_modules/js-yaml/README.md new file mode 100644 index 0000000..3cbc4bd --- /dev/null +++ b/node_modules/js-yaml/README.md @@ -0,0 +1,246 @@ +JS-YAML - YAML 1.2 parser / writer for JavaScript +================================================= + +[![CI](https://github.com/nodeca/js-yaml/workflows/CI/badge.svg?branch=master)](https://github.com/nodeca/js-yaml/actions) +[![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml) + +__[Online Demo](http://nodeca.github.com/js-yaml/)__ + + +This is an implementation of [YAML](http://yaml.org/), a human-friendly data +serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was +completely rewritten from scratch. Now it's very fast, and supports 1.2 spec. + + +Installation +------------ + +### YAML module for node.js + +``` +npm install js-yaml +``` + + +### CLI executable + +If you want to inspect your YAML files from CLI, install js-yaml globally: + +``` +npm install -g js-yaml +``` + +#### Usage + +``` +usage: js-yaml [-h] [-v] [-c] [-t] file + +Positional arguments: + file File with YAML document(s) + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -c, --compact Display errors in compact mode + -t, --trace Show stack trace on error +``` + + +API +--- + +Here we cover the most 'useful' methods. If you need advanced details (creating +your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples) +for more info. + +``` javascript +const yaml = require('js-yaml'); +const fs = require('fs'); + +// Get document, or throw exception on error +try { + const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8')); + console.log(doc); +} catch (e) { + console.log(e); +} +``` + + +### load (string [ , options ]) + +Parses `string` as single YAML document. Returns either a +plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does +not support regexps, functions and undefined. + +options: + +- `filename` _(default: null)_ - string to be used as a file path in + error/warning messages. +- `onWarning` _(default: null)_ - function to call on warning messages. + Loader will call this function with an instance of `YAMLException` for each warning. +- `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use. + - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: + http://www.yaml.org/spec/1.2/spec.html#id2802346 + - `JSON_SCHEMA` - all JSON-supported types: + http://www.yaml.org/spec/1.2/spec.html#id2803231 + - `CORE_SCHEMA` - same as `JSON_SCHEMA`: + http://www.yaml.org/spec/1.2/spec.html#id2804923 + - `DEFAULT_SCHEMA` - all supported YAML types. +- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error. + +NOTE: This function **does not** understand multi-document sources, it throws +exception on those. + +NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. +So, the JSON schema is not as strictly defined in the YAML specification. +It allows numbers in any notation, use `Null` and `NULL` as `null`, etc. +The core schema also has no such restrictions. It allows binary notation for integers. + + +### loadAll (string [, iterator] [, options ]) + +Same as `load()`, but understands multi-document sources. Applies +`iterator` to each document if specified, or returns array of documents. + +``` javascript +const yaml = require('js-yaml'); + +yaml.loadAll(data, function (doc) { + console.log(doc); +}); +``` + + +### dump (object [ , options ]) + +Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will +throw an exception if you try to dump regexps or functions. However, you can +disable exceptions by setting the `skipInvalid` option to `true`. + +options: + +- `indent` _(default: 2)_ - indentation width to use (in spaces). +- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements +- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function + in the safe schema) and skip pairs and single values with such types. +- `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from + block to flow style for collections. -1 means block style everwhere +- `styles` - "tag" => "style" map. Each tag may have own set of styles. +- `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use. +- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a + function, use the function to sort the keys. +- `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width. +- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references +- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older + yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 +- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded. +- `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters. +- `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to. +- `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`). + +The following table show availlable styles (e.g. "canonical", +"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml +output is shown on the right side after `=>` (default setting) or `->`: + +``` none +!!null + "canonical" -> "~" + "lowercase" => "null" + "uppercase" -> "NULL" + "camelcase" -> "Null" + +!!int + "binary" -> "0b1", "0b101010", "0b1110001111010" + "octal" -> "0o1", "0o52", "0o16172" + "decimal" => "1", "42", "7290" + "hexadecimal" -> "0x1", "0x2A", "0x1C7A" + +!!bool + "lowercase" => "true", "false" + "uppercase" -> "TRUE", "FALSE" + "camelcase" -> "True", "False" + +!!float + "lowercase" => ".nan", '.inf' + "uppercase" -> ".NAN", '.INF' + "camelcase" -> ".NaN", '.Inf' +``` + +Example: + +``` javascript +dump(object, { + 'styles': { + '!!null': 'canonical' // dump null as ~ + }, + 'sortKeys': true // sort object keys +}); +``` + +Supported YAML types +-------------------- + +The list of standard YAML tags and corresponding JavaScript types. See also +[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and +[YAML types repository](http://yaml.org/type/). + +``` +!!null '' # null +!!bool 'yes' # bool +!!int '3...' # number +!!float '3.14...' # number +!!binary '...base64...' # buffer +!!timestamp 'YYYY-...' # date +!!omap [ ... ] # array of key-value pairs +!!pairs [ ... ] # array or array pairs +!!set { ... } # array of objects with given keys and null values +!!str '...' # string +!!seq [ ... ] # array +!!map { ... } # object +``` + +**JavaScript-specific tags** + +See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for +extra types. + + +Caveats +------- + +Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects +or arrays as keys, and stringifies (by calling `toString()` method) them at the +moment of adding them. + +``` yaml +--- +? [ foo, bar ] +: - baz +? { foo: bar } +: - baz + - baz +``` + +``` javascript +{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } +``` + +Also, reading of properties on implicit block mapping keys is not supported yet. +So, the following YAML document cannot be loaded. + +``` yaml +&anchor foo: + foo: bar + *anchor: duplicate key + baz: bat + *anchor: duplicate key +``` + + +js-yaml for enterprise +---------------------- + +Available as part of the Tidelift Subscription + +The maintainers of js-yaml 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-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/js-yaml/bin/js-yaml.js b/node_modules/js-yaml/bin/js-yaml.js new file mode 100755 index 0000000..a182f1a --- /dev/null +++ b/node_modules/js-yaml/bin/js-yaml.js @@ -0,0 +1,126 @@ +#!/usr/bin/env node + + +'use strict'; + +/*eslint-disable no-console*/ + + +var fs = require('fs'); +var argparse = require('argparse'); +var yaml = require('..'); + + +//////////////////////////////////////////////////////////////////////////////// + + +var cli = new argparse.ArgumentParser({ + prog: 'js-yaml', + add_help: true +}); + +cli.add_argument('-v', '--version', { + action: 'version', + version: require('../package.json').version +}); + +cli.add_argument('-c', '--compact', { + help: 'Display errors in compact mode', + action: 'store_true' +}); + +// deprecated (not needed after we removed output colors) +// option suppressed, but not completely removed for compatibility +cli.add_argument('-j', '--to-json', { + help: argparse.SUPPRESS, + dest: 'json', + action: 'store_true' +}); + +cli.add_argument('-t', '--trace', { + help: 'Show stack trace on error', + action: 'store_true' +}); + +cli.add_argument('file', { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + default: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parse_args(); + + +//////////////////////////////////////////////////////////////////////////////// + +function readFile(filename, encoding, callback) { + if (options.file === '-') { + // read from stdin + + var chunks = []; + + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }); + + process.stdin.on('end', function () { + return callback(null, Buffer.concat(chunks).toString(encoding)); + }); + } else { + fs.readFile(filename, encoding, callback); + } +} + +readFile(options.file, 'utf8', function (error, input) { + var output, isYaml; + + if (error) { + if (error.code === 'ENOENT') { + console.error('File not found: ' + options.file); + process.exit(2); + } + + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + + try { + output = JSON.parse(input); + isYaml = false; + } catch (err) { + if (err instanceof SyntaxError) { + try { + output = []; + yaml.loadAll(input, function (doc) { output.push(doc); }, {}); + isYaml = true; + + if (output.length === 0) output = null; + else if (output.length === 1) output = output[0]; + + } catch (e) { + if (options.trace && err.stack) console.error(e.stack); + else console.error(e.toString(options.compact)); + + process.exit(1); + } + } else { + console.error( + options.trace && err.stack || + err.message || + String(err)); + + process.exit(1); + } + } + + if (isYaml) console.log(JSON.stringify(output, null, ' ')); + else console.log(yaml.dump(output)); +}); diff --git a/node_modules/js-yaml/dist/js-yaml.js b/node_modules/js-yaml/dist/js-yaml.js new file mode 100644 index 0000000..4cc0ddf --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.js @@ -0,0 +1,3874 @@ + +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jsyaml = {})); +}(this, (function (exports) { 'use strict'; + + function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); + } + + + function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); + } + + + function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; + } + + + function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; + } + + + function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; + } + + + function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); + } + + + var isNothing_1 = isNothing; + var isObject_1 = isObject; + var toArray_1 = toArray; + var repeat_1 = repeat; + var isNegativeZero_1 = isNegativeZero; + var extend_1 = extend; + + var common = { + isNothing: isNothing_1, + isObject: isObject_1, + toArray: toArray_1, + repeat: repeat_1, + isNegativeZero: isNegativeZero_1, + extend: extend_1 + }; + + // YAML error class. http://stackoverflow.com/questions/8458984 + + + function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; + + if (!exception.mark) return message; + + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } + + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; + } + + return message + ' ' + where; + } + + + function YAMLException$1(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } + } + + + // Inherit from Error + YAMLException$1.prototype = Object.create(Error.prototype); + YAMLException$1.prototype.constructor = YAMLException$1; + + + YAMLException$1.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); + }; + + + var exception = YAMLException$1; + + // get snippet for a single line, respecting maxLength + function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; + } + + + function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; + } + + + function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); + } + + + var snippet = makeSnippet; + + var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' + ]; + + var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' + ]; + + function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; + } + + function Type$1(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } + } + + var type = Type$1; + + /*eslint-disable max-len*/ + + + + + + function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; + } + + + function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; + } + + + function Schema$1(definition) { + return this.extend(definition); + } + + + Schema$1.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new exception('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type$1.loadKind && type$1.loadKind !== 'scalar') { + throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type$1.multi) { + throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema$1.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; + }; + + + var schema = Schema$1; + + var str = new type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } + }); + + var seq = new type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } + }); + + var map = new type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } + }); + + var failsafe = new schema({ + explicit: [ + str, + seq, + map + ] + }); + + function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); + } + + function constructYamlNull() { + return null; + } + + function isNull(object) { + return object === null; + } + + var _null = new type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' + }); + + function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); + } + + function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; + } + + function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; + } + + var bool = new type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' + }); + + function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); + } + + function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); + } + + function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); + } + + function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; + } + + function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); + } + + function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); + } + + var int = new type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } + }); + + var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + + function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; + } + + function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); + } + + + var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + + function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; + } + + function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); + } + + var float = new type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' + }); + + var json = failsafe.extend({ + implicit: [ + _null, + bool, + int, + float + ] + }); + + var core = json; + + var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + + var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + + function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; + } + + function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; + } + + function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); + } + + var timestamp = new type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp + }); + + function resolveYamlMerge(data) { + return data === '<<' || data === null; + } + + var merge = new type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge + }); + + /*eslint-disable no-bitwise*/ + + + + + + // [ 64, 65, 66 ] -> [ padding, CR, LF ] + var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + + function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; + } + + function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); + } + + function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; + } + + function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; + } + + var binary = new type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary + }); + + var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; + var _toString$2 = Object.prototype.toString; + + function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString$2.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty$3.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; + } + + function constructYamlOmap(data) { + return data !== null ? data : []; + } + + var omap = new type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap + }); + + var _toString$1 = Object.prototype.toString; + + function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString$1.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; + } + + function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; + } + + var pairs = new type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs + }); + + var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + + function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty$2.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; + } + + function constructYamlSet(data) { + return data !== null ? data : {}; + } + + var set = new type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet + }); + + var _default = core.extend({ + implicit: [ + timestamp, + merge + ], + explicit: [ + binary, + omap, + pairs, + set + ] + }); + + /*eslint-disable max-len,no-use-before-define*/ + + + + + + + + var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + + + var CONTEXT_FLOW_IN = 1; + var CONTEXT_FLOW_OUT = 2; + var CONTEXT_BLOCK_IN = 3; + var CONTEXT_BLOCK_OUT = 4; + + + var CHOMPING_CLIP = 1; + var CHOMPING_STRIP = 2; + var CHOMPING_KEEP = 3; + + + var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; + var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; + var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; + var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + + function _class(obj) { return Object.prototype.toString.call(obj); } + + function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); + } + + function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); + } + + function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); + } + + function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; + } + + function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; + } + + function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; + } + + function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; + } + + function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; + } + + function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); + } + + var simpleEscapeCheck = new Array(256); // integer, for fast access + var simpleEscapeMap = new Array(256); + for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); + } + + + function State$1(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || _default; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + + } + + + function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = snippet(mark); + + return new exception(message, mark); + } + + function throwError(state, message) { + throw generateError(state, message); + } + + function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } + } + + + var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty$1.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } + }; + + + function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } + } + + function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty$1.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } + } + + function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty$1.call(overridableKeys, keyNode) && + _hasOwnProperty$1.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; + } + + function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; + } + + function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; + } + + function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; + } + + function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } + } + + + function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; + } + + function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); + } + + function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); + } + + function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); + } + + function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; + } + + function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; + } + + function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; + } + + function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; + } + + function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; + } + + function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; + } + + function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; + } + + function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } + } + + + function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State$1(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; + } + + + function loadAll$1(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } + } + + + function load$1(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new exception('expected a single document in the stream, but found more'); + } + + + var loadAll_1 = loadAll$1; + var load_1 = load$1; + + var loader = { + loadAll: loadAll_1, + load: load_1 + }; + + /*eslint-disable no-use-before-define*/ + + + + + + var _toString = Object.prototype.toString; + var _hasOwnProperty = Object.prototype.hasOwnProperty; + + var CHAR_BOM = 0xFEFF; + var CHAR_TAB = 0x09; /* Tab */ + var CHAR_LINE_FEED = 0x0A; /* LF */ + var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ + var CHAR_SPACE = 0x20; /* Space */ + var CHAR_EXCLAMATION = 0x21; /* ! */ + var CHAR_DOUBLE_QUOTE = 0x22; /* " */ + var CHAR_SHARP = 0x23; /* # */ + var CHAR_PERCENT = 0x25; /* % */ + var CHAR_AMPERSAND = 0x26; /* & */ + var CHAR_SINGLE_QUOTE = 0x27; /* ' */ + var CHAR_ASTERISK = 0x2A; /* * */ + var CHAR_COMMA = 0x2C; /* , */ + var CHAR_MINUS = 0x2D; /* - */ + var CHAR_COLON = 0x3A; /* : */ + var CHAR_EQUALS = 0x3D; /* = */ + var CHAR_GREATER_THAN = 0x3E; /* > */ + var CHAR_QUESTION = 0x3F; /* ? */ + var CHAR_COMMERCIAL_AT = 0x40; /* @ */ + var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ + var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ + var CHAR_GRAVE_ACCENT = 0x60; /* ` */ + var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ + var CHAR_VERTICAL_LINE = 0x7C; /* | */ + var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + + var ESCAPE_SEQUENCES = {}; + + ESCAPE_SEQUENCES[0x00] = '\\0'; + ESCAPE_SEQUENCES[0x07] = '\\a'; + ESCAPE_SEQUENCES[0x08] = '\\b'; + ESCAPE_SEQUENCES[0x09] = '\\t'; + ESCAPE_SEQUENCES[0x0A] = '\\n'; + ESCAPE_SEQUENCES[0x0B] = '\\v'; + ESCAPE_SEQUENCES[0x0C] = '\\f'; + ESCAPE_SEQUENCES[0x0D] = '\\r'; + ESCAPE_SEQUENCES[0x1B] = '\\e'; + ESCAPE_SEQUENCES[0x22] = '\\"'; + ESCAPE_SEQUENCES[0x5C] = '\\\\'; + ESCAPE_SEQUENCES[0x85] = '\\N'; + ESCAPE_SEQUENCES[0xA0] = '\\_'; + ESCAPE_SEQUENCES[0x2028] = '\\L'; + ESCAPE_SEQUENCES[0x2029] = '\\P'; + + var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' + ]; + + var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + + function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; + } + + function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; + } + + + var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + + function State(options) { + this.schema = options['schema'] || _default; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; + } + + // Indents every line in a string. Empty lines (\n only) are not indented. + function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; + } + + function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); + } + + function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; + } + + // [33] s-white ::= s-space | s-tab + function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; + } + + // Returns true if the character can be printed without escaping. + // From YAML 1.2: "any allowed characters known to be non-printable + // should also be escaped. [However,] This isn’t mandatory" + // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. + function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); + } + + // [34] ns-char ::= nb-char - s-white + // [27] nb-char ::= c-printable - b-char - c-byte-order-mark + // [26] b-char ::= b-line-feed | b-carriage-return + // Including s-white (for some reason, examples doesn't match specs in this aspect) + // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark + function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; + } + + // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out + // c = flow-in ⇒ ns-plain-safe-in + // c = block-key ⇒ ns-plain-safe-out + // c = flow-key ⇒ ns-plain-safe-in + // [128] ns-plain-safe-out ::= ns-char + // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator + // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) + // | ( /* An ns-char preceding */ “#” ) + // | ( “:” /* Followed by an ns-plain-safe(c) */ ) + function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' + } + + // Simplified test for values allowed as the first character in plain style. + function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; + } + + // Simplified test for values allowed as the last character in plain style. + function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; + } + + // Same as 'string'.codePointAt(pos), but works in older browsers. + function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; + } + + // Determines whether block indentation indicator is required. + function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); + } + + var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + + // Determines which scalar styles are possible and returns the preferred style. + // lineWidth = -1 => no limit. + // Pre-conditions: str.length > 0. + // Post-conditions: + // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. + // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). + // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). + function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + + // Note: line breaking/folding is implemented for only the folded style. + // NB. We drop the last trailing newline (if any) of a returned block scalar + // since the dumper adds its own newline. This always works: + // • No ending newline => unaffected; already using strip "-" chomping. + // • Ending newline => removed then restored. + // Importantly, this keeps the "+" chomp indicator from gaining an extra line. + function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string) + '"'; + default: + throw new exception('impossible error: invalid scalar style'); + } + }()); + } + + // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. + function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; + } + + // (See the note for writeScalar.) + function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; + } + + // Note: a long line without a suitable break point will exceed the width limit. + // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. + function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; + } + + // Greedy line breaking. + // Picks the longest line under the limit each time, + // otherwise settles for the shortest line over the limit. + // NB. More-indented lines *cannot* be folded, as that would add an extra \n. + function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner + } + + // Escapes a double-quoted string. + function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; + } + + function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; + } + + function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. + } + + function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; + } + + function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new exception('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. + } + + function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; + } + + // Serializes `object` and writes it to global `result`. + // Returns true on success, or false on invalid object. + // + function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new exception('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; + } + + function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); + } + + function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } + } + + function dump$1(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; + } + + var dump_1 = dump$1; + + var dumper = { + dump: dump_1 + }; + + function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; + } + + + var Type = type; + var Schema = schema; + var FAILSAFE_SCHEMA = failsafe; + var JSON_SCHEMA = json; + var CORE_SCHEMA = core; + var DEFAULT_SCHEMA = _default; + var load = loader.load; + var loadAll = loader.loadAll; + var dump = dumper.dump; + var YAMLException = exception; + + // Re-export all types in case user wants to create custom schema + var types = { + binary: binary, + float: float, + map: map, + null: _null, + pairs: pairs, + set: set, + timestamp: timestamp, + bool: bool, + int: int, + merge: merge, + omap: omap, + seq: seq, + str: str + }; + + // Removed functions from JS-YAML 3.0.x + var safeLoad = renamed('safeLoad', 'load'); + var safeLoadAll = renamed('safeLoadAll', 'loadAll'); + var safeDump = renamed('safeDump', 'dump'); + + var jsYaml = { + Type: Type, + Schema: Schema, + FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, + JSON_SCHEMA: JSON_SCHEMA, + CORE_SCHEMA: CORE_SCHEMA, + DEFAULT_SCHEMA: DEFAULT_SCHEMA, + load: load, + loadAll: loadAll, + dump: dump, + YAMLException: YAMLException, + types: types, + safeLoad: safeLoad, + safeLoadAll: safeLoadAll, + safeDump: safeDump + }; + + exports.CORE_SCHEMA = CORE_SCHEMA; + exports.DEFAULT_SCHEMA = DEFAULT_SCHEMA; + exports.FAILSAFE_SCHEMA = FAILSAFE_SCHEMA; + exports.JSON_SCHEMA = JSON_SCHEMA; + exports.Schema = Schema; + exports.Type = Type; + exports.YAMLException = YAMLException; + exports.default = jsYaml; + exports.dump = dump; + exports.load = load; + exports.loadAll = loadAll; + exports.safeDump = safeDump; + exports.safeLoad = safeLoad; + exports.safeLoadAll = safeLoadAll; + exports.types = types; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/js-yaml/dist/js-yaml.min.js b/node_modules/js-yaml/dist/js-yaml.min.js new file mode 100644 index 0000000..bdd8eef --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.min.js @@ -0,0 +1,2 @@ +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})}(this,(function(e){"use strict";function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2);s<0&&(s=o.length-1);var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"];var p=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),x=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var I=/^[-+]?[0-9]+e/;var S=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!x.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return i=e.toString(10),I.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),O=b.extend({implicit:[A,v,C,S]}),j=O,T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var F=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==T.exec(e)||null!==N.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=T.exec(e))&&(t=N.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var E=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var L=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=M;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=M,a=0,l=[];for(t=0;t>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=M;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),_=Object.prototype.hasOwnProperty,D=Object.prototype.toString;var U=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],l=e;for(t=0,n=l.length;t>10),56320+(e-65536&1023))}for(var ie=new Array(256),re=new Array(256),oe=0;oe<256;oe++)ie[oe]=te(oe)?1:0,re[oe]=te(oe);function ae(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function le(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=c(n),new o(t,n)}function ce(e,t){throw le(e,t)}function se(e,t){e.onWarning&&e.onWarning.call(null,le(e,t))}var ue={YAML:function(e,t,n){var i,r,o;null!==e.version&&ce(e,"duplication of %YAML directive"),1!==n.length&&ce(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&ce(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&ce(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&se(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&ce(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],G.test(i)||ce(e,"ill-formed tag handle (first argument) of the TAG directive"),P.call(e.tagMap,i)&&ce(e,'there is a previously declared suffix for "'+i+'" tag handle'),V.test(r)||ce(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){ce(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function pe(e,t,n,i){var r,o,a,l;if(t1&&(e.result+=n.repeat("\n",t-1))}function be(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),45===i)&&z(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,ge(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,we(e,t,3,!1,!0),a.push(e.result),ge(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)ce(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),we(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(de(e,f,d,h,g,m,a,l,c),h=g=m=null),ge(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)ce(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===o?ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?ce(e,"repeat of an indentation width identifier"):(p=t+o-1,u=!0)}if(Q(a)){do{a=e.input.charCodeAt(++e.position)}while(Q(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!J(a)&&0!==a)}for(;0!==a;){for(he(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!u||e.lineIndentp&&(p=e.lineIndent),J(a))f++;else{if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=ee(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:ce(e,"expected hexadecimal character");e.result+=ne(o),e.position++}else ce(e,"unknown escape sequence");n=i=e.position}else J(l)?(pe(e,n,i,!0),ye(e,ge(e,!1,t)),n=i=e.position):e.position===e.lineStart&&me(e)?ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ce(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!z(i)&&!X(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),P.call(e.anchorMap,n)||ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ge(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(z(u=e.input.charCodeAt(e.position))||X(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(z(i=e.input.charCodeAt(e.position+1))||n&&X(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(z(i=e.input.charCodeAt(e.position+1))||n&&X(i))break}else if(35===u){if(z(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&me(e)||n&&X(u))break;if(J(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,ge(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}}a&&(pe(e,r,o,!1),ye(e,e.line-l),r=o=e.position,a=!1),Q(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return pe(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||ce(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&be(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&ce(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function ke(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ge(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&ce(e,"directive name must not be less than one character in length");0!==r;){for(;Q(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!J(r));break}if(J(r))break;for(t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&he(e),P.call(ue,n)?ue[n](e,n,i):se(e,'unknown document directive "'+n+'"')}ge(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ge(e,!0,-1)):a&&ce(e,"directives end mark is expected"),we(e,e.lineIndent-1,4,!1,!0),ge(e,!0,-1),e.checkLineBreaks&&H.test(e.input.slice(o,e.position))&&se(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&me(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ge(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Re(e){return/^\n* /.test(e)}function Be(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=De(s=Ye(e,0))&&s!==Oe&&!_e(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!_e(e)&&58!==e}(Ye(e,e.length-1));if(t||a)for(c=0;c=65536?c+=2:c++){if(!De(u=Ye(e,c)))return 5;m=m&&qe(u,p,l),p=u}else{for(c=0;c=65536?c+=2:c++){if(10===(u=Ye(e,c)))f=!0,h&&(d=d||c-g-1>i&&" "!==e[g+1],g=c);else if(!De(u))return 5;m=m&&qe(u,p,l),p=u}d=d||h&&c-g-1>i&&" "!==e[g+1]}return f||d?n>9&&Re(e)?5:a?2===o?5:2:d?4:3:!m||a||r(e)?2===o?5:2:1}function Ke(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Te.indexOf(t)||Ne.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel;switch(Be(t,c,e.indent,l,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+Pe(t,e.indent)+We(Me(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,He(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0];var l;for(;i=r.exec(e);){var c=i[1],s=i[2];n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+He(s,t),a=n}return o}(t,l),a));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=Ye(e,r),!(t=je[i])&&De(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Fe(i);return n}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function Pe(e,t){var n=Re(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function We(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function He(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function $e(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function Ve(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Ge(e,n,!1)||Ge(e,n,!0);var c,s=Ie.call(e.dump),u=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var p,f,d="[object Object]"===s||"[object Array]"===s;if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=Le(e,t)),Ve(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ve(e,t,a,!1,!1)&&(c+=l+=e.dump));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?$e(e,t-1,e.dump,r):$e(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i",e.dump=c+" "+e.dump)}return!0}function Ze(e,t){var n,i,r=[],o=[];for(Je(e,r,o),n=0,i=o.length;n maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} + + +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; +} + + +function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); +} + + +var snippet = makeSnippet; + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type$1(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +var type = Type$1; + +/*eslint-disable max-len*/ + + + + + +function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema$1(definition) { + return this.extend(definition); +} + + +Schema$1.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new exception('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type$1.loadKind && type$1.loadKind !== 'scalar') { + throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type$1.multi) { + throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type$1) { + if (!(type$1 instanceof type)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema$1.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; +}; + + +var schema = Schema$1; + +var str = new type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + +var seq = new type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + +var map = new type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + +var failsafe = new schema({ + explicit: [ + str, + seq, + map + ] +}); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +var _null = new type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +var bool = new type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +var int = new type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +var float = new type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + +var json = failsafe.extend({ + implicit: [ + _null, + bool, + int, + float + ] +}); + +var core = json; + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +var timestamp = new type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +var merge = new type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +/*eslint-disable no-bitwise*/ + + + + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +} + +var binary = new type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; +var _toString$2 = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString$2.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty$3.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +var omap = new type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +var _toString$1 = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString$1.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +var pairs = new type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty$2.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +var set = new type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + +var _default = core.extend({ + implicit: [ + timestamp, + merge + ], + explicit: [ + binary, + omap, + pairs, + set + ] +}); + +/*eslint-disable max-len,no-use-before-define*/ + + + + + + + +var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State$1(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || _default; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = snippet(mark); + + return new exception(message, mark); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty$1.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty$1.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty$1.call(overridableKeys, keyNode) && + _hasOwnProperty$1.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State$1(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll$1(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load$1(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new exception('expected a single document in the stream, but found more'); +} + + +var loadAll_1 = loadAll$1; +var load_1 = load$1; + +var loader = { + loadAll: loadAll_1, + load: load_1 +}; + +/*eslint-disable no-use-before-define*/ + + + + + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || _default; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} + +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string) + '"'; + default: + throw new exception('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new exception('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new exception('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump$1(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; +} + +var dump_1 = dump$1; + +var dumper = { + dump: dump_1 +}; + +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; +} + + +var Type = type; +var Schema = schema; +var FAILSAFE_SCHEMA = failsafe; +var JSON_SCHEMA = json; +var CORE_SCHEMA = core; +var DEFAULT_SCHEMA = _default; +var load = loader.load; +var loadAll = loader.loadAll; +var dump = dumper.dump; +var YAMLException = exception; + +// Re-export all types in case user wants to create custom schema +var types = { + binary: binary, + float: float, + map: map, + null: _null, + pairs: pairs, + set: set, + timestamp: timestamp, + bool: bool, + int: int, + merge: merge, + omap: omap, + seq: seq, + str: str +}; + +// Removed functions from JS-YAML 3.0.x +var safeLoad = renamed('safeLoad', 'load'); +var safeLoadAll = renamed('safeLoadAll', 'loadAll'); +var safeDump = renamed('safeDump', 'dump'); + +var jsYaml = { + Type: Type, + Schema: Schema, + FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, + JSON_SCHEMA: JSON_SCHEMA, + CORE_SCHEMA: CORE_SCHEMA, + DEFAULT_SCHEMA: DEFAULT_SCHEMA, + load: load, + loadAll: loadAll, + dump: dump, + YAMLException: YAMLException, + types: types, + safeLoad: safeLoad, + safeLoadAll: safeLoadAll, + safeDump: safeDump +}; + +export default jsYaml; +export { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types }; diff --git a/node_modules/js-yaml/index.js b/node_modules/js-yaml/index.js new file mode 100644 index 0000000..bcb7eba --- /dev/null +++ b/node_modules/js-yaml/index.js @@ -0,0 +1,47 @@ +'use strict'; + + +var loader = require('./lib/loader'); +var dumper = require('./lib/dumper'); + + +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; +} + + +module.exports.Type = require('./lib/type'); +module.exports.Schema = require('./lib/schema'); +module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe'); +module.exports.JSON_SCHEMA = require('./lib/schema/json'); +module.exports.CORE_SCHEMA = require('./lib/schema/core'); +module.exports.DEFAULT_SCHEMA = require('./lib/schema/default'); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.dump = dumper.dump; +module.exports.YAMLException = require('./lib/exception'); + +// Re-export all types in case user wants to create custom schema +module.exports.types = { + binary: require('./lib/type/binary'), + float: require('./lib/type/float'), + map: require('./lib/type/map'), + null: require('./lib/type/null'), + pairs: require('./lib/type/pairs'), + set: require('./lib/type/set'), + timestamp: require('./lib/type/timestamp'), + bool: require('./lib/type/bool'), + int: require('./lib/type/int'), + merge: require('./lib/type/merge'), + omap: require('./lib/type/omap'), + seq: require('./lib/type/seq'), + str: require('./lib/type/str') +}; + +// Removed functions from JS-YAML 3.0.x +module.exports.safeLoad = renamed('safeLoad', 'load'); +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); +module.exports.safeDump = renamed('safeDump', 'dump'); diff --git a/node_modules/js-yaml/lib/common.js b/node_modules/js-yaml/lib/common.js new file mode 100644 index 0000000..25ef7d8 --- /dev/null +++ b/node_modules/js-yaml/lib/common.js @@ -0,0 +1,59 @@ +'use strict'; + + +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); +} + + +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); +} + + +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; +} + + +function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; +} + + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; +} + + +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} + + +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; diff --git a/node_modules/js-yaml/lib/dumper.js b/node_modules/js-yaml/lib/dumper.js new file mode 100644 index 0000000..f357a6a --- /dev/null +++ b/node_modules/js-yaml/lib/dumper.js @@ -0,0 +1,965 @@ +'use strict'; + +/*eslint-disable no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var DEFAULT_SCHEMA = require('./schema/default'); + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} + +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); + + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; + + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; + + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } + + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; +} + +module.exports.dump = dump; diff --git a/node_modules/js-yaml/lib/exception.js b/node_modules/js-yaml/lib/exception.js new file mode 100644 index 0000000..7f62daa --- /dev/null +++ b/node_modules/js-yaml/lib/exception.js @@ -0,0 +1,55 @@ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + + +function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; + + if (!exception.mark) return message; + + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } + + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; + } + + return message + ' ' + where; +} + + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); +}; + + +module.exports = YAMLException; diff --git a/node_modules/js-yaml/lib/loader.js b/node_modules/js-yaml/lib/loader.js new file mode 100644 index 0000000..39f13f5 --- /dev/null +++ b/node_modules/js-yaml/lib/loader.js @@ -0,0 +1,1727 @@ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var makeSnippet = require('./snippet'); +var DEFAULT_SCHEMA = require('./schema/default'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; + + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = makeSnippet(mark); + + return new YAMLException(message, mark); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; + } + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } + + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } + + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; diff --git a/node_modules/js-yaml/lib/schema.js b/node_modules/js-yaml/lib/schema.js new file mode 100644 index 0000000..65b41f4 --- /dev/null +++ b/node_modules/js-yaml/lib/schema.js @@ -0,0 +1,121 @@ +'use strict'; + +/*eslint-disable max-len*/ + +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; + } + }); + + result[newIndex] = currentType; + }); + + return result; +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + return this.extend(definition); +} + + +Schema.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; + + if (definition instanceof Type) { + // Schema.extend(type) + explicit.push(definition); + + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); + + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + + } else { + throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } + + implicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + + if (type.multi) { + throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); + + explicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); + + var result = Object.create(Schema.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; +}; + + +module.exports = Schema; diff --git a/node_modules/js-yaml/lib/schema/core.js b/node_modules/js-yaml/lib/schema/core.js new file mode 100644 index 0000000..608b26d --- /dev/null +++ b/node_modules/js-yaml/lib/schema/core.js @@ -0,0 +1,11 @@ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +module.exports = require('./json'); diff --git a/node_modules/js-yaml/lib/schema/default.js b/node_modules/js-yaml/lib/schema/default.js new file mode 100644 index 0000000..3af0520 --- /dev/null +++ b/node_modules/js-yaml/lib/schema/default.js @@ -0,0 +1,22 @@ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +module.exports = require('./core').extend({ + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); diff --git a/node_modules/js-yaml/lib/schema/failsafe.js b/node_modules/js-yaml/lib/schema/failsafe.js new file mode 100644 index 0000000..b7a33eb --- /dev/null +++ b/node_modules/js-yaml/lib/schema/failsafe.js @@ -0,0 +1,17 @@ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); diff --git a/node_modules/js-yaml/lib/schema/json.js b/node_modules/js-yaml/lib/schema/json.js new file mode 100644 index 0000000..b73df78 --- /dev/null +++ b/node_modules/js-yaml/lib/schema/json.js @@ -0,0 +1,19 @@ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +module.exports = require('./failsafe').extend({ + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); diff --git a/node_modules/js-yaml/lib/snippet.js b/node_modules/js-yaml/lib/snippet.js new file mode 100644 index 0000000..00e2133 --- /dev/null +++ b/node_modules/js-yaml/lib/snippet.js @@ -0,0 +1,101 @@ +'use strict'; + + +var common = require('./common'); + + +// get snippet for a single line, respecting maxLength +function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} + + +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; +} + + +function makeSnippet(mark, options) { + options = Object.create(options || null); + + if (!mark.buffer) return null; + + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); + + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); +} + + +module.exports = makeSnippet; diff --git a/node_modules/js-yaml/lib/type.js b/node_modules/js-yaml/lib/type.js new file mode 100644 index 0000000..5e57877 --- /dev/null +++ b/node_modules/js-yaml/lib/type.js @@ -0,0 +1,66 @@ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; diff --git a/node_modules/js-yaml/lib/type/binary.js b/node_modules/js-yaml/lib/type/binary.js new file mode 100644 index 0000000..e152351 --- /dev/null +++ b/node_modules/js-yaml/lib/type/binary.js @@ -0,0 +1,125 @@ +'use strict'; + +/*eslint-disable no-bitwise*/ + + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + return new Uint8Array(result); +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); diff --git a/node_modules/js-yaml/lib/type/bool.js b/node_modules/js-yaml/lib/type/bool.js new file mode 100644 index 0000000..cb77459 --- /dev/null +++ b/node_modules/js-yaml/lib/type/bool.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/float.js b/node_modules/js-yaml/lib/type/float.js new file mode 100644 index 0000000..74d77ec --- /dev/null +++ b/node_modules/js-yaml/lib/type/float.js @@ -0,0 +1,97 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/int.js b/node_modules/js-yaml/lib/type/int.js new file mode 100644 index 0000000..3fe3a44 --- /dev/null +++ b/node_modules/js-yaml/lib/type/int.js @@ -0,0 +1,156 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } + + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); diff --git a/node_modules/js-yaml/lib/type/map.js b/node_modules/js-yaml/lib/type/map.js new file mode 100644 index 0000000..f327bee --- /dev/null +++ b/node_modules/js-yaml/lib/type/map.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); diff --git a/node_modules/js-yaml/lib/type/merge.js b/node_modules/js-yaml/lib/type/merge.js new file mode 100644 index 0000000..ae08a86 --- /dev/null +++ b/node_modules/js-yaml/lib/type/merge.js @@ -0,0 +1,12 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); diff --git a/node_modules/js-yaml/lib/type/null.js b/node_modules/js-yaml/lib/type/null.js new file mode 100644 index 0000000..315ca4e --- /dev/null +++ b/node_modules/js-yaml/lib/type/null.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/type/omap.js b/node_modules/js-yaml/lib/type/omap.js new file mode 100644 index 0000000..b2b5323 --- /dev/null +++ b/node_modules/js-yaml/lib/type/omap.js @@ -0,0 +1,44 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); diff --git a/node_modules/js-yaml/lib/type/pairs.js b/node_modules/js-yaml/lib/type/pairs.js new file mode 100644 index 0000000..74b5240 --- /dev/null +++ b/node_modules/js-yaml/lib/type/pairs.js @@ -0,0 +1,53 @@ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); diff --git a/node_modules/js-yaml/lib/type/seq.js b/node_modules/js-yaml/lib/type/seq.js new file mode 100644 index 0000000..be8f77f --- /dev/null +++ b/node_modules/js-yaml/lib/type/seq.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); diff --git a/node_modules/js-yaml/lib/type/set.js b/node_modules/js-yaml/lib/type/set.js new file mode 100644 index 0000000..f885a32 --- /dev/null +++ b/node_modules/js-yaml/lib/type/set.js @@ -0,0 +1,29 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); diff --git a/node_modules/js-yaml/lib/type/str.js b/node_modules/js-yaml/lib/type/str.js new file mode 100644 index 0000000..27acc10 --- /dev/null +++ b/node_modules/js-yaml/lib/type/str.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); diff --git a/node_modules/js-yaml/lib/type/timestamp.js b/node_modules/js-yaml/lib/type/timestamp.js new file mode 100644 index 0000000..8fa9c58 --- /dev/null +++ b/node_modules/js-yaml/lib/type/timestamp.js @@ -0,0 +1,88 @@ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); diff --git a/node_modules/js-yaml/package.json b/node_modules/js-yaml/package.json new file mode 100644 index 0000000..17574da --- /dev/null +++ b/node_modules/js-yaml/package.json @@ -0,0 +1,66 @@ +{ + "name": "js-yaml", + "version": "4.1.0", + "description": "YAML 1.2 parser and serializer", + "keywords": [ + "yaml", + "parser", + "serializer", + "pyyaml" + ], + "author": "Vladimir Zapparov ", + "contributors": [ + "Aleksey V Zapparov (http://www.ixti.net/)", + "Vitaly Puzrin (https://github.com/puzrin)", + "Martin Grenfell (http://got-ravings.blogspot.com)" + ], + "license": "MIT", + "repository": "nodeca/js-yaml", + "files": [ + "index.js", + "lib/", + "bin/", + "dist/" + ], + "bin": { + "js-yaml": "bin/js-yaml.js" + }, + "module": "./dist/js-yaml.mjs", + "exports": { + ".": { + "import": "./dist/js-yaml.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "lint": "eslint .", + "test": "npm run lint && mocha", + "coverage": "npm run lint && nyc mocha && nyc report --reporter html", + "demo": "npm run lint && node support/build_demo.js", + "gh-demo": "npm run demo && gh-pages -d demo -f", + "browserify": "rollup -c support/rollup.config.js", + "prepublishOnly": "npm run gh-demo" + }, + "unpkg": "dist/js-yaml.min.js", + "jsdelivr": "dist/js-yaml.min.js", + "dependencies": { + "argparse": "^2.0.1" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.0.0", + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "codemirror": "^5.13.4", + "eslint": "^7.0.0", + "fast-check": "^2.8.0", + "gh-pages": "^3.1.0", + "mocha": "^8.2.1", + "nyc": "^15.1.0", + "rollup": "^2.34.1", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-terser": "^7.0.2", + "shelljs": "^0.8.4" + } +} diff --git a/node_modules/json-schema-traverse/.eslintrc.yml b/node_modules/json-schema-traverse/.eslintrc.yml new file mode 100644 index 0000000..ab1762d --- /dev/null +++ b/node_modules/json-schema-traverse/.eslintrc.yml @@ -0,0 +1,27 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + complexity: [2, 13] + curly: [2, multi-or-nest, consistent] + dot-location: [2, property] + dot-notation: 2 + indent: [2, 2, SwitchCase: 1] + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 diff --git a/node_modules/json-schema-traverse/.travis.yml b/node_modules/json-schema-traverse/.travis.yml new file mode 100644 index 0000000..7ddce74 --- /dev/null +++ b/node_modules/json-schema-traverse/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "4" + - "6" + - "7" + - "8" +after_script: + - coveralls < coverage/lcov.info diff --git a/node_modules/json-schema-traverse/LICENSE b/node_modules/json-schema-traverse/LICENSE new file mode 100644 index 0000000..7f15435 --- /dev/null +++ b/node_modules/json-schema-traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +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/json-schema-traverse/README.md b/node_modules/json-schema-traverse/README.md new file mode 100644 index 0000000..d5ccaf4 --- /dev/null +++ b/node_modules/json-schema-traverse/README.md @@ -0,0 +1,83 @@ +# json-schema-traverse +Traverse JSON Schema passing each schema object to callback + +[![Build Status](https://travis-ci.org/epoberezkin/json-schema-traverse.svg?branch=master)](https://travis-ci.org/epoberezkin/json-schema-traverse) +[![npm version](https://badge.fury.io/js/json-schema-traverse.svg)](https://www.npmjs.com/package/json-schema-traverse) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) + + +## Install + +``` +npm install json-schema-traverse +``` + + +## Usage + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + properties: { + foo: {type: 'string'}, + bar: {type: 'integer'} + } +}; + +traverse(schema, {cb}); +// cb is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} + +// Or: + +traverse(schema, {cb: {pre, post}}); +// pre is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} +// +// post is called 3 times with: +// 1. {type: 'string'} +// 2. {type: 'integer'} +// 3. root schema + +``` + +Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. + +Callback is passed these parameters: + +- _schema_: the current schema object +- _JSON pointer_: from the root schema to the current schema object +- _root schema_: the schema passed to `traverse` object +- _parent JSON pointer_: from the root schema to the parent schema object (see below) +- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) +- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema +- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` + + +## Traverse objects in all unknown keywords + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + mySchema: { + minimum: 1, + maximum: 2 + } +}; + +traverse(schema, {allKeys: true, cb}); +// cb is called 2 times with: +// 1. root schema +// 2. mySchema +``` + +Without option `allKeys: true` callback will be called only with root schema. + + +## License + +[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/node_modules/json-schema-traverse/index.js b/node_modules/json-schema-traverse/index.js new file mode 100644 index 0000000..d4a18df --- /dev/null +++ b/node_modules/json-schema-traverse/index.js @@ -0,0 +1,89 @@ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + // Legacy support for v0.3.1 and earlier. + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + + cb = opts.cb || cb; + var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; + var post = cb.post || function() {}; + + _traverse(opts, pre, post, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i +``` + +This will create a global `JSON5` variable. + +## API +The JSON5 API is compatible with the [JSON API]. + +[JSON API]: +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON + +### JSON5.parse() +Parses a JSON5 string, constructing the JavaScript value or object described by +the string. An optional reviver function can be provided to perform a +transformation on the resulting object before it is returned. + +#### Syntax + JSON5.parse(text[, reviver]) + +#### Parameters +- `text`: The string to parse as JSON5. +- `reviver`: If a function, this prescribes how the value originally produced by + parsing is transformed, before being returned. + +#### Return value +The object corresponding to the given JSON5 text. + +### JSON5.stringify() +Converts a JavaScript value to a JSON5 string, optionally replacing values if a +replacer function is specified, or optionally including only the specified +properties if a replacer array is specified. + +#### Syntax + JSON5.stringify(value[, replacer[, space]]) + JSON5.stringify(value[, options]) + +#### Parameters +- `value`: The value to convert to a JSON5 string. +- `replacer`: A function that alters the behavior of the stringification + process, or an array of String and Number objects that serve as a whitelist + for selecting/filtering the properties of the value object to be included in + the JSON5 string. If this value is null or not provided, all properties of the + object are included in the resulting JSON5 string. +- `space`: A String or Number object that's used to insert white space into the + output JSON5 string for readability purposes. If this is a Number, it + indicates the number of space characters to use as white space; this number is + capped at 10 (if it is greater, the value is just 10). Values less than 1 + indicate that no space should be used. If this is a String, the string (or the + first 10 characters of the string, if it's longer than that) is used as white + space. If this parameter is not provided (or is null), no white space is used. + If white space is used, trailing commas will be used in objects and arrays. +- `options`: An object with the following properties: + - `replacer`: Same as the `replacer` parameter. + - `space`: Same as the `space` parameter. + - `quote`: A String representing the quote character to use when serializing + strings. + +#### Return value +A JSON5 string representing the value. + +### Node.js `require()` JSON5 files +When using Node.js, you can `require()` JSON5 files by adding the following +statement. + +```js +require('json5/lib/register') +``` + +Then you can load a JSON5 file with a Node.js `require()` statement. For +example: + +```js +const config = require('./config.json5') +``` + +## CLI +Since JSON is more widely used than JSON5, this package includes a CLI for +converting JSON5 to JSON and for validating the syntax of JSON5 documents. + +### Installation +```sh +npm install --global json5 +``` + +### Usage +```sh +json5 [options] +``` + +If `` is not provided, then STDIN is used. + +#### Options: +- `-s`, `--space`: The number of spaces to indent or `t` for tabs +- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT +- `-v`, `--validate`: Validate JSON5 but do not output JSON +- `-V`, `--version`: Output the version number +- `-h`, `--help`: Output usage information + +## Contibuting +### Development +```sh +git clone https://github.com/json5/json5 +cd json5 +npm install +``` + +When contributing code, please write relevant tests and run `npm test` and `npm +run lint` before submitting pull requests. Please use an editor that supports +[EditorConfig](http://editorconfig.org/). + +### Issues +To report bugs or request features regarding the JSON5 data format, please +submit an issue to the [official specification +repository](https://github.com/json5/json5-spec). + +To report bugs or request features regarding the JavaScript implentation of +JSON5, please submit an issue to this repository. + +## License +MIT. See [LICENSE.md](./LICENSE.md) for details. + +## Credits +[Assem Kishore](https://github.com/aseemk) founded this project. + +[Michael Bolin](http://bolinfest.com/) independently arrived at and published +some of these same ideas with awesome explanations and detail. Recommended +reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html) + +[Douglas Crockford](http://www.crockford.com/) of course designed and built +JSON, but his state machine diagrams on the [JSON website](http://json.org/), as +cheesy as it may sound, gave us motivation and confidence that building a new +parser to implement these ideas was within reach! The original +implementation of JSON5 was also modeled directly off of Doug’s open-source +[json_parse.js] parser. We’re grateful for that clean and well-documented +code. + +[json_parse.js]: +https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js + +[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific +supporter, contributing multiple patches and ideas. + +[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original +`stringify` method. + +[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely +with ES5, wrote the official JSON5 specification, completely rewrote the +codebase from the ground up, and is actively maintaining this project. diff --git a/node_modules/json5/dist/index.js b/node_modules/json5/dist/index.js new file mode 100644 index 0000000..bfc960b --- /dev/null +++ b/node_modules/json5/dist/index.js @@ -0,0 +1 @@ +!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";var u,D,F=(function(u,D){Object.defineProperty(D,"__esModule",{value:!0});D.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,D.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\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-\u08B4\u08B6-\u08BD\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\u0AF9\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-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\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-\u13F5\u13F8-\u13FD\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-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\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-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,D.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B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\u109D\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\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\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-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44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uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\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|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/}(u={exports:{}},u.exports),u.exports);(D=F)&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")&&D.default;var e=F.Space_Separator,C=F.ID_Start,A=F.ID_Continue;function r(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||C.test(u)}function t(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||A.test(u)}function E(u){return/[0-9]/.test(u)}function n(u){return/[0-9A-Fa-f]/.test(u)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(u){return typeof u}:function(u){return u&&"function"==typeof Symbol&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},o=void 0,a=void 0,B=void 0,c=void 0,s=void 0,f=void 0,d=void 0,l=void 0,v=void 0;var m=void 0,p=void 0,h=void 0,y=void 0,w=void 0;function b(){for(m="default",p="",h=!1,y=1;;){w=g();var u=x[m]();if(u)return u}}function g(){if(o[c])return String.fromCodePoint(o.codePointAt(c))}function S(){var u=g();return"\n"===u?(s++,f=0):u?f+=u.length:f++,u&&(c+=u.length),u}var x={default:function(){switch(w){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void S();case"/":return S(),void(m="comment");case void 0:return S(),N("eof")}if(!function(u){return e.test(u)}(w))return x[a]();S()},comment:function(){switch(w){case"*":return S(),void(m="multiLineComment");case"/":return S(),void(m="singleLineComment")}throw j(S())},multiLineComment:function(){switch(w){case"*":return S(),void(m="multiLineCommentAsterisk");case void 0:throw j(S())}S()},multiLineCommentAsterisk:function(){switch(w){case"*":return void S();case"/":return S(),void(m="default");case void 0:throw j(S())}S(),m="multiLineComment"},singleLineComment:function(){switch(w){case"\n":case"\r":case"\u2028":case"\u2029":return S(),void(m="default");case void 0:return S(),N("eof")}S()},value:function(){switch(w){case"{":case"[":return N("punctuator",S());case"n":return S(),P("ull"),N("null",null);case"t":return S(),P("rue"),N("boolean",!0);case"f":return S(),P("alse"),N("boolean",!1);case"-":case"+":return"-"===S()&&(y=-1),void(m="sign");case".":return p=S(),void(m="decimalPointLeading");case"0":return p=S(),void(m="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return p=S(),void(m="decimalInteger");case"I":return S(),P("nfinity"),N("numeric",1/0);case"N":return S(),P("aN"),N("numeric",NaN);case'"':case"'":return h='"'===S(),p="",void(m="string")}throw j(S())},identifierNameStartEscape:function(){if("u"!==w)throw j(S());S();var u=O();switch(u){case"$":case"_":break;default:if(!r(u))throw L()}p+=u,m="identifierName"},identifierName:function(){switch(w){case"$":case"_":case"‌":case"‍":return void(p+=S());case"\\":return S(),void(m="identifierNameEscape")}if(!t(w))return N("identifier",p);p+=S()},identifierNameEscape:function(){if("u"!==w)throw j(S());S();var u=O();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!t(u))throw L()}p+=u,m="identifierName"},sign:function(){switch(w){case".":return p=S(),void(m="decimalPointLeading");case"0":return p=S(),void(m="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return p=S(),void(m="decimalInteger");case"I":return S(),P("nfinity"),N("numeric",y*(1/0));case"N":return S(),P("aN"),N("numeric",NaN)}throw j(S())},zero:function(){switch(w){case".":return p+=S(),void(m="decimalPoint");case"e":case"E":return p+=S(),void(m="decimalExponent");case"x":case"X":return p+=S(),void(m="hexadecimal")}return N("numeric",0*y)},decimalInteger:function(){switch(w){case".":return p+=S(),void(m="decimalPoint");case"e":case"E":return p+=S(),void(m="decimalExponent")}if(!E(w))return N("numeric",y*Number(p));p+=S()},decimalPointLeading:function(){if(E(w))return p+=S(),void(m="decimalFraction");throw j(S())},decimalPoint:function(){switch(w){case"e":case"E":return p+=S(),void(m="decimalExponent")}return E(w)?(p+=S(),void(m="decimalFraction")):N("numeric",y*Number(p))},decimalFraction:function(){switch(w){case"e":case"E":return p+=S(),void(m="decimalExponent")}if(!E(w))return N("numeric",y*Number(p));p+=S()},decimalExponent:function(){switch(w){case"+":case"-":return p+=S(),void(m="decimalExponentSign")}if(E(w))return p+=S(),void(m="decimalExponentInteger");throw j(S())},decimalExponentSign:function(){if(E(w))return p+=S(),void(m="decimalExponentInteger");throw j(S())},decimalExponentInteger:function(){if(!E(w))return N("numeric",y*Number(p));p+=S()},hexadecimal:function(){if(n(w))return p+=S(),void(m="hexadecimalInteger");throw j(S())},hexadecimalInteger:function(){if(!n(w))return N("numeric",y*Number(p));p+=S()},string:function(){switch(w){case"\\":return S(),void(p+=function(){switch(g()){case"b":return S(),"\b";case"f":return S(),"\f";case"n":return S(),"\n";case"r":return S(),"\r";case"t":return S(),"\t";case"v":return S(),"\v";case"0":if(S(),E(g()))throw j(S());return"\0";case"x":return S(),function(){var u="",D=g();if(!n(D))throw j(S());if(u+=S(),!n(D=g()))throw j(S());return u+=S(),String.fromCodePoint(parseInt(u,16))}();case"u":return S(),O();case"\n":case"\u2028":case"\u2029":return S(),"";case"\r":return S(),"\n"===g()&&S(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw j(S())}return S()}());case'"':return h?(S(),N("string",p)):void(p+=S());case"'":return h?void(p+=S()):(S(),N("string",p));case"\n":case"\r":throw j(S());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+u+"' is not valid ECMAScript; consider escaping")}(w);break;case void 0:throw j(S())}p+=S()},start:function(){switch(w){case"{":case"[":return N("punctuator",S())}m="value"},beforePropertyName:function(){switch(w){case"$":case"_":return p=S(),void(m="identifierName");case"\\":return S(),void(m="identifierNameStartEscape");case"}":return N("punctuator",S());case'"':case"'":return h='"'===S(),void(m="string")}if(r(w))return p+=S(),void(m="identifierName");throw j(S())},afterPropertyName:function(){if(":"===w)return N("punctuator",S());throw j(S())},beforePropertyValue:function(){m="value"},afterPropertyValue:function(){switch(w){case",":case"}":return N("punctuator",S())}throw j(S())},beforeArrayValue:function(){if("]"===w)return N("punctuator",S());m="value"},afterArrayValue:function(){switch(w){case",":case"]":return N("punctuator",S())}throw j(S())},end:function(){throw j(S())}};function N(u,D){return{type:u,value:D,line:s,column:f}}function P(u){var D=!0,F=!1,e=void 0;try{for(var C,A=u[Symbol.iterator]();!(D=(C=A.next()).done);D=!0){var r=C.value;if(g()!==r)throw j(S());S()}}catch(u){F=!0,e=u}finally{try{!D&&A.return&&A.return()}finally{if(F)throw e}}}function O(){for(var u="",D=4;D-- >0;){if(!n(g()))throw j(S());u+=S()}return String.fromCodePoint(parseInt(u,16))}var I={start:function(){if("eof"===d.type)throw J();_()},beforePropertyName:function(){switch(d.type){case"identifier":case"string":return l=d.value,void(a="afterPropertyName");case"punctuator":return void V();case"eof":throw J()}},afterPropertyName:function(){if("eof"===d.type)throw J();a="beforePropertyValue"},beforePropertyValue:function(){if("eof"===d.type)throw J();_()},beforeArrayValue:function(){if("eof"===d.type)throw J();"punctuator"!==d.type||"]"!==d.value?_():V()},afterPropertyValue:function(){if("eof"===d.type)throw J();switch(d.value){case",":return void(a="beforePropertyName");case"}":V()}},afterArrayValue:function(){if("eof"===d.type)throw J();switch(d.value){case",":return void(a="beforeArrayValue");case"]":V()}},end:function(){}};function _(){var u=void 0;switch(d.type){case"punctuator":switch(d.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=d.value}if(void 0===v)v=u;else{var D=B[B.length-1];Array.isArray(D)?D.push(u):D[l]=u}if(null!==u&&"object"===(void 0===u?"undefined":i(u)))B.push(u),a=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var F=B[B.length-1];a=null==F?"end":Array.isArray(F)?"afterArrayValue":"afterPropertyValue"}}function V(){B.pop();var u=B[B.length-1];a=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function j(u){return k(void 0===u?"JSON5: invalid end of input at "+s+":"+f:"JSON5: invalid character '"+function(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var F=u.charCodeAt(0).toString(16);return"\\x"+("00"+F).substring(F.length)}return u}(u)+"' at "+s+":"+f)}function J(){return k("JSON5: invalid end of input at "+s+":"+f)}function L(){return k("JSON5: invalid identifier character at "+s+":"+(f-=5))}function k(u){var D=new SyntaxError(u);return D.lineNumber=s,D.columnNumber=f,D}return{parse:function(u,D){o=String(u),a="start",B=[],c=0,s=1,f=0,d=void 0,l=void 0,v=void 0;do{d=b(),I[a]()}while("eof"!==d.type);return"function"==typeof D?function u(D,F,e){var C=D[F];if(null!=C&&"object"===(void 0===C?"undefined":i(C)))for(var A in C){var r=u(C,A,e);void 0===r?delete C[A]:C[A]=r}return e.call(D,F,C)}({"":v},"",D):v},stringify:function(u,D,F){var e=[],C="",A=void 0,E=void 0,n="",o=void 0;if(null==D||"object"!==(void 0===D?"undefined":i(D))||Array.isArray(D)||(F=D.space,o=D.quote,D=D.replacer),"function"==typeof D)E=D;else if(Array.isArray(D)){A=[];var a=!0,B=!1,c=void 0;try{for(var s,f=D[Symbol.iterator]();!(a=(s=f.next()).done);a=!0){var d=s.value,l=void 0;"string"==typeof d?l=d:("number"==typeof d||d instanceof String||d instanceof Number)&&(l=String(d)),void 0!==l&&A.indexOf(l)<0&&A.push(l)}}catch(u){B=!0,c=u}finally{try{!a&&f.return&&f.return()}finally{if(B)throw c}}}return F instanceof Number?F=Number(F):F instanceof String&&(F=String(F)),"number"==typeof F?F>0&&(F=Math.min(10,Math.floor(F)),n=" ".substr(0,F)):"string"==typeof F&&(n=F.substr(0,10)),v("",{"":u});function v(u,D){var F=D[u];switch(null!=F&&("function"==typeof F.toJSON5?F=F.toJSON5(u):"function"==typeof F.toJSON&&(F=F.toJSON(u))),E&&(F=E.call(D,u,F)),F instanceof Number?F=Number(F):F instanceof String?F=String(F):F instanceof Boolean&&(F=F.valueOf()),F){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof F?m(F):"number"==typeof F?String(F):"object"===(void 0===F?"undefined":i(F))?Array.isArray(F)?function(u){if(e.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");e.push(u);var D=C;C+=n;for(var F=[],A=0;A=0)throw TypeError("Converting circular structure to JSON5");e.push(u);var D=C;C+=n;var F=A||Object.keys(u),r=[],t=!0,E=!1,i=void 0;try{for(var o,a=F[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var B=o.value,c=v(B,u);if(void 0!==c){var s=p(B)+":";""!==n&&(s+=" "),s+=c,r.push(s)}}}catch(u){E=!0,i=u}finally{try{!t&&a.return&&a.return()}finally{if(E)throw i}}var f=void 0;if(0===r.length)f="{}";else{var d=void 0;if(""===n)d=r.join(","),f="{"+d+"}";else{var l=",\n"+C;d=r.join(l),f="{\n"+C+d+",\n"+D+"}"}}return e.pop(),C=D,f}(F):void 0}function m(u){var D={"'":.1,'"':.2},F={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},e="",C=!0,A=!1,r=void 0;try{for(var t,E=u[Symbol.iterator]();!(C=(t=E.next()).done);C=!0){var n=t.value;switch(n){case"'":case'"':D[n]++,e+=n;continue}if(F[n])e+=F[n];else if(n<" "){var i=n.charCodeAt(0).toString(16);e+="\\x"+("00"+i).substring(i.length)}else e+=n}}catch(u){A=!0,r=u}finally{try{!C&&E.return&&E.return()}finally{if(A)throw r}}var a=o||Object.keys(D).reduce(function(u,F){return D[u]\n\n If is not provided, then STDIN is used.\n\n Options:\n\n -s, --space The number of spaces to indent or \'t\' for tabs\n -o, --out-file [file] Output to the specified file, otherwise STDOUT\n -v, --validate Validate JSON5 but do not output JSON\n -V, --version Output the version number\n -h, --help Output usage information')} \ No newline at end of file diff --git a/node_modules/json5/lib/index.js b/node_modules/json5/lib/index.js new file mode 100644 index 0000000..c943e65 --- /dev/null +++ b/node_modules/json5/lib/index.js @@ -0,0 +1 @@ +'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _parse=require('./parse');var _parse2=_interopRequireDefault(_parse);var _stringify=require('./stringify');var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default']; \ No newline at end of file diff --git a/node_modules/json5/lib/parse.js b/node_modules/json5/lib/parse.js new file mode 100644 index 0000000..a1f756f --- /dev/null +++ b/node_modules/json5/lib/parse.js @@ -0,0 +1 @@ +'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=parse;var _util=require('./util');var util=_interopRequireWildcard(_util);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}var source=void 0;var parseState=void 0;var stack=void 0;var pos=void 0;var line=void 0;var column=void 0;var token=void 0;var key=void 0;var root=void 0;function parse(text,reviver){source=String(text);parseState='start';stack=[];pos=0;line=1;column=0;token=undefined;key=undefined;root=undefined;do{token=lex();parseStates[parseState]()}while(token.type!=='eof');if(typeof reviver==='function'){return internalize({'':root},'',reviver)}return root}function internalize(holder,name,reviver){var value=holder[name];if(value!=null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){for(var _key in value){var replacement=internalize(value,_key,reviver);if(replacement===undefined){delete value[_key]}else{value[_key]=replacement}}}return reviver.call(holder,name,value)}var lexState=void 0;var buffer=void 0;var doubleQuote=void 0;var _sign=void 0;var c=void 0;function lex(){lexState='default';buffer='';doubleQuote=false;_sign=1;for(;;){c=peek();var _token=lexStates[lexState]();if(_token){return _token}}}function peek(){if(source[pos]){return String.fromCodePoint(source.codePointAt(pos))}}function read(){var c=peek();if(c==='\n'){line++;column=0}else if(c){column+=c.length}else{column++}if(c){pos+=c.length}return c}var lexStates={default:function _default(){switch(c){case'\t':case'\x0B':case'\f':case' ':case'\xA0':case'\uFEFF':case'\n':case'\r':case'\u2028':case'\u2029':read();return;case'/':read();lexState='comment';return;case undefined:read();return newToken('eof');}if(util.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment:function comment(){switch(c){case'*':read();lexState='multiLineComment';return;case'/':read();lexState='singleLineComment';return;}throw invalidChar(read())},multiLineComment:function multiLineComment(){switch(c){case'*':read();lexState='multiLineCommentAsterisk';return;case undefined:throw invalidChar(read());}read()},multiLineCommentAsterisk:function multiLineCommentAsterisk(){switch(c){case'*':read();return;case'/':read();lexState='default';return;case undefined:throw invalidChar(read());}read();lexState='multiLineComment'},singleLineComment:function singleLineComment(){switch(c){case'\n':case'\r':case'\u2028':case'\u2029':read();lexState='default';return;case undefined:read();return newToken('eof');}read()},value:function value(){switch(c){case'{':case'[':return newToken('punctuator',read());case'n':read();literal('ull');return newToken('null',null);case't':read();literal('rue');return newToken('boolean',true);case'f':read();literal('alse');return newToken('boolean',false);case'-':case'+':if(read()==='-'){_sign=-1}lexState='sign';return;case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);case'"':case'\'':doubleQuote=read()==='"';buffer='';lexState='string';return;}throw invalidChar(read())},identifierNameStartEscape:function identifierNameStartEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':break;default:if(!util.isIdStartChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName'},identifierName:function identifierName(){switch(c){case'$':case'_':case'\u200C':case'\u200D':buffer+=read();return;case'\\':read();lexState='identifierNameEscape';return;}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken('identifier',buffer)},identifierNameEscape:function identifierNameEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':case'\u200C':case'\u200D':break;default:if(!util.isIdContinueChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName'},sign:function sign(){switch(c){case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',_sign*Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);}throw invalidChar(read())},zero:function zero(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;case'x':case'X':buffer+=read();lexState='hexadecimal';return;}return newToken('numeric',_sign*0)},decimalInteger:function decimalInteger(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalPointLeading:function decimalPointLeading(){if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}throw invalidChar(read())},decimalPoint:function decimalPoint(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}return newToken('numeric',_sign*Number(buffer))},decimalFraction:function decimalFraction(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalExponent:function decimalExponent(){switch(c){case'+':case'-':buffer+=read();lexState='decimalExponentSign';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentSign:function decimalExponentSign(){if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentInteger:function decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},hexadecimal:function hexadecimal(){if(util.isHexDigit(c)){buffer+=read();lexState='hexadecimalInteger';return}throw invalidChar(read())},hexadecimalInteger:function hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},string:function string(){switch(c){case'\\':read();buffer+=escape();return;case'"':if(doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\'':if(!doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\n':case'\r':throw invalidChar(read());case'\u2028':case'\u2029':separatorChar(c);break;case undefined:throw invalidChar(read());}buffer+=read()},start:function start(){switch(c){case'{':case'[':return newToken('punctuator',read());}lexState='value'},beforePropertyName:function beforePropertyName(){switch(c){case'$':case'_':buffer=read();lexState='identifierName';return;case'\\':read();lexState='identifierNameStartEscape';return;case'}':return newToken('punctuator',read());case'"':case'\'':doubleQuote=read()==='"';lexState='string';return;}if(util.isIdStartChar(c)){buffer+=read();lexState='identifierName';return}throw invalidChar(read())},afterPropertyName:function afterPropertyName(){if(c===':'){return newToken('punctuator',read())}throw invalidChar(read())},beforePropertyValue:function beforePropertyValue(){lexState='value'},afterPropertyValue:function afterPropertyValue(){switch(c){case',':case'}':return newToken('punctuator',read());}throw invalidChar(read())},beforeArrayValue:function beforeArrayValue(){if(c===']'){return newToken('punctuator',read())}lexState='value'},afterArrayValue:function afterArrayValue(){switch(c){case',':case']':return newToken('punctuator',read());}throw invalidChar(read())},end:function end(){throw invalidChar(read())}};function newToken(type,value){return{type:type,value:value,line:line,column:column}}function literal(s){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _c=_step.value;var p=peek();if(p!==_c){throw invalidChar(read())}read()}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}function escape(){var c=peek();switch(c){case'b':read();return'\b';case'f':read();return'\f';case'n':read();return'\n';case'r':read();return'\r';case't':read();return'\t';case'v':read();return'\x0B';case'0':read();if(util.isDigit(peek())){throw invalidChar(read())}return'\0';case'x':read();return hexEscape();case'u':read();return unicodeEscape();case'\n':case'\u2028':case'\u2029':read();return'';case'\r':read();if(peek()==='\n'){read()}return'';case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':throw invalidChar(read());case undefined:throw invalidChar(read());}return read()}function hexEscape(){var buffer='';var c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();return String.fromCodePoint(parseInt(buffer,16))}function unicodeEscape(){var buffer='';var count=4;while(count-->0){var _c2=peek();if(!util.isHexDigit(_c2)){throw invalidChar(read())}buffer+=read()}return String.fromCodePoint(parseInt(buffer,16))}var parseStates={start:function start(){if(token.type==='eof'){throw invalidEOF()}push()},beforePropertyName:function beforePropertyName(){switch(token.type){case'identifier':case'string':key=token.value;parseState='afterPropertyName';return;case'punctuator':pop();return;case'eof':throw invalidEOF();}},afterPropertyName:function afterPropertyName(){if(token.type==='eof'){throw invalidEOF()}parseState='beforePropertyValue'},beforePropertyValue:function beforePropertyValue(){if(token.type==='eof'){throw invalidEOF()}push()},beforeArrayValue:function beforeArrayValue(){if(token.type==='eof'){throw invalidEOF()}if(token.type==='punctuator'&&token.value===']'){pop();return}push()},afterPropertyValue:function afterPropertyValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforePropertyName';return;case'}':pop();}},afterArrayValue:function afterArrayValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforeArrayValue';return;case']':pop();}},end:function end(){}};function push(){var value=void 0;switch(token.type){case'punctuator':switch(token.value){case'{':value={};break;case'[':value=[];break;}break;case'null':case'boolean':case'numeric':case'string':value=token.value;break;}if(root===undefined){root=value}else{var parent=stack[stack.length-1];if(Array.isArray(parent)){parent.push(value)}else{parent[key]=value}}if(value!==null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){stack.push(value);if(Array.isArray(value)){parseState='beforeArrayValue'}else{parseState='beforePropertyName'}}else{var current=stack[stack.length-1];if(current==null){parseState='end'}else if(Array.isArray(current)){parseState='afterArrayValue'}else{parseState='afterPropertyValue'}}}function pop(){stack.pop();var current=stack[stack.length-1];if(current==null){parseState='end'}else if(Array.isArray(current)){parseState='afterArrayValue'}else{parseState='afterPropertyValue'}}function invalidChar(c){if(c===undefined){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}return syntaxError('JSON5: invalid character \''+formatChar(c)+'\' at '+line+':'+column)}function invalidEOF(){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}function invalidIdentifier(){column-=5;return syntaxError('JSON5: invalid identifier character at '+line+':'+column)}function separatorChar(c){console.warn('JSON5: \''+c+'\' is not valid ECMAScript; consider escaping')}function formatChar(c){var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};if(replacements[c]){return replacements[c]}if(c<' '){var hexString=c.charCodeAt(0).toString(16);return'\\x'+('00'+hexString).substring(hexString.length)}return c}function syntaxError(message){var err=new SyntaxError(message);err.lineNumber=line;err.columnNumber=column;return err}module.exports=exports['default']; \ No newline at end of file diff --git a/node_modules/json5/lib/register.js b/node_modules/json5/lib/register.js new file mode 100644 index 0000000..aa16e96 --- /dev/null +++ b/node_modules/json5/lib/register.js @@ -0,0 +1 @@ +'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}require.extensions['.json5']=function(module,filename){var content=_fs2.default.readFileSync(filename,'utf8');try{module.exports=_2.default.parse(content)}catch(err){err.message=filename+': '+err.message;throw err}}; \ No newline at end of file diff --git a/node_modules/json5/lib/require.js b/node_modules/json5/lib/require.js new file mode 100644 index 0000000..dfdc039 --- /dev/null +++ b/node_modules/json5/lib/require.js @@ -0,0 +1 @@ +"use strict";require("./register");console.warn("'json5/require' is deprecated. Please use 'json5/register' instead."); \ No newline at end of file diff --git a/node_modules/json5/lib/stringify.js b/node_modules/json5/lib/stringify.js new file mode 100644 index 0000000..ce6917e --- /dev/null +++ b/node_modules/json5/lib/stringify.js @@ -0,0 +1 @@ +'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=stringify;var _util=require('./util');var util=_interopRequireWildcard(_util);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function stringify(value,replacer,space){var stack=[];var indent='';var propertyList=void 0;var replacerFunc=void 0;var gap='';var quote=void 0;if(replacer!=null&&(typeof replacer==='undefined'?'undefined':_typeof(replacer))==='object'&&!Array.isArray(replacer)){space=replacer.space;quote=replacer.quote;replacer=replacer.replacer}if(typeof replacer==='function'){replacerFunc=replacer}else if(Array.isArray(replacer)){propertyList=[];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=replacer[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;var item=void 0;if(typeof v==='string'){item=v}else if(typeof v==='number'||v instanceof String||v instanceof Number){item=String(v)}if(item!==undefined&&propertyList.indexOf(item)<0){propertyList.push(item)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}if(space instanceof Number){space=Number(space)}else if(space instanceof String){space=String(space)}if(typeof space==='number'){if(space>0){space=Math.min(10,Math.floor(space));gap=' '.substr(0,space)}}else if(typeof space==='string'){gap=space.substr(0,10)}return serializeProperty('',{'':value});function serializeProperty(key,holder){var value=holder[key];if(value!=null){if(typeof value.toJSON5==='function'){value=value.toJSON5(key)}else if(typeof value.toJSON==='function'){value=value.toJSON(key)}}if(replacerFunc){value=replacerFunc.call(holder,key,value)}if(value instanceof Number){value=Number(value)}else if(value instanceof String){value=String(value)}else if(value instanceof Boolean){value=value.valueOf()}switch(value){case null:return'null';case true:return'true';case false:return'false';}if(typeof value==='string'){return quoteString(value,false)}if(typeof value==='number'){return String(value)}if((typeof value==='undefined'?'undefined':_typeof(value))==='object'){return Array.isArray(value)?serializeArray(value):serializeObject(value)}return undefined}function quoteString(value){var quotes={'\'':0.1,'"':0.2};var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};var product='';var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=value[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var c=_step2.value;switch(c){case'\'':case'"':quotes[c]++;product+=c;continue;}if(replacements[c]){product+=replacements[c];continue}if(c<' '){var hexString=c.charCodeAt(0).toString(16);product+='\\x'+('00'+hexString).substring(hexString.length);continue}product+=c}}catch(err){_didIteratorError2=true;_iteratorError2=err}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return()}}finally{if(_didIteratorError2){throw _iteratorError2}}}var quoteChar=quote||Object.keys(quotes).reduce(function(a,b){return quotes[a]=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var keys=propertyList||Object.keys(value);var partial=[];var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=keys[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var key=_step3.value;var propertyString=serializeProperty(key,value);if(propertyString!==undefined){var member=serializeKey(key)+':';if(gap!==''){member+=' '}member+=propertyString;partial.push(member)}}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var final=void 0;if(partial.length===0){final='{}'}else{var properties=void 0;if(gap===''){properties=partial.join(',');final='{'+properties+'}'}else{var separator=',\n'+indent;properties=partial.join(separator);final='{\n'+indent+properties+',\n'+stepback+'}'}}stack.pop();indent=stepback;return final}function serializeKey(key){if(key.length===0){return quoteString(key,true)}var firstChar=String.fromCodePoint(key.codePointAt(0));if(!util.isIdStartChar(firstChar)){return quoteString(key,true)}for(var i=firstChar.length;i=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var partial=[];for(var i=0;i='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)} \ No newline at end of file diff --git a/node_modules/json5/package.json b/node_modules/json5/package.json new file mode 100644 index 0000000..b51b762 --- /dev/null +++ b/node_modules/json5/package.json @@ -0,0 +1,76 @@ +{ + "name": "json5", + "version": "1.0.1", + "description": "JSON for humans.", + "main": "lib/index.js", + "bin": "lib/cli.js", + "browser": "dist/index.js", + "files": [ + "lib/", + "dist/" + ], + "scripts": { + "build": "babel-node build/build.js && babel src -d lib && rollup -c", + "coverage": "nyc report --reporter=text-lcov | coveralls", + "lint": "eslint --fix build src", + "prepublishOnly": "npm run lint && npm test && npm run production", + "pretest": "cross-env NODE_ENV=test npm run build", + "preversion": "npm run lint && npm test && npm run production", + "production": "cross-env NODE_ENV=production npm run build", + "test": "nyc --reporter=html --reporter=text mocha" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/json5/json5.git" + }, + "keywords": [ + "json", + "json5", + "es5", + "es2015", + "ecmascript" + ], + "author": "Aseem Kishore ", + "contributors": [ + "Max Nanasy ", + "Andrew Eisenberg ", + "Jordan Tucker " + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/json5/json5/issues" + }, + "homepage": "http://json5.org/", + "dependencies": { + "minimist": "^1.2.0" + }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-istanbul": "^4.1.5", + "babel-preset-env": "^1.6.1", + "babel-register": "^6.26.0", + "babelrc-rollup": "^3.0.0", + "coveralls": "^3.0.0", + "cross-env": "^5.1.4", + "del": "^3.0.0", + "eslint": "^4.18.2", + "eslint-config-standard": "^11.0.0", + "eslint-plugin-import": "^2.9.0", + "eslint-plugin-node": "^6.0.1", + "eslint-plugin-promise": "^3.7.0", + "eslint-plugin-standard": "^3.0.1", + "mocha": "^5.0.4", + "nyc": "^11.4.1", + "regenerate": "^1.3.3", + "rollup": "^0.56.5", + "rollup-plugin-babel": "^3.0.3", + "rollup-plugin-commonjs": "^9.0.0", + "rollup-plugin-node-resolve": "^3.2.0", + "rollup-plugin-uglify": "^3.0.0", + "sinon": "^4.4.2", + "unicode-9.0.0": "^0.7.5" + } +} diff --git a/node_modules/levn/LICENSE b/node_modules/levn/LICENSE new file mode 100644 index 0000000..525b118 --- /dev/null +++ b/node_modules/levn/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/levn/README.md b/node_modules/levn/README.md new file mode 100644 index 0000000..7ab008d --- /dev/null +++ b/node_modules/levn/README.md @@ -0,0 +1,196 @@ +# levn [![Build Status](https://travis-ci.org/gkz/levn.png)](https://travis-ci.org/gkz/levn) +__Light ECMAScript (JavaScript) Value Notation__ +Levn is a library which allows you to parse a string into a JavaScript value based on an expected type. It is meant for short amounts of human entered data (eg. config files, command line arguments). + +Levn aims to concisely describe JavaScript values in text, and allow for the extraction and validation of those values. Levn uses [type-check](https://github.com/gkz/type-check) for its type format, and to validate the results. MIT license. Version 0.4.1. + +__How is this different than JSON?__ levn is meant to be written by humans only, is (due to the previous point) much more concise, can be validated against supplied types, has regex and date literals, and can easily be extended with custom types. On the other hand, it is probably slower and thus less efficient at transporting large amounts of data, which is fine since this is not its purpose. + + npm install levn + +For updates on levn, [follow me on twitter](https://twitter.com/gkzahariev). + + +## Quick Examples + +```js +var parse = require('levn').parse; +parse('Number', '2'); // 2 +parse('String', '2'); // '2' +parse('String', 'levn'); // 'levn' +parse('String', 'a b'); // 'a b' +parse('Boolean', 'true'); // true + +parse('Date', '#2011-11-11#'); // (Date object) +parse('Date', '2011-11-11'); // (Date object) +parse('RegExp', '/[a-z]/gi'); // /[a-z]/gi +parse('RegExp', 're'); // /re/ +parse('Int', '2'); // 2 + +parse('Number | String', 'str'); // 'str' +parse('Number | String', '2'); // 2 + +parse('[Number]', '[1,2,3]'); // [1,2,3] +parse('(String, Boolean)', '(hi, false)'); // ['hi', false] +parse('{a: String, b: Number}', '{a: str, b: 2}'); // {a: 'str', b: 2} + +// at the top level, you can ommit surrounding delimiters +parse('[Number]', '1,2,3'); // [1,2,3] +parse('(String, Boolean)', 'hi, false'); // ['hi', false] +parse('{a: String, b: Number}', 'a: str, b: 2'); // {a: 'str', b: 2} + +// wildcard - auto choose type +parse('*', '[hi,(null,[42]),{k: true}]'); // ['hi', [null, [42]], {k: true}] +``` +## Usage + +`require('levn');` returns an object that exposes three properties. `VERSION` is the current version of the library as a string. `parse` and `parsedTypeParse` are functions. + +```js +// parse(type, input, options); +parse('[Number]', '1,2,3'); // [1, 2, 3] + +// parsedTypeParse(parsedType, input, options); +var parsedType = require('type-check').parseType('[Number]'); +parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3] +``` + +### parse(type, input, options) + +`parse` casts the string `input` into a JavaScript value according to the specified `type` in the [type format](https://github.com/gkz/type-check#type-format) (and taking account the optional `options`) and returns the resulting JavaScript value. + +##### arguments +* type - `String` - the type written in the [type format](https://github.com/gkz/type-check#type-format) which to check against +* input - `String` - the value written in the [levn format](#levn-format) +* options - `Maybe Object` - an optional parameter specifying additional [options](#options) + +##### returns +`*` - the resulting JavaScript value + +##### example +```js +parse('[Number]', '1,2,3'); // [1, 2, 3] +``` + +### parsedTypeParse(parsedType, input, options) + +`parsedTypeParse` casts the string `input` into a JavaScript value according to the specified `type` which has already been parsed (and taking account the optional `options`) and returns the resulting JavaScript value. You can parse a type using the [type-check](https://github.com/gkz/type-check) library's `parseType` function. + +##### arguments +* type - `Object` - the type in the parsed type format which to check against +* input - `String` - the value written in the [levn format](#levn-format) +* options - `Maybe Object` - an optional parameter specifying additional [options](#options) + +##### returns +`*` - the resulting JavaScript value + +##### example +```js +var parsedType = require('type-check').parseType('[Number]'); +parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3] +``` + +## Levn Format + +Levn can use the type information you provide to choose the appropriate value to produce from the input. For the same input, it will choose a different output value depending on the type provided. For example, `parse('Number', '2')` will produce the number `2`, but `parse('String', '2')` will produce the string `"2"`. + +If you do not provide type information, and simply use `*`, levn will parse the input according the unambiguous "explicit" mode, which we will now detail - you can also set the `explicit` option to true manually in the [options](#options). + +* `"string"`, `'string'` are parsed as a String, eg. `"a msg"` is `"a msg"` +* `#date#` is parsed as a Date, eg. `#2011-11-11#` is `new Date('2011-11-11')` +* `/regexp/flags` is parsed as a RegExp, eg. `/re/gi` is `/re/gi` +* `undefined`, `null`, `NaN`, `true`, and `false` are all their JavaScript equivalents +* `[element1, element2, etc]` is an Array, and the casting procedure is recursively applied to each element. Eg. `[1,2,3]` is `[1,2,3]`. +* `(element1, element2, etc)` is an tuple, and the casting procedure is recursively applied to each element. Eg. `(1, a)` is `(1, a)` (is `[1, 'a']`). +* `{key1: val1, key2: val2, ...}` is an Object, and the casting procedure is recursively applied to each property. Eg. `{a: 1, b: 2}` is `{a: 1, b: 2}`. +* Any test which does not fall under the above, and which does not contain special characters (`[``]``(``)``{``}``:``,`) is a string, eg. `$12- blah` is `"$12- blah"`. + +If you do provide type information, you can make your input more concise as the program already has some information about what it expects. Please see the [type format](https://github.com/gkz/type-check#type-format) section of [type-check](https://github.com/gkz/type-check) for more information about how to specify types. There are some rules about what levn can do with the information: + +* If a String is expected, and only a String, all characters of the input (including any special ones) will become part of the output. Eg. `[({})]` is `"[({})]"`, and `"hi"` is `'"hi"'`. +* If a Date is expected, the surrounding `#` can be omitted from date literals. Eg. `2011-11-11` is `new Date('2011-11-11')`. +* If a RegExp is expected, no flags need to be specified, and the regex is not using any of the special characters,the opening and closing `/` can be omitted - this will have the affect of setting the source of the regex to the input. Eg. `regex` is `/regex/`. +* If an Array is expected, and it is the root node (at the top level), the opening `[` and closing `]` can be omitted. Eg. `1,2,3` is `[1,2,3]`. +* If a tuple is expected, and it is the root node (at the top level), the opening `(` and closing `)` can be omitted. Eg. `1, a` is `(1, a)` (is `[1, 'a']`). +* If an Object is expected, and it is the root node (at the top level), the opening `{` and closing `}` can be omitted. Eg `a: 1, b: 2` is `{a: 1, b: 2}`. + +If you list multiple types (eg. `Number | String`), it will first attempt to cast to the first type and then validate - if the validation fails it will move on to the next type and so forth, left to right. You must be careful as some types will succeed with any input, such as String. Thus put String at the end of your list. In non-explicit mode, Date and RegExp will succeed with a large variety of input - also be careful with these and list them near the end if not last in your list. + +Whitespace between special characters and elements is inconsequential. + +## Options + +Options is an object. It is an optional parameter to the `parse` and `parsedTypeParse` functions. + +### Explicit + +A `Boolean`. By default it is `false`. + +__Example:__ + +```js +parse('RegExp', 're', {explicit: false}); // /re/ +parse('RegExp', 're', {explicit: true}); // Error: ... does not type check... +parse('RegExp | String', 're', {explicit: true}); // 're' +``` + +`explicit` sets whether to be in explicit mode or not. Using `*` automatically activates explicit mode. For more information, read the [levn format](#levn-format) section. + +### customTypes + +An `Object`. Empty `{}` by default. + +__Example:__ + +```js +var options = { + customTypes: { + Even: { + typeOf: 'Number', + validate: function (x) { + return x % 2 === 0; + }, + cast: function (x) { + return {type: 'Just', value: parseInt(x)}; + } + } + } +} +parse('Even', '2', options); // 2 +parse('Even', '3', options); // Error: Value: "3" does not type check... +``` + +__Another Example:__ +```js +function Person(name, age){ + this.name = name; + this.age = age; +} +var options = { + customTypes: { + Person: { + typeOf: 'Object', + validate: function (x) { + x instanceof Person; + }, + cast: function (value, options, typesCast) { + var name, age; + if ({}.toString.call(value).slice(8, -1) !== 'Object') { + return {type: 'Nothing'}; + } + name = typesCast(value.name, [{type: 'String'}], options); + age = typesCast(value.age, [{type: 'Numger'}], options); + return {type: 'Just', value: new Person(name, age)}; + } + } +} +parse('Person', '{name: Laura, age: 25}', options); // Person {name: 'Laura', age: 25} +``` + +`customTypes` is an object whose keys are the name of the types, and whose values are an object with three properties, `typeOf`, `validate`, and `cast`. For more information about `typeOf` and `validate`, please see the [custom types](https://github.com/gkz/type-check#custom-types) section of type-check. + +`cast` is a function which receives three arguments, the value under question, options, and the typesCast function. In `cast`, attempt to cast the value into the specified type. If you are successful, return an object in the format `{type: 'Just', value: CAST-VALUE}`, if you know it won't work, return `{type: 'Nothing'}`. You can use the `typesCast` function to cast any child values. Remember to pass `options` to it. In your function you can also check for `options.explicit` and act accordingly. + +## Technical About + +`levn` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [type-check](https://github.com/gkz/type-check) to both parse types and validate values. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/levn/lib/cast.js b/node_modules/levn/lib/cast.js new file mode 100644 index 0000000..92cb9a6 --- /dev/null +++ b/node_modules/levn/lib/cast.js @@ -0,0 +1,327 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var parsedTypeCheck, types, toString$ = {}.toString; + parsedTypeCheck = require('type-check').parsedTypeCheck; + types = { + '*': function(value, options){ + switch (toString$.call(value).slice(8, -1)) { + case 'Array': + return typeCast(value, { + type: 'Array' + }, options); + case 'Object': + return typeCast(value, { + type: 'Object' + }, options); + default: + return { + type: 'Just', + value: typesCast(value, [ + { + type: 'Undefined' + }, { + type: 'Null' + }, { + type: 'NaN' + }, { + type: 'Boolean' + }, { + type: 'Number' + }, { + type: 'Date' + }, { + type: 'RegExp' + }, { + type: 'Array' + }, { + type: 'Object' + }, { + type: 'String' + } + ], (options.explicit = true, options)) + }; + } + }, + Undefined: function(it){ + if (it === 'undefined' || it === void 8) { + return { + type: 'Just', + value: void 8 + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Null: function(it){ + if (it === 'null') { + return { + type: 'Just', + value: null + }; + } else { + return { + type: 'Nothing' + }; + } + }, + NaN: function(it){ + if (it === 'NaN') { + return { + type: 'Just', + value: NaN + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Boolean: function(it){ + if (it === 'true') { + return { + type: 'Just', + value: true + }; + } else if (it === 'false') { + return { + type: 'Just', + value: false + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Number: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Int: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Float: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Date: function(value, options){ + var that; + if (that = /^\#([\s\S]*)\#$/.exec(value)) { + return { + type: 'Just', + value: new Date(+that[1] || that[1]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new Date(+value || value) + }; + } + }, + RegExp: function(value, options){ + var that; + if (that = /^\/([\s\S]*)\/([gimy]*)$/.exec(value)) { + return { + type: 'Just', + value: new RegExp(that[1], that[2]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new RegExp(value) + }; + } + }, + Array: function(value, options){ + return castArray(value, { + of: [{ + type: '*' + }] + }, options); + }, + Object: function(value, options){ + return castFields(value, { + of: {} + }, options); + }, + String: function(it){ + var replace, that; + if (toString$.call(it).slice(8, -1) !== 'String') { + return { + type: 'Nothing' + }; + } + replace = function(value, quote){ + return value.replace(/\\([^u]|u[0-9a-fA-F]{4})/g, function(all, escaped){ + switch (escaped[0]) { + case quote: + return quote; + case '\\': + return '\\'; + case 'b': + return '\b'; + case 'f': + return '\f'; + case 'n': + return '\n'; + case 'r': + return '\r'; + case 't': + return '\t'; + case 'u': + return JSON.parse("\"" + all + "\""); + default: + return escaped; + } + }); + }; + if (that = it.match(/^'([\s\S]*)'$/)) { + return { + type: 'Just', + value: replace(that[1], "'") + }; + } else if (that = it.match(/^"([\s\S]*)"$/)) { + return { + type: 'Just', + value: replace(that[1], '"') + }; + } else { + return { + type: 'Just', + value: it + }; + } + } + }; + function castArray(node, type, options){ + var typeOf, element; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) { + element = ref$[i$]; + results$.push(typesCast(element, typeOf, options)); + } + return results$; + }()) + }; + } + function castTuple(node, type, options){ + var result, i, i$, ref$, len$, types, cast; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + result = []; + i = 0; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + types = ref$[i$]; + cast = typesCast(node[i], types, options); + if (toString$.call(cast).slice(8, -1) !== 'Undefined') { + result.push(cast); + } + i++; + } + if (node.length <= i) { + return { + type: 'Just', + value: result + }; + } else { + return { + type: 'Nothing' + }; + } + } + function castFields(node, type, options){ + var typeOf, key, value; + if (toString$.call(node).slice(8, -1) !== 'Object') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var ref$, resultObj$ = {}; + for (key in ref$ = node) { + value = ref$[key]; + resultObj$[typesCast(key, [{ + type: 'String' + }], options)] = typesCast(value, typeOf[key] || [{ + type: '*' + }], options); + } + return resultObj$; + }()) + }; + } + function typeCast(node, typeObj, options){ + var type, structure, castFunc, ref$; + type = typeObj.type, structure = typeObj.structure; + if (type) { + castFunc = ((ref$ = options.customTypes[type]) != null ? ref$.cast : void 8) || types[type]; + if (!castFunc) { + throw new Error("Type not defined: " + type + "."); + } + return castFunc(node, options, typesCast); + } else { + switch (structure) { + case 'array': + return castArray(node, typeObj, options); + case 'tuple': + return castTuple(node, typeObj, options); + case 'fields': + return castFields(node, typeObj, options); + } + } + } + function typesCast(node, types, options){ + var i$, len$, type, ref$, valueType, value; + for (i$ = 0, len$ = types.length; i$ < len$; ++i$) { + type = types[i$]; + ref$ = typeCast(node, type, options), valueType = ref$.type, value = ref$.value; + if (valueType === 'Nothing') { + continue; + } + if (parsedTypeCheck([type], value, { + customTypes: options.customTypes + })) { + return value; + } + } + throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types) + "."); + } + module.exports = function(node, types, options){ + if (!options.explicit && types.length === 1 && types[0].type === 'String') { + return node; + } + return typesCast(node, types, options); + }; +}).call(this); diff --git a/node_modules/levn/lib/index.js b/node_modules/levn/lib/index.js new file mode 100644 index 0000000..b8b6684 --- /dev/null +++ b/node_modules/levn/lib/index.js @@ -0,0 +1,22 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var parseString, cast, parseType, VERSION, parsedTypeParse, parse; + parseString = require('./parse-string'); + cast = require('./cast'); + parseType = require('type-check').parseType; + VERSION = '0.4.1'; + parsedTypeParse = function(parsedType, string, options){ + options == null && (options = {}); + options.explicit == null && (options.explicit = false); + options.customTypes == null && (options.customTypes = {}); + return cast(parseString(parsedType, string, options), parsedType, options); + }; + parse = function(type, string, options){ + return parsedTypeParse(parseType(type), string, options); + }; + module.exports = { + VERSION: VERSION, + parse: parse, + parsedTypeParse: parsedTypeParse + }; +}).call(this); diff --git a/node_modules/levn/lib/parse-string.js b/node_modules/levn/lib/parse-string.js new file mode 100644 index 0000000..eaed2f0 --- /dev/null +++ b/node_modules/levn/lib/parse-string.js @@ -0,0 +1,113 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var reject, special, tokenRegex; + reject = require('prelude-ls').reject; + function consumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } else { + throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + "."); + } + } + function maybeConsumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } + } + function consumeList(tokens, arg$, hasDelimiters){ + var open, close, result, untilTest; + open = arg$[0], close = arg$[1]; + if (hasDelimiters) { + consumeOp(tokens, open); + } + result = []; + untilTest = "," + (hasDelimiters ? close : ''); + while (tokens.length && (hasDelimiters && tokens[0] !== close)) { + result.push(consumeElement(tokens, untilTest)); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, close); + } + return result; + } + function consumeArray(tokens, hasDelimiters){ + return consumeList(tokens, ['[', ']'], hasDelimiters); + } + function consumeTuple(tokens, hasDelimiters){ + return consumeList(tokens, ['(', ')'], hasDelimiters); + } + function consumeFields(tokens, hasDelimiters){ + var result, untilTest, key; + if (hasDelimiters) { + consumeOp(tokens, '{'); + } + result = {}; + untilTest = "," + (hasDelimiters ? '}' : ''); + while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) { + key = consumeValue(tokens, ':'); + consumeOp(tokens, ':'); + result[key] = consumeElement(tokens, untilTest); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, '}'); + } + return result; + } + function consumeValue(tokens, untilTest){ + var out; + untilTest == null && (untilTest = ''); + out = ''; + while (tokens.length && -1 === untilTest.indexOf(tokens[0])) { + out += tokens.shift(); + } + return out; + } + function consumeElement(tokens, untilTest){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens, true); + case '(': + return consumeTuple(tokens, true); + case '{': + return consumeFields(tokens, true); + default: + return consumeValue(tokens, untilTest); + } + } + function consumeTopLevel(tokens, types, options){ + var ref$, type, structure, origTokens, result, finalResult, x$, y$; + ref$ = types[0], type = ref$.type, structure = ref$.structure; + origTokens = tokens.concat(); + if (!options.explicit && types.length === 1 && ((!type && structure) || (type === 'Array' || type === 'Object'))) { + result = structure === 'array' || type === 'Array' + ? consumeArray(tokens, tokens[0] === '[') + : structure === 'tuple' + ? consumeTuple(tokens, tokens[0] === '(') + : consumeFields(tokens, tokens[0] === '{'); + finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array' + ? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$) + : (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result; + } else { + finalResult = consumeElement(tokens); + } + return finalResult; + } + special = /\[\]\(\)}{:,/.source; + tokenRegex = RegExp('("(?:\\\\"|[^"])*")|(\'(?:\\\\\'|[^\'])*\')|(/(?:\\\\/|[^/])*/[a-zA-Z]*)|(#.*#)|([' + special + '])|([^\\s' + special + '](?:\\s*[^\\s' + special + ']+)*)|\\s*'); + module.exports = function(types, string, options){ + var tokens, node; + options == null && (options = {}); + if (!options.explicit && types.length === 1 && types[0].type === 'String') { + return string; + } + tokens = reject(not$, string.split(tokenRegex)); + node = consumeTopLevel(tokens, types, options); + if (!node) { + throw new Error("Error parsing '" + string + "'."); + } + return node; + }; + function not$(x){ return !x; } +}).call(this); diff --git a/node_modules/levn/package.json b/node_modules/levn/package.json new file mode 100644 index 0000000..0c356d6 --- /dev/null +++ b/node_modules/levn/package.json @@ -0,0 +1,46 @@ +{ + "name": "levn", + "version": "0.4.1", + "author": "George Zahariev ", + "description": "Light ECMAScript (JavaScript) Value Notation - human written, concise, typed, flexible", + "homepage": "https://github.com/gkz/levn", + "keywords": [ + "levn", + "light", + "ecmascript", + "value", + "notation", + "json", + "typed", + "human", + "concise", + "typed", + "flexible" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": "https://github.com/gkz/levn/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/levn.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "devDependencies": { + "livescript": "^1.6.0", + "mocha": "^7.1.1" + } +} diff --git a/node_modules/locate-path/index.js b/node_modules/locate-path/index.js new file mode 100644 index 0000000..32b108d --- /dev/null +++ b/node_modules/locate-path/index.js @@ -0,0 +1,24 @@ +'use strict'; +const path = require('path'); +const pathExists = require('path-exists'); +const pLocate = require('p-locate'); + +module.exports = (iterable, opts) => { + opts = Object.assign({ + cwd: process.cwd() + }, opts); + + return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts); +}; + +module.exports.sync = (iterable, opts) => { + opts = Object.assign({ + cwd: process.cwd() + }, opts); + + for (const el of iterable) { + if (pathExists.sync(path.resolve(opts.cwd, el))) { + return el; + } + } +}; diff --git a/node_modules/locate-path/license b/node_modules/locate-path/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/locate-path/license @@ -0,0 +1,21 @@ +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/locate-path/package.json b/node_modules/locate-path/package.json new file mode 100644 index 0000000..17bcd7f --- /dev/null +++ b/node_modules/locate-path/package.json @@ -0,0 +1,47 @@ +{ + "name": "locate-path", + "version": "2.0.0", + "description": "Get the first path that exists on disk of multiple paths", + "license": "MIT", + "repository": "sindresorhus/locate-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "locate", + "path", + "paths", + "file", + "files", + "exists", + "find", + "finder", + "search", + "searcher", + "array", + "iterable", + "iterator" + ], + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/locate-path/readme.md b/node_modules/locate-path/readme.md new file mode 100644 index 0000000..f7b337b --- /dev/null +++ b/node_modules/locate-path/readme.md @@ -0,0 +1,99 @@ +# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) + +> Get the first path that exists on disk of multiple paths + + +## Install + +``` +$ npm install --save locate-path +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const locatePath = require('locate-path'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // only this one actually exists on disk + 'pony.png' +]; + +locatePath(files).then(foundPath => { + console.log(foundPath); + //=> 'rainbow' +}); +``` + + +## API + +### locatePath(input, [options]) + +Returns a `Promise` for the first path that exists or `undefined` if none exists. + +#### input + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Current working directory. + +### locatePath.sync(input, [options]) + +Returns the first path that exists or `undefined` if none exists. + +#### input + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### cwd + +Same as above. + + +## Related + +- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/lodash.merge/LICENSE b/node_modules/lodash.merge/LICENSE new file mode 100644 index 0000000..77c42f1 --- /dev/null +++ b/node_modules/lodash.merge/LICENSE @@ -0,0 +1,47 @@ +Copyright OpenJS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/node_modules/lodash.merge/README.md b/node_modules/lodash.merge/README.md new file mode 100644 index 0000000..91b7538 --- /dev/null +++ b/node_modules/lodash.merge/README.md @@ -0,0 +1,18 @@ +# lodash.merge v4.6.2 + +The [Lodash](https://lodash.com/) method `_.merge` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.merge +``` + +In Node.js: +```js +var merge = require('lodash.merge'); +``` + +See the [documentation](https://lodash.com/docs#merge) or [package source](https://github.com/lodash/lodash/blob/4.6.2-npm-packages/lodash.merge) for more details. diff --git a/node_modules/lodash.merge/index.js b/node_modules/lodash.merge/index.js new file mode 100644 index 0000000..8e75d95 --- /dev/null +++ b/node_modules/lodash.merge/index.js @@ -0,0 +1,1977 @@ +/** + * Lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800, + HOT_SPAN = 16; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined, + Symbol = root.Symbol, + Uint8Array = root.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeMax = Math.max, + nativeNow = Date.now; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ +var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined; + return result; + }; +}()); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; + this.size = 0; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +/** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; +} + +/** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ +function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); +} + +/** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ +function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +/** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ +function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; +} + +/** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ +function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; +} + +/** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ +function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; +} + +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +/** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ +function initCloneObject(object) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +/** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; +} + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; +} + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +/** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ +function toPlainObject(value) { + return copyObject(value, keysIn(value)); +} + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} + +/** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ +var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); +}); + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +module.exports = merge; diff --git a/node_modules/lodash.merge/package.json b/node_modules/lodash.merge/package.json new file mode 100644 index 0000000..3130fc8 --- /dev/null +++ b/node_modules/lodash.merge/package.json @@ -0,0 +1,16 @@ +{ + "name": "lodash.merge", + "version": "4.6.2", + "description": "The Lodash method `_.merge` exported as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": "lodash-modularized, merge", + "author": "John-David Dalton ", + "contributors": [ + "John-David Dalton ", + "Mathias Bynens " + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } +} diff --git a/node_modules/lru-cache/LICENSE b/node_modules/lru-cache/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/lru-cache/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/lru-cache/README.md b/node_modules/lru-cache/README.md new file mode 100644 index 0000000..435dfeb --- /dev/null +++ b/node_modules/lru-cache/README.md @@ -0,0 +1,166 @@ +# lru cache + +A cache object that deletes the least-recently-used items. + +[![Build Status](https://travis-ci.org/isaacs/node-lru-cache.svg?branch=master)](https://travis-ci.org/isaacs/node-lru-cache) [![Coverage Status](https://coveralls.io/repos/isaacs/node-lru-cache/badge.svg?service=github)](https://coveralls.io/github/isaacs/node-lru-cache) + +## Installation: + +```javascript +npm install lru-cache --save +``` + +## Usage: + +```javascript +var LRU = require("lru-cache") + , options = { max: 500 + , length: function (n, key) { return n * 2 + key.length } + , dispose: function (key, n) { n.close() } + , maxAge: 1000 * 60 * 60 } + , cache = new LRU(options) + , otherCache = new LRU(50) // sets just the max size + +cache.set("key", "value") +cache.get("key") // "value" + +// non-string keys ARE fully supported +// but note that it must be THE SAME object, not +// just a JSON-equivalent object. +var someObject = { a: 1 } +cache.set(someObject, 'a value') +// Object keys are not toString()-ed +cache.set('[object Object]', 'a different value') +assert.equal(cache.get(someObject), 'a value') +// A similar object with same keys/values won't work, +// because it's a different object identity +assert.equal(cache.get({ a: 1 }), undefined) + +cache.reset() // empty the cache +``` + +If you put more stuff in it, then items will fall out. + +If you try to put an oversized thing in it, then it'll fall out right +away. + +## Options + +* `max` The maximum size of the cache, checked by applying the length + function to all values in the cache. Not setting this is kind of + silly, since that's the whole purpose of this lib, but it defaults + to `Infinity`. Setting it to a non-number or negative number will + throw a `TypeError`. Setting it to 0 makes it be `Infinity`. +* `maxAge` Maximum age in ms. Items are not pro-actively pruned out + as they age, but if you try to get an item that is too old, it'll + drop it and return undefined instead of giving it to you. + Setting this to a negative value will make everything seem old! + Setting it to a non-number will throw a `TypeError`. +* `length` Function that is used to calculate the length of stored + items. If you're storing strings or buffers, then you probably want + to do something like `function(n, key){return n.length}`. The default is + `function(){return 1}`, which is fine if you want to store `max` + like-sized things. The item is passed as the first argument, and + the key is passed as the second argumnet. +* `dispose` Function that is called on items when they are dropped + from the cache. This can be handy if you want to close file + descriptors or do other cleanup tasks when items are no longer + accessible. Called with `key, value`. It's called *before* + actually removing the item from the internal cache, so if you want + to immediately put it back in, you'll have to do that in a + `nextTick` or `setTimeout` callback or it won't do anything. +* `stale` By default, if you set a `maxAge`, it'll only actually pull + stale items out of the cache when you `get(key)`. (That is, it's + not pre-emptively doing a `setTimeout` or anything.) If you set + `stale:true`, it'll return the stale value before deleting it. If + you don't set this, then it'll return `undefined` when you try to + get a stale entry, as if it had already been deleted. +* `noDisposeOnSet` By default, if you set a `dispose()` method, then + it'll be called whenever a `set()` operation overwrites an existing + key. If you set this option, `dispose()` will only be called when a + key falls out of the cache, not when it is overwritten. +* `updateAgeOnGet` When using time-expiring entries with `maxAge`, + setting this to `true` will make each item's effective time update + to the current time whenever it is retrieved from cache, causing it + to not expire. (It can still fall out of cache based on recency of + use, of course.) + +## API + +* `set(key, value, maxAge)` +* `get(key) => value` + + Both of these will update the "recently used"-ness of the key. + They do what you think. `maxAge` is optional and overrides the + cache `maxAge` option if provided. + + If the key is not found, `get()` will return `undefined`. + + The key and val can be any value. + +* `peek(key)` + + Returns the key value (or `undefined` if not found) without + updating the "recently used"-ness of the key. + + (If you find yourself using this a lot, you *might* be using the + wrong sort of data structure, but there are some use cases where + it's handy.) + +* `del(key)` + + Deletes a key out of the cache. + +* `reset()` + + Clear the cache entirely, throwing away all values. + +* `has(key)` + + Check if a key is in the cache, without updating the recent-ness + or deleting it for being stale. + +* `forEach(function(value,key,cache), [thisp])` + + Just like `Array.prototype.forEach`. Iterates over all the keys + in the cache, in order of recent-ness. (Ie, more recently used + items are iterated over first.) + +* `rforEach(function(value,key,cache), [thisp])` + + The same as `cache.forEach(...)` but items are iterated over in + reverse order. (ie, less recently used items are iterated over + first.) + +* `keys()` + + Return an array of the keys in the cache. + +* `values()` + + Return an array of the values in the cache. + +* `length` + + Return total length of objects in cache taking into account + `length` options function. + +* `itemCount` + + Return total quantity of objects currently in cache. Note, that + `stale` (see options) items are returned as part of this item + count. + +* `dump()` + + Return an array of the cache entries ready for serialization and usage + with 'destinationCache.load(arr)`. + +* `load(cacheEntriesArray)` + + Loads another cache entries array, obtained with `sourceCache.dump()`, + into the cache. The destination cache is reset before loading new entries + +* `prune()` + + Manually iterates over the entire cache proactively pruning old entries diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js new file mode 100644 index 0000000..573b6b8 --- /dev/null +++ b/node_modules/lru-cache/index.js @@ -0,0 +1,334 @@ +'use strict' + +// A linked list to keep track of recently-used-ness +const Yallist = require('yallist') + +const MAX = Symbol('max') +const LENGTH = Symbol('length') +const LENGTH_CALCULATOR = Symbol('lengthCalculator') +const ALLOW_STALE = Symbol('allowStale') +const MAX_AGE = Symbol('maxAge') +const DISPOSE = Symbol('dispose') +const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') +const LRU_LIST = Symbol('lruList') +const CACHE = Symbol('cache') +const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') + +const naiveLength = () => 1 + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +class LRUCache { + constructor (options) { + if (typeof options === 'number') + options = { max: options } + + if (!options) + options = {} + + if (options.max && (typeof options.max !== 'number' || options.max < 0)) + throw new TypeError('max must be a non-negative number') + // Kind of weird to have a default max of Infinity, but oh well. + const max = this[MAX] = options.max || Infinity + + const lc = options.length || naiveLength + this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc + this[ALLOW_STALE] = options.stale || false + if (options.maxAge && typeof options.maxAge !== 'number') + throw new TypeError('maxAge must be a number') + this[MAX_AGE] = options.maxAge || 0 + this[DISPOSE] = options.dispose + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false + this.reset() + } + + // resize the cache when the max changes. + set max (mL) { + if (typeof mL !== 'number' || mL < 0) + throw new TypeError('max must be a non-negative number') + + this[MAX] = mL || Infinity + trim(this) + } + get max () { + return this[MAX] + } + + set allowStale (allowStale) { + this[ALLOW_STALE] = !!allowStale + } + get allowStale () { + return this[ALLOW_STALE] + } + + set maxAge (mA) { + if (typeof mA !== 'number') + throw new TypeError('maxAge must be a non-negative number') + + this[MAX_AGE] = mA + trim(this) + } + get maxAge () { + return this[MAX_AGE] + } + + // resize the cache when the lengthCalculator changes. + set lengthCalculator (lC) { + if (typeof lC !== 'function') + lC = naiveLength + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC + this[LENGTH] = 0 + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) + this[LENGTH] += hit.length + }) + } + trim(this) + } + get lengthCalculator () { return this[LENGTH_CALCULATOR] } + + get length () { return this[LENGTH] } + get itemCount () { return this[LRU_LIST].length } + + rforEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev + forEachStep(this, fn, walker, thisp) + walker = prev + } + } + + forEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next + forEachStep(this, fn, walker, thisp) + walker = next + } + } + + keys () { + return this[LRU_LIST].toArray().map(k => k.key) + } + + values () { + return this[LRU_LIST].toArray().map(k => k.value) + } + + reset () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) + } + + this[CACHE] = new Map() // hash of items by key + this[LRU_LIST] = new Yallist() // list of items in order of use recency + this[LENGTH] = 0 // length of items in the list + } + + dump () { + return this[LRU_LIST].map(hit => + isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h) + } + + dumpLru () { + return this[LRU_LIST] + } + + set (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE] + + if (maxAge && typeof maxAge !== 'number') + throw new TypeError('maxAge must be a number') + + const now = maxAge ? Date.now() : 0 + const len = this[LENGTH_CALCULATOR](value, key) + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)) + return false + } + + const node = this[CACHE].get(key) + const item = node.value + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value) + } + + item.now = now + item.maxAge = maxAge + item.value = value + this[LENGTH] += len - item.length + item.length = len + this.get(key) + trim(this) + return true + } + + const hit = new Entry(key, value, len, now, maxAge) + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value) + + return false + } + + this[LENGTH] += hit.length + this[LRU_LIST].unshift(hit) + this[CACHE].set(key, this[LRU_LIST].head) + trim(this) + return true + } + + has (key) { + if (!this[CACHE].has(key)) return false + const hit = this[CACHE].get(key).value + return !isStale(this, hit) + } + + get (key) { + return get(this, key, true) + } + + peek (key) { + return get(this, key, false) + } + + pop () { + const node = this[LRU_LIST].tail + if (!node) + return null + + del(this, node) + return node.value + } + + del (key) { + del(this, this[CACHE].get(key)) + } + + load (arr) { + // reset the cache + this.reset() + + const now = Date.now() + // A previous serialized cache has the most recent items first + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l] + const expiresAt = hit.e || 0 + if (expiresAt === 0) + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + else { + const maxAge = expiresAt - now + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge) + } + } + } + } + + prune () { + this[CACHE].forEach((value, key) => get(this, key, false)) + } +} + +const get = (self, key, doUse) => { + const node = self[CACHE].get(key) + if (node) { + const hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + return undefined + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) + node.value.now = Date.now() + self[LRU_LIST].unshiftNode(node) + } + } + return hit.value + } +} + +const isStale = (self, hit) => { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) + return false + + const diff = Date.now() - hit.now + return hit.maxAge ? diff > hit.maxAge + : self[MAX_AGE] && (diff > self[MAX_AGE]) +} + +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev + del(self, walker) + walker = prev + } + } +} + +const del = (self, node) => { + if (node) { + const hit = node.value + if (self[DISPOSE]) + self[DISPOSE](hit.key, hit.value) + + self[LENGTH] -= hit.length + self[CACHE].delete(hit.key) + self[LRU_LIST].removeNode(node) + } +} + +class Entry { + constructor (key, value, length, now, maxAge) { + this.key = key + this.value = value + this.length = length + this.now = now + this.maxAge = maxAge || 0 + } +} + +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + hit = undefined + } + if (hit) + fn.call(thisp, hit.value, hit.key, self) +} + +module.exports = LRUCache diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json new file mode 100644 index 0000000..43b7502 --- /dev/null +++ b/node_modules/lru-cache/package.json @@ -0,0 +1,34 @@ +{ + "name": "lru-cache", + "description": "A cache object that deletes the least-recently-used items.", + "version": "6.0.0", + "author": "Isaac Z. Schlueter ", + "keywords": [ + "mru", + "lru", + "cache" + ], + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "main": "index.js", + "repository": "git://github.com/isaacs/node-lru-cache.git", + "devDependencies": { + "benchmark": "^2.1.4", + "tap": "^14.10.7" + }, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "files": [ + "index.js" + ], + "engines": { + "node": ">=10" + } +} diff --git a/node_modules/minimist/.travis.yml b/node_modules/minimist/.travis.yml new file mode 100644 index 0000000..74c57bf --- /dev/null +++ b/node_modules/minimist/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.12" + - "iojs" +before_install: + - npm install -g npm@~1.4.6 diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 0000000..f7c8d49 --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js new file mode 100644 index 0000000..d9c3eb7 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,249 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (isConstructorOrProto(o, key)) return; + if (o[key] === undefined) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; + o = o[key]; + } + + var key = keys[keys.length - 1]; + if (isConstructorOrProto(o, key)) return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + var key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + + +function isConstructorOrProto (obj, key) { + return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__'; +} diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 0000000..c225853 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,45 @@ +{ + "name": "minimist", + "version": "1.2.6", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "scripts": { + "test": "tap test/*.js", + "coverage": "covert test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/node_modules/minimist/readme.markdown b/node_modules/minimist/readme.markdown new file mode 100644 index 0000000..859d1ab --- /dev/null +++ b/node_modules/minimist/readme.markdown @@ -0,0 +1,98 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.6 or later: + +* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) +* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 0000000..ac83548 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,32 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js new file mode 100644 index 0000000..5f7dbde --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,178 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var alt = [ '--harp', 'derp' ]; + var opts = { + alias: { 'h': ['herp', 'harp'] }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, false); + t.end(); +}); + +test('boolean using something similar to true', function (t) { + var opts = { boolean: 'h' }; + var result = parse(['-h', 'true.txt'], opts); + var expected = { + h: true, + '_': ['true.txt'] + }; + + t.same(result, expected); + t.end(); +}); \ No newline at end of file diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 0000000..5a4fa5b --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,31 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); + +test('move arguments after the -- into their own `--` array', function(t) { + t.plan(1); + t.deepEqual( + parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), + { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); +}); diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 0000000..780a311 --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, null); + var argv = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, true); + t.end(); + +}) diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js new file mode 100644 index 0000000..d8b3e85 --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js new file mode 100644 index 0000000..f813b30 --- /dev/null +++ b/node_modules/minimist/test/kv_short.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-b=123' ]); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-a=whatever', '-b=robots' ]); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 0000000..5d3a1e0 --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js new file mode 100644 index 0000000..2cc77f4 --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js new file mode 100644 index 0000000..7b4a2a1 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js new file mode 100644 index 0000000..ab620dc --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js new file mode 100644 index 0000000..4ac62df --- /dev/null +++ b/node_modules/minimist/test/proto.js @@ -0,0 +1,60 @@ +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x','123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4,5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x','5','--x.__proto__.z','100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x','abc','--x.__proto__.z','def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y','123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +test('proto pollution (constructor function)', function (t) { + var argv = parse(['--_.concat.constructor.prototype.y', '123']); + function fnToBeTested() {} + t.equal(fnToBeTested.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +// powered by snyk - https://github.com/backstage/backstage/issues/10343 +test('proto pollution (constructor function) snyk', function (t) { + var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); + t.equal((function(){}).foo, undefined); + t.equal(argv.y, undefined); + t.end(); +}) diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js new file mode 100644 index 0000000..d513a1c --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js new file mode 100644 index 0000000..bdf9fbc --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,15 @@ +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'] + }); + + t.end(); +}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js new file mode 100644 index 0000000..462a36b --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,102 @@ +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'true', '--derp', 'true' ]; + var regular = [ '--herp', 'true', '-d', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [] + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; + var regular = [ '--herp', 'hello', '-d', 'moon' ]; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello' ]; + var regular = [ '--herp', 'hello' ]; + var opts = { + default: { 'h': 'bar' }, + alias: { 'h': 'herp' }, + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '--bad', '--', 'good', 'arg' ]; + var opts = { + '--': true, + unknown: unknownFn + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + '_': [] + }) + t.end(); +}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js new file mode 100644 index 0000000..8a52a58 --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/natural-compare/README.md b/node_modules/natural-compare/README.md new file mode 100644 index 0000000..c85dfdf --- /dev/null +++ b/node_modules/natural-compare/README.md @@ -0,0 +1,125 @@ + +[Build]: http://img.shields.io/travis/litejs/natural-compare-lite.png +[Coverage]: http://img.shields.io/coveralls/litejs/natural-compare-lite.png +[1]: https://travis-ci.org/litejs/natural-compare-lite +[2]: https://coveralls.io/r/litejs/natural-compare-lite +[npm package]: https://npmjs.org/package/natural-compare-lite +[GitHub repo]: https://github.com/litejs/natural-compare-lite + + + + @version 1.4.0 + @date 2015-10-26 + @stability 3 - Stable + + +Natural Compare – [![Build][]][1] [![Coverage][]][2] +=============== + +Compare strings containing a mix of letters and numbers +in the way a human being would in sort order. +This is described as a "natural ordering". + +```text +Standard sorting: Natural order sorting: + img1.png img1.png + img10.png img2.png + img12.png img10.png + img2.png img12.png +``` + +String.naturalCompare returns a number indicating +whether a reference string comes before or after or is the same +as the given string in sort order. +Use it with builtin sort() function. + + + +### Installation + +- In browser + +```html + +``` + +- In node.js: `npm install natural-compare-lite` + +```javascript +require("natural-compare-lite") +``` + +### Usage + +```javascript +// Simple case sensitive example +var a = ["z1.doc", "z10.doc", "z17.doc", "z2.doc", "z23.doc", "z3.doc"]; +a.sort(String.naturalCompare); +// ["z1.doc", "z2.doc", "z3.doc", "z10.doc", "z17.doc", "z23.doc"] + +// Use wrapper function for case insensitivity +a.sort(function(a, b){ + return String.naturalCompare(a.toLowerCase(), b.toLowerCase()); +}) + +// In most cases we want to sort an array of objects +var a = [ {"street":"350 5th Ave", "room":"A-1021"} + , {"street":"350 5th Ave", "room":"A-21046-b"} ]; + +// sort by street, then by room +a.sort(function(a, b){ + return String.naturalCompare(a.street, b.street) || String.naturalCompare(a.room, b.room); +}) + +// When text transformation is needed (eg toLowerCase()), +// it is best for performance to keep +// transformed key in that object. +// There are no need to do text transformation +// on each comparision when sorting. +var a = [ {"make":"Audi", "model":"A6"} + , {"make":"Kia", "model":"Rio"} ]; + +// sort by make, then by model +a.map(function(car){ + car.sort_key = (car.make + " " + car.model).toLowerCase(); +}) +a.sort(function(a, b){ + return String.naturalCompare(a.sort_key, b.sort_key); +}) +``` + +- Works well with dates in ISO format eg "Rev 2012-07-26.doc". + + +### Custom alphabet + +It is possible to configure a custom alphabet +to achieve a desired order. + +```javascript +// Estonian alphabet +String.alphabet = "ABDEFGHIJKLMNOPRSŠZŽTUVÕÄÖÜXYabdefghijklmnoprsšzžtuvõäöüxy" +["t", "z", "x", "õ"].sort(String.naturalCompare) +// ["z", "t", "õ", "x"] + +// Russian alphabet +String.alphabet = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя" +["Ё", "А", "Б"].sort(String.naturalCompare) +// ["А", "Б", "Ё"] +``` + + +External links +-------------- + +- [GitHub repo][https://github.com/litejs/natural-compare-lite] +- [jsperf test](http://jsperf.com/natural-sort-2/12) + + +Licence +------- + +Copyright (c) 2012-2015 Lauri Rooden <lauri@rooden.ee> +[The MIT License](http://lauri.rooden.ee/mit-license.txt) + + diff --git a/node_modules/natural-compare/index.js b/node_modules/natural-compare/index.js new file mode 100644 index 0000000..e705d49 --- /dev/null +++ b/node_modules/natural-compare/index.js @@ -0,0 +1,57 @@ + + + +/* + * @version 1.4.0 + * @date 2015-10-26 + * @stability 3 - Stable + * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite) + * @license MIT License + */ + + +var naturalCompare = function(a, b) { + var i, codeA + , codeB = 1 + , posA = 0 + , posB = 0 + , alphabet = String.alphabet + + function getCode(str, pos, code) { + if (code) { + for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i; + return +str.slice(pos - 1, i) + } + code = alphabet && alphabet.indexOf(str.charAt(pos)) + return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code + : code < 46 ? 65 // - + : code < 48 ? code - 1 + : code < 58 ? code + 18 // 0-9 + : code < 65 ? code - 11 + : code < 91 ? code + 11 // A-Z + : code < 97 ? code - 37 + : code < 123 ? code + 5 // a-z + : code - 63 + } + + + if ((a+="") != (b+="")) for (;codeB;) { + codeA = getCode(a, posA++) + codeB = getCode(b, posB++) + + if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) { + codeA = getCode(a, posA, posA) + codeB = getCode(b, posB, posA = i) + posB = i + } + + if (codeA != codeB) return (codeA < codeB) ? -1 : 1 + } + return 0 +} + +try { + module.exports = naturalCompare; +} catch (e) { + String.naturalCompare = naturalCompare; +} diff --git a/node_modules/natural-compare/package.json b/node_modules/natural-compare/package.json new file mode 100644 index 0000000..1a71362 --- /dev/null +++ b/node_modules/natural-compare/package.json @@ -0,0 +1,42 @@ +{ + "name": "natural-compare", + "version": "1.4.0", + "stability": 3, + "author": "Lauri Rooden (https://github.com/litejs/natural-compare-lite)", + "license": "MIT", + "description": "Compare strings containing a mix of letters and numbers in the way a human being would in sort order.", + "keywords": [ + "string", + "natural", + "order", + "sort", + "natsort", + "natcmp", + "compare", + "alphanum", + "litejs" + ], + "main": "index.js", + "readmeFilename": "README.md", + "files": [ + "index.js" + ], + "scripts": { + "build": "node node_modules/buildman/index.js --all", + "test": "node tests/index.js" + }, + "repository": "git://github.com/litejs/natural-compare-lite.git", + "bugs": { + "url": "https://github.com/litejs/natural-compare-lite/issues" + }, + "devDependencies": { + "buildman": "*", + "testman": "*" + }, + "buildman": { + "dist/index-min.js": { + "banner": "/*! litejs.com/MIT-LICENSE.txt */", + "input": "index.js" + } + } +} diff --git a/node_modules/object-keys/.editorconfig b/node_modules/object-keys/.editorconfig new file mode 100644 index 0000000..eaa2141 --- /dev/null +++ b/node_modules/object-keys/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/object-keys/.eslintrc b/node_modules/object-keys/.eslintrc new file mode 100644 index 0000000..9a8d5b0 --- /dev/null +++ b/node_modules/object-keys/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 23], + "id-length": [2, { "min": 1, "max": 40 }], + "max-params": [2, 3], + "max-statements": [2, 23], + "max-statements-per-line": [2, { "max": 2 }], + "no-extra-parens": [1], + "no-invalid-this": [1], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "LabeledStatement", "WithStatement"], + "operator-linebreak": [2, "after"] + } +} diff --git a/node_modules/object-keys/.travis.yml b/node_modules/object-keys/.travis.yml new file mode 100644 index 0000000..94a6ce4 --- /dev/null +++ b/node_modules/object-keys/.travis.yml @@ -0,0 +1,277 @@ +language: node_js +os: + - linux +node_js: + - "11.8" + - "10.15" + - "9.11" + - "8.15" + - "7.10" + - "6.16" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && 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: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "11.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "11.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=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.15" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.14" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + 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.8" + 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 + - env: COVERAGE=true + - env: POSTTEST=true diff --git a/node_modules/object-keys/CHANGELOG.md b/node_modules/object-keys/CHANGELOG.md new file mode 100644 index 0000000..b7d92df --- /dev/null +++ b/node_modules/object-keys/CHANGELOG.md @@ -0,0 +1,232 @@ +1.1.1 / 2019-04-06 +================= + * [Fix] exclude deprecated Firefox keys (#53) + +1.1.0 / 2019-02-10 +================= + * [New] [Refactor] move full implementation to `implementation` entry point + * [Refactor] only evaluate the implementation if `Object.keys` is not present + * [Tests] up to `node` `v11.8`, `v10.15`, `v8.15`, `v6.16` + * [Tests] remove jscs + * [Tests] switch to `npm audit` from `nsp` + +1.0.12 / 2018-06-18 +================= + * [Fix] avoid accessing `window.applicationCache`, to avoid issues with latest Chrome on HTTP (#46) + +1.0.11 / 2016-07-05 +================= + * [Fix] exclude keys regarding the style (eg. `pageYOffset`) on `window` to avoid reflow (#32) + +1.0.10 / 2016-07-04 +================= + * [Fix] exclude `height` and `width` keys on `window` to avoid reflow (#31) + * [Fix] In IE 6, `window.external` makes `Object.keys` throw + * [Tests] up to `node` `v6.2`, `v5.10`, `v4.4` + * [Tests] use pretest/posttest for linting/security + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Dev Deps] remove unused eccheck script + dep + +1.0.9 / 2015-10-19 +================= + * [Fix] Blacklist 'frame' property on window (#16, #17) + * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` + +1.0.8 / 2015-10-14 +================= + * [Fix] wrap automation equality bug checking in try/catch, per [es5-shim#327](https://github.com/es-shims/es5-shim/issues/327) + * [Fix] Blacklist 'window.frameElement' per [es5-shim#322](https://github.com/es-shims/es5-shim/issues/322) + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + * [Dev Deps] update `eslint`, `tape`, `@ljharb/eslint-config`, `jscs` + +1.0.7 / 2015-07-18 +================= + * [Fix] A proper fix for 176f03335e90d5c8d0d8125a99f27819c9b9cdad / https://github.com/es-shims/es5-shim/issues/275 that doesn't break dontEnum/constructor fixes in IE 8. + * [Fix] Remove deprecation message in Chrome by touching deprecated window properties (#15) + * [Tests] Improve test output for automation equality bugfix + * [Tests] Test on `io.js` `v2.4` + +1.0.6 / 2015-07-09 +================= + * [Fix] Use an object lookup rather than ES5's `indexOf` (#14) + * [Tests] ES3 browsers don't have `Array.isArray` + * [Tests] Fix `no-shadow` rule, as well as an IE 8 bug caused by engine NFE shadowing bugs. + +1.0.5 / 2015-07-03 +================= + * [Fix] Fix a flabbergasting IE 8 bug where `localStorage.constructor.prototype === localStorage` throws + * [Tests] Test up to `io.js` `v2.3` + * [Dev Deps] Update `nsp`, `eslint` + +1.0.4 / 2015-05-23 +================= + * Fix a Safari 5.0 bug with `Object.keys` not working with `arguments` + * Test on latest `node` and `io.js` + * Update `jscs`, `tape`, `eslint`, `nsp`, `is`, `editorconfig-tools`, `covert` + +1.0.3 / 2015-01-06 +================= + * Revert "Make `object-keys` more robust against later environment tampering" to maintain ES3 compliance + +1.0.2 / 2014-12-28 +================= + * Update lots of dev dependencies + * Tweaks to README + * Make `object-keys` more robust against later environment tampering + +1.0.1 / 2014-09-03 +================= + * Update URLs and badges in README + +1.0.0 / 2014-08-26 +================= + * v1.0.0 + +0.6.1 / 2014-08-25 +================= + * v0.6.1 + * Updating dependencies (tape, covert, is) + * Update badges in readme + * Use separate var statements + +0.6.0 / 2014-04-23 +================= + * v0.6.0 + * Updating dependencies (tape, covert) + * Make sure boxed primitives, and arguments objects, work properly in ES3 browsers + * Improve test matrix: test all node versions, but only latest two stables are a failure + * Remove internal foreach shim. + +0.5.1 / 2014-03-09 +================= + * 0.5.1 + * Updating dependencies (tape, covert, is) + * Removing forEach from the module (but keeping it in tests) + +0.5.0 / 2014-01-30 +================= + * 0.5.0 + * Explicitly returning the shim, instead of returning native Object.keys when present + * Adding a changelog. + * Cleaning up IIFE wrapping + * Testing on node 0.4 through 0.11 + +0.4.0 / 2013-08-14 +================== + + * v0.4.0 + * In Chrome 4-10 and Safari 4, typeof (new RegExp) === 'function' + * If it's a string, make sure to use charAt instead of brackets. + * Only use Function#call if necessary. + * Making sure the context tests actually run. + * Better function detection + * Adding the android browser + * Fixing testling files + * Updating tape + * Removing the "is" dependency. + * Making an isArguments shim. + * Adding a local forEach shim and tests. + * Updating paths. + * Moving the shim test. + * v0.3.0 + +0.3.0 / 2013-05-18 +================== + + * README tweak. + * Fixing constructor enum issue. Fixes [#5](https://github.com/ljharb/object-keys/issues/5). + * Adding a test for [#5](https://github.com/ljharb/object-keys/issues/5) + * Updating readme. + * Updating dependencies. + * Giving credit to lodash. + * Make sure that a prototype's constructor property is not enumerable. Fixes [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding additional tests to handle arguments objects, and to skip "prototype" in functions. Fixes [#2](https://github.com/ljharb/object-keys/issues/2). + * Fixing a typo on this test for [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding node 0.10 to travis. + * Adding an IE < 9 test per [#3](https://github.com/ljharb/object-keys/issues/3) + * Adding an iOS 5 mobile Safari test per [#2](https://github.com/ljharb/object-keys/issues/2) + * Moving "indexof" and "is" to be dev dependencies. + * Making sure the shim works with functions. + * Flattening the tests. + +0.2.0 / 2013-05-10 +================== + + * v0.2.0 + * Object.keys should work with arrays. + +0.1.8 / 2013-05-10 +================== + + * v0.1.8 + * Upgrading dependencies. + * Using a simpler check. + * Fixing a bug in hasDontEnumBug browsers. + * Using the newest tape! + * Fixing this error test. + * "undefined" is probably a reserved word in ES3. + * Better test message. + +0.1.7 / 2013-04-17 +================== + + * Upgrading "is" once more. + * The key "null" is breaking some browsers. + +0.1.6 / 2013-04-17 +================== + + * v0.1.6 + * Upgrading "is" + +0.1.5 / 2013-04-14 +================== + + * Bumping version. + * Adding more testling browsers. + * Updating "is" + +0.1.4 / 2013-04-08 +================== + + * Using "is" instead of "is-extended". + +0.1.3 / 2013-04-07 +================== + + * Using "foreach" instead of my own shim. + * Removing "tap"; I'll just wait for "tape" to fix its node 0.10 bug. + +0.1.2 / 2013-04-03 +================== + + * Adding dependency status; moving links to an index at the bottom. + * Upgrading is-extended; version 0.1.2 + * Adding an npm version badge. + +0.1.1 / 2013-04-01 +================== + + * Adding Travis CI. + * Bumping the version. + * Adding indexOf since IE sucks. + * Adding a forEach shim since older browsers don't have Array#forEach. + * Upgrading tape - 0.3.2 uses Array#map + * Using explicit end instead of plan. + * Can't test with Array.isArray in older browsers. + * Using is-extended. + * Fixing testling files. + * JSHint/JSLint-ing. + * Removing an unused object. + * Using strict mode. + +0.1.0 / 2013-03-30 +================== + + * Changing the exports should have meant a higher version bump. + * Oops, fixing the repo URL. + * Adding more tests. + * 0.0.2 + * Merge branch 'export_one_thing'; closes [#1](https://github.com/ljharb/object-keys/issues/1) + * Move shim export to a separate file. diff --git a/node_modules/object-keys/LICENSE b/node_modules/object-keys/LICENSE new file mode 100644 index 0000000..28553fd --- /dev/null +++ b/node_modules/object-keys/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2013 Jordan Harband + +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/object-keys/README.md b/node_modules/object-keys/README.md new file mode 100644 index 0000000..ed4c277 --- /dev/null +++ b/node_modules/object-keys/README.md @@ -0,0 +1,76 @@ +#object-keys [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable. + +Most common usage: +```js +var keys = Object.keys || require('object-keys'); +``` + +## Example + +```js +var keys = require('object-keys'); +var assert = require('assert'); +var obj = { + a: true, + b: true, + c: true +}; + +assert.deepEqual(keys(obj), ['a', 'b', 'c']); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is not present */ +delete Object.keys; +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is present */ +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, Object.keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +## Source +Implementation taken directly from [es5-shim][es5-shim-url], with modifications, including from [lodash][lodash-url]. + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/object-keys +[npm-version-svg]: http://versionbadg.es/ljharb/object-keys.svg +[travis-svg]: https://travis-ci.org/ljharb/object-keys.svg +[travis-url]: https://travis-ci.org/ljharb/object-keys +[deps-svg]: https://david-dm.org/ljharb/object-keys.svg +[deps-url]: https://david-dm.org/ljharb/object-keys +[dev-deps-svg]: https://david-dm.org/ljharb/object-keys/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/object-keys#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/object-keys.png +[testling-url]: https://ci.testling.com/ljharb/object-keys +[es5-shim-url]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589 +[lodash-url]: https://github.com/lodash/lodash +[npm-badge-png]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object-keys.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object-keys + diff --git a/node_modules/object-keys/implementation.js b/node_modules/object-keys/implementation.js new file mode 100644 index 0000000..5b32986 --- /dev/null +++ b/node_modules/object-keys/implementation.js @@ -0,0 +1,122 @@ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; diff --git a/node_modules/object-keys/index.js b/node_modules/object-keys/index.js new file mode 100644 index 0000000..a43807d --- /dev/null +++ b/node_modules/object-keys/index.js @@ -0,0 +1,32 @@ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; diff --git a/node_modules/object-keys/isArguments.js b/node_modules/object-keys/isArguments.js new file mode 100644 index 0000000..f2a2a90 --- /dev/null +++ b/node_modules/object-keys/isArguments.js @@ -0,0 +1,17 @@ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; diff --git a/node_modules/object-keys/package.json b/node_modules/object-keys/package.json new file mode 100644 index 0000000..99ea923 --- /dev/null +++ b/node_modules/object-keys/package.json @@ -0,0 +1,88 @@ +{ + "name": "object-keys", + "version": "1.1.1", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net" + }, + { + "name": "Ivan Starkov", + "email": "istarkov@gmail.com" + }, + { + "name": "Gary Katsevman", + "email": "git@gkatsev.com" + } + ], + "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent audit", + "tests-only": "node test/index.js", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "eslint .", + "preaudit": "npm install --package-lock --package-lock-only", + "audit": "npm audit", + "postaudit": "rm package-lock.json" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object-keys.git" + }, + "keywords": [ + "Object.keys", + "keys", + "ES5", + "shim" + ], + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^13.1.1", + "covert": "^1.1.1", + "eslint": "^5.13.0", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.3.0", + "tape": "^4.9.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/object-keys/test/index.js b/node_modules/object-keys/test/index.js new file mode 100644 index 0000000..5402465 --- /dev/null +++ b/node_modules/object-keys/test/index.js @@ -0,0 +1,5 @@ +'use strict'; + +require('./isArguments'); + +require('./shim'); diff --git a/node_modules/object.assign/.editorconfig b/node_modules/object.assign/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/object.assign/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/object.assign/.eslintignore b/node_modules/object.assign/.eslintignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/node_modules/object.assign/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/node_modules/object.assign/.eslintrc b/node_modules/object.assign/.eslintrc new file mode 100644 index 0000000..6d4cafd --- /dev/null +++ b/node_modules/object.assign/.eslintrc @@ -0,0 +1,26 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 19], + "id-length": [2, { "min": 1, "max": 30 }], + "max-statements": [2, 33], + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": [1, { "ignore": [0] }], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "no-invalid-this": 1, + "max-lines-per-function": 0, + "max-statements-per-line": [2, { "max": 3 }], + "no-magic-numbers": 0, + }, + }, + ], +} diff --git a/node_modules/object.assign/.github/FUNDING.yml b/node_modules/object.assign/.github/FUNDING.yml new file mode 100644 index 0000000..ef7fdbf --- /dev/null +++ b/node_modules/object.assign/.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/object.assign +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/object.assign/.github/workflows/rebase.yml b/node_modules/object.assign/.github/workflows/rebase.yml new file mode 100644 index 0000000..0c2ad39 --- /dev/null +++ b/node_modules/object.assign/.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/object.assign/.github/workflows/require-allow-edits.yml b/node_modules/object.assign/.github/workflows/require-allow-edits.yml new file mode 100644 index 0000000..aac42d3 --- /dev/null +++ b/node_modules/object.assign/.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/object.assign/.nycrc b/node_modules/object.assign/.nycrc new file mode 100644 index 0000000..d316b4d --- /dev/null +++ b/node_modules/object.assign/.nycrc @@ -0,0 +1,14 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "operations", + "test" + ] +} diff --git a/node_modules/object.assign/CHANGELOG.md b/node_modules/object.assign/CHANGELOG.md new file mode 100644 index 0000000..ac543d5 --- /dev/null +++ b/node_modules/object.assign/CHANGELOG.md @@ -0,0 +1,201 @@ +4.1.2 / 2020-10-30 +================== + * [Refactor] use extracted `call-bind` instead of full `es-abstract` + * [Dev Deps] update `eslint`, `ses`, `browserify` + * [Tests] run tests in SES + * [Tests] ses-compat: show error stacks + +4.1.1 / 2020-09-11 +================== + * [Fix] avoid mutating `Object.assign` in modern engines + * [Refactor] use `callBind` from `es-abstract` instead of `function-bind` + * [Deps] update `has-symbols`, `object-keys`, `define-properties` + * [meta] add `funding` field, FUNDING.yml + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `browserify`, `covert`, `for-each`, `is`, `tape`, `functions-have-names`; add `aud`, `safe-publish-latest`; remove `jscs` + * [actions] add Require Allow Edits workflow + * [actions] add automatic rebasing / merge commit blocking + * [Tests] ses-compat - add test to ensure package initializes correctly after ses lockdown (#77) + * [Tests] Add passing test for a source of `window.location` (#68) + * [Tests] use shared travis-ci config + * [Tests] use `npx aud` instead of `npm audit` with hoops or `nsp` + * [Tests] use `functions-have-names` + +4.1.0 / 2017-12-21 +================== + * [New] add `auto` entry point (#52) + * [Refactor] Use `has-symbols` module + * [Deps] update `function-bind`, `object-keys` + * [Dev Deps] update `@es-shims/api`, `browserify`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is` + * [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS + +4.0.4 / 2016-07-04 +================== + * [Fix] Cache original `getOwnPropertySymbols`, and use that when `Object.getOwnPropertySymbols` is unavailable + * [Deps] update `object-keys` + * [Dev Deps] update `eslint`, `get-own-property-symbols`, `core-js`, `jscs`, `nsp`, `browserify`, `@ljharb/eslint-config`, `tape`, `@es-shims/api` + * [Tests] up to `node` `v6.2`, `v5.10`, `v4.4` + * [Tests] run sham tests on node 0.10 + * [Tests] use pretest/posttest for linting/security + +4.0.3 / 2015-10-21 +================== + * [Fix] Support core-js's Symbol sham (#17) + * [Fix] Ensure that properties removed or made non-enumerable during enumeration are not assigned (#16) + * [Fix] Avoid looking up keys and values more than once + * [Tests] Avoid using `reduce` so `npm run test:shams:corejs` passes in `node` `v0.8` ([core-js#122](https://github.com/zloirock/core-js/issues/122)) + * [Tests] Refactor to use my conventional structure that separates shimmed, implementation, and common tests + * [Tests] Create `npm run test:shams` and better organize tests for symbol shams + * [Tests] Remove `nsp` in favor of `requiresafe` + +4.0.2 / 2015-10-20 +================== + * [Fix] Ensure correct property enumeration order, particularly in v8 (#15) + * [Deps] update `object-keys`, `define-properties` + * [Dev Deps] update `browserify`, `is`, `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + +4.0.1 / 2015-08-16 +================== + * [Docs] Add `Symbol` note to readme + +4.0.0 / 2015-08-15 +================== + * [Breaking] Implement the [es-shim API](es-shims/api). + * [Robustness] Make implementation robust against later modification of environment methods. + * [Refactor] Move implementation to `implementation.js` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Deps] update `object-keys`, `define-properties` + * [Dev Deps] update `browserify`, `tape`, `eslint`, `jscs`, `browserify` + * [Tests] Add `npm run tests-only` + * [Tests] use my personal shared `eslint` config. + * [Tests] up to `io.js` `v3.0` + +3.0.1 / 2015-06-28 +================== + * Cache `Object` and `Array#push` to make the shim more robust. + * [Fix] Remove use of `Array#filter`, which isn't in ES3. + * [Deps] Update `object-keys`, `define-properties` + * [Dev Deps] Update `get-own-property-symbols`, `browserify`, `eslint`, `nsp` + * [Tests] Test up to `io.js` `v2.3` + * [Tests] Adding `Object.assign` tests for non-object targets, per https://github.com/paulmillr/es6-shim/issues/348 + +3.0.0 / 2015-05-20 +================== + * Attempt to feature-detect Symbols, even if `typeof Symbol() !== 'symbol'` (#12) + * Make a separate `hasSymbols` internal module + * Update `browserify`, `eslint` + +2.0.3 / 2015-06-28 +================== + * Cache `Object` and `Array#push` to make the shim more robust. + * [Fix] Remove use of `Array#filter`, which isn't in ES3 + * [Deps] Update `object-keys`, `define-properties` + * [Dev Deps] Update `browserify`, `nsp`, `eslint` + * [Tests] Test up to `io.js` `v2.3` + +2.0.2 / 2015-05-20 +================== + * Make sure `.shim` is non-enumerable. + * Refactor `.shim` implementation to use `define-properties` predicates, rather than `delete`ing the original. + * Update docs to match spec/implementation. (#11) + * Add `npm run eslint` + * Test up to `io.js` `v2.0` + * Update `jscs`, `browserify`, `covert` + +2.0.1 / 2015-04-12 +================== + * Make sure non-enumerable Symbols are excluded. + +2.0.0 / 2015-04-12 +================== + * Make sure the shim function overwrites a broken implementation with pending exceptions. + * Ensure shim is not enumerable using `define-properties` + * Ensure `Object.assign` includes symbols. + * All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. + * Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. + * Add `npm run security` via `nsp` + * Update `browserify`, `jscs`, `tape`, `object-keys`, `is` + +1.1.1 / 2014-12-14 +================== + * Actually include the browser build in `npm` + +1.1.0 / 2014-12-14 +================== + * Add `npm run build`, and build an automatic-shimming browser distribution as part of the npm publish process. + * Update `is`, `jscs` + +1.0.3 / 2014-11-29 +================== + * Revert "optimize --production installs" + +1.0.2 / 2014-11-27 +================== + * Update `jscs`, `is`, `object-keys`, `tape` + * Add badges to README + * Name URLs in README + * Lock `covert` to `v1.0.0` + * Optimize --production installs + +1.0.1 / 2014-08-26 +================== + * Update `is`, `covert` + +1.0.0 / 2014-08-07 +================== + * Update `object-keys`, `tape` + +0.5.0 / 2014-07-31 +================== + * Object.assign no longer throws on null or undefined sources, per https://bugs.ecmascript.org/show_bug.cgi?id=3096 + +0.4.3 / 2014-07-30 +================== + * Don’t modify vars in the function signature, since it deoptimizes v8 + +0.4.2 / 2014-07-30 +================== + * Fixing the version number: v0.4.2 + +0.4.1 / 2014-07-19 +================== + * Revert "Use the native Object.keys if it’s available." + +0.4.0 / 2014-07-19 +================== + * Use the native Object.keys if it’s available. + * Fixes [#2](https://github.com/ljharb/object.assign/issues/2). + * Adding failing tests for [#2](https://github.com/ljharb/object.assign/issues/2). + * Fix indentation. + * Adding `npm run lint` + * Update `tape`, `covert` + * README: Use SVG badge for Travis [#1](https://github.com/ljharb/object.assign/issues/1) from mathiasbynens/patch-1 + +0.3.1 / 2014-04-10 +================== + * Object.assign does partially modify objects if it throws, per https://twitter.com/awbjs/status/454320863093862400 + +0.3.0 / 2014-04-10 +================== + * Update with newest ES6 behavior - Object.assign now takes a variable number of source objects. + * Update `tape` + * Make sure old and unstable nodes don’t fail Travis + +0.2.1 / 2014-03-16 +================== + * Let object-keys handle the fallback + * Update dependency badges + * Adding bower.json + +0.2.0 / 2014-03-16 +================== + * Use a for loop, because ES3 browsers don’t have "reduce" + +0.1.1 / 2014-03-14 +================== + * Updating readme + +0.1.0 / 2014-03-14 +================== + * Initial release. + diff --git a/node_modules/object.assign/LICENSE b/node_modules/object.assign/LICENSE new file mode 100644 index 0000000..ab29cbd --- /dev/null +++ b/node_modules/object.assign/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +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/object.assign/README.md b/node_modules/object.assign/README.md new file mode 100644 index 0000000..70b6ac4 --- /dev/null +++ b/node_modules/object.assign/README.md @@ -0,0 +1,135 @@ +#object.assign [![Version Badge][npm-version-svg]][npm-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][npm-url] + +[![browser support][testling-png]][testling-url] + +An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Takes a minimum of 2 arguments: `target` and `source`. +Takes a variable sized list of source arguments - at least 1, as many as you want. +Throws a TypeError if the `target` argument is `null` or `undefined`. + +Most common usage: +```js +var assign = require('object.assign').getPolyfill(); // returns native method if compliant + /* or */ +var assign = require('object.assign/polyfill')(); // returns native method if compliant +``` + +## Example + +```js +var assert = require('assert'); + +// Multiple sources! +var target = { a: true }; +var source1 = { b: true }; +var source2 = { c: true }; +var sourceN = { n: true }; + +var expected = { + a: true, + b: true, + c: true, + n: true +}; + +assign(target, source1, source2, sourceN); +assert.deepEqual(target, expected); // AWESOME! +``` + +```js +var target = { + a: true, + b: true, + c: true +}; +var source1 = { + c: false, + d: false +}; +var sourceN = { + e: false +}; + +var assigned = assign(target, source1, sourceN); +assert.equal(target, assigned); // returns the target object +assert.deepEqual(assigned, { + a: true, + b: true, + c: false, + d: false, + e: false +}); +``` + +```js +/* when Object.assign is not present */ +delete Object.assign; +var shimmedAssign = require('object.assign').shim(); + /* or */ +var shimmedAssign = require('object.assign/shim')(); + +assert.equal(shimmedAssign, assign); + +var target = { + a: true, + b: true, + c: true +}; +var source = { + c: false, + d: false, + e: false +}; + +var assigned = assign(target, source); +assert.deepEqual(Object.assign(target, source), assign(target, source)); +``` + +```js +/* when Object.assign is present */ +var shimmedAssign = require('object.assign').shim(); +assert.equal(shimmedAssign, Object.assign); + +var target = { + a: true, + b: true, + c: true +}; +var source = { + c: false, + d: false, + e: false +}; + +assert.deepEqual(Object.assign(target, source), assign(target, source)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[npm-url]: https://npmjs.org/package/object.assign +[npm-version-svg]: http://versionbadg.es/ljharb/object.assign.svg +[travis-svg]: https://travis-ci.org/ljharb/object.assign.svg +[travis-url]: https://travis-ci.org/ljharb/object.assign +[deps-svg]: https://david-dm.org/ljharb/object.assign.svg?theme=shields.io +[deps-url]: https://david-dm.org/ljharb/object.assign +[dev-deps-svg]: https://david-dm.org/ljharb/object.assign/dev-status.svg?theme=shields.io +[dev-deps-url]: https://david-dm.org/ljharb/object.assign#info=devDependencies +[testling-png]: https://ci.testling.com/ljharb/object.assign.png +[testling-url]: https://ci.testling.com/ljharb/object.assign +[npm-badge-png]: https://nodei.co/npm/object.assign.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object.assign.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object.assign.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object.assign diff --git a/node_modules/object.assign/auto.js b/node_modules/object.assign/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/object.assign/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/object.assign/dist/browser.js b/node_modules/object.assign/dist/browser.js new file mode 100644 index 0000000..15f0e20 --- /dev/null +++ b/node_modules/object.assign/dist/browser.js @@ -0,0 +1,865 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i -1) { + return callBind(intrinsic); + } + return intrinsic; +}; + +},{"./":5,"get-intrinsic":9}],5:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); + +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } +} + +module.exports = function callBind() { + return $reflectApply(bind, $call, arguments); +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + +},{"function-bind":8,"get-intrinsic":9}],6:[function(require,module,exports){ +'use strict'; + +var keys = require('object-keys'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +var toStr = Object.prototype.toString; +var concat = Array.prototype.concat; +var origDefineProperty = Object.defineProperty; + +var isFunction = function (fn) { + return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; +}; + +var arePropertyDescriptorsSupported = function () { + var obj = {}; + try { + origDefineProperty(obj, 'x', { enumerable: false, value: obj }); + // eslint-disable-next-line no-unused-vars, no-restricted-syntax + for (var _ in obj) { // jscs:ignore disallowUnusedVariables + return false; + } + return obj.x === obj; + } catch (e) { /* this is IE 8. */ + return false; + } +}; +var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); + +var defineProperty = function (object, name, value, predicate) { + if (name in object && (!isFunction(predicate) || !predicate())) { + return; + } + if (supportsDescriptors) { + origDefineProperty(object, name, { + configurable: true, + enumerable: false, + value: value, + writable: true + }); + } else { + object[name] = value; + } +}; + +var defineProperties = function (object, map) { + var predicates = arguments.length > 2 ? arguments[2] : {}; + var props = keys(map); + if (hasSymbols) { + props = concat.call(props, Object.getOwnPropertySymbols(map)); + } + for (var i = 0; i < props.length; i += 1) { + defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + } +}; + +defineProperties.supportsDescriptors = !!supportsDescriptors; + +module.exports = defineProperties; + +},{"object-keys":14}],7:[function(require,module,exports){ +'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; +}; + +},{}],8:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; + +},{"./implementation":7}],9:[function(require,module,exports){ +'use strict'; + +/* globals + AggregateError, + Atomics, + FinalizationRegistry, + SharedArrayBuffer, + WeakRef, +*/ + +var undefined; + +var $SyntaxError = SyntaxError; +var $Function = Function; +var $TypeError = TypeError; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + // eslint-disable-next-line no-new-func + return Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var asyncGenFunction = getEvalledConstructor('async function* () {}'); +var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined; +var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': getEvalledConstructor('async function () {}'), + '%AsyncGenerator%': asyncGenFunctionPrototype, + '%AsyncGeneratorFunction%': asyncGenFunction, + '%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': getEvalledConstructor('function* () {}'), + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': RangeError, + '%ReferenceError%': ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +var LEGACY_ALIASES = { + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('has'); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + if (!allowMissing && !(part in value)) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + +},{"function-bind":8,"has":12,"has-symbols":10}],10:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var origSymbol = global.Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./shams":11}],11:[function(require,module,exports){ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + +},{}],12:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); + +},{"function-bind":8}],13:[function(require,module,exports){ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; + +},{"./isArguments":15}],14:[function(require,module,exports){ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; + +},{"./implementation":13,"./isArguments":15}],15:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; + +},{}],16:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; +}; + +},{"./implementation":2}],17:[function(require,module,exports){ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimAssign() { + var polyfill = getPolyfill(); + define( + Object, + { assign: polyfill }, + { assign: function () { return Object.assign !== polyfill; } } + ); + return polyfill; +}; + +},{"./polyfill":16,"define-properties":6}]},{},[1]); diff --git a/node_modules/object.assign/hasSymbols.js b/node_modules/object.assign/hasSymbols.js new file mode 100644 index 0000000..34841e0 --- /dev/null +++ b/node_modules/object.assign/hasSymbols.js @@ -0,0 +1,43 @@ +'use strict'; + +var keys = require('object-keys'); + +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + /* + * temp disabled per https://github.com/ljharb/object.assign/issues/17 + * if (sym instanceof Symbol) { return false; } + * temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + * if (!(symObj instanceof Symbol)) { return false; } + */ + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-unreachable-loop + if (keys(obj).length !== 0) { return false; } + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; diff --git a/node_modules/object.assign/implementation.js b/node_modules/object.assign/implementation.js new file mode 100644 index 0000000..567efe9 --- /dev/null +++ b/node_modules/object.assign/implementation.js @@ -0,0 +1,42 @@ +'use strict'; + +// modified from https://github.com/es-shims/es6-shim +var keys = require('object-keys'); +var canBeObject = function (obj) { + return typeof obj !== 'undefined' && obj !== null; +}; +var hasSymbols = require('has-symbols/shams')(); +var callBound = require('call-bind/callBound'); +var toObject = Object; +var $push = callBound('Array.prototype.push'); +var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; + +// eslint-disable-next-line no-unused-vars +module.exports = function assign(target, source1) { + if (!canBeObject(target)) { throw new TypeError('target must be an object'); } + var objTarget = toObject(target); + var s, source, i, props, syms, value, key; + for (s = 1; s < arguments.length; ++s) { + source = toObject(arguments[s]); + props = keys(source); + var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); + if (getSymbols) { + syms = getSymbols(source); + for (i = 0; i < syms.length; ++i) { + key = syms[i]; + if ($propIsEnumerable(source, key)) { + $push(props, key); + } + } + } + for (i = 0; i < props.length; ++i) { + key = props[i]; + value = source[key]; + if ($propIsEnumerable(source, key)) { + objTarget[key] = value; + } + } + } + return objTarget; +}; diff --git a/node_modules/object.assign/index.js b/node_modules/object.assign/index.js new file mode 100644 index 0000000..9b50603 --- /dev/null +++ b/node_modules/object.assign/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var polyfill = callBind.apply(getPolyfill()); +// eslint-disable-next-line no-unused-vars +var bound = function assign(target, source1) { + return polyfill(Object, arguments); +}; + +defineProperties(bound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = bound; diff --git a/node_modules/object.assign/package.json b/node_modules/object.assign/package.json new file mode 100644 index 0000000..25247a8 --- /dev/null +++ b/node_modules/object.assign/package.json @@ -0,0 +1,83 @@ +{ + "name": "object.assign", + "version": "4.1.2", + "author": "Jordan Harband", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run lint && es-shim-api --bound", + "test": "npm run tests-only && npm run test:ses", + "posttest": "aud --production", + "tests-only": "npm run test:implementation && npm run test:shim", + "test:native": "nyc node test/native", + "test:shim": "nyc node test/shimmed", + "test:implementation": "nyc node test", + "test:ses": "node test/ses-compat", + "lint": "eslint .", + "build": "mkdir -p dist && browserify browserShim.js > dist/browser.js", + "prepublish": "safe-publish-latest && npm run build" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object.assign.git" + }, + "keywords": [ + "Object.assign", + "assign", + "ES6", + "extend", + "$.extend", + "jQuery", + "_.extend", + "Underscore", + "es-shim API", + "polyfill", + "shim" + ], + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "devDependencies": { + "@es-shims/api": "^2.1.2", + "@ljharb/eslint-config": "^17.2.0", + "aud": "^1.1.2", + "browserify": "^16.5.2", + "eslint": "^7.12.1", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.1", + "has": "^1.0.3", + "is": "^3.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "ses": "^0.10.4", + "tape": "^5.0.1" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/object.assign/polyfill.js b/node_modules/object.assign/polyfill.js new file mode 100644 index 0000000..ca94aea --- /dev/null +++ b/node_modules/object.assign/polyfill.js @@ -0,0 +1,55 @@ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; +}; diff --git a/node_modules/object.assign/shim.js b/node_modules/object.assign/shim.js new file mode 100644 index 0000000..9f896ae --- /dev/null +++ b/node_modules/object.assign/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimAssign() { + var polyfill = getPolyfill(); + define( + Object, + { assign: polyfill }, + { assign: function () { return Object.assign !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/object.assign/test/index.js b/node_modules/object.assign/test/index.js new file mode 100644 index 0000000..776b2b3 --- /dev/null +++ b/node_modules/object.assign/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var assign = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/native.js b/node_modules/object.assign/test/native.js new file mode 100644 index 0000000..49a70f7 --- /dev/null +++ b/node_modules/object.assign/test/native.js @@ -0,0 +1,49 @@ +'use strict'; + +var test = require('tape'); +var defineProperties = require('define-properties'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('native', function (t) { + t.equal(Object.assign.length, 2, 'Object.assign has a length of 2'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + // v8 in node 0.8 and 0.10 have non-enumerable string properties + var stringCharsAreEnumerable = isEnumerable.call('xy', 0); + t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) { + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: '2' }); + var error; + try { Object.assign(thrower, 'xy'); } catch (e) { error = e; } + st.equal(error instanceof TypeError, true, 'error is TypeError'); + st.equal(thrower[1], '2', 'thrower[1] === "2"'); + + st.end(); + }); + + runTests(Object.assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/ses-compat.js b/node_modules/object.assign/test/ses-compat.js new file mode 100644 index 0000000..9669eb9 --- /dev/null +++ b/node_modules/object.assign/test/ses-compat.js @@ -0,0 +1,12 @@ +'use strict'; + +/* globals lockdown */ + +// requiring ses exposes "lockdown" on the global +require('ses'); + +// lockdown freezes the primordials +lockdown({ errorTaming: 'unsafe' }); + +// initialize the module +require('./'); diff --git a/node_modules/object.assign/test/shimmed.js b/node_modules/object.assign/test/shimmed.js new file mode 100644 index 0000000..ee57758 --- /dev/null +++ b/node_modules/object.assign/test/shimmed.js @@ -0,0 +1,52 @@ +'use strict'; + +var assign = require('../'); +assign.shim(); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.equal(Object.assign.length, 2, 'Object.assign has a length of 2'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + // v8 in node 0.8 and 0.10 have non-enumerable string properties + var stringCharsAreEnumerable = isEnumerable.call('xy', 0); + t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) { + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: '2' }); + var error; + try { Object.assign(thrower, 'xy'); } catch (e) { error = e; } + st.equal(error instanceof TypeError, true, 'error is TypeError'); + st.equal(thrower[1], '2', 'thrower[1] === "2"'); + + st.end(); + }); + + runTests(Object.assign, t); + + t.end(); +}); diff --git a/node_modules/object.assign/test/tests.js b/node_modules/object.assign/test/tests.js new file mode 100644 index 0000000..81b1326 --- /dev/null +++ b/node_modules/object.assign/test/tests.js @@ -0,0 +1,237 @@ +'use strict'; + +var hasSymbols = require('has-symbols/shams')(); +var forEach = require('for-each'); +var has = require('has'); + +module.exports = function (assign, t) { + t.test('error cases', function (st) { + st['throws'](function () { assign(null); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(undefined); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(null, {}); }, TypeError, 'target must be an object'); + st['throws'](function () { assign(undefined, {}); }, TypeError, 'target must be an object'); + st.end(); + }); + + t.test('non-object target, no sources', function (st) { + var bool = assign(true); + st.equal(typeof bool, 'object', 'bool is object'); + st.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`'); + + var number = assign(1); + st.equal(typeof number, 'object', 'number is object'); + st.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`'); + + var string = assign('1'); + st.equal(typeof string, 'object', 'number is object'); + st.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`'); + + st.end(); + }); + + t.test('non-object target, with sources', function (st) { + var signal = {}; + + st.test('boolean', function (st2) { + var bool = assign(true, { a: signal }); + st2.equal(typeof bool, 'object', 'bool is object'); + st2.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`'); + st2.equal(bool.a, signal, 'source properties copied'); + st2.end(); + }); + + st.test('number', function (st2) { + var number = assign(1, { a: signal }); + st2.equal(typeof number, 'object', 'number is object'); + st2.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`'); + st2.equal(number.a, signal, 'source properties copied'); + st2.end(); + }); + + st.test('string', function (st2) { + var string = assign('1', { a: signal }); + st2.equal(typeof string, 'object', 'number is object'); + st2.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`'); + st2.equal(string.a, signal, 'source properties copied'); + st2.end(); + }); + + st.end(); + }); + + t.test('non-object sources', function (st) { + st.deepEqual(assign({ a: 1 }, null, { b: 2 }), { a: 1, b: 2 }, 'ignores null source'); + st.deepEqual(assign({ a: 1 }, { b: 2 }, undefined), { a: 1, b: 2 }, 'ignores undefined source'); + st.end(); + }); + + t.test('returns the modified target object', function (st) { + var target = {}; + var returned = assign(target, { a: 1 }); + st.equal(returned, target, 'returned object is the same reference as the target object'); + st.end(); + }); + + t.test('has the right length', function (st) { + st.equal(assign.length, 2, 'length is 2 => 2 required arguments'); + st.end(); + }); + + t.test('merge two objects', function (st) { + var target = { a: 1 }; + var returned = assign(target, { b: 2 }); + st.deepEqual(returned, { a: 1, b: 2 }, 'returned object has properties from both'); + st.end(); + }); + + t.test('works with functions', function (st) { + var target = function () {}; + target.a = 1; + var returned = assign(target, { b: 2 }); + st.equal(target, returned, 'returned object is target'); + st.equal(returned.a, 1); + st.equal(returned.b, 2); + st.end(); + }); + + t.test('works with primitives', function (st) { + var target = 2; + var source = { b: 42 }; + var returned = assign(target, source); + st.equal(Object.prototype.toString.call(returned), '[object Number]', 'returned is object form of number primitive'); + st.equal(Number(returned), target, 'returned and target have same valueOf'); + st.equal(returned.b, source.b); + st.end(); + }); + + /* globals window */ + t.test('works with window.location', { skip: typeof window === 'undefined' }, function (st) { + var target = {}; + assign(target, window.location); + for (var prop in window.location) { + if (has(window.location, prop)) { + st.deepEqual(target[prop], window.location[prop], prop + ' is copied'); + } + } + st.end(); + }); + + t.test('merge N objects', function (st) { + var target = { a: 1 }; + var source1 = { b: 2 }; + var source2 = { c: 3 }; + var returned = assign(target, source1, source2); + st.deepEqual(returned, { a: 1, b: 2, c: 3 }, 'returned object has properties from all sources'); + st.end(); + }); + + t.test('only iterates over own keys', function (st) { + var Foo = function () {}; + Foo.prototype.bar = true; + var foo = new Foo(); + foo.baz = true; + var target = { a: 1 }; + var returned = assign(target, foo); + st.equal(returned, target, 'returned object is the same reference as the target object'); + st.deepEqual(target, { a: 1, baz: true }, 'returned object has only own properties from both'); + st.end(); + }); + + t.test('includes enumerable symbols, after keys', { skip: !hasSymbols }, function (st) { + var visited = []; + var obj = {}; + Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); + var symbol = Symbol('enumerable'); + Object.defineProperty(obj, symbol, { + enumerable: true, + get: function () { visited.push(symbol); return Infinity; } + }); + var nonEnumSymbol = Symbol('non-enumerable'); + Object.defineProperty(obj, nonEnumSymbol, { + enumerable: false, + get: function () { visited.push(nonEnumSymbol); return -Infinity; } + }); + var target = assign({}, obj); + st.deepEqual(visited, ['a', symbol], 'key is visited first, then symbol'); + st.equal(target.a, 42, 'target.a is 42'); + st.equal(target[symbol], Infinity, 'target[symbol] is Infinity'); + st.notEqual(target[nonEnumSymbol], -Infinity, 'target[nonEnumSymbol] is not -Infinity'); + st.end(); + }); + + t.test('does not fail when symbols are not present', { skip: !Object.isFrozen || Object.isFrozen(Object) }, function (st) { + var getSyms; + if (hasSymbols) { + getSyms = Object.getOwnPropertySymbols; + delete Object.getOwnPropertySymbols; + } + + var visited = []; + var obj = {}; + Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); + var keys = ['a']; + if (hasSymbols) { + var symbol = Symbol('sym'); + Object.defineProperty(obj, symbol, { + enumerable: true, + get: function () { visited.push(symbol); return Infinity; } + }); + keys.push(symbol); + } + var target = assign({}, obj); + st.deepEqual(visited, keys, 'assign visits expected keys'); + st.equal(target.a, 42, 'target.a is 42'); + + if (hasSymbols) { + st.equal(target[symbol], Infinity); + + Object.getOwnPropertySymbols = getSyms; + } + st.end(); + }); + + t.test('preserves correct property enumeration order', function (st) { + var str = 'abcdefghijklmnopqrst'; + var letters = {}; + forEach(str.split(''), function (letter) { + letters[letter] = letter; + }); + + var n = 5; + st.comment('run the next test ' + n + ' times'); + var object = assign({}, letters); + var actual = ''; + for (var k in object) { + actual += k; + } + for (var i = 0; i < n; ++i) { + st.equal(actual, str, 'property enumeration order should be followed'); + } + st.end(); + }); + + t.test('checks enumerability and existence, in case of modification during [[Get]]', { skip: !Object.defineProperty }, function (st) { + var targetBvalue = {}; + var targetCvalue = {}; + var target = { b: targetBvalue, c: targetCvalue }; + var source = {}; + Object.defineProperty(source, 'a', { + enumerable: true, + get: function () { + delete this.b; + Object.defineProperty(this, 'c', { enumerable: false }); + return 'a'; + } + }); + var sourceBvalue = {}; + var sourceCvalue = {}; + source.b = sourceBvalue; + source.c = sourceCvalue; + var result = assign(target, source); + st.equal(result, target, 'sanity check: result is === target'); + st.equal(result.b, targetBvalue, 'target key not overwritten by deleted source key'); + st.equal(result.c, targetCvalue, 'target key not overwritten by non-enumerable source key'); + + st.end(); + }); +}; diff --git a/node_modules/object.values/.editorconfig b/node_modules/object.values/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/object.values/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/object.values/.eslintignore b/node_modules/object.values/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/object.values/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/object.values/.eslintrc b/node_modules/object.values/.eslintrc new file mode 100644 index 0000000..15c95c1 --- /dev/null +++ b/node_modules/object.values/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "new-cap": [2, { "capIsNewExceptions": ["RequireObjectCoercible"] }], + "no-magic-numbers": [0], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"] + } +} diff --git a/node_modules/object.values/.nycrc b/node_modules/object.values/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/object.values/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/object.values/CHANGELOG.md b/node_modules/object.values/CHANGELOG.md new file mode 100644 index 0000000..a58077e --- /dev/null +++ b/node_modules/object.values/CHANGELOG.md @@ -0,0 +1,160 @@ +# 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). + +## [v1.1.5](https://github.com/ljharb/Object.values/compare/v1.1.4...v1.1.5) - 2021-10-03 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `tape` [`c397925`](https://github.com/ljharb/Object.values/commit/c3979252140c24514aeebf3d452b422528e36349) +- [Deps] update `es-abstract` [`f98d0da`](https://github.com/ljharb/Object.values/commit/f98d0da2035bf8396b2544f2e2ac02aec766d36f) +- [Robustness] use a call-bound `Array.prototype.push` [`72a3213`](https://github.com/ljharb/Object.values/commit/72a32138e91a9a7b3a828fa1f8f02fe361097c51) +- [meta] npmignore coverage output [`3b0433f`](https://github.com/ljharb/Object.values/commit/3b0433fe3025cb079b0de2373a0a9cfd2e0777b5) + +## [v1.1.4](https://github.com/ljharb/Object.values/compare/v1.1.3...v1.1.4) - 2021-05-26 + +### Commits + +- [meta] add `auto-changelog` [`01ee3ac`](https://github.com/ljharb/Object.values/commit/01ee3acb5c767559ce37a3b24bbd30253eae280c) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`f403cba`](https://github.com/ljharb/Object.values/commit/f403cba8852664d82bbf744cd36ad019742a14b5) +- [readme] add actions and codecov badges [`bee5cd2`](https://github.com/ljharb/Object.values/commit/bee5cd21770c9dffa874a2d18d728cf8478e3e7d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; switch `array-map` for `array.prototype.map` [`8c49dbe`](https://github.com/ljharb/Object.values/commit/8c49dbeed8e3312081d88848abe6bb04383d46ae) +- [Refactor] `propertyIsEnumerable` checks own-ness; remove `has` [`3cb48cf`](https://github.com/ljharb/Object.values/commit/3cb48cf8655504fee0d226036e9582be0fd3fbb0) +- [actions] update workflows [`eb1d757`](https://github.com/ljharb/Object.values/commit/eb1d7574489b86d5d276cf58e3faf77271d0a6f7) +- [Dev Deps] update `eslint`, `tape` [`0abdb2d`](https://github.com/ljharb/Object.values/commit/0abdb2d576aba1074075c1fb25de01ef943aaa77) +- [Tests] increase coverage [`8ca19a3`](https://github.com/ljharb/Object.values/commit/8ca19a3472a9e7883de91d4623fbbce978a0c535) +- [meta] use `prepublishOnly` script for npm 7+ [`88998c8`](https://github.com/ljharb/Object.values/commit/88998c80f21c0aaf7a640ad14caa7b9c08aa1e7c) +- [Deps] update `es-abstract` [`12515ab`](https://github.com/ljharb/Object.values/commit/12515ab54f055c42904caaadecce8d13edd673d8) +- [Deps] update `es-abstract` [`3083ce7`](https://github.com/ljharb/Object.values/commit/3083ce7cd7263cb2570d894947c5d6a4f64feffa) +- [meta] gitignore coverage output [`7aef22b`](https://github.com/ljharb/Object.values/commit/7aef22b2c623b756a3302c6df2265b69b1bb3e10) + +## [v1.1.3](https://github.com/ljharb/Object.values/compare/v1.1.2...v1.1.3) - 2021-02-22 + +### Commits + +- [meta] do not publish github action workflow files [`208c71c`](https://github.com/ljharb/Object.values/commit/208c71c6b34125317ea7784cd05f72c2c511fdfb) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `functions-have-names`, `has-strict-mode`, `tape` [`88849ab`](https://github.com/ljharb/Object.values/commit/88849abd1607d5e80cd4252246ad3d9d0876c431) +- [readme] remove travis badge [`0a9a67f`](https://github.com/ljharb/Object.values/commit/0a9a67f3f33fd82a8c45db6ec0059996c19b54cd) +- [actions] update workflows [`4ecb890`](https://github.com/ljharb/Object.values/commit/4ecb8909b6b5dead0a5ce65489f71c626a569826) +- [Deps] update `call-bind`, `es-abstract` [`28845c7`](https://github.com/ljharb/Object.values/commit/28845c737b5aa665344c39bcf87799484891fe47) + +## [v1.1.2](https://github.com/ljharb/Object.values/compare/v1.1.1...v1.1.2) - 2020-11-26 + +### Commits + +- [Tests] migrate tests to Github Actions [`6ab9d79`](https://github.com/ljharb/Object.values/commit/6ab9d798482ad84fbcb874b085820b6830d0d4e3) +- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`65667b7`](https://github.com/ljharb/Object.values/commit/65667b7b346a13f91ce6e541871a7687ff4673a4) +- [Tests] run `nyc` on all tests [`b83f36c`](https://github.com/ljharb/Object.values/commit/b83f36ce151a31a78f7e0b763a0b3a118be76256) +- [actions] add "Allow Edits" workflow [`44c7de1`](https://github.com/ljharb/Object.values/commit/44c7de155a409bda38215c32ce616eb33b0cf1cf) +- [Deps] update `es-abstract`; use `call-bind` where applicable [`35f88b0`](https://github.com/ljharb/Object.values/commit/35f88b0f8c7243238058640518446d09f3abe319) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `functions-have-names`; add `safe-publish-latest` [`2495030`](https://github.com/ljharb/Object.values/commit/2495030adccb3f3af615395f364950d76390517d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1cc1742`](https://github.com/ljharb/Object.values/commit/1cc17421906a8afa3d2ece4ebb745c6b501cba0e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `aud` [`f42bc75`](https://github.com/ljharb/Object.values/commit/f42bc75fc7c3a61a09eb0a2e5b4ae003f92d0023) +- [Fix] do not mutate the native function when present [`ea2a273`](https://github.com/ljharb/Object.values/commit/ea2a273cbd8f60f91cf9bb6528b8d5d1cae25f47) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`5040d09`](https://github.com/ljharb/Object.values/commit/5040d09bee5c3ea77694f76ff95c6d4b09bf4a0c) +- [Tests] only audit prod deps [`2803c92`](https://github.com/ljharb/Object.values/commit/2803c924114308f261e4c38dfc81706458046e7b) +- [Deps] update `es-abstract` [`d15d0e5`](https://github.com/ljharb/Object.values/commit/d15d0e5e0ac5342588aa558477e56a075b4b130f) +- [Dev Deps] update `tape` [`e83fe3a`](https://github.com/ljharb/Object.values/commit/e83fe3a4c38dc678866cd0905445d59ea7c58b5b) +- [Deps] update `es-abstract` [`cfab489`](https://github.com/ljharb/Object.values/commit/cfab48956d88dbf4a2659672c648465ca0cc3fc8) + +## [v1.1.1](https://github.com/ljharb/Object.values/compare/v1.1.0...v1.1.1) - 2019-12-12 + +### Commits + +- [Tests] use shared travis-ci configs [`2a82dea`](https://github.com/ljharb/Object.values/commit/2a82dea7bbde9773c0fbae64f7a70f9236effd86) +- [Tests] up to `node` `v12.7`, `v11.15`, `v10.16`, `v8.16`, `v6.17`; use `nvm install-latest-npm` [`58a4209`](https://github.com/ljharb/Object.values/commit/58a420950f906d62b9b62b6ad5881216f7585be2) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`80080cd`](https://github.com/ljharb/Object.values/commit/80080cdd93f8dbceb3383864e4d18f8cbb4947c0) +- [actions] add automatic rebasing / merge commit blocking [`e8a9297`](https://github.com/ljharb/Object.values/commit/e8a92975258fd674a2c00380f7ee7c2adb6ee009) +- [Refactor] use split-up `es-abstract` (85% bundle size decrease) [`a8ac36f`](https://github.com/ljharb/Object.values/commit/a8ac36fcad70e86a42d08cf0163f7b23945a3f45) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names` [`c74ad8a`](https://github.com/ljharb/Object.values/commit/c74ad8adcb78173f8e9cec541366c21307587de4) +- [Dev Deps] update `object-keys`, `tape`, `eslint` [`10adf18`](https://github.com/ljharb/Object.values/commit/10adf18de8784be02de042b7c8eec5dd911f4f1a) +- [meta] add `funding` field [`110dbca`](https://github.com/ljharb/Object.values/commit/110dbca51bc0413bab11fe56dabc5d0a373415a7) +- [Tests] use `functions-have-names` [`40746e5`](https://github.com/ljharb/Object.values/commit/40746e5311298d61385e3e316e3f0bc2956d9053) +- [Deps] update `es-abstract` [`9b7c99b`](https://github.com/ljharb/Object.values/commit/9b7c99b9881a3af022ec002cedd72a9aa64f34d2) + +## [v1.1.0](https://github.com/ljharb/Object.values/compare/v1.0.4...v1.1.0) - 2019-01-01 + +### Commits + +- [Tests] remove `jscs` [`a9d5f94`](https://github.com/ljharb/Object.values/commit/a9d5f94000ae6efb44cd964dcdfa5b986596392f) +- [Tests] up to `node` `v11.1`, `v10.13`, `v9.11`, `v8.12`, `v7.10`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`103a907`](https://github.com/ljharb/Object.values/commit/103a907829c29fabf16e880b178341d3b6832e32) +- [Tests] up to `node` `v7.4`, `v4.7`; improve test matrix [`66caa4a`](https://github.com/ljharb/Object.values/commit/66caa4a74e08de777c1b00185f796e609704bb83) +- [Tests] up to `node` `v11.6`, `v10.15`, `v8.15`, `v6.16` [`81de647`](https://github.com/ljharb/Object.values/commit/81de647b1eede60d69f49cf4ccbf970e3224528e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape` [`13c5dd1`](https://github.com/ljharb/Object.values/commit/13c5dd1fa7762cf509deafde12b14fe65e6c0c17) +- [Dev Deps] add missing `object-keys` dev dep [`7cbc7f3`](https://github.com/ljharb/Object.values/commit/7cbc7f38ac6b13738af8b42b62d0c89c5dce6bc6) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`1bf1dbe`](https://github.com/ljharb/Object.values/commit/1bf1dbe0b1fa1c646ef2c6c1bc3a14f5d4045f92) +- [Deps] update `define-properties`, `es-abstract`, `function-bind`, `has` [`faa4051`](https://github.com/ljharb/Object.values/commit/faa40515ff43662e3f381147a902e978cf250bdc) +- [Tests] use `npm audit` instead of `nsp` [`428fb50`](https://github.com/ljharb/Object.values/commit/428fb50c79cc0ef1e62fc053dc959a8848b0d190) +- Only apps should have lockfiles [`f35eb85`](https://github.com/ljharb/Object.values/commit/f35eb8520052bb4dd27ccfd4a399c6011c2ec157) +- [New] add `auto` entry point [`ed730e3`](https://github.com/ljharb/Object.values/commit/ed730e3b2508e4d89691b57d00fc63eebce7130e) + +## [v1.0.4](https://github.com/ljharb/Object.values/compare/v1.0.3...v1.0.4) - 2016-12-04 + +### Commits + +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `@es-shims/api` [`b0db351`](https://github.com/ljharb/Object.values/commit/b0db351280cfebad008eedff99556cead33a2f37) +- [Tests] up to `node` `v7.2`, `v6.9`, `v4.6`; improve test matrix. [`89362d3`](https://github.com/ljharb/Object.values/commit/89362d30ccee1a27f8d85c114adb14937b4ca7d0) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`883dce4`](https://github.com/ljharb/Object.values/commit/883dce455bcab08a045561554055003c3f06a917) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`67e83b8`](https://github.com/ljharb/Object.values/commit/67e83b8a84ff77f29c99b924760256e05e358dd8) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`2c1c6c7`](https://github.com/ljharb/Object.values/commit/2c1c6c759725418806d079abf828fd16b3df0aba) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@es-shims/api` [`d878ea6`](https://github.com/ljharb/Object.values/commit/d878ea62dc98952e62136de5a42a8caab2a66e84) +- [Tests] up to `node` `v5.6`, `v4.3` [`f37757e`](https://github.com/ljharb/Object.values/commit/f37757e78526e060d7fe2a7ba11414690bbbaa98) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`348a2a3`](https://github.com/ljharb/Object.values/commit/348a2a386b791fe090a08b7f33111d531277a3ab) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`b1e915e`](https://github.com/ljharb/Object.values/commit/b1e915ed9b35bdb9bb2b7ea35cdd5c78e62636d9) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`015b78d`](https://github.com/ljharb/Object.values/commit/015b78db57c4cc46d06b1b4f04f4ea2fdb35fc0c) +- [Tests] up to `node` `v5.9`, `v4.4` [`b33686e`](https://github.com/ljharb/Object.values/commit/b33686ea45a842c84e5186416fb52be31a60cc7e) +- [Dev Deps] update `jscs` [`0a44aa3`](https://github.com/ljharb/Object.values/commit/0a44aa30ab2fd5fe4a15070237c700172e517b3f) +- [Docs] update to reflect ES2017 inclusion. [`c01085b`](https://github.com/ljharb/Object.values/commit/c01085b134408bffadafa060bd1585a61674dd57) +- [Tests] use pretest/posttest for linting/security. [`8f9c6c7`](https://github.com/ljharb/Object.values/commit/8f9c6c7104d5694aaf266a6e6d12a92b9731a709) +- [Tests] fix npm upgrades on older nodes [`68c195f`](https://github.com/ljharb/Object.values/commit/68c195fe88677667002e5102c4efcfcc7bef059b) +- [Tests] up to `node` `v6.2` [`48fac8d`](https://github.com/ljharb/Object.values/commit/48fac8de7265142acb1554b28a29322baf53be20) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`471a794`](https://github.com/ljharb/Object.values/commit/471a7940a7dff28a6544c6c253b90daa60ff3c65) +- [Deps] update `es-abstract` [`7e644f1`](https://github.com/ljharb/Object.values/commit/7e644f1bb7c6db533ed137d88de7856e7b9c55b1) +- [Deps] update `es-abstract` [`1856267`](https://github.com/ljharb/Object.values/commit/18562676e8aa606a47116753c323dd28619dea50) +- [Tests] on `node` `v5.12` [`8a4e0c0`](https://github.com/ljharb/Object.values/commit/8a4e0c03415fb67fc2ac420eba6ece5b660cbfe7) +- [Tests] on `node` `v5.10` [`aaeb1a7`](https://github.com/ljharb/Object.values/commit/aaeb1a7a176eca1e69f4df7a8979f0ba40b12c29) +- [Deps] update `function-bind` [`14d2e88`](https://github.com/ljharb/Object.values/commit/14d2e88045d8f92877e9a31f31a2b624267de54f) +- [Deps] update `es-abstract` [`63e46a9`](https://github.com/ljharb/Object.values/commit/63e46a9efd3081872e92ec94a2ed6dbaae3c615a) +- [Deps] update `es-abstract` [`7c40db6`](https://github.com/ljharb/Object.values/commit/7c40db6381bad3232be3e1c24ef79839b6edaba7) +- [Deps] update `define-properties` [`0a86270`](https://github.com/ljharb/Object.values/commit/0a86270bda6478c4e08045b1fb3f2eb72b2207cd) +- [Tests] on `node` `v4.2` [`8ee831d`](https://github.com/ljharb/Object.values/commit/8ee831dae76ef522d6acaae9869a1a7b465361a4) +- [Tests] on `node` `v5.0` [`b9c88c7`](https://github.com/ljharb/Object.values/commit/b9c88c74f2cbb280cfc1c88064c9cd514b4876ae) + +## [v1.0.3](https://github.com/ljharb/Object.values/compare/v1.0.2...v1.0.3) - 2015-10-06 + +### Commits + +- Add test case to cover non-enumerable keys made enumerable by a previous getter. [`9d61739`](https://github.com/ljharb/Object.values/commit/9d617395f0ec81cbdcbc50a46e4489c95253f80b) +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`cf6dff8`](https://github.com/ljharb/Object.values/commit/cf6dff84131cef953498988249c5306c71c1fe9f) +- [Dev Deps] update `jscs`, `eslint` [`f439029`](https://github.com/ljharb/Object.values/commit/f439029b228e0dab0542caa63e1d032889d53705) +- [Deps] update `es-abstract` [`6879994`](https://github.com/ljharb/Object.values/commit/6879994fec305490b5550d25ce390e4b64c74fe0) + +## [v1.0.2](https://github.com/ljharb/Object.values/compare/v1.0.1...v1.0.2) - 2015-09-25 + +### Fixed + +- Not-yet-visited keys deleted on a [[Get]] must not show up in the output [`#1`](https://github.com/ljharb/Object.values/issues/1) + +## [v1.0.1](https://github.com/ljharb/Object.values/compare/v1.0.0...v1.0.1) - 2015-09-21 + +### Commits + +- [Tests] on `io.js` `v3.3`, up to `node` `v4.1` [`27aac5f`](https://github.com/ljharb/Object.values/commit/27aac5f80c05f66d584056931b63eed637059621) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`83cde5c`](https://github.com/ljharb/Object.values/commit/83cde5c685db366f769d738bc30f7a6d273bcc3a) +- Add es-shim API keyword [`2c6b885`](https://github.com/ljharb/Object.values/commit/2c6b88550c155b4f9a7c6ece609b8d97d77b2942) +- [Docs] update version badge URL [`626bf99`](https://github.com/ljharb/Object.values/commit/626bf991d9b0f5720819537698918b295c6ea0d0) + +## v1.0.0 - 2015-09-02 + +### Commits + +- Dotfiles [`5251629`](https://github.com/ljharb/Object.values/commit/5251629c47404fa0dec7b6d230eda10da0f47eea) +- Tests [`b02e54e`](https://github.com/ljharb/Object.values/commit/b02e54ef157c56117b390cb1db95f7d48163a838) +- package.json [`7b84f4e`](https://github.com/ljharb/Object.values/commit/7b84f4e839f75b227a5233325f064900a6032f9a) +- Read me [`31e115b`](https://github.com/ljharb/Object.values/commit/31e115b31af2eabf4db518343310f2bb42e7fa04) +- Initial commit [`01271a5`](https://github.com/ljharb/Object.values/commit/01271a51976524c62bac00d8af9af3ede72831dd) +- Implementation. [`9a0c315`](https://github.com/ljharb/Object.values/commit/9a0c31554899f411d31d3b8343c754eb2c19842e) +- Clarifying tests that only Symbol *properties* are omitted. [`16b3abb`](https://github.com/ljharb/Object.values/commit/16b3abb7c15790cb63e9b2b842b75fdc4210ad69) diff --git a/node_modules/object.values/LICENSE b/node_modules/object.values/LICENSE new file mode 100644 index 0000000..b43df44 --- /dev/null +++ b/node_modules/object.values/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/object.values/README.md b/node_modules/object.values/README.md new file mode 100644 index 0000000..153b534 --- /dev/null +++ b/node_modules/object.values/README.md @@ -0,0 +1,58 @@ +# object.values [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2017 spec-compliant `Object.values` shim. Invoke its "shim" method to shim `Object.values` if it is unavailable or noncompliant. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.github.io/ecma262/#sec-object.values). + +Most common usage: +```js +var assert = require('assert'); +var values = require('object.values'); + +var obj = { a: 1, b: 2, c: 3 }; +var expected = [1, 2, 3]; + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + // for environments with Symbol support + var sym = Symbol(); + obj[sym] = 4; + obj.d = sym; + expected.push(sym); +} + +assert.deepEqual(values(obj), expected); + +if (!Object.values) { + values.shim(); +} + +assert.deepEqual(Object.values(obj), expected); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/object.values +[npm-version-svg]: https://versionbadg.es/es-shims/Object.values.svg +[deps-svg]: https://david-dm.org/es-shims/Object.values.svg +[deps-url]: https://david-dm.org/es-shims/Object.values +[dev-deps-svg]: https://david-dm.org/es-shims/Object.values/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/Object.values#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/object.values.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/object.values.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/object.values.svg +[downloads-url]: https://npm-stat.com/charts.html?package=object.values +[codecov-image]: https://codecov.io/gh/es-shims/Object.values/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/Object.values/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Object.values +[actions-url]: https://github.com/es-shims/Object.values/actions diff --git a/node_modules/object.values/auto.js b/node_modules/object.values/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/object.values/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/object.values/implementation.js b/node_modules/object.values/implementation.js new file mode 100644 index 0000000..a4958f7 --- /dev/null +++ b/node_modules/object.values/implementation.js @@ -0,0 +1,18 @@ +'use strict'; + +var RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible'); +var callBound = require('call-bind/callBound'); + +var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var $push = callBound('Array.prototype.push'); + +module.exports = function values(O) { + var obj = RequireObjectCoercible(O); + var vals = []; + for (var key in obj) { + if ($isEnumerable(obj, key)) { // checks own-ness as well + $push(vals, obj[key]); + } + } + return vals; +}; diff --git a/node_modules/object.values/index.js b/node_modules/object.values/index.js new file mode 100644 index 0000000..abf0449 --- /dev/null +++ b/node_modules/object.values/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var polyfill = callBind(getPolyfill(), Object); + +define(polyfill, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = polyfill; diff --git a/node_modules/object.values/package.json b/node_modules/object.values/package.json new file mode 100644 index 0000000..6c514ac --- /dev/null +++ b/node_modules/object.values/package.json @@ -0,0 +1,90 @@ +{ + "name": "object.values", + "version": "1.1.5", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES2017 spec-compliant Object.values shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npx aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint .", + "postlint": "es-shim-api --bound", + "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://github.com/es-shims/Object.values.git" + }, + "keywords": [ + "Object.values", + "Object.keys", + "Object.entries", + "values", + "ES7", + "ES8", + "ES2017", + "shim", + "object", + "keys", + "entries", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + }, + "devDependencies": { + "@es-shims/api": "^2.2.2", + "@ljharb/eslint-config": "^18.0.0", + "array.prototype.map": "^1.0.3", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^7.32.0", + "functions-have-names": "^1.2.2", + "has-strict-mode": "^1.0.1", + "nyc": "^10.3.2", + "object-keys": "^1.1.1", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.1" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/11.6..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/object.values/polyfill.js b/node_modules/object.values/polyfill.js new file mode 100644 index 0000000..2790be4 --- /dev/null +++ b/node_modules/object.values/polyfill.js @@ -0,0 +1,7 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + return typeof Object.values === 'function' ? Object.values : implementation; +}; diff --git a/node_modules/object.values/shim.js b/node_modules/object.values/shim.js new file mode 100644 index 0000000..a680e98 --- /dev/null +++ b/node_modules/object.values/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var getPolyfill = require('./polyfill'); +var define = require('define-properties'); + +module.exports = function shimValues() { + var polyfill = getPolyfill(); + define(Object, { values: polyfill }, { + values: function testValues() { + return Object.values !== polyfill; + } + }); + return polyfill; +}; diff --git a/node_modules/object.values/test/.eslintrc b/node_modules/object.values/test/.eslintrc new file mode 100644 index 0000000..5562962 --- /dev/null +++ b/node_modules/object.values/test/.eslintrc @@ -0,0 +1,11 @@ +{ + "rules": { + "array-bracket-newline": 0, + "max-lines-per-function": 0, + "max-nested-callbacks": [2, 3], + "max-statements": [2, 12], + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": [1], + "object-curly-newline": 0, + } +} diff --git a/node_modules/object.values/test/implementation.js b/node_modules/object.values/test/implementation.js new file mode 100644 index 0000000..e3a1e46 --- /dev/null +++ b/node_modules/object.values/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation, Object), t); + + t.end(); +}); diff --git a/node_modules/object.values/test/index.js b/node_modules/object.values/test/index.js new file mode 100644 index 0000000..2c1bba5 --- /dev/null +++ b/node_modules/object.values/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var values = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { values(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { values(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(values, t); + + t.end(); +}); diff --git a/node_modules/object.values/test/shimmed.js b/node_modules/object.values/test/shimmed.js new file mode 100644 index 0000000..2fc74cd --- /dev/null +++ b/node_modules/object.values/test/shimmed.js @@ -0,0 +1,35 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + t.equal(Object.values.length, 1, 'Object.values has a length of 1'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.values.name, 'values', 'Object.values has name "values"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'values'), 'Object.values is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return Object.values(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return Object.values(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(Object.values, t); + + t.end(); +}); diff --git a/node_modules/object.values/test/tests.js b/node_modules/object.values/test/tests.js new file mode 100644 index 0000000..2dacfd0 --- /dev/null +++ b/node_modules/object.values/test/tests.js @@ -0,0 +1,82 @@ +'use strict'; + +var keys = require('object-keys'); +var map = require('array.prototype.map'); +var define = require('define-properties'); + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +module.exports = function (values, t) { + var a = {}; + var b = {}; + var c = {}; + var obj = { a: a, b: b, c: c }; + + t.deepEqual(values(obj), [a, b, c], 'basic support'); + t.deepEqual(values({ a: a, b: a, c: c }), [a, a, c], 'duplicate values are included'); + + t.test('values are in the same order as keys', function (st) { + var object = { a: a, b: b }; + object[0] = 3; + object.c = c; + object[1] = 4; + delete object[0]; + var objKeys = keys(object); + var objValues = map(objKeys, function (key) { + return object[key]; + }); + st.deepEqual(values(object), objValues, 'values match key order'); + st.end(); + }); + + t.test('non-enumerable properties are omitted', { skip: !Object.defineProperty }, function (st) { + var object = { a: a, b: b }; + Object.defineProperty(object, 'c', { enumerable: false, value: c }); + st.deepEqual(values(object), [a, b], 'non-enumerable property‘s value is omitted'); + st.end(); + }); + + t.test('inherited properties are omitted', function (st) { + var F = function G() {}; + F.prototype.a = a; + var f = new F(); + f.b = b; + st.deepEqual(values(f), [b], 'only own properties are included'); + st.end(); + }); + + t.test('Symbol properties are omitted', { skip: !hasSymbols }, function (st) { + var object = { a: a, b: b, c: c }; + var enumSym = Symbol('enum'); + var nonEnumSym = Symbol('non enum'); + object[enumSym] = enumSym; + object.d = enumSym; + Object.defineProperty(object, nonEnumSym, { enumerable: false, value: nonEnumSym }); + st.deepEqual(values(object), [a, b, c, enumSym], 'symbol properties are omitted'); + st.end(); + }); + + t.test('not-yet-visited keys deleted on [[Get]] must not show up in output', { skip: !define.supportsDescriptors }, function (st) { + var o = { a: 1, b: 2, c: 3 }; + Object.defineProperty(o, 'a', { + get: function () { + delete this.b; + return 1; + } + }); + st.deepEqual(values(o), [1, 3], 'when "b" is deleted prior to being visited, it should not show up'); + st.end(); + }); + + t.test('not-yet-visited keys made non-enumerable on [[Get]] must not show up in output', { skip: !define.supportsDescriptors }, function (st) { + var o = { a: 'A', b: 'B' }; + Object.defineProperty(o, 'a', { + get: function () { + Object.defineProperty(o, 'b', { enumerable: false }); + return 'A'; + } + }); + st.deepEqual(values(o), ['A'], 'when "b" is made non-enumerable prior to being visited, it should not show up'); + st.end(); + }); +}; diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/once/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/once/README.md b/node_modules/once/README.md new file mode 100644 index 0000000..1f1ffca --- /dev/null +++ b/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/node_modules/once/once.js b/node_modules/once/once.js new file mode 100644 index 0000000..2354067 --- /dev/null +++ b/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/node_modules/once/package.json b/node_modules/once/package.json new file mode 100644 index 0000000..16815b2 --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,33 @@ +{ + "name": "once", + "version": "1.4.0", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.0.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "files": [ + "once.js" + ], + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/node_modules/optionator/CHANGELOG.md b/node_modules/optionator/CHANGELOG.md new file mode 100644 index 0000000..2928cc2 --- /dev/null +++ b/node_modules/optionator/CHANGELOG.md @@ -0,0 +1,59 @@ +# 0.9.0 +- update dependencies, in particular `levn` and `type-check` - this could affect behaviour of argument parsing + +# 0.8.3 +- changes dependency from `wordwrap` to `word-wrap` due to license issue +- update dependencies + +# 0.8.2 +- fix bug #18 - detect missing value when flag is last item +- update dependencies + +# 0.8.1 +- update `fast-levenshtein` dependency + +# 0.8.0 +- update `levn` dependency - supplying a float value to an option with type `Int` now throws an error, instead of silently converting to an `Int` + +# 0.7.1 +- fix bug with use of `defaults` and `concatRepeatedArrays` or `mergeRepeatedObjects` + +# 0.7.0 +- added `concatrepeatedarrays` option: `oneValuePerFlag`, only allows one array value per flag +- added `typeAliases` option +- added `parseArgv` which takes an array and parses with the first two items sliced off +- changed enum help style +- bug fixes (#12) +- use of `concatRepeatedArrays` and `mergeRepeatedObjects` at the top level is deprecated, use it as either a per-option option, or set them in the `defaults` object to set them for all objects + +# 0.6.0 +- added `defaults` lib-option flag, allowing one to set default properties for all options +- added `concatRepeatedArrays` and `mergeRepeatedObjects` as option level properties, allowing you to turn this feature on for specific options only + +# 0.5.0 +- `Boolean` flags with `default: 'true'`, and no short aliases, will by default show the `--no` version in help + +# 0.4.0 +- add `mergeRepeatedObjects` setting + +# 0.3.0 +- add `concatRepeatedArrays` setting +- add `overrideRequired` option setting +- use just Levenshtein string compare algo rather than Levenshtein Damerau to due dependency license issue + +# 0.2.2 +- bug fixes + +# 0.2.1 +- improved interpolation +- added changelog + +# 0.2.0 +- add dependency checks to options - added `dependsOn` as an option property +- add interpolation for `prepend` and `append` text with new `generateHelp` option, `interpolate` + +# 0.1.1 +- update dependencies + +# 0.1.0 +- initial release diff --git a/node_modules/optionator/LICENSE b/node_modules/optionator/LICENSE new file mode 100644 index 0000000..525b118 --- /dev/null +++ b/node_modules/optionator/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/optionator/README.md b/node_modules/optionator/README.md new file mode 100644 index 0000000..b1c5391 --- /dev/null +++ b/node_modules/optionator/README.md @@ -0,0 +1,238 @@ +# Optionator +
+ +Optionator is a JavaScript/Node.js option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator). + +For an online demo, check out the [Grasp online demo](http://www.graspjs.com/#demo). + +[About](#about) · [Usage](#usage) · [Settings Format](#settings-format) · [Argument Format](#argument-format) + +## Why? +The problem with other option parsers, such as `yargs` or `minimist`, is they just accept all input, valid or not. +With Optionator, if you mistype an option, it will give you an error (with a suggestion for what you meant). +If you give the wrong type of argument for an option, it will give you an error rather than supplying the wrong input to your application. + + $ cmd --halp + Invalid option '--halp' - perhaps you meant '--help'? + + $ cmd --count str + Invalid value for option 'count' - expected type Int, received value: str. + +Other helpful features include reformatting the help text based on the size of the console, so that it fits even if the console is narrow, and accepting not just an array (eg. process.argv), but a string or object as well, making things like testing much easier. + +## About +Optionator uses [type-check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) behind the scenes to cast and verify input according the specified types. + +MIT license. Version 0.9.1 + + npm install optionator + +For updates on Optionator, [follow me on twitter](https://twitter.com/gkzahariev). + +Optionator is a Node.js module, but can be used in the browser as well if packed with webpack/browserify. + +## Usage +`require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `parseArgv`, `generateHelp`, and `generateHelpForOption`, which are all functions. + +```js +var optionator = require('optionator')({ + prepend: 'Usage: cmd [options]', + append: 'Version 1.0.0', + options: [{ + option: 'help', + alias: 'h', + type: 'Boolean', + description: 'displays help' + }, { + option: 'count', + alias: 'c', + type: 'Int', + description: 'number of things', + example: 'cmd --count 2' + }] +}); + +var options = optionator.parseArgv(process.argv); +if (options.help) { + console.log(optionator.generateHelp()); +} +... +``` + +### parse(input, parseOptions) +`parse` processes the `input` according to your settings, and returns an object with the results. + +##### arguments +* input - `[String] | Object | String` - the input you wish to parse +* parseOptions - `{slice: Int}` - all options optional + - `slice` specifies how much to slice away from the beginning if the input is an array or string - by default `0` for string, `2` for array (works with `process.argv`) + +##### returns +`Object` - the parsed options, each key is a camelCase version of the option name (specified in dash-case), and each value is the processed value for that option. Positional values are in an array under the `_` key. + +##### example +```js +parse(['node', 't.js', '--count', '2', 'positional']); // {count: 2, _: ['positional']} +parse('--count 2 positional'); // {count: 2, _: ['positional']} +parse({count: 2, _:['positional']}); // {count: 2, _: ['positional']} +``` + +### parseArgv(input) +`parseArgv` works exactly like `parse`, but only for array input and it slices off the first two elements. + +##### arguments +* input - `[String]` - the input you wish to parse + +##### returns +See "returns" section in "parse" + +##### example +```js +parseArgv(process.argv); +``` + +### generateHelp(helpOptions) +`generateHelp` produces help text based on your settings. + +##### arguments +* helpOptions - `{showHidden: Boolean, interpolate: Object}` - all options optional + - `showHidden` specifies whether to show options with `hidden: true` specified, by default it is `false` + - `interpolate` specify data to be interpolated in `prepend` and `append` text, `{{key}}` is the format - eg. `generateHelp({interpolate:{version: '0.4.2'}})`, will change this `append` text: `Version {{version}}` to `Version 0.4.2` + +##### returns +`String` - the generated help text + +##### example +```js +generateHelp(); /* +"Usage: cmd [options] positional + + -h, --help displays help + -c, --count Int number of things + +Version 1.0.0 +"*/ +``` + +### generateHelpForOption(optionName) +`generateHelpForOption` produces expanded help text for the specified with `optionName` option. If an `example` was specified for the option, it will be displayed, and if a `longDescription` was specified, it will display that instead of the `description`. + +##### arguments +* optionName - `String` - the name of the option to display + +##### returns +`String` - the generated help text for the option + +##### example +```js +generateHelpForOption('count'); /* +"-c, --count Int +description: number of things +example: cmd --count 2 +"*/ +``` + +## Settings Format +When your `require('optionator')`, you get a function that takes in a settings object. This object has the type: + + { + prepend: String, + append: String, + options: [{heading: String} | { + option: String, + alias: [String] | String, + type: String, + enum: [String], + default: String, + restPositional: Boolean, + required: Boolean, + overrideRequired: Boolean, + dependsOn: [String] | String, + concatRepeatedArrays: Boolean | (Boolean, Object), + mergeRepeatedObjects: Boolean, + description: String, + longDescription: String, + example: [String] | String + }], + helpStyle: { + aliasSeparator: String, + typeSeparator: String, + descriptionSeparator: String, + initialIndent: Int, + secondaryIndent: Int, + maxPadFactor: Number + }, + mutuallyExclusive: [[String | [String]]], + concatRepeatedArrays: Boolean | (Boolean, Object), // deprecated, set in defaults object + mergeRepeatedObjects: Boolean, // deprecated, set in defaults object + positionalAnywhere: Boolean, + typeAliases: Object, + defaults: Object + } + +All of the properties are optional (the `Maybe` has been excluded for brevities sake), except for having either `heading: String` or `option: String` in each object in the `options` array. + +### Top Level Properties +* `prepend` is an optional string to be placed before the options in the help text +* `append` is an optional string to be placed after the options in the help text +* `options` is a required array specifying your options and headings, the options and headings will be displayed in the order specified +* `helpStyle` is an optional object which enables you to change the default appearance of some aspects of the help text +* `mutuallyExclusive` is an optional array of arrays of either strings or arrays of strings. The top level array is a list of rules, each rule is a list of elements - each element can be either a string (the name of an option), or a list of strings (a group of option names) - there will be an error if more than one element is present +* `concatRepeatedArrays` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property +* `mergeRepeatedObjects` see description under the "Option Properties" heading - use at the top level is deprecated, if you want to set this for all options, use the `defaults` property +* `positionalAnywhere` is an optional boolean (defaults to `true`) - when `true` it allows positional arguments anywhere, when `false`, all arguments after the first positional one are taken to be positional as well, even if they look like a flag. For example, with `positionalAnywhere: false`, the arguments `--flag --boom 12 --crack` would have two positional arguments: `12` and `--crack` +* `typeAliases` is an optional object, it allows you to set aliases for types, eg. `{Path: 'String'}` would allow you to use the type `Path` as an alias for the type `String` +* `defaults` is an optional object following the option properties format, which specifies default values for all options. A default will be overridden if manually set. For example, you can do `default: { type: "String" }` to set the default type of all options to `String`, and then override that default in an individual option by setting the `type` property + +#### Heading Properties +* `heading` a required string, the name of the heading + +#### Option Properties +* `option` the required name of the option - use dash-case, without the leading dashes +* `alias` is an optional string or array of strings which specify any aliases for the option +* `type` is a required string in the [type check](https://github.com/gkz/type-check) [format](https://github.com/gkz/type-check#type-format), this will be used to cast the inputted value and validate it +* `enum` is an optional array of strings, each string will be parsed by [levn](https://github.com/gkz/levn) - the argument value must be one of the resulting values - each potential value must validate against the specified `type` +* `default` is a optional string, which will be parsed by [levn](https://github.com/gkz/levn) and used as the default value if none is set - the value must validate against the specified `type` +* `restPositional` is an optional boolean - if set to `true`, everything after the option will be taken to be a positional argument, even if it looks like a named argument +* `required` is an optional boolean - if set to `true`, the option parsing will fail if the option is not defined +* `overrideRequired` is a optional boolean - if set to `true` and the option is used, and there is another option which is required but not set, it will override the need for the required option and there will be no error - this is useful if you have required options and want to use `--help` or `--version` flags +* `concatRepeatedArrays` is an optional boolean or tuple with boolean and options object (defaults to `false`) - when set to `true` and an option contains an array value and is repeated, the subsequent values for the flag will be appended rather than overwriting the original value - eg. option `g` of type `[String]`: `-g a -g b -g c,d` will result in `['a','b','c','d']` + + You can supply an options object by giving the following value: `[true, options]`. The one currently supported option is `oneValuePerFlag`, this only allows one array value per flag. This is useful if your potential values contain a comma. +* `mergeRepeatedObjects` is an optional boolean (defaults to `false`) - when set to `true` and an option contains an object value and is repeated, the subsequent values for the flag will be merged rather than overwriting the original value - eg. option `g` of type `Object`: `-g a:1 -g b:2 -g c:3,d:4` will result in `{a: 1, b: 2, c: 3, d: 4}` +* `dependsOn` is an optional string or array of strings - if simply a string (the name of another option), it will make sure that that other option is set, if an array of strings, depending on whether `'and'` or `'or'` is first, it will either check whether all (`['and', 'option-a', 'option-b']`), or at least one (`['or', 'option-a', 'option-b']`) other options are set +* `description` is an optional string, which will be displayed next to the option in the help text +* `longDescription` is an optional string, it will be displayed instead of the `description` when `generateHelpForOption` is used +* `example` is an optional string or array of strings with example(s) for the option - these will be displayed when `generateHelpForOption` is used + +#### Help Style Properties +* `aliasSeparator` is an optional string, separates multiple names from each other - default: ' ,' +* `typeSeparator` is an optional string, separates the type from the names - default: ' ' +* `descriptionSeparator` is an optional string , separates the description from the padded name and type - default: ' ' +* `initialIndent` is an optional int - the amount of indent for options - default: 2 +* `secondaryIndent` is an optional int - the amount of indent if wrapped fully (in addition to the initial indent) - default: 4 +* `maxPadFactor` is an optional number - affects the default level of padding for the names/type, it is multiplied by the average of the length of the names/type - default: 1.5 + +## Argument Format +At the highest level there are two types of arguments: named, and positional. + +Name arguments of any length are prefixed with `--` (eg. `--go`), and those of one character may be prefixed with either `--` or `-` (eg. `-g`). + +There are two types of named arguments: boolean flags (eg. `--problemo`, `-p`) which take no value and result in a `true` if they are present, the falsey `undefined` if they are not present, or `false` if present and explicitly prefixed with `no` (eg. `--no-problemo`). Named arguments with values (eg. `--tseries 800`, `-t 800`) are the other type. If the option has a type `Boolean` it will automatically be made into a boolean flag. Any other type results in a named argument that takes a value. + +For more information about how to properly set types to get the value you want, take a look at the [type check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) pages. + +You can group single character arguments that use a single `-`, however all except the last must be boolean flags (which take no value). The last may be a boolean flag, or an argument which takes a value - eg. `-ba 2` is equivalent to `-b -a 2`. + +Positional arguments are all those values which do not fall under the above - they can be anywhere, not just at the end. For example, in `cmd -b one -a 2 two` where `b` is a boolean flag, and `a` has the type `Number`, there are two positional arguments, `one` and `two`. + +Everything after an `--` is positional, even if it looks like a named argument. + +You may optionally use `=` to separate option names from values, for example: `--count=2`. + +If you specify the option `NUM`, then any argument using a single `-` followed by a number will be valid and will set the value of `NUM`. Eg. `-2` will be parsed into `NUM: 2`. + +If duplicate named arguments are present, the last one will be taken. + +## Technical About +`optionator` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [levn](https://github.com/gkz/levn) to cast arguments to their specified type, and uses [type-check](https://github.com/gkz/type-check) to validate values. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/optionator/lib/help.js b/node_modules/optionator/lib/help.js new file mode 100644 index 0000000..59e6f96 --- /dev/null +++ b/node_modules/optionator/lib/help.js @@ -0,0 +1,260 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordWrap, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp; + ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines; + ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin; + wordWrap = require('word-wrap'); + wordwrap = function(a, b){ + var ref$, indent, width; + ref$ = b === undefined + ? ['', a - 1] + : [repeatString$(' ', a), b - a - 1], indent = ref$[0], width = ref$[1]; + return function(text){ + return wordWrap(text, { + indent: indent, + width: width, + trim: true + }); + }; + }; + getPreText = function(option, arg$, maxWidth){ + var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap; + mainName = option.option, shortNames = (ref$ = option.shortNames) != null + ? ref$ + : [], longNames = (ref$ = option.longNames) != null + ? ref$ + : [], type = option.type, description = option.description; + aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent; + if (option.negateName) { + mainName = "no-" + mainName; + if (longNames) { + longNames = map(function(it){ + return "no-" + it; + }, longNames); + } + } + names = mainName.length === 1 + ? [mainName].concat(shortNames, longNames) + : shortNames.concat([mainName], longNames); + namesString = map(nameToRaw, names).join(aliasSeparator); + namesStringLen = namesString.length; + typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator; + typeSeparatorStringLen = typeSeparatorString.length; + if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + type.length > maxWidth) { + wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth); + return namesString + "" + typeSeparatorString + wrap(type).replace(/^\s+/, ''); + } else { + return namesString + "" + (option.boolean + ? '' + : typeSeparatorString + "" + type); + } + }; + setHelpStyleDefaults = function(helpStyle){ + helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', '); + helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' '); + helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' '); + helpStyle.initialIndent == null && (helpStyle.initialIndent = 2); + helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4); + helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5); + }; + generateHelpForOption = function(getOption, arg$){ + var stdout, helpStyle, ref$; + stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null + ? ref$ + : {}; + setHelpStyleDefaults(helpStyle); + return function(optionName){ + var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator; + maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null; + wrap = maxWidth ? wordwrap(maxWidth) : id; + try { + option = getOption(dasherize(optionName)); + } catch (e$) { + e = e$; + return e.message; + } + pre = getPreText(option, helpStyle); + defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : ''; + restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : ''; + description = option.longDescription || option.description && sentencize(option.description); + fullDescription = description && restPositionalString + ? description + " " + restPositionalString + : (that = description || restPositionalString) ? that : ''; + preDescription = 'description:'; + descriptionString = !fullDescription + ? '' + : maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth + ? "\n" + preDescription + "\n" + wrap(fullDescription) + : "\n" + preDescription + " " + fullDescription; + exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1 + ? "\nexamples:\n" + unlines(examples) + : "\nexample: " + examples[0]) : ''; + seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : ''; + return pre + "" + seperator + defaultString + descriptionString + exampleString; + }; + }; + generateHelp = function(arg$){ + var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent; + options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null + ? ref$ + : {}, stdout = arg$.stdout; + setHelpStyleDefaults(helpStyle); + aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent; + return function(arg$){ + var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, descParts, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap; + ref$ = arg$ != null + ? arg$ + : {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate; + maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null; + output = []; + out = function(it){ + return output.push(it != null ? it : ''); + }; + if (prepend) { + out(interpolate ? interp(prepend, interpolate) : prepend); + out(); + } + data = []; + optionCount = 0; + totalPreLen = 0; + preLens = []; + for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) { + item = ref$[i$]; + if (showHidden || !item.hidden) { + if (that = item.heading) { + data.push({ + type: 'heading', + value: that + }); + } else { + pre = getPreText(item, helpStyle, maxWidth); + descParts = []; + if ((that = item.description) != null) { + descParts.push(that); + } + if (that = item['enum']) { + descParts.push("either: " + naturalJoin(that)); + } + if (item['default'] && !item.negateName) { + descParts.push("default: " + item['default']); + } + desc = descParts.join(' - '); + data.push({ + type: 'option', + pre: pre, + desc: desc, + descLen: desc.length + }); + preLen = pre.length; + optionCount++; + totalPreLen += preLen; + preLens.push(preLen); + } + } + } + sortedPreLens = sort(preLens); + maxPreLen = sortedPreLens[sortedPreLens.length - 1]; + preLenMean = initialIndent + totalPreLen / optionCount; + x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen; + for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) { + preLen = sortedPreLens[i$]; + if (preLen <= x) { + padAmount = preLen; + break; + } + } + descSepLen = descriptionSeparator.length; + if (maxWidth != null) { + fullWrapCount = 0; + partialWrapCount = 0; + for (i$ = 0, len$ = data.length; i$ < len$; ++i$) { + item = data[i$]; + if (item.type === 'option') { + pre = item.pre, desc = item.desc, descLen = item.descLen; + if (descLen === 0) { + item.wrap = 'none'; + } else { + preLen = max(padAmount, pre.length) + initialIndent + descSepLen; + totalLen = preLen + descLen; + if (totalLen > maxWidth) { + if (descLen / 2.5 > maxWidth - preLen) { + fullWrapCount++; + item.wrap = 'full'; + } else { + partialWrapCount++; + item.wrap = 'partial'; + } + } else { + item.wrap = 'none'; + } + } + } + } + } + initialSpace = repeatString$(' ', initialIndent); + wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5; + for (i$ = 0, len$ = data.length; i$ < len$; ++i$) { + i = i$; + item = data[i$]; + if (item.type === 'heading') { + if (i !== 0) { + out(); + } + out(item.value + ":"); + } else { + pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap; + if (maxWidth != null) { + if (wrapAllFull || wrap === 'full') { + wrap = wordwrap(initialIndent + secondaryIndent, maxWidth); + out(initialSpace + "" + pre + "\n" + wrap(desc)); + continue; + } else if (wrap === 'partial') { + wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth); + out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, '')); + continue; + } + } + if (descLen === 0) { + out(initialSpace + "" + pre); + } else { + out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc); + } + } + } + if (append) { + out(); + out(interpolate ? interp(append, interpolate) : append); + } + return unlines(output); + }; + }; + function pad(str, num){ + var len, padAmount; + len = str.length; + padAmount = num - len; + return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0); + } + function sentencize(str){ + var first, rest, period; + first = str.charAt(0).toUpperCase(); + rest = str.slice(1); + period = /[\.!\?]$/.test(str) ? '' : '.'; + return first + "" + rest + period; + } + function interp(string, object){ + return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){ + var ref$; + return (ref$ = object[key]) != null + ? ref$ + : "{{" + key + "}}"; + }); + } + module.exports = { + generateHelp: generateHelp, + generateHelpForOption: generateHelpForOption + }; + function repeatString$(str, n){ + for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str; + return r; + } +}).call(this); diff --git a/node_modules/optionator/lib/index.js b/node_modules/optionator/lib/index.js new file mode 100644 index 0000000..20d914b --- /dev/null +++ b/node_modules/optionator/lib/index.js @@ -0,0 +1,465 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, naturalJoin, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice, arrayFrom$ = Array.from || function(x){return slice$.call(x);}; + VERSION = '0.9.1'; + ref$ = require('prelude-ls'), id = ref$.id, map = ref$.map, compact = ref$.compact, any = ref$.any, groupBy = ref$.groupBy, partition = ref$.partition, chars = ref$.chars, isItNaN = ref$.isItNaN, keys = ref$.keys, Obj = ref$.Obj, camelize = ref$.camelize; + deepIs = require('deep-is'); + ref$ = require('./util'), closestString = ref$.closestString, nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin; + ref$ = require('./help'), generateHelp = ref$.generateHelp, generateHelpForOption = ref$.generateHelpForOption; + ref$ = require('type-check'), parsedTypeCheck = ref$.parsedTypeCheck, parseType = ref$.parseType; + parseLevn = require('levn').parsedTypeParse; + camelizeKeys = function(obj){ + var key, value, resultObj$ = {}; + for (key in obj) { + value = obj[key]; + resultObj$[camelize(key)] = value; + } + return resultObj$; + }; + parseString = function(string){ + var assignOpt, regex, replaceRegex, result; + assignOpt = '--?[a-zA-Z][-a-z-A-Z0-9]*='; + regex = RegExp('(?:' + assignOpt + ')?(?:\'(?:\\\\\'|[^\'])+\'|"(?:\\\\"|[^"])+")|[^\'"\\s]+', 'g'); + replaceRegex = RegExp('^(' + assignOpt + ')?[\'"]([\\s\\S]*)[\'"]$'); + result = map(function(it){ + return it.replace(replaceRegex, '$1$2'); + }, string.match(regex) || []); + return result; + }; + main = function(libOptions){ + var opts, defaults, required, traverse, getOption, parse; + opts = {}; + defaults = {}; + required = []; + if (toString$.call(libOptions.stdout).slice(8, -1) === 'Undefined') { + libOptions.stdout = process.stdout; + } + libOptions.positionalAnywhere == null && (libOptions.positionalAnywhere = true); + libOptions.typeAliases == null && (libOptions.typeAliases = {}); + libOptions.defaults == null && (libOptions.defaults = {}); + if (libOptions.concatRepeatedArrays != null) { + libOptions.defaults.concatRepeatedArrays = libOptions.concatRepeatedArrays; + } + if (libOptions.mergeRepeatedObjects != null) { + libOptions.defaults.mergeRepeatedObjects = libOptions.mergeRepeatedObjects; + } + traverse = function(options){ + var i$, len$, option, name, k, ref$, v, type, that, e, parsedPossibilities, parsedType, j$, len1$, possibility, rawDependsType, dependsOpts, dependsType, cra, alias, shortNames, longNames; + if (toString$.call(options).slice(8, -1) !== 'Array') { + throw new Error('No options defined.'); + } + for (i$ = 0, len$ = options.length; i$ < len$; ++i$) { + option = options[i$]; + if (option.heading == null) { + name = option.option; + if (opts[name] != null) { + throw new Error("Option '" + name + "' already defined."); + } + for (k in ref$ = libOptions.defaults) { + v = ref$[k]; + option[k] == null && (option[k] = v); + } + if (option.type === 'Boolean') { + option.boolean == null && (option.boolean = true); + } + if (option.parsedType == null) { + if (!option.type) { + throw new Error("No type defined for option '" + name + "'."); + } + try { + type = (that = libOptions.typeAliases[option.type]) != null + ? that + : option.type; + option.parsedType = parseType(type); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing type '" + option.type + "': " + e.message); + } + } + if (option['default']) { + try { + defaults[name] = parseLevn(option.parsedType, option['default']); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing default value '" + option['default'] + "' for type '" + option.type + "': " + e.message); + } + } + if (option['enum'] && !option.parsedPossiblities) { + parsedPossibilities = []; + parsedType = option.parsedType; + for (j$ = 0, len1$ = (ref$ = option['enum']).length; j$ < len1$; ++j$) { + possibility = ref$[j$]; + try { + parsedPossibilities.push(parseLevn(parsedType, possibility)); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing enum value '" + possibility + "' for type '" + option.type + "': " + e.message); + } + } + option.parsedPossibilities = parsedPossibilities; + } + if (that = option.dependsOn) { + if (that.length) { + ref$ = [].concat(option.dependsOn), rawDependsType = ref$[0], dependsOpts = slice$.call(ref$, 1); + dependsType = rawDependsType.toLowerCase(); + if (dependsOpts.length) { + if (dependsType === 'and' || dependsType === 'or') { + option.dependsOn = [dependsType].concat(arrayFrom$(dependsOpts)); + } else { + throw new Error("Option '" + name + "': If you have more than one dependency, you must specify either 'and' or 'or'"); + } + } else { + if ((ref$ = dependsType.toLowerCase()) === 'and' || ref$ === 'or') { + option.dependsOn = null; + } else { + option.dependsOn = ['and', rawDependsType]; + } + } + } else { + option.dependsOn = null; + } + } + if (option.required) { + required.push(name); + } + opts[name] = option; + if (option.concatRepeatedArrays != null) { + cra = option.concatRepeatedArrays; + if ('Boolean' === toString$.call(cra).slice(8, -1)) { + option.concatRepeatedArrays = [cra, {}]; + } else if (cra.length === 1) { + option.concatRepeatedArrays = [cra[0], {}]; + } else if (cra.length !== 2) { + throw new Error("Invalid setting for concatRepeatedArrays"); + } + } + if (option.alias || option.aliases) { + if (name === 'NUM') { + throw new Error("-NUM option can't have aliases."); + } + if (option.alias) { + option.aliases == null && (option.aliases = [].concat(option.alias)); + } + for (j$ = 0, len1$ = (ref$ = option.aliases).length; j$ < len1$; ++j$) { + alias = ref$[j$]; + if (opts[alias] != null) { + throw new Error("Option '" + alias + "' already defined."); + } + opts[alias] = option; + } + ref$ = partition(fn$, option.aliases), shortNames = ref$[0], longNames = ref$[1]; + option.shortNames == null && (option.shortNames = shortNames); + option.longNames == null && (option.longNames = longNames); + } + if ((!option.aliases || option.shortNames.length === 0) && option.type === 'Boolean' && option['default'] === 'true') { + option.negateName = true; + } + } + } + function fn$(it){ + return it.length === 1; + } + }; + traverse(libOptions.options); + getOption = function(name){ + var opt, possiblyMeant; + opt = opts[name]; + if (opt == null) { + possiblyMeant = closestString(keys(opts), name); + throw new Error("Invalid option '" + nameToRaw(name) + "'" + (possiblyMeant ? " - perhaps you meant '" + nameToRaw(possiblyMeant) + "'?" : '.')); + } + return opt; + }; + parse = function(input, arg$){ + var slice, obj, positional, restPositional, overrideRequired, prop, setValue, setDefaults, checkRequired, mutuallyExclusiveError, checkMutuallyExclusive, checkDependency, checkDependencies, checkProp, args, key, value, option, ref$, i$, len$, arg, that, result, short, argName, usingAssign, val, flags, len, j$, len1$, i, flag, opt, name, valPrime, negated, noedName; + slice = (arg$ != null + ? arg$ + : {}).slice; + obj = {}; + positional = []; + restPositional = false; + overrideRequired = false; + prop = null; + setValue = function(name, value){ + var opt, val, cra, e, currentType; + opt = getOption(name); + if (opt.boolean) { + val = value; + } else { + try { + cra = opt.concatRepeatedArrays; + if (cra != null && cra[0] && cra[1].oneValuePerFlag && opt.parsedType.length === 1 && opt.parsedType[0].structure === 'array') { + val = [parseLevn(opt.parsedType[0].of, value)]; + } else { + val = parseLevn(opt.parsedType, value); + } + } catch (e$) { + e = e$; + throw new Error("Invalid value for option '" + name + "' - expected type " + opt.type + ", received value: " + value + "."); + } + if (opt['enum'] && !any(function(it){ + return deepIs(it, val); + }, opt.parsedPossibilities)) { + throw new Error("Option " + name + ": '" + val + "' not one of " + naturalJoin(opt['enum']) + "."); + } + } + currentType = toString$.call(obj[name]).slice(8, -1); + if (obj[name] != null) { + if (opt.concatRepeatedArrays != null && opt.concatRepeatedArrays[0] && currentType === 'Array') { + obj[name] = obj[name].concat(val); + } else if (opt.mergeRepeatedObjects && currentType === 'Object') { + import$(obj[name], val); + } else { + obj[name] = val; + } + } else { + obj[name] = val; + } + if (opt.restPositional) { + restPositional = true; + } + if (opt.overrideRequired) { + overrideRequired = true; + } + }; + setDefaults = function(){ + var name, ref$, value; + for (name in ref$ = defaults) { + value = ref$[name]; + if (obj[name] == null) { + obj[name] = value; + } + } + }; + checkRequired = function(){ + var i$, ref$, len$, name; + if (overrideRequired) { + return; + } + for (i$ = 0, len$ = (ref$ = required).length; i$ < len$; ++i$) { + name = ref$[i$]; + if (!obj[name]) { + throw new Error("Option " + nameToRaw(name) + " is required."); + } + } + }; + mutuallyExclusiveError = function(first, second){ + throw new Error("The options " + nameToRaw(first) + " and " + nameToRaw(second) + " are mutually exclusive - you cannot use them at the same time."); + }; + checkMutuallyExclusive = function(){ + var rules, i$, len$, rule, present, j$, len1$, element, k$, len2$, opt; + rules = libOptions.mutuallyExclusive; + if (!rules) { + return; + } + for (i$ = 0, len$ = rules.length; i$ < len$; ++i$) { + rule = rules[i$]; + present = null; + for (j$ = 0, len1$ = rule.length; j$ < len1$; ++j$) { + element = rule[j$]; + if (toString$.call(element).slice(8, -1) === 'Array') { + for (k$ = 0, len2$ = element.length; k$ < len2$; ++k$) { + opt = element[k$]; + if (opt in obj) { + if (present != null) { + mutuallyExclusiveError(present, opt); + } else { + present = opt; + break; + } + } + } + } else { + if (element in obj) { + if (present != null) { + mutuallyExclusiveError(present, element); + } else { + present = element; + } + } + } + } + } + }; + checkDependency = function(option){ + var dependsOn, type, targetOptionNames, i$, len$, targetOptionName, targetOption; + dependsOn = option.dependsOn; + if (!dependsOn || option.dependenciesMet) { + return true; + } + type = dependsOn[0], targetOptionNames = slice$.call(dependsOn, 1); + for (i$ = 0, len$ = targetOptionNames.length; i$ < len$; ++i$) { + targetOptionName = targetOptionNames[i$]; + targetOption = obj[targetOptionName]; + if (targetOption && checkDependency(targetOption)) { + if (type === 'or') { + return true; + } + } else if (type === 'and') { + throw new Error("The option '" + option.option + "' did not have its dependencies met."); + } + } + if (type === 'and') { + return true; + } else { + throw new Error("The option '" + option.option + "' did not meet any of its dependencies."); + } + }; + checkDependencies = function(){ + var name; + for (name in obj) { + checkDependency(opts[name]); + } + }; + checkProp = function(){ + if (prop) { + throw new Error("Value for '" + prop + "' of type '" + getOption(prop).type + "' required."); + } + }; + switch (toString$.call(input).slice(8, -1)) { + case 'String': + args = parseString(input.slice(slice != null ? slice : 0)); + break; + case 'Array': + args = input.slice(slice != null ? slice : 2); + break; + case 'Object': + obj = {}; + for (key in input) { + value = input[key]; + if (key !== '_') { + option = getOption(dasherize(key)); + if (parsedTypeCheck(option.parsedType, value)) { + obj[option.option] = value; + } else { + throw new Error("Option '" + option.option + "': Invalid type for '" + value + "' - expected type '" + option.type + "'."); + } + } + } + checkMutuallyExclusive(); + checkDependencies(); + setDefaults(); + checkRequired(); + return ref$ = camelizeKeys(obj), ref$._ = input._ || [], ref$; + default: + throw new Error("Invalid argument to 'parse': " + input + "."); + } + for (i$ = 0, len$ = args.length; i$ < len$; ++i$) { + arg = args[i$]; + if (arg === '--') { + restPositional = true; + } else if (restPositional) { + positional.push(arg); + } else { + if (that = arg.match(/^(--?)([a-zA-Z][-a-zA-Z0-9]*)(=)?(.*)?$/)) { + result = that; + checkProp(); + short = result[1].length === 1; + argName = result[2]; + usingAssign = result[3] != null; + val = result[4]; + if (usingAssign && val == null) { + throw new Error("No value for '" + argName + "' specified."); + } + if (short) { + flags = chars(argName); + len = flags.length; + for (j$ = 0, len1$ = flags.length; j$ < len1$; ++j$) { + i = j$; + flag = flags[j$]; + opt = getOption(flag); + name = opt.option; + if (restPositional) { + positional.push(flag); + } else if (i === len - 1) { + if (usingAssign) { + valPrime = opt.boolean ? parseLevn([{ + type: 'Boolean' + }], val) : val; + setValue(name, valPrime); + } else if (opt.boolean) { + setValue(name, true); + } else { + prop = name; + } + } else if (opt.boolean) { + setValue(name, true); + } else { + throw new Error("Can't set argument '" + flag + "' when not last flag in a group of short flags."); + } + } + } else { + negated = false; + if (that = argName.match(/^no-(.+)$/)) { + negated = true; + noedName = that[1]; + opt = getOption(noedName); + } else { + opt = getOption(argName); + } + name = opt.option; + if (opt.boolean) { + valPrime = usingAssign ? parseLevn([{ + type: 'Boolean' + }], val) : true; + if (negated) { + setValue(name, !valPrime); + } else { + setValue(name, valPrime); + } + } else { + if (negated) { + throw new Error("Only use 'no-' prefix for Boolean options, not with '" + noedName + "'."); + } + if (usingAssign) { + setValue(name, val); + } else { + prop = name; + } + } + } + } else if (that = arg.match(/^-([0-9]+(?:\.[0-9]+)?)$/)) { + opt = opts.NUM; + if (!opt) { + throw new Error('No -NUM option defined.'); + } + setValue(opt.option, that[1]); + } else { + if (prop) { + setValue(prop, arg); + prop = null; + } else { + positional.push(arg); + if (!libOptions.positionalAnywhere) { + restPositional = true; + } + } + } + } + } + checkProp(); + checkMutuallyExclusive(); + checkDependencies(); + setDefaults(); + checkRequired(); + return ref$ = camelizeKeys(obj), ref$._ = positional, ref$; + }; + return { + parse: parse, + parseArgv: function(it){ + return parse(it, { + slice: 2 + }); + }, + generateHelp: generateHelp(libOptions), + generateHelpForOption: generateHelpForOption(getOption, libOptions) + }; + }; + main.VERSION = VERSION; + module.exports = main; + function import$(obj, src){ + var own = {}.hasOwnProperty; + for (var key in src) if (own.call(src, key)) obj[key] = src[key]; + return obj; + } +}).call(this); diff --git a/node_modules/optionator/lib/util.js b/node_modules/optionator/lib/util.js new file mode 100644 index 0000000..5bc0cbb --- /dev/null +++ b/node_modules/optionator/lib/util.js @@ -0,0 +1,54 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize, naturalJoin; + prelude = require('prelude-ls'), map = prelude.map, sortBy = prelude.sortBy; + fl = require('fast-levenshtein'); + closestString = function(possibilities, input){ + var distances, ref$, string, distance; + if (!possibilities.length) { + return; + } + distances = map(function(it){ + var ref$, longer, shorter; + ref$ = input.length > it.length + ? [input, it] + : [it, input], longer = ref$[0], shorter = ref$[1]; + return { + string: it, + distance: fl.get(longer, shorter) + }; + })( + possibilities); + ref$ = sortBy(function(it){ + return it.distance; + }, distances)[0], string = ref$.string, distance = ref$.distance; + return string; + }; + nameToRaw = function(name){ + if (name.length === 1 || name === 'NUM') { + return "-" + name; + } else { + return "--" + name; + } + }; + dasherize = function(string){ + if (/^[A-Z]/.test(string)) { + return string; + } else { + return prelude.dasherize(string); + } + }; + naturalJoin = function(array){ + if (array.length < 3) { + return array.join(' or '); + } else { + return array.slice(0, -1).join(', ') + ", or " + array[array.length - 1]; + } + }; + module.exports = { + closestString: closestString, + nameToRaw: nameToRaw, + dasherize: dasherize, + naturalJoin: naturalJoin + }; +}).call(this); diff --git a/node_modules/optionator/package.json b/node_modules/optionator/package.json new file mode 100644 index 0000000..83fb1c2 --- /dev/null +++ b/node_modules/optionator/package.json @@ -0,0 +1,43 @@ +{ + "name": "optionator", + "version": "0.9.1", + "author": "George Zahariev ", + "description": "option parsing and help generation", + "homepage": "https://github.com/gkz/optionator", + "keywords": [ + "options", + "flags", + "option parsing", + "cli" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": "https://github.com/gkz/optionator/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/optionator.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "^1.2.1", + "deep-is": "^0.1.3", + "word-wrap": "^1.2.3", + "type-check": "^0.4.0", + "levn": "^0.4.1", + "fast-levenshtein": "^2.0.6" + }, + "devDependencies": { + "livescript": "^1.6.0", + "mocha": "^7.1.1" + } +} diff --git a/node_modules/p-limit/index.js b/node_modules/p-limit/index.js new file mode 100644 index 0000000..873f0e7 --- /dev/null +++ b/node_modules/p-limit/index.js @@ -0,0 +1,42 @@ +'use strict'; +const pTry = require('p-try'); + +module.exports = concurrency => { + if (concurrency < 1) { + throw new TypeError('Expected `concurrency` to be a number from 1 and up'); + } + + const queue = []; + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.length > 0) { + queue.shift()(); + } + }; + + return fn => new Promise((resolve, reject) => { + const run = () => { + activeCount++; + + pTry(fn).then( + val => { + resolve(val); + next(); + }, + err => { + reject(err); + next(); + } + ); + }; + + if (activeCount < concurrency) { + run(); + } else { + queue.push(run); + } + }); +}; diff --git a/node_modules/p-limit/license b/node_modules/p-limit/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/p-limit/license @@ -0,0 +1,9 @@ +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/p-limit/package.json b/node_modules/p-limit/package.json new file mode 100644 index 0000000..4079517 --- /dev/null +++ b/node_modules/p-limit/package.json @@ -0,0 +1,49 @@ +{ + "name": "p-limit", + "version": "1.3.0", + "description": "Run multiple promise-returning & async functions with limited concurrency", + "license": "MIT", + "repository": "sindresorhus/p-limit", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "limit", + "limited", + "concurrency", + "throttle", + "throat", + "rate", + "batch", + "ratelimit", + "task", + "queue", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-try": "^1.0.0" + }, + "devDependencies": { + "ava": "*", + "delay": "^2.0.0", + "in-range": "^1.0.0", + "random-int": "^1.0.0", + "time-span": "^2.0.0", + "xo": "*" + } +} diff --git a/node_modules/p-limit/readme.md b/node_modules/p-limit/readme.md new file mode 100644 index 0000000..9012992 --- /dev/null +++ b/node_modules/p-limit/readme.md @@ -0,0 +1,69 @@ +# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) + +> Run multiple promise-returning & async functions with limited concurrency + + +## Install + +``` +$ npm install p-limit +``` + + +## Usage + +```js +const pLimit = require('p-limit'); + +const limit = pLimit(1); + +const input = [ + limit(() => fetchSomething('foo')), + limit(() => fetchSomething('bar')), + limit(() => doSomething()) +]; + +(async () => { + // Only one promise is run at once + const result = await Promise.all(input); + console.log(result); +})(); +``` + + +## API + +### pLimit(concurrency) + +Returns a `limit` function. + +#### concurrency + +Type: `number`
+Minimum: `1` + +Concurrency limit. + +### limit(fn) + +Returns the promise returned by calling `fn`. + +#### fn + +Type: `Function` + +Promise-returning/async function. + + +## Related + +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions +- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-locate/index.js b/node_modules/p-locate/index.js new file mode 100644 index 0000000..7461d66 --- /dev/null +++ b/node_modules/p-locate/index.js @@ -0,0 +1,31 @@ +'use strict'; +const pLimit = require('p-limit'); + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } +} + +// the input can also be a promise, so we `Promise.all()` them both +const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0]))); + +module.exports = (iterable, tester, opts) => { + opts = Object.assign({ + concurrency: Infinity, + preserveOrder: true + }, opts); + + const limit = pLimit(opts.concurrency); + + // start all the promises concurrently with optional limit + const items = Array.from(iterable).map(el => [el, limit(() => Promise.resolve(el).then(tester))]); + + // check the promises either serially or concurrently + const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity); + + return Promise.all(items.map(el => checkLimit(() => finder(el)))) + .then(() => {}) + .catch(err => err instanceof EndError ? err.value : Promise.reject(err)); +}; diff --git a/node_modules/p-locate/license b/node_modules/p-locate/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-locate/license @@ -0,0 +1,21 @@ +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/p-locate/package.json b/node_modules/p-locate/package.json new file mode 100644 index 0000000..767002b --- /dev/null +++ b/node_modules/p-locate/package.json @@ -0,0 +1,54 @@ +{ + "name": "p-locate", + "version": "2.0.0", + "description": "Get the first fulfilled promise that satisfies the provided testing function", + "license": "MIT", + "repository": "sindresorhus/p-locate", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "locate", + "find", + "finder", + "search", + "searcher", + "test", + "array", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "fastest", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-limit": "^1.1.0" + }, + "devDependencies": { + "ava": "*", + "delay": "^1.3.1", + "in-range": "^1.0.0", + "time-span": "^1.0.0", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md new file mode 100644 index 0000000..68b96a4 --- /dev/null +++ b/node_modules/p-locate/readme.md @@ -0,0 +1,86 @@ +# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) + +> Get the first fulfilled promise that satisfies the provided testing function + +Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + + +## Install + +``` +$ npm install --save p-locate +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const pathExists = require('path-exists'); +const pLocate = require('p-locate'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // only this one actually exists on disk + 'pony.png' +]; + +pLocate(files, file => pathExists(file)).then(foundPath => { + console.log(foundPath); + //=> 'rainbow' +}); +``` + +*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* + + +## API + +### pLocate(input, tester, [options]) + +Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +#### input + +Type: `Iterable` + +#### tester(element) + +Type: `Function` + +Expected to return a `Promise` or boolean. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises returned by `tester`. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + + +## Related + +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-try/index.js b/node_modules/p-try/index.js new file mode 100644 index 0000000..efa2f74 --- /dev/null +++ b/node_modules/p-try/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = cb => new Promise(resolve => { + resolve(cb()); +}); diff --git a/node_modules/p-try/license b/node_modules/p-try/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-try/license @@ -0,0 +1,21 @@ +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/p-try/package.json b/node_modules/p-try/package.json new file mode 100644 index 0000000..ba2513a --- /dev/null +++ b/node_modules/p-try/package.json @@ -0,0 +1,43 @@ +{ + "name": "p-try", + "version": "1.0.0", + "description": "`Promise#try()` ponyfill - Starts a promise chain", + "license": "MIT", + "repository": "sindresorhus/p-try", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "try", + "resolve", + "function", + "catch", + "async", + "await", + "promises", + "settled", + "ponyfill", + "polyfill", + "shim", + "bluebird" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-try/readme.md b/node_modules/p-try/readme.md new file mode 100644 index 0000000..8e5fddd --- /dev/null +++ b/node_modules/p-try/readme.md @@ -0,0 +1,38 @@ +# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try) + +> [`Promise#try()`](https://github.com/ljharb/proposal-promise-try) [ponyfill](https://ponyfill.com) - Starts a promise chain + +[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/) + + +## Install + +``` +$ npm install --save p-try +``` + + +## Usage + +```js +const pTry = require('p-try'); + +pTry(() => { + return synchronousFunctionThatMightThrow(); +}).then(value => { + console.log(value); +}).catch(error => { + console.error(error); +}); +``` + + +## Related + +- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/parent-module/index.js b/node_modules/parent-module/index.js new file mode 100644 index 0000000..a26f953 --- /dev/null +++ b/node_modules/parent-module/index.js @@ -0,0 +1,37 @@ +'use strict'; +const callsites = require('callsites'); + +module.exports = filepath => { + const stacks = callsites(); + + if (!filepath) { + return stacks[2].getFileName(); + } + + let seenVal = false; + + // Skip the first stack as it's this function + stacks.shift(); + + for (const stack of stacks) { + const parentFilepath = stack.getFileName(); + + if (typeof parentFilepath !== 'string') { + continue; + } + + if (parentFilepath === filepath) { + seenVal = true; + continue; + } + + // Skip native modules + if (parentFilepath === 'module.js') { + continue; + } + + if (seenVal && parentFilepath !== filepath) { + return parentFilepath; + } + } +}; diff --git a/node_modules/parent-module/license b/node_modules/parent-module/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/parent-module/license @@ -0,0 +1,9 @@ +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/parent-module/package.json b/node_modules/parent-module/package.json new file mode 100644 index 0000000..790333d --- /dev/null +++ b/node_modules/parent-module/package.json @@ -0,0 +1,46 @@ +{ + "name": "parent-module", + "version": "1.0.1", + "description": "Get the path of the parent module", + "license": "MIT", + "repository": "sindresorhus/parent-module", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "parent", + "module", + "package", + "pkg", + "caller", + "calling", + "module", + "path", + "callsites", + "callsite", + "stacktrace", + "stack", + "trace", + "function", + "file" + ], + "dependencies": { + "callsites": "^3.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "execa": "^1.0.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/parent-module/readme.md b/node_modules/parent-module/readme.md new file mode 100644 index 0000000..dffb4ce --- /dev/null +++ b/node_modules/parent-module/readme.md @@ -0,0 +1,67 @@ +# parent-module [![Build Status](https://travis-ci.org/sindresorhus/parent-module.svg?branch=master)](https://travis-ci.org/sindresorhus/parent-module) + +> Get the path of the parent module + +Node.js exposes `module.parent`, but it only gives you the first cached parent, which is not necessarily the actual parent. + + +## Install + +``` +$ npm install parent-module +``` + + +## Usage + +```js +// bar.js +const parentModule = require('parent-module'); + +module.exports = () => { + console.log(parentModule()); + //=> '/Users/sindresorhus/dev/unicorn/foo.js' +}; +``` + +```js +// foo.js +const bar = require('./bar'); + +bar(); +``` + + +## API + +### parentModule([filepath]) + +By default, it will return the path of the immediate parent. + +#### filepath + +Type: `string`
+Default: [`__filename`](https://nodejs.org/api/globals.html#globals_filename) + +Filepath of the module of which to get the parent path. + +Useful if you want it to work [multiple module levels down](https://github.com/sindresorhus/parent-module/tree/master/fixtures/filepath). + + +## Tip + +Combine it with [`read-pkg-up`](https://github.com/sindresorhus/read-pkg-up) to read the package.json of the parent module. + +```js +const path = require('path'); +const readPkgUp = require('read-pkg-up'); +const parentModule = require('parent-module'); + +console.log(readPkgUp.sync({cwd: path.dirname(parentModule())}).pkg); +//=> {name: 'chalk', version: '1.0.0', …} +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js new file mode 100644 index 0000000..16ae60a --- /dev/null +++ b/node_modules/path-exists/index.js @@ -0,0 +1,17 @@ +'use strict'; +const fs = require('fs'); + +module.exports = fp => new Promise(resolve => { + fs.access(fp, err => { + resolve(!err); + }); +}); + +module.exports.sync = fp => { + try { + fs.accessSync(fp); + return true; + } catch (err) { + return false; + } +}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/path-exists/license @@ -0,0 +1,21 @@ +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/path-exists/package.json b/node_modules/path-exists/package.json new file mode 100644 index 0000000..efd5626 --- /dev/null +++ b/node_modules/path-exists/package.json @@ -0,0 +1,40 @@ +{ + "name": "path-exists", + "version": "3.0.0", + "description": "Check if a path exists", + "license": "MIT", + "repository": "sindresorhus/path-exists", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "exists", + "exist", + "file", + "filepath", + "fs", + "filesystem", + "file-system", + "access", + "stat" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md new file mode 100644 index 0000000..1b65fa7 --- /dev/null +++ b/node_modules/path-exists/readme.md @@ -0,0 +1,50 @@ +# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists) + +> Check if a path exists + +Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it. + +Never use this before handling a file though: + +> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there. + + +## Install + +``` +$ npm install --save path-exists +``` + + +## Usage + +```js +// foo.js +const pathExists = require('path-exists'); + +pathExists('foo.js').then(exists => { + console.log(exists); + //=> true +}); +``` + + +## API + +### pathExists(path) + +Returns a promise for a boolean of whether the path exists. + +### pathExists.sync(path) + +Returns a boolean of whether the path exists. + + +## Related + +- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 0000000..22aa6c3 --- /dev/null +++ b/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/path-is-absolute/license b/node_modules/path-is-absolute/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +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/path-is-absolute/package.json b/node_modules/path-is-absolute/package.json new file mode 100644 index 0000000..91196d5 --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,43 @@ +{ + "name": "path-is-absolute", + "version": "1.0.1", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": "sindresorhus/path-is-absolute", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "devDependencies": { + "xo": "^0.16.0" + } +} diff --git a/node_modules/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md new file mode 100644 index 0000000..8dbdf5f --- /dev/null +++ b/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-key/index.d.ts b/node_modules/path-key/index.d.ts new file mode 100644 index 0000000..7c575d1 --- /dev/null +++ b/node_modules/path-key/index.d.ts @@ -0,0 +1,40 @@ +/// + +declare namespace pathKey { + interface Options { + /** + Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env). + */ + readonly env?: {[key: string]: string | undefined}; + + /** + Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform). + */ + readonly platform?: NodeJS.Platform; + } +} + +declare const pathKey: { + /** + Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform. + + @example + ``` + import pathKey = require('path-key'); + + const key = pathKey(); + //=> 'PATH' + + const PATH = process.env[key]; + //=> '/usr/local/bin:/usr/bin:/bin' + ``` + */ + (options?: pathKey.Options): string; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function pathKey(options?: pathKey.Options): string; + // export = pathKey; + default: typeof pathKey; +}; + +export = pathKey; diff --git a/node_modules/path-key/index.js b/node_modules/path-key/index.js new file mode 100644 index 0000000..0cf6415 --- /dev/null +++ b/node_modules/path-key/index.js @@ -0,0 +1,16 @@ +'use strict'; + +const pathKey = (options = {}) => { + const environment = options.env || process.env; + const platform = options.platform || process.platform; + + if (platform !== 'win32') { + return 'PATH'; + } + + return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path'; +}; + +module.exports = pathKey; +// TODO: Remove this for the next major release +module.exports.default = pathKey; diff --git a/node_modules/path-key/license b/node_modules/path-key/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/path-key/license @@ -0,0 +1,9 @@ +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/path-key/package.json b/node_modules/path-key/package.json new file mode 100644 index 0000000..c8cbd38 --- /dev/null +++ b/node_modules/path-key/package.json @@ -0,0 +1,39 @@ +{ + "name": "path-key", + "version": "3.1.1", + "description": "Get the PATH environment variable key cross-platform", + "license": "MIT", + "repository": "sindresorhus/path-key", + "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": [ + "path", + "key", + "environment", + "env", + "variable", + "var", + "get", + "cross-platform", + "windows" + ], + "devDependencies": { + "@types/node": "^11.13.0", + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/path-key/readme.md b/node_modules/path-key/readme.md new file mode 100644 index 0000000..a9052d7 --- /dev/null +++ b/node_modules/path-key/readme.md @@ -0,0 +1,61 @@ +# path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key) + +> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform + +It's usually `PATH`, but on Windows it can be any casing like `Path`... + + +## Install + +``` +$ npm install path-key +``` + + +## Usage + +```js +const pathKey = require('path-key'); + +const key = pathKey(); +//=> 'PATH' + +const PATH = process.env[key]; +//=> '/usr/local/bin:/usr/bin:/bin' +``` + + +## API + +### pathKey(options?) + +#### options + +Type: `object` + +##### env + +Type: `object`
+Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env) + +Use a custom environment variables object. + +#### platform + +Type: `string`
+Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform) + +Get the PATH key for a specific platform. + + +--- + +
+ + 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/path-parse/LICENSE b/node_modules/path-parse/LICENSE new file mode 100644 index 0000000..810f3db --- /dev/null +++ b/node_modules/path-parse/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Javier Blanco + +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/path-parse/README.md b/node_modules/path-parse/README.md new file mode 100644 index 0000000..05097f8 --- /dev/null +++ b/node_modules/path-parse/README.md @@ -0,0 +1,42 @@ +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) + +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). + +## Install + +``` +$ npm install --save path-parse +``` + +## Usage + +```js +var pathParse = require('path-parse'); + +pathParse('/home/user/dir/file.txt'); +//=> { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +## API + +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. + +### pathParse(path) + +### pathParse.posix(path) + +The Posix specific version. + +### pathParse.win32(path) + +The Windows specific version. + +## License + +MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js new file mode 100644 index 0000000..f062d0a --- /dev/null +++ b/node_modules/path-parse/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into into [dir, root, basename, name, ext] +var splitWindowsRe = + /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/; + +var win32 = {}; + +function win32SplitPath(filename) { + return splitWindowsRe.exec(filename).slice(1); +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[1], + dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3] + }; +}; + + + +// Split a filename into [dir, root, basename, name, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + return { + root: allParts[1], + dir: allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3], + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json new file mode 100644 index 0000000..36c23f8 --- /dev/null +++ b/node_modules/path-parse/package.json @@ -0,0 +1,33 @@ +{ + "name": "path-parse", + "version": "1.0.7", + "description": "Node.js path.parse() ponyfill", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/jbgutierrez/path-parse.git" + }, + "keywords": [ + "path", + "paths", + "file", + "dir", + "parse", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim" + ], + "author": "Javier Blanco ", + "license": "MIT", + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" + }, + "homepage": "https://github.com/jbgutierrez/path-parse#readme" +} diff --git a/node_modules/prelude-ls/CHANGELOG.md b/node_modules/prelude-ls/CHANGELOG.md new file mode 100644 index 0000000..71b8a0f --- /dev/null +++ b/node_modules/prelude-ls/CHANGELOG.md @@ -0,0 +1,108 @@ +# 1.2.1 +- fix version + +# 1.2.0 +- add `List.remove` +- build with LiveScript 1.6.0 +- update dependencies +- remove coverage calculation + +# 1.1.2 +- add `Func.memoize` +- fix `zip-all` and `zip-with-all` corner case (no input) +- build with LiveScript 1.4.0 + +# 1.1.1 +- curry `unique-by`, `minimum-by` + +# 1.1.0 +- added `List` functions: `maximum-by`, `minimum-by`, `unique-by` +- added `List` functions: `at`, `elem-index`, `elem-indices`, `find-index`, `find-indices` +- added `Str` functions: `capitalize`, `camelize`, `dasherize` +- added `Func` function: `over` - eg. ``same-length = (==) `over` (.length)`` +- exported `Str.repeat` through main `prelude` object +- fixed definition of `foldr` and `foldr1`, the new correct definition is backwards incompatible with the old, incorrect one +- fixed issue with `fix` +- improved code coverage + +# 1.0.3 +- build browser versions + +# 1.0.2 +- bug fix for `flatten` - slight change with bug fix, flattens arrays only, not array-like objects + +# 1.0.1 +- bug fixes for `drop-while` and `take-while` + +# 1.0.0 +* massive update - separated functions into separate modules +* functions do not accept multiple types anymore - use different versions in their respective modules in some cases (eg. `Obj.map`), or use `chars` or `values` in other cases to transform into a list +* objects are no longer transformed into functions, simply use `(obj.)` in LiveScript to do that +* browser version now using browserify - use `prelude = require('prelude-ls')` +* added `compact`, `split`, `flatten`, `difference`, `intersection`, `union`, `count-by`, `group-by`, `chars`, `unchars`, `apply` +* added `lists-to-obj` which takes a list of keys and list of values and zips them up into an object, and the converse `obj-to-lists` +* added `pairs-to-obj` which takes a list of pairs (2 element lists) and creates an object, and the converse `obj-to-pairs` +* removed `cons`, `append` - use the concat operator +* removed `compose` - use the compose operator +* removed `obj-to-func` - use partially applied access (eg. `(obj.)`) +* removed `length` - use `(.length)` +* `sort-by` renamed to `sort-with` +* added new `sort-by` +* removed `compare` - just use the new `sort-by` +* `break-it` renamed `break-list`, (`Str.break-str` for the string version) +* added `Str.repeat` which creates a new string by repeating the input n times +* `unfold` as alias to `unfoldr` is no longer used +* fixed up style and compiled with LiveScript 1.1.1 +* use Make instead of Slake +* greatly improved tests + +# 0.6.0 +* fixed various bugs +* added `fix`, a fixpoint (Y combinator) for anonymous recursive functions +* added `unfoldr` (alias `unfold`) +* calling `replicate` with a string now returns a list of strings +* removed `partial`, just use native partial application in LiveScript using the `_` placeholder, or currying +* added `sort`, `sortBy`, and `compare` + +# 0.5.0 +* removed `lookup` - use (.prop) +* removed `call` - use (.func arg1, arg2) +* removed `pluck` - use map (.prop), xs +* fixed buys wtih `head` and `last` +* added non-minifed browser version, as `prelude-browser.js` +* renamed `prelude-min.js` to `prelude-browser-min.js` +* renamed `zip` to `zipAll` +* renamed `zipWith` to `zipAllWith` +* added `zip`, a curried zip that takes only two arguments +* added `zipWith`, a curried zipWith that takes only two arguments + +# 0.4.0 +* added `parition` function +* added `curry` function +* removed `elem` function (use `in`) +* removed `notElem` function (use `not in`) + +# 0.3.0 +* added `listToObject` +* added `unique` +* added `objToFunc` +* added support for using strings in map and the like +* added support for using objects in map and the like +* added ability to use objects instead of functions in certain cases +* removed `error` (just use throw) +* added `tau` constant +* added `join` +* added `values` +* added `keys` +* added `partial` +* renamed `log` to `ln` +* added alias to `head`: `first` +* added `installPrelude` helper + +# 0.2.0 +* removed functions that simply warp operators as you can now use operators as functions in LiveScript +* `min/max` are now curried and take only 2 arguments +* added `call` + +# 0.1.0 +* initial public release diff --git a/node_modules/prelude-ls/LICENSE b/node_modules/prelude-ls/LICENSE new file mode 100644 index 0000000..525b118 --- /dev/null +++ b/node_modules/prelude-ls/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/prelude-ls/README.md b/node_modules/prelude-ls/README.md new file mode 100644 index 0000000..fabc212 --- /dev/null +++ b/node_modules/prelude-ls/README.md @@ -0,0 +1,15 @@ +# prelude.ls [![Build Status](https://travis-ci.org/gkz/prelude-ls.png?branch=master)](https://travis-ci.org/gkz/prelude-ls) + +is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript. + +See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more. + +You can install via npm `npm install prelude-ls` + +### Development + +`make test` to test + +`make build` to build `lib` from `src` + +`make build-browser` to build browser versions diff --git a/node_modules/prelude-ls/lib/Func.js b/node_modules/prelude-ls/lib/Func.js new file mode 100644 index 0000000..09777a8 --- /dev/null +++ b/node_modules/prelude-ls/lib/Func.js @@ -0,0 +1,69 @@ +// Generated by LiveScript 1.6.0 +var apply, curry, flip, fix, over, memoize, toString$ = {}.toString; +apply = curry$(function(f, list){ + return f.apply(null, list); +}); +curry = function(f){ + return curry$(f); +}; +flip = curry$(function(f, x, y){ + return f(y, x); +}); +fix = function(f){ + return function(g){ + return function(){ + return f(g(g)).apply(null, arguments); + }; + }(function(g){ + return function(){ + return f(g(g)).apply(null, arguments); + }; + }); +}; +over = curry$(function(f, g, x, y){ + return f(g(x), g(y)); +}); +memoize = function(f){ + var memo; + memo = {}; + return function(){ + var args, res$, i$, to$, key, arg; + res$ = []; + for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + args = res$; + key = (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = args).length; i$ < len$; ++i$) { + arg = ref$[i$]; + results$.push(arg + toString$.call(arg).slice(8, -1)); + } + return results$; + }()).join(''); + return memo[key] = key in memo + ? memo[key] + : f.apply(null, args); + }; +}; +module.exports = { + curry: curry, + flip: flip, + fix: fix, + apply: apply, + over: over, + memoize: memoize +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/prelude-ls/lib/List.js b/node_modules/prelude-ls/lib/List.js new file mode 100644 index 0000000..d2e41ab --- /dev/null +++ b/node_modules/prelude-ls/lib/List.js @@ -0,0 +1,716 @@ +// Generated by LiveScript 1.6.0 +var each, map, compact, filter, reject, remove, partition, find, head, first, tail, last, initial, empty, reverse, unique, uniqueBy, fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, concat, concatMap, flatten, difference, intersection, union, countBy, groupBy, andList, orList, any, all, sort, sortWith, sortBy, sum, product, mean, average, maximum, minimum, maximumBy, minimumBy, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, at, elemIndex, elemIndices, findIndex, findIndices, toString$ = {}.toString; +each = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + f(x); + } + return xs; +}); +map = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + results$.push(f(x)); + } + return results$; +}); +compact = function(xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (x) { + results$.push(x); + } + } + return results$; +}; +filter = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + results$.push(x); + } + } + return results$; +}); +reject = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!f(x)) { + results$.push(x); + } + } + return results$; +}); +remove = curry$(function(el, xs){ + var i, x$; + i = elemIndex(el, xs); + x$ = xs.slice(); + if (i != null) { + x$.splice(i, 1); + } + return x$; +}); +partition = curry$(function(f, xs){ + var passed, failed, i$, len$, x; + passed = []; + failed = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + (f(x) ? passed : failed).push(x); + } + return [passed, failed]; +}); +find = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + return x; + } + } +}); +head = first = function(xs){ + return xs[0]; +}; +tail = function(xs){ + if (!xs.length) { + return; + } + return xs.slice(1); +}; +last = function(xs){ + return xs[xs.length - 1]; +}; +initial = function(xs){ + if (!xs.length) { + return; + } + return xs.slice(0, -1); +}; +empty = function(xs){ + return !xs.length; +}; +reverse = function(xs){ + return xs.concat().reverse(); +}; +unique = function(xs){ + var result, i$, len$, x; + result = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!in$(x, result)) { + result.push(x); + } + } + return result; +}; +uniqueBy = curry$(function(f, xs){ + var seen, i$, len$, x, val, results$ = []; + seen = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + val = f(x); + if (in$(val, seen)) { + continue; + } + seen.push(val); + results$.push(x); + } + return results$; +}); +fold = foldl = curry$(function(f, memo, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + memo = f(memo, x); + } + return memo; +}); +fold1 = foldl1 = curry$(function(f, xs){ + return fold(f, xs[0], xs.slice(1)); +}); +foldr = curry$(function(f, memo, xs){ + var i$, x; + for (i$ = xs.length - 1; i$ >= 0; --i$) { + x = xs[i$]; + memo = f(x, memo); + } + return memo; +}); +foldr1 = curry$(function(f, xs){ + return foldr(f, xs[xs.length - 1], xs.slice(0, -1)); +}); +unfoldr = curry$(function(f, b){ + var result, x, that; + result = []; + x = b; + while ((that = f(x)) != null) { + result.push(that[0]); + x = that[1]; + } + return result; +}); +concat = function(xss){ + return [].concat.apply([], xss); +}; +concatMap = curry$(function(f, xs){ + var x; + return [].concat.apply([], (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + results$.push(f(x)); + } + return results$; + }())); +}); +flatten = function(xs){ + var x; + return [].concat.apply([], (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (toString$.call(x).slice(8, -1) === 'Array') { + results$.push(flatten(x)); + } else { + results$.push(x); + } + } + return results$; + }())); +}; +difference = function(xs){ + var yss, res$, i$, to$, results, len$, x, j$, len1$, ys; + res$ = []; + for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + yss = res$; + results = []; + outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) { + ys = yss[j$]; + if (in$(x, ys)) { + continue outer; + } + } + results.push(x); + } + return results; +}; +intersection = function(xs){ + var yss, res$, i$, to$, results, len$, x, j$, len1$, ys; + res$ = []; + for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + yss = res$; + results = []; + outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) { + ys = yss[j$]; + if (!in$(x, ys)) { + continue outer; + } + } + results.push(x); + } + return results; +}; +union = function(){ + var xss, res$, i$, to$, results, len$, xs, j$, len1$, x; + res$ = []; + for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + xss = res$; + results = []; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) { + x = xs[j$]; + if (!in$(x, results)) { + results.push(x); + } + } + } + return results; +}; +countBy = curry$(function(f, xs){ + var results, i$, len$, x, key; + results = {}; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + key = f(x); + if (key in results) { + results[key] += 1; + } else { + results[key] = 1; + } + } + return results; +}); +groupBy = curry$(function(f, xs){ + var results, i$, len$, x, key; + results = {}; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + key = f(x); + if (key in results) { + results[key].push(x); + } else { + results[key] = [x]; + } + } + return results; +}); +andList = function(xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!x) { + return false; + } + } + return true; +}; +orList = function(xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (x) { + return true; + } + } + return false; +}; +any = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + return true; + } + } + return false; +}); +all = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!f(x)) { + return false; + } + } + return true; +}); +sort = function(xs){ + return xs.concat().sort(function(x, y){ + if (x > y) { + return 1; + } else if (x < y) { + return -1; + } else { + return 0; + } + }); +}; +sortWith = curry$(function(f, xs){ + return xs.concat().sort(f); +}); +sortBy = curry$(function(f, xs){ + return xs.concat().sort(function(x, y){ + if (f(x) > f(y)) { + return 1; + } else if (f(x) < f(y)) { + return -1; + } else { + return 0; + } + }); +}); +sum = function(xs){ + var result, i$, len$, x; + result = 0; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + result += x; + } + return result; +}; +product = function(xs){ + var result, i$, len$, x; + result = 1; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + result *= x; + } + return result; +}; +mean = average = function(xs){ + var sum, i$, len$, x; + sum = 0; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + sum += x; + } + return sum / xs.length; +}; +maximum = function(xs){ + var max, i$, ref$, len$, x; + max = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (x > max) { + max = x; + } + } + return max; +}; +minimum = function(xs){ + var min, i$, ref$, len$, x; + min = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (x < min) { + min = x; + } + } + return min; +}; +maximumBy = curry$(function(f, xs){ + var max, i$, ref$, len$, x; + max = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (f(x) > f(max)) { + max = x; + } + } + return max; +}); +minimumBy = curry$(function(f, xs){ + var min, i$, ref$, len$, x; + min = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (f(x) < f(min)) { + min = x; + } + } + return min; +}); +scan = scanl = curry$(function(f, memo, xs){ + var last, x; + last = memo; + return [memo].concat((function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + results$.push(last = f(last, x)); + } + return results$; + }())); +}); +scan1 = scanl1 = curry$(function(f, xs){ + if (!xs.length) { + return; + } + return scan(f, xs[0], xs.slice(1)); +}); +scanr = curry$(function(f, memo, xs){ + xs = xs.concat().reverse(); + return scan(f, memo, xs).reverse(); +}); +scanr1 = curry$(function(f, xs){ + if (!xs.length) { + return; + } + xs = xs.concat().reverse(); + return scan(f, xs[0], xs.slice(1)).reverse(); +}); +slice = curry$(function(x, y, xs){ + return xs.slice(x, y); +}); +take = curry$(function(n, xs){ + if (n <= 0) { + return xs.slice(0, 0); + } else { + return xs.slice(0, n); + } +}); +drop = curry$(function(n, xs){ + if (n <= 0) { + return xs; + } else { + return xs.slice(n); + } +}); +splitAt = curry$(function(n, xs){ + return [take(n, xs), drop(n, xs)]; +}); +takeWhile = curry$(function(p, xs){ + var len, i; + len = xs.length; + if (!len) { + return xs; + } + i = 0; + while (i < len && p(xs[i])) { + i += 1; + } + return xs.slice(0, i); +}); +dropWhile = curry$(function(p, xs){ + var len, i; + len = xs.length; + if (!len) { + return xs; + } + i = 0; + while (i < len && p(xs[i])) { + i += 1; + } + return xs.slice(i); +}); +span = curry$(function(p, xs){ + return [takeWhile(p, xs), dropWhile(p, xs)]; +}); +breakList = curry$(function(p, xs){ + return span(compose$(p, not$), xs); +}); +zip = curry$(function(xs, ys){ + var result, len, i$, len$, i, x; + result = []; + len = ys.length; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (i === len) { + break; + } + result.push([x, ys[i]]); + } + return result; +}); +zipWith = curry$(function(f, xs, ys){ + var result, len, i$, len$, i, x; + result = []; + len = ys.length; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (i === len) { + break; + } + result.push(f(x, ys[i])); + } + return result; +}); +zipAll = function(){ + var xss, res$, i$, to$, minLength, len$, xs, ref$, i, lresult$, j$, results$ = []; + res$ = []; + for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + xss = res$; + minLength = undefined; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + minLength <= (ref$ = xs.length) || (minLength = ref$); + } + for (i$ = 0; i$ < minLength; ++i$) { + i = i$; + lresult$ = []; + for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) { + xs = xss[j$]; + lresult$.push(xs[i]); + } + results$.push(lresult$); + } + return results$; +}; +zipAllWith = function(f){ + var xss, res$, i$, to$, minLength, len$, xs, ref$, i, results$ = []; + res$ = []; + for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) { + res$.push(arguments[i$]); + } + xss = res$; + minLength = undefined; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + minLength <= (ref$ = xs.length) || (minLength = ref$); + } + for (i$ = 0; i$ < minLength; ++i$) { + i = i$; + results$.push(f.apply(null, (fn$()))); + } + return results$; + function fn$(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) { + xs = ref$[i$]; + results$.push(xs[i]); + } + return results$; + } +}; +at = curry$(function(n, xs){ + if (n < 0) { + return xs[xs.length + n]; + } else { + return xs[n]; + } +}); +elemIndex = curry$(function(el, xs){ + var i$, len$, i, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (x === el) { + return i; + } + } +}); +elemIndices = curry$(function(el, xs){ + var i$, len$, i, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (x === el) { + results$.push(i); + } + } + return results$; +}); +findIndex = curry$(function(f, xs){ + var i$, len$, i, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (f(x)) { + return i; + } + } +}); +findIndices = curry$(function(f, xs){ + var i$, len$, i, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (f(x)) { + results$.push(i); + } + } + return results$; +}); +module.exports = { + each: each, + map: map, + filter: filter, + compact: compact, + reject: reject, + remove: remove, + partition: partition, + find: find, + head: head, + first: first, + tail: tail, + last: last, + initial: initial, + empty: empty, + reverse: reverse, + difference: difference, + intersection: intersection, + union: union, + countBy: countBy, + groupBy: groupBy, + fold: fold, + fold1: fold1, + foldl: foldl, + foldl1: foldl1, + foldr: foldr, + foldr1: foldr1, + unfoldr: unfoldr, + andList: andList, + orList: orList, + any: any, + all: all, + unique: unique, + uniqueBy: uniqueBy, + sort: sort, + sortWith: sortWith, + sortBy: sortBy, + sum: sum, + product: product, + mean: mean, + average: average, + concat: concat, + concatMap: concatMap, + flatten: flatten, + maximum: maximum, + minimum: minimum, + maximumBy: maximumBy, + minimumBy: minimumBy, + scan: scan, + scan1: scan1, + scanl: scanl, + scanl1: scanl1, + scanr: scanr, + scanr1: scanr1, + slice: slice, + take: take, + drop: drop, + splitAt: splitAt, + takeWhile: takeWhile, + dropWhile: dropWhile, + span: span, + breakList: breakList, + zip: zip, + zipWith: zipWith, + zipAll: zipAll, + zipAllWith: zipAllWith, + at: at, + elemIndex: elemIndex, + elemIndices: elemIndices, + findIndex: findIndex, + findIndices: findIndices +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} +function in$(x, xs){ + var i = -1, l = xs.length >>> 0; + while (++i < l) if (x === xs[i]) return true; + return false; +} +function compose$() { + var functions = arguments; + return function() { + var i, result; + result = functions[0].apply(this, arguments); + for (i = 1; i < functions.length; ++i) { + result = functions[i](result); + } + return result; + }; +} +function not$(x){ return !x; } \ No newline at end of file diff --git a/node_modules/prelude-ls/lib/Num.js b/node_modules/prelude-ls/lib/Num.js new file mode 100644 index 0000000..f6b5319 --- /dev/null +++ b/node_modules/prelude-ls/lib/Num.js @@ -0,0 +1,130 @@ +// Generated by LiveScript 1.6.0 +var max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm; +max = curry$(function(x$, y$){ + return x$ > y$ ? x$ : y$; +}); +min = curry$(function(x$, y$){ + return x$ < y$ ? x$ : y$; +}); +negate = function(x){ + return -x; +}; +abs = Math.abs; +signum = function(x){ + if (x < 0) { + return -1; + } else if (x > 0) { + return 1; + } else { + return 0; + } +}; +quot = curry$(function(x, y){ + return ~~(x / y); +}); +rem = curry$(function(x$, y$){ + return x$ % y$; +}); +div = curry$(function(x, y){ + return Math.floor(x / y); +}); +mod = curry$(function(x$, y$){ + var ref$; + return ((x$) % (ref$ = y$) + ref$) % ref$; +}); +recip = (function(it){ + return 1 / it; +}); +pi = Math.PI; +tau = pi * 2; +exp = Math.exp; +sqrt = Math.sqrt; +ln = Math.log; +pow = curry$(function(x$, y$){ + return Math.pow(x$, y$); +}); +sin = Math.sin; +tan = Math.tan; +cos = Math.cos; +asin = Math.asin; +acos = Math.acos; +atan = Math.atan; +atan2 = curry$(function(x, y){ + return Math.atan2(x, y); +}); +truncate = function(x){ + return ~~x; +}; +round = Math.round; +ceiling = Math.ceil; +floor = Math.floor; +isItNaN = function(x){ + return x !== x; +}; +even = function(x){ + return x % 2 === 0; +}; +odd = function(x){ + return x % 2 !== 0; +}; +gcd = curry$(function(x, y){ + var z; + x = Math.abs(x); + y = Math.abs(y); + while (y !== 0) { + z = x % y; + x = y; + y = z; + } + return x; +}); +lcm = curry$(function(x, y){ + return Math.abs(Math.floor(x / gcd(x, y) * y)); +}); +module.exports = { + max: max, + min: min, + negate: negate, + abs: abs, + signum: signum, + quot: quot, + rem: rem, + div: div, + mod: mod, + recip: recip, + pi: pi, + tau: tau, + exp: exp, + sqrt: sqrt, + ln: ln, + pow: pow, + sin: sin, + tan: tan, + cos: cos, + acos: acos, + asin: asin, + atan: atan, + atan2: atan2, + truncate: truncate, + round: round, + ceiling: ceiling, + floor: floor, + isItNaN: isItNaN, + even: even, + odd: odd, + gcd: gcd, + lcm: lcm +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/prelude-ls/lib/Obj.js b/node_modules/prelude-ls/lib/Obj.js new file mode 100644 index 0000000..0b8d321 --- /dev/null +++ b/node_modules/prelude-ls/lib/Obj.js @@ -0,0 +1,154 @@ +// Generated by LiveScript 1.6.0 +var values, keys, pairsToObj, objToPairs, listsToObj, objToLists, empty, each, map, compact, filter, reject, partition, find; +values = function(object){ + var i$, x, results$ = []; + for (i$ in object) { + x = object[i$]; + results$.push(x); + } + return results$; +}; +keys = function(object){ + var x, results$ = []; + for (x in object) { + results$.push(x); + } + return results$; +}; +pairsToObj = function(object){ + var i$, len$, x, resultObj$ = {}; + for (i$ = 0, len$ = object.length; i$ < len$; ++i$) { + x = object[i$]; + resultObj$[x[0]] = x[1]; + } + return resultObj$; +}; +objToPairs = function(object){ + var key, value, results$ = []; + for (key in object) { + value = object[key]; + results$.push([key, value]); + } + return results$; +}; +listsToObj = curry$(function(keys, values){ + var i$, len$, i, key, resultObj$ = {}; + for (i$ = 0, len$ = keys.length; i$ < len$; ++i$) { + i = i$; + key = keys[i$]; + resultObj$[key] = values[i]; + } + return resultObj$; +}); +objToLists = function(object){ + var keys, values, key, value; + keys = []; + values = []; + for (key in object) { + value = object[key]; + keys.push(key); + values.push(value); + } + return [keys, values]; +}; +empty = function(object){ + var x; + for (x in object) { + return false; + } + return true; +}; +each = curry$(function(f, object){ + var i$, x; + for (i$ in object) { + x = object[i$]; + f(x); + } + return object; +}); +map = curry$(function(f, object){ + var k, x, resultObj$ = {}; + for (k in object) { + x = object[k]; + resultObj$[k] = f(x); + } + return resultObj$; +}); +compact = function(object){ + var k, x, resultObj$ = {}; + for (k in object) { + x = object[k]; + if (x) { + resultObj$[k] = x; + } + } + return resultObj$; +}; +filter = curry$(function(f, object){ + var k, x, resultObj$ = {}; + for (k in object) { + x = object[k]; + if (f(x)) { + resultObj$[k] = x; + } + } + return resultObj$; +}); +reject = curry$(function(f, object){ + var k, x, resultObj$ = {}; + for (k in object) { + x = object[k]; + if (!f(x)) { + resultObj$[k] = x; + } + } + return resultObj$; +}); +partition = curry$(function(f, object){ + var passed, failed, k, x; + passed = {}; + failed = {}; + for (k in object) { + x = object[k]; + (f(x) ? passed : failed)[k] = x; + } + return [passed, failed]; +}); +find = curry$(function(f, object){ + var i$, x; + for (i$ in object) { + x = object[i$]; + if (f(x)) { + return x; + } + } +}); +module.exports = { + values: values, + keys: keys, + pairsToObj: pairsToObj, + objToPairs: objToPairs, + listsToObj: listsToObj, + objToLists: objToLists, + empty: empty, + each: each, + map: map, + filter: filter, + compact: compact, + reject: reject, + partition: partition, + find: find +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/prelude-ls/lib/Str.js b/node_modules/prelude-ls/lib/Str.js new file mode 100644 index 0000000..59406d6 --- /dev/null +++ b/node_modules/prelude-ls/lib/Str.js @@ -0,0 +1,92 @@ +// Generated by LiveScript 1.6.0 +var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat, capitalize, camelize, dasherize; +split = curry$(function(sep, str){ + return str.split(sep); +}); +join = curry$(function(sep, xs){ + return xs.join(sep); +}); +lines = function(str){ + if (!str.length) { + return []; + } + return str.split('\n'); +}; +unlines = function(it){ + return it.join('\n'); +}; +words = function(str){ + if (!str.length) { + return []; + } + return str.split(/[ ]+/); +}; +unwords = function(it){ + return it.join(' '); +}; +chars = function(it){ + return it.split(''); +}; +unchars = function(it){ + return it.join(''); +}; +reverse = function(str){ + return str.split('').reverse().join(''); +}; +repeat = curry$(function(n, str){ + var result, i$; + result = ''; + for (i$ = 0; i$ < n; ++i$) { + result += str; + } + return result; +}); +capitalize = function(str){ + return str.charAt(0).toUpperCase() + str.slice(1); +}; +camelize = function(it){ + return it.replace(/[-_]+(.)?/g, function(arg$, c){ + return (c != null ? c : '').toUpperCase(); + }); +}; +dasherize = function(str){ + return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper){ + return lower + "-" + (upper.length > 1 + ? upper + : upper.toLowerCase()); + }).replace(/^([A-Z]+)/, function(arg$, upper){ + if (upper.length > 1) { + return upper + "-"; + } else { + return upper.toLowerCase(); + } + }); +}; +module.exports = { + split: split, + join: join, + lines: lines, + unlines: unlines, + words: words, + unwords: unwords, + chars: chars, + unchars: unchars, + reverse: reverse, + repeat: repeat, + capitalize: capitalize, + camelize: camelize, + dasherize: dasherize +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/prelude-ls/lib/index.js b/node_modules/prelude-ls/lib/index.js new file mode 100644 index 0000000..9dcbed4 --- /dev/null +++ b/node_modules/prelude-ls/lib/index.js @@ -0,0 +1,178 @@ +// Generated by LiveScript 1.6.0 +var Func, List, Obj, Str, Num, id, isType, replicate, prelude, toString$ = {}.toString; +Func = require('./Func.js'); +List = require('./List.js'); +Obj = require('./Obj.js'); +Str = require('./Str.js'); +Num = require('./Num.js'); +id = function(x){ + return x; +}; +isType = curry$(function(type, x){ + return toString$.call(x).slice(8, -1) === type; +}); +replicate = curry$(function(n, x){ + var i$, results$ = []; + for (i$ = 0; i$ < n; ++i$) { + results$.push(x); + } + return results$; +}); +Str.empty = List.empty; +Str.slice = List.slice; +Str.take = List.take; +Str.drop = List.drop; +Str.splitAt = List.splitAt; +Str.takeWhile = List.takeWhile; +Str.dropWhile = List.dropWhile; +Str.span = List.span; +Str.breakStr = List.breakList; +prelude = { + Func: Func, + List: List, + Obj: Obj, + Str: Str, + Num: Num, + id: id, + isType: isType, + replicate: replicate +}; +prelude.each = List.each; +prelude.map = List.map; +prelude.filter = List.filter; +prelude.compact = List.compact; +prelude.reject = List.reject; +prelude.partition = List.partition; +prelude.find = List.find; +prelude.head = List.head; +prelude.first = List.first; +prelude.tail = List.tail; +prelude.last = List.last; +prelude.initial = List.initial; +prelude.empty = List.empty; +prelude.reverse = List.reverse; +prelude.difference = List.difference; +prelude.intersection = List.intersection; +prelude.union = List.union; +prelude.countBy = List.countBy; +prelude.groupBy = List.groupBy; +prelude.fold = List.fold; +prelude.foldl = List.foldl; +prelude.fold1 = List.fold1; +prelude.foldl1 = List.foldl1; +prelude.foldr = List.foldr; +prelude.foldr1 = List.foldr1; +prelude.unfoldr = List.unfoldr; +prelude.andList = List.andList; +prelude.orList = List.orList; +prelude.any = List.any; +prelude.all = List.all; +prelude.unique = List.unique; +prelude.uniqueBy = List.uniqueBy; +prelude.sort = List.sort; +prelude.sortWith = List.sortWith; +prelude.sortBy = List.sortBy; +prelude.sum = List.sum; +prelude.product = List.product; +prelude.mean = List.mean; +prelude.average = List.average; +prelude.concat = List.concat; +prelude.concatMap = List.concatMap; +prelude.flatten = List.flatten; +prelude.maximum = List.maximum; +prelude.minimum = List.minimum; +prelude.maximumBy = List.maximumBy; +prelude.minimumBy = List.minimumBy; +prelude.scan = List.scan; +prelude.scanl = List.scanl; +prelude.scan1 = List.scan1; +prelude.scanl1 = List.scanl1; +prelude.scanr = List.scanr; +prelude.scanr1 = List.scanr1; +prelude.slice = List.slice; +prelude.take = List.take; +prelude.drop = List.drop; +prelude.splitAt = List.splitAt; +prelude.takeWhile = List.takeWhile; +prelude.dropWhile = List.dropWhile; +prelude.span = List.span; +prelude.breakList = List.breakList; +prelude.zip = List.zip; +prelude.zipWith = List.zipWith; +prelude.zipAll = List.zipAll; +prelude.zipAllWith = List.zipAllWith; +prelude.at = List.at; +prelude.elemIndex = List.elemIndex; +prelude.elemIndices = List.elemIndices; +prelude.findIndex = List.findIndex; +prelude.findIndices = List.findIndices; +prelude.apply = Func.apply; +prelude.curry = Func.curry; +prelude.flip = Func.flip; +prelude.fix = Func.fix; +prelude.over = Func.over; +prelude.split = Str.split; +prelude.join = Str.join; +prelude.lines = Str.lines; +prelude.unlines = Str.unlines; +prelude.words = Str.words; +prelude.unwords = Str.unwords; +prelude.chars = Str.chars; +prelude.unchars = Str.unchars; +prelude.repeat = Str.repeat; +prelude.capitalize = Str.capitalize; +prelude.camelize = Str.camelize; +prelude.dasherize = Str.dasherize; +prelude.values = Obj.values; +prelude.keys = Obj.keys; +prelude.pairsToObj = Obj.pairsToObj; +prelude.objToPairs = Obj.objToPairs; +prelude.listsToObj = Obj.listsToObj; +prelude.objToLists = Obj.objToLists; +prelude.max = Num.max; +prelude.min = Num.min; +prelude.negate = Num.negate; +prelude.abs = Num.abs; +prelude.signum = Num.signum; +prelude.quot = Num.quot; +prelude.rem = Num.rem; +prelude.div = Num.div; +prelude.mod = Num.mod; +prelude.recip = Num.recip; +prelude.pi = Num.pi; +prelude.tau = Num.tau; +prelude.exp = Num.exp; +prelude.sqrt = Num.sqrt; +prelude.ln = Num.ln; +prelude.pow = Num.pow; +prelude.sin = Num.sin; +prelude.tan = Num.tan; +prelude.cos = Num.cos; +prelude.acos = Num.acos; +prelude.asin = Num.asin; +prelude.atan = Num.atan; +prelude.atan2 = Num.atan2; +prelude.truncate = Num.truncate; +prelude.round = Num.round; +prelude.ceiling = Num.ceiling; +prelude.floor = Num.floor; +prelude.isItNaN = Num.isItNaN; +prelude.even = Num.even; +prelude.odd = Num.odd; +prelude.gcd = Num.gcd; +prelude.lcm = Num.lcm; +prelude.VERSION = '1.2.1'; +module.exports = prelude; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/prelude-ls/package.json b/node_modules/prelude-ls/package.json new file mode 100644 index 0000000..c313c3d --- /dev/null +++ b/node_modules/prelude-ls/package.json @@ -0,0 +1,46 @@ +{ + "name": "prelude-ls", + "version": "1.2.1", + "author": "George Zahariev ", + "description": "prelude.ls is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript.", + "keywords": [ + "prelude", + "livescript", + "utility", + "ls", + "coffeescript", + "javascript", + "library", + "functional", + "array", + "list", + "object", + "string" + ], + "main": "lib/", + "files": [ + "lib/", + "README.md", + "LICENSE" + ], + "homepage": "http://preludels.com", + "bugs": "https://github.com/gkz/prelude-ls/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/prelude-ls.git" + }, + "scripts": { + "test": "make test" + }, + "devDependencies": { + "livescript": "^1.6.0", + "uglify-js": "^3.8.1", + "mocha": "^7.1.1", + "browserify": "^16.5.1", + "sinon": "~8.0.1" + } +} diff --git a/node_modules/punycode/LICENSE-MIT.txt b/node_modules/punycode/LICENSE-MIT.txt new file mode 100644 index 0000000..a41e0a7 --- /dev/null +++ b/node_modules/punycode/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/punycode/README.md b/node_modules/punycode/README.md new file mode 100644 index 0000000..ee2f9d6 --- /dev/null +++ b/node_modules/punycode/README.md @@ -0,0 +1,122 @@ +# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/codecov/c/github/bestiejs/punycode.js.svg)](https://codecov.io/gh/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js) + +Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891). + +This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm: + +* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C) +* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c) +* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c) +* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287) +* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072)) + +This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated). + +The current version supports recent versions of Node.js only. It provides a CommonJS module and an ES6 module. For the old version that offers the same functionality with broader support, including Rhino, Ringo, Narwhal, and web browsers, see [v1.4.1](https://github.com/bestiejs/punycode.js/releases/tag/v1.4.1). + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install punycode --save +``` + +In [Node.js](https://nodejs.org/): + +```js +const punycode = require('punycode'); +``` + +## API + +### `punycode.decode(string)` + +Converts a Punycode string of ASCII symbols to a string of Unicode symbols. + +```js +// decode domain name parts +punycode.decode('maana-pta'); // 'mañana' +punycode.decode('--dqo34k'); // '☃-⌘' +``` + +### `punycode.encode(string)` + +Converts a string of Unicode symbols to a Punycode string of ASCII symbols. + +```js +// encode domain name parts +punycode.encode('mañana'); // 'maana-pta' +punycode.encode('☃-⌘'); // '--dqo34k' +``` + +### `punycode.toUnicode(input)` + +Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode. + +```js +// decode domain names +punycode.toUnicode('xn--maana-pta.com'); +// → 'mañana.com' +punycode.toUnicode('xn----dqo34k.com'); +// → '☃-⌘.com' + +// decode email addresses +punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'); +// → 'джумла@джpумлатест.bрфa' +``` + +### `punycode.toASCII(input)` + +Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII. + +```js +// encode domain names +punycode.toASCII('mañana.com'); +// → 'xn--maana-pta.com' +punycode.toASCII('☃-⌘.com'); +// → 'xn----dqo34k.com' + +// encode email addresses +punycode.toASCII('джумла@джpумлатест.bрфa'); +// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq' +``` + +### `punycode.ucs2` + +#### `punycode.ucs2.decode(string)` + +Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16. + +```js +punycode.ucs2.decode('abc'); +// → [0x61, 0x62, 0x63] +// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE: +punycode.ucs2.decode('\uD834\uDF06'); +// → [0x1D306] +``` + +#### `punycode.ucs2.encode(codePoints)` + +Creates a string based on an array of numeric code point values. + +```js +punycode.ucs2.encode([0x61, 0x62, 0x63]); +// → 'abc' +punycode.ucs2.encode([0x1D306]); +// → '\uD834\uDF06' +``` + +### `punycode.version` + +A string representing the current Punycode.js version number. + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +Punycode.js is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/punycode/package.json b/node_modules/punycode/package.json new file mode 100644 index 0000000..9202ccf --- /dev/null +++ b/node_modules/punycode/package.json @@ -0,0 +1,58 @@ +{ + "name": "punycode", + "version": "2.1.1", + "description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.", + "homepage": "https://mths.be/punycode", + "main": "punycode.js", + "jsnext:main": "punycode.es6.js", + "module": "punycode.es6.js", + "engines": { + "node": ">=6" + }, + "keywords": [ + "punycode", + "unicode", + "idn", + "idna", + "dns", + "url", + "domain" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "contributors": [ + { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git" + }, + "bugs": "https://github.com/bestiejs/punycode.js/issues", + "files": [ + "LICENSE-MIT.txt", + "punycode.js", + "punycode.es6.js" + ], + "scripts": { + "test": "mocha tests", + "prepublish": "node scripts/prepublish.js" + }, + "devDependencies": { + "codecov": "^1.0.1", + "istanbul": "^0.4.1", + "mocha": "^2.5.3" + }, + "jspm": { + "map": { + "./punycode.js": { + "node": "@node/punycode" + } + } + } +} diff --git a/node_modules/punycode/punycode.es6.js b/node_modules/punycode/punycode.es6.js new file mode 100644 index 0000000..4610bc9 --- /dev/null +++ b/node_modules/punycode/punycode.es6.js @@ -0,0 +1,441 @@ +'use strict'; + +/** Highest positive signed 32-bit float value */ +const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 + +/** Bootstring parameters */ +const base = 36; +const tMin = 1; +const tMax = 26; +const skew = 38; +const damp = 700; +const initialBias = 72; +const initialN = 128; // 0x80 +const delimiter = '-'; // '\x2D' + +/** Regular expressions */ +const regexPunycode = /^xn--/; +const regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars +const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators + +/** Error messages */ +const errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' +}; + +/** Convenience shortcuts */ +const baseMinusTMin = base - tMin; +const floor = Math.floor; +const stringFromCharCode = String.fromCharCode; + +/*--------------------------------------------------------------------------*/ + +/** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ +function error(type) { + throw new RangeError(errors[type]); +} + +/** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ +function map(array, fn) { + const result = []; + let length = array.length; + while (length--) { + result[length] = fn(array[length]); + } + return result; +} + +/** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ +function mapDomain(string, fn) { + const parts = string.split('@'); + let result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + const labels = string.split('.'); + const encoded = map(labels, fn).join('.'); + return result + encoded; +} + +/** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ +function ucs2decode(string) { + const output = []; + let counter = 0; + const length = string.length; + while (counter < length) { + const value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // It's a high surrogate, and there is a next character. + const extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // It's an unmatched surrogate; only append this code unit, in case the + // next code unit is the high surrogate of a surrogate pair. + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; +} + +/** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ +const ucs2encode = array => String.fromCodePoint(...array); + +/** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ +const basicToDigit = function(codePoint) { + if (codePoint - 0x30 < 0x0A) { + return codePoint - 0x16; + } + if (codePoint - 0x41 < 0x1A) { + return codePoint - 0x41; + } + if (codePoint - 0x61 < 0x1A) { + return codePoint - 0x61; + } + return base; +}; + +/** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ +const digitToBasic = function(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); +}; + +/** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ +const adapt = function(delta, numPoints, firstTime) { + let k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); +}; + +/** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ +const decode = function(input) { + // Don't use UCS-2. + const output = []; + const inputLength = input.length; + let i = 0; + let n = initialN; + let bias = initialBias; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + let basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (let j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + let oldi = i; + for (let w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + const digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + const baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + const out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output. + output.splice(i++, 0, n); + + } + + return String.fromCodePoint(...output); +}; + +/** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ +const encode = function(input) { + const output = []; + + // Convert the input in UCS-2 to an array of Unicode code points. + input = ucs2decode(input); + + // Cache the length. + let inputLength = input.length; + + // Initialize the state. + let n = initialN; + let delta = 0; + let bias = initialBias; + + // Handle the basic code points. + for (const currentValue of input) { + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + let basicLength = output.length; + let handledCPCount = basicLength; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string with a delimiter unless it's empty. + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + let m = maxInt; + for (const currentValue of input) { + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow. + const handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (const currentValue of input) { + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + if (currentValue == n) { + // Represent delta as a generalized variable-length integer. + let q = delta; + for (let k = base; /* no condition */; k += base) { + const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + const qMinusT = q - t; + const baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); +}; + +/** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ +const toUnicode = function(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); +}; + +/** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ +const toASCII = function(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); +}; + +/*--------------------------------------------------------------------------*/ + +/** Define the public API */ +const punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '2.1.0', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode +}; + +export { ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode }; +export default punycode; diff --git a/node_modules/punycode/punycode.js b/node_modules/punycode/punycode.js new file mode 100644 index 0000000..ea61fd0 --- /dev/null +++ b/node_modules/punycode/punycode.js @@ -0,0 +1,440 @@ +'use strict'; + +/** Highest positive signed 32-bit float value */ +const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 + +/** Bootstring parameters */ +const base = 36; +const tMin = 1; +const tMax = 26; +const skew = 38; +const damp = 700; +const initialBias = 72; +const initialN = 128; // 0x80 +const delimiter = '-'; // '\x2D' + +/** Regular expressions */ +const regexPunycode = /^xn--/; +const regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars +const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators + +/** Error messages */ +const errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' +}; + +/** Convenience shortcuts */ +const baseMinusTMin = base - tMin; +const floor = Math.floor; +const stringFromCharCode = String.fromCharCode; + +/*--------------------------------------------------------------------------*/ + +/** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ +function error(type) { + throw new RangeError(errors[type]); +} + +/** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ +function map(array, fn) { + const result = []; + let length = array.length; + while (length--) { + result[length] = fn(array[length]); + } + return result; +} + +/** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ +function mapDomain(string, fn) { + const parts = string.split('@'); + let result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + const labels = string.split('.'); + const encoded = map(labels, fn).join('.'); + return result + encoded; +} + +/** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ +function ucs2decode(string) { + const output = []; + let counter = 0; + const length = string.length; + while (counter < length) { + const value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // It's a high surrogate, and there is a next character. + const extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // It's an unmatched surrogate; only append this code unit, in case the + // next code unit is the high surrogate of a surrogate pair. + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; +} + +/** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ +const ucs2encode = array => String.fromCodePoint(...array); + +/** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ +const basicToDigit = function(codePoint) { + if (codePoint - 0x30 < 0x0A) { + return codePoint - 0x16; + } + if (codePoint - 0x41 < 0x1A) { + return codePoint - 0x41; + } + if (codePoint - 0x61 < 0x1A) { + return codePoint - 0x61; + } + return base; +}; + +/** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ +const digitToBasic = function(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); +}; + +/** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ +const adapt = function(delta, numPoints, firstTime) { + let k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); +}; + +/** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ +const decode = function(input) { + // Don't use UCS-2. + const output = []; + const inputLength = input.length; + let i = 0; + let n = initialN; + let bias = initialBias; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + let basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (let j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + let oldi = i; + for (let w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + const digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + const baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + const out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output. + output.splice(i++, 0, n); + + } + + return String.fromCodePoint(...output); +}; + +/** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ +const encode = function(input) { + const output = []; + + // Convert the input in UCS-2 to an array of Unicode code points. + input = ucs2decode(input); + + // Cache the length. + let inputLength = input.length; + + // Initialize the state. + let n = initialN; + let delta = 0; + let bias = initialBias; + + // Handle the basic code points. + for (const currentValue of input) { + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + let basicLength = output.length; + let handledCPCount = basicLength; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string with a delimiter unless it's empty. + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + let m = maxInt; + for (const currentValue of input) { + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow. + const handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (const currentValue of input) { + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + if (currentValue == n) { + // Represent delta as a generalized variable-length integer. + let q = delta; + for (let k = base; /* no condition */; k += base) { + const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + const qMinusT = q - t; + const baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); +}; + +/** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ +const toUnicode = function(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); +}; + +/** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ +const toASCII = function(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); +}; + +/*--------------------------------------------------------------------------*/ + +/** Define the public API */ +const punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '2.1.0', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode +}; + +module.exports = punycode; diff --git a/node_modules/regexp.prototype.flags/.editorconfig b/node_modules/regexp.prototype.flags/.editorconfig new file mode 100644 index 0000000..eaa2141 --- /dev/null +++ b/node_modules/regexp.prototype.flags/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/regexp.prototype.flags/.eslintrc b/node_modules/regexp.prototype.flags/.eslintrc new file mode 100644 index 0000000..dcbbda2 --- /dev/null +++ b/node_modules/regexp.prototype.flags/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "eqeqeq": [2, "allow-null"], + "id-length": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + }, + }, + ], +} diff --git a/node_modules/regexp.prototype.flags/.nycrc b/node_modules/regexp.prototype.flags/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/regexp.prototype.flags/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/regexp.prototype.flags/CHANGELOG.md b/node_modules/regexp.prototype.flags/CHANGELOG.md new file mode 100644 index 0000000..f7bf7b8 --- /dev/null +++ b/node_modules/regexp.prototype.flags/CHANGELOG.md @@ -0,0 +1,190 @@ +# 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). + +## [v1.4.3](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.2...v1.4.3) - 2022-04-14 + +### Commits + +- [Fix] when shimmed, name must be `get flags` [`fcefd00`](https://github.com/es-shims/RegExp.prototype.flags/commit/fcefd0039177e9cbcb2ed842d353131ace7a3377) + +## [v1.4.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.1...v1.4.2) - 2022-04-12 + +### Commits + +- [Fix] ensure `hasIndices` is patched properly, and getter order is correct [`a1af45a`](https://github.com/es-shims/RegExp.prototype.flags/commit/a1af45a8a6f7305b097b83f96ee9fc45abb3e733) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`24f5a0c`](https://github.com/es-shims/RegExp.prototype.flags/commit/24f5a0c84f2e7d263ae0e2008def870afd6d5a4f) + +## [v1.4.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.4.0...v1.4.1) - 2022-01-13 + +### Commits + +- [Fix] `polyfill`: do not throw in a descriptorless environment [`e2d24e7`](https://github.com/es-shims/RegExp.prototype.flags/commit/e2d24e707a44d958a0b6d3a114effb2f2b475337) + +## [v1.4.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.2...v1.4.0) - 2022-01-13 + +### Commits + +- [Tests] use `available-regexp-flags` [`95af246`](https://github.com/es-shims/RegExp.prototype.flags/commit/95af2463f1373282087528f8566e20ffae26c3db) +- [New] add `hasIndices`/`d` flag [`89959ca`](https://github.com/es-shims/RegExp.prototype.flags/commit/89959ca1128ea48dcd0ec1416355264425fa3bc5) + +## [v1.3.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.1...v1.3.2) - 2022-01-13 + +### Commits + +- [actions] reuse common workflows [`6665b5d`](https://github.com/es-shims/RegExp.prototype.flags/commit/6665b5db7c45ce6b987d08ebaf6d2767eec95b94) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`babce94`](https://github.com/es-shims/RegExp.prototype.flags/commit/babce94b5ca96e93e74e384c0a01295943677a3f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `object-inspect`, `safe-publish-latest`, `tape` [`52132d9`](https://github.com/es-shims/RegExp.prototype.flags/commit/52132d9f3df904864d4cf3fd44892ee563aee524) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c16687c`](https://github.com/es-shims/RegExp.prototype.flags/commit/c16687c118d374d8997a8d885467507bf943b4bc) +- [actions] update codecov uploader [`0a3c904`](https://github.com/es-shims/RegExp.prototype.flags/commit/0a3c904a9fd1247b3b8e0fb6b451b3fbe97735bd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`3fce7f2`](https://github.com/es-shims/RegExp.prototype.flags/commit/3fce7f27c753440003675d03ae9a7ecfa6a74d30) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`75ca498`](https://github.com/es-shims/RegExp.prototype.flags/commit/75ca49889349fc42e51ea79b2ec7a1996fb3eb18) +- [actions] update workflows [`300f321`](https://github.com/es-shims/RegExp.prototype.flags/commit/300f321984526066656bec791f0bb3861b33cfbc) +- [meta] better `eccheck` command [`5f735ab`](https://github.com/es-shims/RegExp.prototype.flags/commit/5f735ab1b1c87dbd05c0096249160587f166cd51) +- [Dev Deps] update `eslint`, `tape` [`3059637`](https://github.com/es-shims/RegExp.prototype.flags/commit/3059637210eb5c9fa97160ec2f0aea1d1d724eb7) +- [actions] update workflows` [`dbd8ab4`](https://github.com/es-shims/RegExp.prototype.flags/commit/dbd8ab49fa2196dd74791107825c43e4481cdfd2) +- [meta] use `prepublishOnly` script for npm 7+ [`5cc8652`](https://github.com/es-shims/RegExp.prototype.flags/commit/5cc86524a41bf358b6701bcf46e480f0e3e470b4) +- [Fix] use polyfill, not implementation, in main export [`15ab4b8`](https://github.com/es-shims/RegExp.prototype.flags/commit/15ab4b85f3904e48664e26394dc12765ed666da4) +- [meta] remove `audit-level` config, which breaks npm 7 installs [`1cb98ae`](https://github.com/es-shims/RegExp.prototype.flags/commit/1cb98aed731e73d11df5ed3b853b371d35a69f5a) + +## [v1.3.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.3.0...v1.3.1) - 2021-01-15 + +### Commits + +- [Tests] run `nyc` on all tests; use `tape` runner; add full es-shims test suite [`047a1e8`](https://github.com/es-shims/RegExp.prototype.flags/commit/047a1e8ff250220254b0e9598d962a56c8ec3ffc) +- [Tests] migrate tests to Github Actions [`e4e391f`](https://github.com/es-shims/RegExp.prototype.flags/commit/e4e391fd3e6f057172994ad0c33ca128568c0b06) +- [meta] use `auto-changelog` for changelog [`afbcd06`](https://github.com/es-shims/RegExp.prototype.flags/commit/afbcd06402e97e975af797e2c1375e35e22e90f2) +- [actions] add Require Allow Edits workflow [`0db5d50`](https://github.com/es-shims/RegExp.prototype.flags/commit/0db5d50cdf59e3e5529024af4f8ce05829edc06d) +- [meta] do not publish github action workflow files [`53f2902`](https://github.com/es-shims/RegExp.prototype.flags/commit/53f29020e5a1f517e91b8cf226ed6bc97eadc090) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `aud` [`05f2a85`](https://github.com/es-shims/RegExp.prototype.flags/commit/05f2a851869069c7911176809028be8491465f86) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2a197b8`](https://github.com/es-shims/RegExp.prototype.flags/commit/2a197b84916f094946c5cad56ef8e7bb7e8f12ac) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`e40bd37`](https://github.com/es-shims/RegExp.prototype.flags/commit/e40bd37de9bb756672832a6c994652965d09b9ae) +- [Refactor] use `call-bind` instead of `es-abstract` [`e6eac90`](https://github.com/es-shims/RegExp.prototype.flags/commit/e6eac9052ebdb4bc28cb83b5d3017a4ed74fe3f1) +- [Deps] update `es-abstract` [`f198075`](https://github.com/es-shims/RegExp.prototype.flags/commit/f198075d6fc075e0d98967af98a512742e6e7e4f) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`2d21727`](https://github.com/es-shims/RegExp.prototype.flags/commit/2d217275d78214b82c7f5cacca85ca2308df83f1) +- [Deps] update `es-abstract` [`7e7ddc6`](https://github.com/es-shims/RegExp.prototype.flags/commit/7e7ddc66174256f6688a857b09c9a02bafcf4866) + +## [v1.3.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.2.0...v1.3.0) - 2019-12-14 + +### Commits + +- [Tests] remove `jscs` [`4a09ab4`](https://github.com/es-shims/RegExp.prototype.flags/commit/4a09ab467f62065a1718b0dcc50f7818b5400ab6) +- [Tests] use shared travis-ci configs [`8afa6a9`](https://github.com/es-shims/RegExp.prototype.flags/commit/8afa6a99fd35c19fb49ba630fd17159a5da2a34e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `has`, `tape` [`13a9fc9`](https://github.com/es-shims/RegExp.prototype.flags/commit/13a9fc9d6bc2600681eb3f638668beccf80b843c) +- [Refactor] use `callBind` helper from `es-abstract` [`c3a3727`](https://github.com/es-shims/RegExp.prototype.flags/commit/c3a37276764d99c1e4f7e9467ad636fce8c92c58) +- [actions] add automatic rebasing / merge commit blocking [`51e3f93`](https://github.com/es-shims/RegExp.prototype.flags/commit/51e3f9366d15a07edaf532884948ce74b6827125) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`7e1ee50`](https://github.com/es-shims/RegExp.prototype.flags/commit/7e1ee505df374867c2c04d500aa1c36265161b6f) +- [meta] add `funding` field [`c99cbec`](https://github.com/es-shims/RegExp.prototype.flags/commit/c99cbec1af9b0e0be42e82f164adacf2e1bdee16) +- [New] add `auto` entry point [`1e53e85`](https://github.com/es-shims/RegExp.prototype.flags/commit/1e53e854f663472e74dd0350e0c095df9c2b9c7b) +- [Tests] use `eclint` instead of `editorconfig-tools` [`8600bfe`](https://github.com/es-shims/RegExp.prototype.flags/commit/8600bfed42ab8d294463df482874c344fc079f82) +- [Deps] update `define-properties` [`ad221fa`](https://github.com/es-shims/RegExp.prototype.flags/commit/ad221fa2a26a9c2bc8d274b689cf7a626b58f4e9) + +## [v1.2.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.1.1...v1.2.0) - 2017-10-24 + +### Commits + +- [Tests] up to `node` `v8.8`, `v7.10`, `v6.11`, `v4.8`; improve matrix; use `nvm install-latest-npm` so new npm doesn’t break old node [`5a9653d`](https://github.com/es-shims/RegExp.prototype.flags/commit/5a9653d1904eb8ad8baffe43cd065b6f36013e5a) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`; add `has` [`556de86`](https://github.com/es-shims/RegExp.prototype.flags/commit/556de8632bbe7a23279717f7d0b6ee841514fbe1) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`726772c`](https://github.com/es-shims/RegExp.prototype.flags/commit/726772c054a499ab7680823c4bd8fa9b048d9420) +- [New] add support for `dotAll` regex flag. [`fcbd64f`](https://github.com/es-shims/RegExp.prototype.flags/commit/fcbd64f84fd974d98384bdb093bf25656eb72e8f) +- [Dev Deps] update `eslint`, `jscs`, `nsp`, `tape`, `@ljharb/eslint-config`, `@es-shims/api` [`0272934`](https://github.com/es-shims/RegExp.prototype.flags/commit/02729344addadc105b9c5e12d90cca85a75d16d6) +- [Dev Deps] update `jscs`, `nsp`, `eslint` [`e4cd264`](https://github.com/es-shims/RegExp.prototype.flags/commit/e4cd264f4afa33ff865325b04791de95696e3ae4) +- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@es-shims/api` [`baf5169`](https://github.com/es-shims/RegExp.prototype.flags/commit/baf51698ac00b31b6a4a6d5646a183a409ad1118) +- [Dev Deps] update `tape`, `nsp`, `eslint`, `@ljharb/eslint-config` [`97cea15`](https://github.com/es-shims/RegExp.prototype.flags/commit/97cea152c20bb0e63e9c5111780f7b4af5d1a0e8) +- [Dev Deps] update `tape`, `discs`, `eslint`, `@ljharb/eslint-config` [`b6872f4`](https://github.com/es-shims/RegExp.prototype.flags/commit/b6872f44c833f6f7faf63881657208b6cd43ef49) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`14702cc`](https://github.com/es-shims/RegExp.prototype.flags/commit/14702ccd050029d4e6ea2e59d0912e6bfc16ffc0) +- [Dev Deps] update `jscs`, `@es-shims/api` [`cd060a6`](https://github.com/es-shims/RegExp.prototype.flags/commit/cd060a650db019be5244e1c1b77a29f6d79c89db) +- [Tests] up to `node` `v6.2`, `v5.11` [`14638bd`](https://github.com/es-shims/RegExp.prototype.flags/commit/14638bdbd62d6b6a7c89efb8ec57a7815032b4bb) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`b0a5ffb`](https://github.com/es-shims/RegExp.prototype.flags/commit/b0a5ffb25a76783053652e0d7f835e354f9b29b6) +- [Tests] npm run silently [`35804d4`](https://github.com/es-shims/RegExp.prototype.flags/commit/35804d45dd7f57faab923aaab914e6390813e700) +- [Tests] up to `node` `v5.9`, `v4.4` [`e0fe80d`](https://github.com/es-shims/RegExp.prototype.flags/commit/e0fe80d96783820444d6dea1e6b5739032a50c1b) +- [Tests] up to `node` `v5.7`, `v4.3` [`9739c42`](https://github.com/es-shims/RegExp.prototype.flags/commit/9739c422523571cc439d73a9ecaf5dc2e2643bec) +- [Dev Deps] update `jscs` [`4aa1699`](https://github.com/es-shims/RegExp.prototype.flags/commit/4aa1699a0582b7739f14c6cd8d5ae1a4515bd604) +- [Dev Deps] update `tape`, `jscs`, `nsp`, `@ljharb/eslint-config` [`8bc5e6b`](https://github.com/es-shims/RegExp.prototype.flags/commit/8bc5e6ba5befc8f399e00f3c2d064519457fb57c) +- [Tests] fix npm upgrades on older nodes [`ae00bb9`](https://github.com/es-shims/RegExp.prototype.flags/commit/ae00bb9d979605f41fc598156b5c590923ac8184) +- Only apps should have lockfiles. [`6d14965`](https://github.com/es-shims/RegExp.prototype.flags/commit/6d1496550a962ea8525fb7b62dc4ac99d9513a6d) +- [Tests] use pretest/posttest for better organization [`0520cfd`](https://github.com/es-shims/RegExp.prototype.flags/commit/0520cfda23835fb5bff038a6e5cc530b0ce66985) +- [Tests] up to `node` `v5.5` [`810f62b`](https://github.com/es-shims/RegExp.prototype.flags/commit/810f62b6d2418e843b7c2c225841e9305dbc01ee) +- [Tests] on `node` `v5.3` [`f839662`](https://github.com/es-shims/RegExp.prototype.flags/commit/f839662887cbb1a5e472a9302185355b431c85c1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`78ecaa5`](https://github.com/es-shims/RegExp.prototype.flags/commit/78ecaa5b203a07f76505824f77ce1e5d60d8b0ca) +- [Tests] up to `node` `v5.2` [`c04d762`](https://github.com/es-shims/RegExp.prototype.flags/commit/c04d762a8c09ab544df14c14521f32dac3f67823) +- [Tests] up to `node` `v5.0` [`7c0d5b9`](https://github.com/es-shims/RegExp.prototype.flags/commit/7c0d5b944d9ba30f38227d0750109d582be254e2) +- [Tests] on `node` `v5.10` [`40ddafd`](https://github.com/es-shims/RegExp.prototype.flags/commit/40ddafd83e2e1c959ee8ba24cb296559f2545a0c) +- [Deps] update `define-properties` [`98ea89d`](https://github.com/es-shims/RegExp.prototype.flags/commit/98ea89dc9c41b81b84d4071105048687dab0660e) + +## [v1.1.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.1.0...v1.1.1) - 2015-08-16 + +### Commits + +- [Fix] cover the case where there is no descriptor on the prototype [`67014c3`](https://github.com/es-shims/RegExp.prototype.flags/commit/67014c35a93c76e28c4ab5cd3e5a54f7f40c2ddf) + +## [v1.1.0](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.0.1...v1.1.0) - 2015-08-16 + +### Commits + +- Update `jscs`, `eslint`; use my personal shared `eslint` config. [`37ca379`](https://github.com/es-shims/RegExp.prototype.flags/commit/37ca379bc72620fa6785b0a9ca791b160328c236) +- Update `eslint`, `tape`, `editorconfig-tools`, `nsp` [`cb92d6e`](https://github.com/es-shims/RegExp.prototype.flags/commit/cb92d6e8a8c1df5f00a226e11a78f38c6f7c3055) +- Implement the [es-shim API](es-shims/api). [`15eb821`](https://github.com/es-shims/RegExp.prototype.flags/commit/15eb821be2771e03a1341a08483513702118b45c) +- Refactoring to reduce complexity. [`aeb4785`](https://github.com/es-shims/RegExp.prototype.flags/commit/aeb47854f6b00355702104066c63f6eed38b5e81) +- Move implementation to `implementation.js` [`a698925`](https://github.com/es-shims/RegExp.prototype.flags/commit/a698925b4c1c78cd1ed4315b9deb5bb1707d5203) +- Update `eslint`, `jscs` [`277a4a1`](https://github.com/es-shims/RegExp.prototype.flags/commit/277a4a15e663eb823b63743b84645158b9bb9a43) +- Update `nsp`, `eslint` [`c9f3866`](https://github.com/es-shims/RegExp.prototype.flags/commit/c9f3866e25b52050f6bfe3fd0de8849de0271ea4) +- Update `tape`, `eslint` [`a08795b`](https://github.com/es-shims/RegExp.prototype.flags/commit/a08795b688b186fa5a2ec207358d81c16a07d30d) +- Make some things a bit more robust. [`450abb4`](https://github.com/es-shims/RegExp.prototype.flags/commit/450abb48974f10bfd2d9478e7ea1b9d87f004fb9) +- Update `eslint` [`25d898f`](https://github.com/es-shims/RegExp.prototype.flags/commit/25d898f62719b26fea5f9245be141103d4ec58cd) +- Test on latest two `io.js` versions. [`2e17ca3`](https://github.com/es-shims/RegExp.prototype.flags/commit/2e17ca304e12fb5071a091706a4d559b3eac968a) +- All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`4a2a548`](https://github.com/es-shims/RegExp.prototype.flags/commit/4a2a5480c50f30814000684462a8a3b44c87ae2e) +- Update `eslint` [`64df4e0`](https://github.com/es-shims/RegExp.prototype.flags/commit/64df4e0a2d0e2901b57652e30913db797dc0829b) +- Update `eslint` [`ac05ae5`](https://github.com/es-shims/RegExp.prototype.flags/commit/ac05ae509a4a70d107820a749ea6f02784fc41eb) +- Clean up `supportsDescriptors` check. [`e44d0de`](https://github.com/es-shims/RegExp.prototype.flags/commit/e44d0dec9c8415ff9a911b8806e1d245d6919a11) +- [Dev Deps] Update `jscs` [`8741758`](https://github.com/es-shims/RegExp.prototype.flags/commit/87417588f52f1176fc37d7c32221aa85f749aa34) +- Update `tape`, `jscs`, `nsp`, `eslint` [`db1f658`](https://github.com/es-shims/RegExp.prototype.flags/commit/db1f6584b18cc035ef3b5aec556f54e0ee8c639d) +- Test on `io.js` `v2.3` [`18c948f`](https://github.com/es-shims/RegExp.prototype.flags/commit/18c948f033c87ab2657a0395052cbec531c40900) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`c37e79f`](https://github.com/es-shims/RegExp.prototype.flags/commit/c37e79f380d87a226a6cdaa5f09f832f5dc21b7d) +- Update `tape`, `jscs`, `eslint` [`4b652bf`](https://github.com/es-shims/RegExp.prototype.flags/commit/4b652bf5f2f0e36a15227d0b4048de91ee6c4433) +- [Dev Deps] Update `tape`, `eslint` [`29d4ac0`](https://github.com/es-shims/RegExp.prototype.flags/commit/29d4ac0bea16c6a9f611cb15baccd30449f30a91) +- Test up to `io.js` `v2.1` [`9f9e342`](https://github.com/es-shims/RegExp.prototype.flags/commit/9f9e34295ced1b288dea08e0a66dffd2bc03ff8b) +- Update `covert`, `jscs` [`c98f3b4`](https://github.com/es-shims/RegExp.prototype.flags/commit/c98f3b47f01f317e8a589486dfaee482c66b8b64) +- Update `jscs` [`9e5e220`](https://github.com/es-shims/RegExp.prototype.flags/commit/9e5e220be6ec5d5b9b658235287e35bded580b06) +- [Dev Deps] update `tape` [`cdd3af2`](https://github.com/es-shims/RegExp.prototype.flags/commit/cdd3af21507b01aa524f8b87f158dfc8a8153c85) +- [Dev Deps] update `tape` [`d42d0bf`](https://github.com/es-shims/RegExp.prototype.flags/commit/d42d0bf28f8da2cb47fff49283a07a693f8cb626) +- Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`a5e7453`](https://github.com/es-shims/RegExp.prototype.flags/commit/a5e745375c01e9f90ff632c55a5b44b6ada38217) +- Update `tape` [`2a675ec`](https://github.com/es-shims/RegExp.prototype.flags/commit/2a675ec707a9d89aea403d0b9a723ea531e50c2d) +- Test on `io.js` `v2.5` [`448cbdb`](https://github.com/es-shims/RegExp.prototype.flags/commit/448cbdb7df47e52677daea4e0c41e892ad8770e4) +- Test on `io.js` `v2.4` [`948e511`](https://github.com/es-shims/RegExp.prototype.flags/commit/948e51129c01147ffe4dedc3a7d4980128d0cf73) +- Test on `io.js` `v2.2` [`4793278`](https://github.com/es-shims/RegExp.prototype.flags/commit/4793278f5aca187e36b42b08fc1388d8021400e2) +- Update `eslint` [`0f463da`](https://github.com/es-shims/RegExp.prototype.flags/commit/0f463daa14a193ed94b16c46832074d63e861c91) +- Update `eslint` [`5a16967`](https://github.com/es-shims/RegExp.prototype.flags/commit/5a16967db71bb8a24c81a27ee366f0b02b663e34) +- Test on `io.js` `v3.0` [`7ba8706`](https://github.com/es-shims/RegExp.prototype.flags/commit/7ba87064bc8520d34a9560bea8e366d70c93dbbb) +- Test on `iojs-v1.2` [`b521e09`](https://github.com/es-shims/RegExp.prototype.flags/commit/b521e099b7de48cfbdd6860265eb5e972d2859a5) + +## [v1.0.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.0.0...v1.0.1) - 2014-12-13 + +### Merged + +- Match the spec properly: throw when not an object; make getter generic. [`#3`](https://github.com/es-shims/RegExp.prototype.flags/pull/3) + +### Fixed + +- Match the spec properly [`#1`](https://github.com/es-shims/RegExp.prototype.flags/issues/1) + +### Commits + +- Speed up the “is object” check in case of `null` or `undefined` [`77137f9`](https://github.com/es-shims/RegExp.prototype.flags/commit/77137f99449c9b6583cdfda295a00b832dfd45f3) + +## v1.0.0 - 2014-12-10 + +### Commits + +- Adding dotfiles [`313812e`](https://github.com/es-shims/RegExp.prototype.flags/commit/313812e1d8ff42a13dbc8689f2e719324c46c9ca) +- Tests [`625a042`](https://github.com/es-shims/RegExp.prototype.flags/commit/625a042220a3152b49608fb6f187f67bff02b6fb) +- Add package.json [`8b98257`](https://github.com/es-shims/RegExp.prototype.flags/commit/8b98257f900d0a73c8eb3805b9b01999e05e880a) +- Adding the README [`884798b`](https://github.com/es-shims/RegExp.prototype.flags/commit/884798b710d5a85bc6d9a6879f509766e2e57c0e) +- Implementation. [`4186cc9`](https://github.com/es-shims/RegExp.prototype.flags/commit/4186cc9d9a7533f78d88be976f0a8a2757604fc5) +- Adding LICENSE and CHANGELOG [`f87fa81`](https://github.com/es-shims/RegExp.prototype.flags/commit/f87fa8126cc6c39747fbe0dc6cb40ca0ff77fbbc) +- Fixing README URLs [`b821703`](https://github.com/es-shims/RegExp.prototype.flags/commit/b821703d5e5b01ee4f526f15c8e525645cf95ef7) +- Clean up dependencies; update `tape`, `jscs`, `nsp` [`0e13fc1`](https://github.com/es-shims/RegExp.prototype.flags/commit/0e13fc12df09f3a7ac30116ef13bba820c220730) +- Initial commit. [`8a9e35e`](https://github.com/es-shims/RegExp.prototype.flags/commit/8a9e35e15f65c9640e64ee14fab190a60993efaa) diff --git a/node_modules/regexp.prototype.flags/LICENSE b/node_modules/regexp.prototype.flags/LICENSE new file mode 100644 index 0000000..e5956a8 --- /dev/null +++ b/node_modules/regexp.prototype.flags/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (C) 2014 Jordan Harband + +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/regexp.prototype.flags/README.md b/node_modules/regexp.prototype.flags/README.md new file mode 100644 index 0000000..77e151e --- /dev/null +++ b/node_modules/regexp.prototype.flags/README.md @@ -0,0 +1,54 @@ +RegExp.prototype.flags [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An ES6 spec-compliant `RegExp.prototype.flags` shim. Invoke its "shim" method to shim RegExp.prototype.flags if it is unavailable. +*Note*: `RegExp#flags` requires a true ES5 environment - specifically, one with ES5 getters. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-get-regexp.prototype.flags). + +Most common usage: +```js +var flags = require('regexp.prototype.flags'); + +assert(flags(/a/) === ''); +assert(flags(new RegExp('a') === ''); +assert(flags(/a/mig) === 'gim'); +assert(flags(new RegExp('a', 'mig')) === 'gim'); + +if (!RegExp.prototype.flags) { + flags.shim(); +} + +assert(flags(/a/) === /a/.flags); +assert(flags(new RegExp('a') === new RegExp('a').flags); +assert(flags(/a/mig) === /a/mig.flags); +assert(flags(new RegExp('a', 'mig')) === new RegExp('a', 'mig').flags); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/regexp.prototype.flags +[npm-version-svg]: http://versionbadg.es/es-shims/RegExp.prototype.flags.svg +[travis-svg]: https://travis-ci.org/es-shims/RegExp.prototype.flags.svg +[travis-url]: https://travis-ci.org/es-shims/RegExp.prototype.flags +[deps-svg]: https://david-dm.org/es-shims/RegExp.prototype.flags.svg +[deps-url]: https://david-dm.org/es-shims/RegExp.prototype.flags +[dev-deps-svg]: https://david-dm.org/es-shims/RegExp.prototype.flags/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/RegExp.prototype.flags#info=devDependencies +[testling-svg]: https://ci.testling.com/es-shims/RegExp.prototype.flags.png +[testling-url]: https://ci.testling.com/es-shims/RegExp.prototype.flags +[npm-badge-png]: https://nodei.co/npm/regexp.prototype.flags.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/regexp.prototype.flags.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/regexp.prototype.flags.svg +[downloads-url]: http://npm-stat.com/charts.html?package=regexp.prototype.flags diff --git a/node_modules/regexp.prototype.flags/auto.js b/node_modules/regexp.prototype.flags/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/regexp.prototype.flags/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/regexp.prototype.flags/implementation.js b/node_modules/regexp.prototype.flags/implementation.js new file mode 100644 index 0000000..9d2f0bc --- /dev/null +++ b/node_modules/regexp.prototype.flags/implementation.js @@ -0,0 +1,39 @@ +'use strict'; + +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); + +var $Object = Object; +var $TypeError = TypeError; + +module.exports = function flags() { + if (this != null && this !== $Object(this)) { + throw new $TypeError('RegExp.prototype.flags getter called on non-object'); + } + var result = ''; + if (this.hasIndices) { + result += 'd'; + } + if (this.global) { + result += 'g'; + } + if (this.ignoreCase) { + result += 'i'; + } + if (this.multiline) { + result += 'm'; + } + if (this.dotAll) { + result += 's'; + } + if (this.unicode) { + result += 'u'; + } + if (this.sticky) { + result += 'y'; + } + return result; +}; + +if (functionsHaveConfigurableNames && Object.defineProperty) { + Object.defineProperty(module.exports, 'name', { value: 'get flags' }); +} diff --git a/node_modules/regexp.prototype.flags/index.js b/node_modules/regexp.prototype.flags/index.js new file mode 100644 index 0000000..d6054c7 --- /dev/null +++ b/node_modules/regexp.prototype.flags/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var define = require('define-properties'); +var callBind = require('call-bind'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var flagsBound = callBind(getPolyfill()); + +define(flagsBound, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = flagsBound; diff --git a/node_modules/regexp.prototype.flags/package.json b/node_modules/regexp.prototype.flags/package.json new file mode 100644 index 0000000..cc8f120 --- /dev/null +++ b/node_modules/regexp.prototype.flags/package.json @@ -0,0 +1,92 @@ +{ + "name": "regexp.prototype.flags", + "version": "1.4.3", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES6 spec-compliant RegExp.prototype.flags shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "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://github.com/es-shims/RegExp.prototype.flags.git" + }, + "keywords": [ + "RegExp.prototype.flags", + "regex", + "regular expression", + "ES6", + "shim", + "flag", + "flags", + "regexp", + "RegExp#flags", + "polyfill", + "es-shim API" + ], + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, + "devDependencies": { + "@es-shims/api": "^2.2.3", + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "available-regexp-flags": "^1.0.0", + "covert": "^1.1.1", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "foreach": "^2.0.5", + "has": "^1.0.3", + "has-strict-mode": "^1.0.1", + "nyc": "^10.3.2", + "object-inspect": "^1.12.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/11.6..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/regexp.prototype.flags/polyfill.js b/node_modules/regexp.prototype.flags/polyfill.js new file mode 100644 index 0000000..2ea3dac --- /dev/null +++ b/node_modules/regexp.prototype.flags/polyfill.js @@ -0,0 +1,36 @@ +'use strict'; + +var implementation = require('./implementation'); + +var supportsDescriptors = require('define-properties').supportsDescriptors; +var $gOPD = Object.getOwnPropertyDescriptor; + +module.exports = function getPolyfill() { + if (supportsDescriptors && (/a/mig).flags === 'gim') { + var descriptor = $gOPD(RegExp.prototype, 'flags'); + if ( + descriptor + && typeof descriptor.get === 'function' + && typeof RegExp.prototype.dotAll === 'boolean' + && typeof RegExp.prototype.hasIndices === 'boolean' + ) { + /* eslint getter-return: 0 */ + var calls = ''; + var o = {}; + Object.defineProperty(o, 'hasIndices', { + get: function () { + calls += 'd'; + } + }); + Object.defineProperty(o, 'sticky', { + get: function () { + calls += 'y'; + } + }); + if (calls === 'dy') { + return descriptor.get; + } + } + } + return implementation; +}; diff --git a/node_modules/regexp.prototype.flags/shim.js b/node_modules/regexp.prototype.flags/shim.js new file mode 100644 index 0000000..3ec77c1 --- /dev/null +++ b/node_modules/regexp.prototype.flags/shim.js @@ -0,0 +1,26 @@ +'use strict'; + +var supportsDescriptors = require('define-properties').supportsDescriptors; +var getPolyfill = require('./polyfill'); +var gOPD = Object.getOwnPropertyDescriptor; +var defineProperty = Object.defineProperty; +var TypeErr = TypeError; +var getProto = Object.getPrototypeOf; +var regex = /a/; + +module.exports = function shimFlags() { + if (!supportsDescriptors || !getProto) { + throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors'); + } + var polyfill = getPolyfill(); + var proto = getProto(regex); + var descriptor = gOPD(proto, 'flags'); + if (!descriptor || descriptor.get !== polyfill) { + defineProperty(proto, 'flags', { + configurable: true, + enumerable: false, + get: polyfill + }); + } + return polyfill; +}; diff --git a/node_modules/regexp.prototype.flags/test/implementation.js b/node_modules/regexp.prototype.flags/test/implementation.js new file mode 100644 index 0000000..1e3a714 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var flags = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { flags.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { flags.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(flags), t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/index.js b/node_modules/regexp.prototype.flags/test/index.js new file mode 100644 index 0000000..10d1071 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var flags = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { flags(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { flags(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(flags, t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/shimmed.js b/node_modules/regexp.prototype.flags/test/shimmed.js new file mode 100644 index 0000000..059e0e1 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/shimmed.js @@ -0,0 +1,48 @@ +'use strict'; + +require('../auto'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); + +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); +var hasStrictMode = require('has-strict-mode')(); + +var runTests = require('./tests'); + +test('shimmed', function (t) { + var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags'); + + t.equal(descriptor.get.length, 0, 'RegExp#flags getter has a length of 0'); + + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(descriptor.get.name, functionsHaveConfigurableNames ? 'get flags' : 'flags', 'RegExp#flags getter has name "get flags" (or "flags" if function names are not configurable)'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(RegExp.prototype, 'flags'), 'RegExp#flags is not enumerable'); + et.end(); + }); + + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + st['throws'](function () { return descriptor.get.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return descriptor.get.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + t.test('has the correct descriptor', function (st) { + st.equal(descriptor.configurable, true); + st.equal(descriptor.enumerable, false); + st.equal(typeof descriptor.get, 'function'); + st.equal(descriptor.set, undefined); + st.end(); + }); + + runTests(callBind(descriptor.get), t); + + t.end(); +}); diff --git a/node_modules/regexp.prototype.flags/test/tests.js b/node_modules/regexp.prototype.flags/test/tests.js new file mode 100644 index 0000000..0421a99 --- /dev/null +++ b/node_modules/regexp.prototype.flags/test/tests.js @@ -0,0 +1,141 @@ +'use strict'; + +var has = require('has'); +var inspect = require('object-inspect'); +var supportsDescriptors = require('define-properties').supportsDescriptors; + +var forEach = require('foreach'); +var availableFlags = require('available-regexp-flags'); +var regexProperties = require('available-regexp-flags/properties'); + +var sortedFlags = availableFlags.slice().sort(function (a, b) { return a.localeCompare(b); }).join(''); + +var getRegexLiteral = function (stringRegex) { + try { + // eslint-disable-next-line no-new-func + return Function('return ' + stringRegex + ';')(); + } catch (e) { /**/ } + return null; +}; + +module.exports = function runTests(flags, t) { + t.equal(flags(/a/g), 'g', 'flags(/a/g) !== "g"'); + t.equal(flags(/a/gmi), 'gim', 'flags(/a/gmi) !== "gim"'); + t.equal(flags(new RegExp('a', 'gmi')), 'gim', 'flags(new RegExp("a", "gmi")) !== "gim"'); + t.equal(flags(/a/), '', 'flags(/a/) !== ""'); + t.equal(flags(new RegExp('a')), '', 'flags(new RegExp("a")) !== ""'); + + forEach(availableFlags, function (flag) { + var property = regexProperties[flag]; + t.test(property + ' flag', function (st) { + st.equal(flags(getRegexLiteral('/a/' + flag)), flag, 'flags(/a/' + flag + ') !== ' + inspect(flag)); + st.equal(flags(new RegExp('a', flag)), flag, 'flags(new RegExp("a", ' + inspect(flag) + ')) !== ' + inspect(flag)); + st.end(); + }); + }); + + t.test('sorting', function (st) { + st.equal(flags(/a/gim), 'gim', 'flags(/a/gim) !== "gim"'); + st.equal(flags(/a/mig), 'gim', 'flags(/a/mig) !== "gim"'); + st.equal(flags(/a/mgi), 'gim', 'flags(/a/mgi) !== "gim"'); + if (has(RegExp.prototype, 'sticky')) { + st.equal(flags(getRegexLiteral('/a/gyim')), 'gimy', 'flags(/a/gyim) !== "gimy"'); + } + if (has(RegExp.prototype, 'unicode')) { + st.equal(flags(getRegexLiteral('/a/ugmi')), 'gimu', 'flags(/a/ugmi) !== "gimu"'); + } + if (has(RegExp.prototype, 'dotAll')) { + st.equal(flags(getRegexLiteral('/a/sgmi')), 'gims', 'flags(/a/sgmi) !== "gims"'); + } + + var randomFlags = availableFlags.slice().sort(function () { return Math.random() > 0.5 ? 1 : -1; }).join(''); + st.equal( + flags(getRegexLiteral('/a/' + randomFlags)), + sortedFlags, + 'random: flags(/a/' + randomFlags + ') === ' + inspect(sortedFlags) + ); + + st.end(); + }); + + t.test('basic examples', function (st) { + st.equal(flags(/a/g), 'g', '(/a/g).flags !== "g"'); + st.equal(flags(/a/gmi), 'gim', '(/a/gmi).flags !== "gim"'); + st.equal(flags(new RegExp('a', 'gmi')), 'gim', 'new RegExp("a", "gmi").flags !== "gim"'); + st.equal(flags(/a/), '', '(/a/).flags !== ""'); + st.equal(flags(new RegExp('a')), '', 'new RegExp("a").flags !== ""'); + + st.end(); + }); + + t.test('generic flags', function (st) { + st.equal(flags({}), ''); + st.equal(flags({ ignoreCase: true }), 'i'); + st.equal(flags({ dotAll: 1, global: 0, sticky: 1, unicode: 1 }), 'suy'); + st.equal(flags({ __proto__: { multiline: true } }), 'm'); + + var obj = {}; + forEach(availableFlags, function (flag) { + obj[regexProperties[flag]] = true; + }); + st.equal(flags(obj), sortedFlags, 'an object with every available flag: ' + sortedFlags); + + st.end(); + }); + + t.test('throws properly', function (st) { + var nonObjects = ['', false, true, 42, NaN, null, undefined]; + st.plan(nonObjects.length); + var throwsOnNonObject = function (nonObject) { + st['throws'](flags.bind(null, nonObject), TypeError, inspect(nonObject) + ' is not an Object'); + }; + nonObjects.forEach(throwsOnNonObject); + }); + + t.test('getters', { skip: !supportsDescriptors }, function (st) { + /* eslint getter-return: 0 */ + var calls = ''; + var re = {}; + Object.defineProperty(re, 'hasIndices', { + get: function () { + calls += 'd'; + } + }); + Object.defineProperty(re, 'global', { + get: function () { + calls += 'g'; + } + }); + Object.defineProperty(re, 'ignoreCase', { + get: function () { + calls += 'i'; + } + }); + Object.defineProperty(re, 'multiline', { + get: function () { + calls += 'm'; + } + }); + Object.defineProperty(re, 'dotAll', { + get: function () { + calls += 's'; + } + }); + Object.defineProperty(re, 'unicode', { + get: function () { + calls += 'u'; + } + }); + Object.defineProperty(re, 'sticky', { + get: function () { + calls += 'y'; + } + }); + + flags(re); + + st.equal(calls, 'dgimsuy', 'getters are called in expected order'); + + st.end(); + }); +}; diff --git a/node_modules/regexpp/LICENSE b/node_modules/regexpp/LICENSE new file mode 100644 index 0000000..883ee1f --- /dev/null +++ b/node_modules/regexpp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Toru Nagashima + +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/regexpp/README.md b/node_modules/regexpp/README.md new file mode 100644 index 0000000..a5e2e14 --- /dev/null +++ b/node_modules/regexpp/README.md @@ -0,0 +1,178 @@ +# regexpp + +[![npm version](https://img.shields.io/npm/v/regexpp.svg)](https://www.npmjs.com/package/regexpp) +[![Downloads/month](https://img.shields.io/npm/dm/regexpp.svg)](http://www.npmtrends.com/regexpp) +[![Build Status](https://github.com/mysticatea/regexpp/workflows/CI/badge.svg)](https://github.com/mysticatea/regexpp/actions) +[![codecov](https://codecov.io/gh/mysticatea/regexpp/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/regexpp) +[![Dependency Status](https://david-dm.org/mysticatea/regexpp.svg)](https://david-dm.org/mysticatea/regexpp) + +A regular expression parser for ECMAScript. + +## 💿 Installation + +```bash +$ npm install regexpp +``` + +- require Node.js 8 or newer. + +## 📖 Usage + +```ts +import { + AST, + RegExpParser, + RegExpValidator, + RegExpVisitor, + parseRegExpLiteral, + validateRegExpLiteral, + visitRegExpAST +} from "regexpp" +``` + +### parseRegExpLiteral(source, options?) + +Parse a given regular expression literal then make AST object. + +This is equivalent to `new RegExpParser(options).parseLiteral(source)`. + +- **Parameters:** + - `source` (`string | RegExp`) The source code to parse. + - `options?` ([`RegExpParser.Options`]) The options to parse. +- **Return:** + - The AST of the regular expression. + +### validateRegExpLiteral(source, options?) + +Validate a given regular expression literal. + +This is equivalent to `new RegExpValidator(options).validateLiteral(source)`. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `options?` ([`RegExpValidator.Options`]) The options to validate. + +### visitRegExpAST(ast, handlers) + +Visit each node of a given AST. + +This is equivalent to `new RegExpVisitor(handlers).visit(ast)`. + +- **Parameters:** + - `ast` ([`AST.Node`]) The AST to visit. + - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks. + +### RegExpParser + +#### new RegExpParser(options?) + +- **Parameters:** + - `options?` ([`RegExpParser.Options`]) The options to parse. + +#### parser.parseLiteral(source, start?, end?) + +Parse a regular expression literal. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"/abc/g"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. +- **Return:** + - The AST of the regular expression. + +#### parser.parsePattern(source, start?, end?, uFlag?) + +Parse a regular expression pattern. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"abc"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + - `uFlag?` (`boolean`) The flag to enable Unicode mode. +- **Return:** + - The AST of the regular expression pattern. + +#### parser.parseFlags(source, start?, end?) + +Parse a regular expression flags. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"gim"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. +- **Return:** + - The AST of the regular expression flags. + +### RegExpValidator + +#### new RegExpValidator(options) + +- **Parameters:** + - `options` ([`RegExpValidator.Options`]) The options to validate. + +#### validator.validateLiteral(source, start, end) + +Validate a regular expression literal. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + +#### validator.validatePattern(source, start, end, uFlag) + +Validate a regular expression pattern. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + - `uFlag?` (`boolean`) The flag to enable Unicode mode. + +#### validator.validateFlags(source, start, end) + +Validate a regular expression flags. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + +### RegExpVisitor + +#### new RegExpVisitor(handlers) + +- **Parameters:** + - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks. + +#### visitor.visit(ast) + +Validate a regular expression literal. + +- **Parameters:** + - `ast` ([`AST.Node`]) The AST to visit. + +## 📰 Changelog + +- [GitHub Releases](https://github.com/mysticatea/regexpp/releases) + +## 🍻 Contributing + +Welcome contributing! + +Please use GitHub's Issues/PRs. + +### Development Tools + +- `npm test` runs tests and measures coverage. +- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`. +- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`. +- `npm run lint` runs ESLint. +- `npm run update:test` updates test fixtures. +- `npm run update:ids` updates `src/unicode/ids.ts`. +- `npm run watch` runs tests with `--watch` option. + +[`AST.Node`]: src/ast.ts#L4 +[`RegExpParser.Options`]: src/parser.ts#L539 +[`RegExpValidator.Options`]: src/validator.ts#L127 +[`RegExpVisitor.Handlers`]: src/visitor.ts#L204 diff --git a/node_modules/regexpp/index.d.ts b/node_modules/regexpp/index.d.ts new file mode 100644 index 0000000..ae359cf --- /dev/null +++ b/node_modules/regexpp/index.d.ts @@ -0,0 +1,248 @@ +// Generated by dts-bundle v0.7.3 + +declare module 'regexpp' { + import * as AST from "regexpp/ast"; + import { RegExpParser } from "regexpp/parser"; + import { RegExpValidator } from "regexpp/validator"; + import { RegExpVisitor } from "regexpp/visitor"; + export { AST, RegExpParser, RegExpValidator }; + export function parseRegExpLiteral(source: string | RegExp, options?: RegExpParser.Options): AST.RegExpLiteral; + export function validateRegExpLiteral(source: string, options?: RegExpValidator.Options): void; + export function visitRegExpAST(node: AST.Node, handlers: RegExpVisitor.Handlers): void; +} + +declare module 'regexpp/ast' { + export type Node = BranchNode | LeafNode; + export type BranchNode = RegExpLiteral | Pattern | Alternative | Group | CapturingGroup | Quantifier | CharacterClass | LookaroundAssertion | CharacterClassRange; + export type LeafNode = BoundaryAssertion | CharacterSet | Character | Backreference | Flags; + export type Element = Assertion | Quantifier | QuantifiableElement; + export type QuantifiableElement = Group | CapturingGroup | CharacterClass | CharacterSet | Character | Backreference | LookaheadAssertion; + export type CharacterClassElement = EscapeCharacterSet | UnicodePropertyCharacterSet | Character | CharacterClassRange; + export interface NodeBase { + type: Node["type"]; + parent: Node["parent"]; + start: number; + end: number; + raw: string; + } + export interface RegExpLiteral extends NodeBase { + type: "RegExpLiteral"; + parent: null; + pattern: Pattern; + flags: Flags; + } + export interface Pattern extends NodeBase { + type: "Pattern"; + parent: RegExpLiteral | null; + alternatives: Alternative[]; + } + export interface Alternative extends NodeBase { + type: "Alternative"; + parent: Pattern | Group | CapturingGroup | LookaroundAssertion; + elements: Element[]; + } + export interface Group extends NodeBase { + type: "Group"; + parent: Alternative | Quantifier; + alternatives: Alternative[]; + } + export interface CapturingGroup extends NodeBase { + type: "CapturingGroup"; + parent: Alternative | Quantifier; + name: string | null; + alternatives: Alternative[]; + references: Backreference[]; + } + export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion; + export interface LookaheadAssertion extends NodeBase { + type: "Assertion"; + parent: Alternative | Quantifier; + kind: "lookahead"; + negate: boolean; + alternatives: Alternative[]; + } + export interface LookbehindAssertion extends NodeBase { + type: "Assertion"; + parent: Alternative; + kind: "lookbehind"; + negate: boolean; + alternatives: Alternative[]; + } + export interface Quantifier extends NodeBase { + type: "Quantifier"; + parent: Alternative; + min: number; + max: number; + greedy: boolean; + element: QuantifiableElement; + } + export interface CharacterClass extends NodeBase { + type: "CharacterClass"; + parent: Alternative | Quantifier; + negate: boolean; + elements: CharacterClassElement[]; + } + export interface CharacterClassRange extends NodeBase { + type: "CharacterClassRange"; + parent: CharacterClass; + min: Character; + max: Character; + } + export type Assertion = BoundaryAssertion | LookaroundAssertion; + export type BoundaryAssertion = EdgeAssertion | WordBoundaryAssertion; + export interface EdgeAssertion extends NodeBase { + type: "Assertion"; + parent: Alternative | Quantifier; + kind: "start" | "end"; + } + export interface WordBoundaryAssertion extends NodeBase { + type: "Assertion"; + parent: Alternative | Quantifier; + kind: "word"; + negate: boolean; + } + export type CharacterSet = AnyCharacterSet | EscapeCharacterSet | UnicodePropertyCharacterSet; + export interface AnyCharacterSet extends NodeBase { + type: "CharacterSet"; + parent: Alternative | Quantifier; + kind: "any"; + } + export interface EscapeCharacterSet extends NodeBase { + type: "CharacterSet"; + parent: Alternative | Quantifier | CharacterClass; + kind: "digit" | "space" | "word"; + negate: boolean; + } + export interface UnicodePropertyCharacterSet extends NodeBase { + type: "CharacterSet"; + parent: Alternative | Quantifier | CharacterClass; + kind: "property"; + key: string; + value: string | null; + negate: boolean; + } + export interface Character extends NodeBase { + type: "Character"; + parent: Alternative | Quantifier | CharacterClass | CharacterClassRange; + value: number; + } + export interface Backreference extends NodeBase { + type: "Backreference"; + parent: Alternative | Quantifier; + ref: number | string; + resolved: CapturingGroup; + } + export interface Flags extends NodeBase { + type: "Flags"; + parent: RegExpLiteral | null; + dotAll: boolean; + global: boolean; + hasIndices: boolean; + ignoreCase: boolean; + multiline: boolean; + sticky: boolean; + unicode: boolean; + } +} + +declare module 'regexpp/parser' { + import { Flags, RegExpLiteral, Pattern } from "regexpp/ast"; + import { EcmaVersion } from "regexpp/ecma-versions"; + export namespace RegExpParser { + interface Options { + strict?: boolean; + ecmaVersion?: EcmaVersion; + } + } + export class RegExpParser { + constructor(options?: RegExpParser.Options); + parseLiteral(source: string, start?: number, end?: number): RegExpLiteral; + parseFlags(source: string, start?: number, end?: number): Flags; + parsePattern(source: string, start?: number, end?: number, uFlag?: boolean): Pattern; + } +} + +declare module 'regexpp/validator' { + import { EcmaVersion } from "regexpp/ecma-versions"; + export namespace RegExpValidator { + interface Options { + strict?: boolean; + ecmaVersion?: EcmaVersion; + onLiteralEnter?(start: number): void; + onLiteralLeave?(start: number, end: number): void; + onFlags?(start: number, end: number, global: boolean, ignoreCase: boolean, multiline: boolean, unicode: boolean, sticky: boolean, dotAll: boolean, hasIndices: boolean): void; + onPatternEnter?(start: number): void; + onPatternLeave?(start: number, end: number): void; + onDisjunctionEnter?(start: number): void; + onDisjunctionLeave?(start: number, end: number): void; + onAlternativeEnter?(start: number, index: number): void; + onAlternativeLeave?(start: number, end: number, index: number): void; + onGroupEnter?(start: number): void; + onGroupLeave?(start: number, end: number): void; + onCapturingGroupEnter?(start: number, name: string | null): void; + onCapturingGroupLeave?(start: number, end: number, name: string | null): void; + onQuantifier?(start: number, end: number, min: number, max: number, greedy: boolean): void; + onLookaroundAssertionEnter?(start: number, kind: "lookahead" | "lookbehind", negate: boolean): void; + onLookaroundAssertionLeave?(start: number, end: number, kind: "lookahead" | "lookbehind", negate: boolean): void; + onEdgeAssertion?(start: number, end: number, kind: "start" | "end"): void; + onWordBoundaryAssertion?(start: number, end: number, kind: "word", negate: boolean): void; + onAnyCharacterSet?(start: number, end: number, kind: "any"): void; + onEscapeCharacterSet?(start: number, end: number, kind: "digit" | "space" | "word", negate: boolean): void; + onUnicodePropertyCharacterSet?(start: number, end: number, kind: "property", key: string, value: string | null, negate: boolean): void; + onCharacter?(start: number, end: number, value: number): void; + onBackreference?(start: number, end: number, ref: number | string): void; + onCharacterClassEnter?(start: number, negate: boolean): void; + onCharacterClassLeave?(start: number, end: number, negate: boolean): void; + onCharacterClassRange?(start: number, end: number, min: number, max: number): void; + } + } + export class RegExpValidator { + constructor(options?: RegExpValidator.Options); + validateLiteral(source: string, start?: number, end?: number): void; + validateFlags(source: string, start?: number, end?: number): void; + validatePattern(source: string, start?: number, end?: number, uFlag?: boolean): void; + } +} + +declare module 'regexpp/visitor' { + import { Alternative, Assertion, Backreference, CapturingGroup, Character, CharacterClass, CharacterClassRange, CharacterSet, Flags, Group, Node, Pattern, Quantifier, RegExpLiteral } from "regexpp/ast"; + export class RegExpVisitor { + constructor(handlers: RegExpVisitor.Handlers); + visit(node: Node): void; + } + export namespace RegExpVisitor { + interface Handlers { + onAlternativeEnter?(node: Alternative): void; + onAlternativeLeave?(node: Alternative): void; + onAssertionEnter?(node: Assertion): void; + onAssertionLeave?(node: Assertion): void; + onBackreferenceEnter?(node: Backreference): void; + onBackreferenceLeave?(node: Backreference): void; + onCapturingGroupEnter?(node: CapturingGroup): void; + onCapturingGroupLeave?(node: CapturingGroup): void; + onCharacterEnter?(node: Character): void; + onCharacterLeave?(node: Character): void; + onCharacterClassEnter?(node: CharacterClass): void; + onCharacterClassLeave?(node: CharacterClass): void; + onCharacterClassRangeEnter?(node: CharacterClassRange): void; + onCharacterClassRangeLeave?(node: CharacterClassRange): void; + onCharacterSetEnter?(node: CharacterSet): void; + onCharacterSetLeave?(node: CharacterSet): void; + onFlagsEnter?(node: Flags): void; + onFlagsLeave?(node: Flags): void; + onGroupEnter?(node: Group): void; + onGroupLeave?(node: Group): void; + onPatternEnter?(node: Pattern): void; + onPatternLeave?(node: Pattern): void; + onQuantifierEnter?(node: Quantifier): void; + onQuantifierLeave?(node: Quantifier): void; + onRegExpLiteralEnter?(node: RegExpLiteral): void; + onRegExpLiteralLeave?(node: RegExpLiteral): void; + } + } +} + +declare module 'regexpp/ecma-versions' { + export type EcmaVersion = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022; +} + diff --git a/node_modules/regexpp/index.js b/node_modules/regexpp/index.js new file mode 100644 index 0000000..cd0e165 --- /dev/null +++ b/node_modules/regexpp/index.js @@ -0,0 +1,2096 @@ +/*! @author Toru Nagashima */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + + + +var ast = /*#__PURE__*/Object.freeze({ + +}); + +let largeIdStartRanges = undefined; +let largeIdContinueRanges = undefined; +function isIdStart(cp) { + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp); +} +function isIdContinue(cp) { + if (cp < 0x30) + return false; + if (cp < 0x3a) + return true; + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp === 0x5f) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp) || isLargeIdContinue(cp); +} +function isLargeIdStart(cp) { + return isInRange(cp, largeIdStartRanges || (largeIdStartRanges = initLargeIdStartRanges())); +} +function isLargeIdContinue(cp) { + return isInRange(cp, largeIdContinueRanges || + (largeIdContinueRanges = initLargeIdContinueRanges())); +} +function initLargeIdStartRanges() { + return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0 7 14 20 q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 1i k 2 h 1p 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 6 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 x 0 2 1 g 1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 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f 4d 8m a l b 7 49 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 1z 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 9p 15 7 1 27 s b 0 9 l 2z k s m d 1g 24 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o 2d 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 4f 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 6e 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 z 1k 7c 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 94 i 5a 0 28 pl 2v 32 i 5f 24d tq 34i g6 6nu fs 8 u 36 t j 1b h 3 w k 6 i j5 1r 3l 22 6 0 1v c 1t 1 2 0 t 4qf 9 yd 17 8 6wo 7y 1e 2 i 3 9 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9f 3 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1th 18 b 6 h 0 aa 17 105 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyl z 378 c 65 3 4g1 f 5rk 2e8 f1 15v 3t6"); +} +function initLargeIdContinueR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 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 4h b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 5d h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 2c e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f ba 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 96 3 ewa 9 3r 4 1o 6 q 9 s6 0 2 1i 8 3 2a 0 c 1 f58 1 43r 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 7a 6 a 9 bn d 15j 6 32 6 6 9 3o7 9 gvt3 6n"); +} +function isInRange(cp, ranges) { + let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0; + while (l < r) { + i = ((l + r) / 2) | 0; + min = ranges[2 * i]; + max = ranges[2 * i + 1]; + if (cp < min) { + r = i; + } + else if (cp > max) { + l = i + 1; + } + else { + return true; + } + } + return false; +} +function restoreRanges(data) { + let last = 0; + return data.split(" ").map(s => (last += parseInt(s, 36) | 0)); +} + +class DataSet { + constructor(raw2018, raw2019, raw2020, raw2021) { + this._raw2018 = raw2018; + this._raw2019 = raw2019; + this._raw2020 = raw2020; + this._raw2021 = raw2021; + } + get es2018() { + return (this._set2018 || (this._set2018 = new Set(this._raw2018.split(" ")))); + } + get es2019() { + return (this._set2019 || (this._set2019 = new Set(this._raw2019.split(" ")))); + } + get es2020() { + return (this._set2020 || (this._set2020 = new Set(this._raw2020.split(" ")))); + } + get es2021() { + return (this._set2021 || (this._set2021 = new Set(this._raw2021.split(" ")))); + } +} +const gcNameSet = new Set(["General_Category", "gc"]); +const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]); +const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", ""); +const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"); +const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict"); +function isValidUnicodeProperty(version, name, value) { + if (gcNameSet.has(name)) { + return version >= 2018 && gcValueSets.es2018.has(value); + } + if (scNameSet.has(name)) { + return ((version >= 2018 && scValueSets.es2018.has(value)) || + (version >= 2019 && scValueSets.es2019.has(value)) || + (version >= 2020 && scValueSets.es2020.has(value)) || + (version >= 2021 && scValueSets.es2021.has(value))); + } + return false; +} +function isValidLoneUnicodeProperty(version, value) { + return ((version >= 2018 && binPropertySets.es2018.has(value)) || + (version >= 2019 && binPropertySets.es2019.has(value)) || + (version >= 2021 && binPropertySets.es2021.has(value))); +} + +const Backspace = 0x08; +const CharacterTabulation = 0x09; +const LineFeed = 0x0a; +const LineTabulation = 0x0b; +const FormFeed = 0x0c; +const CarriageReturn = 0x0d; +const ExclamationMark = 0x21; +const DollarSign = 0x24; +const LeftParenthesis = 0x28; +const RightParenthesis = 0x29; +const Asterisk = 0x2a; +const PlusSign = 0x2b; +const Comma = 0x2c; +const HyphenMinus = 0x2d; +const FullStop = 0x2e; +const Solidus = 0x2f; +const DigitZero = 0x30; +const DigitOne = 0x31; +const DigitSeven = 0x37; +const DigitNine = 0x39; +const Colon = 0x3a; +const LessThanSign = 0x3c; +const EqualsSign = 0x3d; +const GreaterThanSign = 0x3e; +const QuestionMark = 0x3f; +const LatinCapitalLetterA = 0x41; +const LatinCapitalLetterB = 0x42; +const LatinCapitalLetterD = 0x44; +const LatinCapitalLetterF = 0x46; +const LatinCapitalLetterP = 0x50; +const LatinCapitalLetterS = 0x53; +const LatinCapitalLetterW = 0x57; +const LatinCapitalLetterZ = 0x5a; +const LowLine = 0x5f; +const LatinSmallLetterA = 0x61; +const LatinSmallLetterB = 0x62; +const LatinSmallLetterC = 0x63; +const LatinSmallLetterD = 0x64; +const LatinSmallLetterF = 0x66; +const LatinSmallLetterG = 0x67; +const LatinSmallLetterI = 0x69; +const LatinSmallLetterK = 0x6b; +const LatinSmallLetterM = 0x6d; +const LatinSmallLetterN = 0x6e; +const LatinSmallLetterP = 0x70; +const LatinSmallLetterR = 0x72; +const LatinSmallLetterS = 0x73; +const LatinSmallLetterT = 0x74; +const LatinSmallLetterU = 0x75; +const LatinSmallLetterV = 0x76; +const LatinSmallLetterW = 0x77; +const LatinSmallLetterX = 0x78; +const LatinSmallLetterY = 0x79; +const LatinSmallLetterZ = 0x7a; +const LeftSquareBracket = 0x5b; +const ReverseSolidus = 0x5c; +const RightSquareBracket = 0x5d; +const CircumflexAccent = 0x5e; +const LeftCurlyBracket = 0x7b; +const VerticalLine = 0x7c; +const RightCurlyBracket = 0x7d; +const ZeroWidthNonJoiner = 0x200c; +const ZeroWidthJoiner = 0x200d; +const LineSeparator = 0x2028; +const ParagraphSeparator = 0x2029; +const MinCodePoint = 0x00; +const MaxCodePoint = 0x10ffff; +function isLatinLetter(code) { + return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) || + (code >= LatinSmallLetterA && code <= LatinSmallLetterZ)); +} +function isDecimalDigit(code) { + return code >= DigitZero && code <= DigitNine; +} +function isOctalDigit(code) { + return code >= DigitZero && code <= DigitSeven; +} +function isHexDigit(code) { + return ((code >= DigitZero && code <= DigitNine) || + (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) || + (code >= LatinSmallLetterA && code <= LatinSmallLetterF)); +} +function isLineTerminator(code) { + return (code === LineFeed || + code === CarriageReturn || + code === LineSeparator || + code === ParagraphSeparator); +} +function isValidUnicode(code) { + return code >= MinCodePoint && code <= MaxCodePoint; +} +function digitToInt(code) { + if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) { + return code - LatinSmallLetterA + 10; + } + if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) { + return code - LatinCapitalLetterA + 10; + } + return code - DigitZero; +} +function isLeadSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} +function isTrailSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +function combineSurrogatePair(lead, trail) { + return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; +} + +const legacyImpl = { + at(s, end, i) { + return i < end ? s.charCodeAt(i) : -1; + }, + width(c) { + return 1; + }, +}; +const unicodeImpl = { + at(s, end, i) { + return i < end ? s.codePointAt(i) : -1; + }, + width(c) { + return c > 0xffff ? 2 : 1; + }, +}; +class Reader { + constructor() { + this._impl = legacyImpl; + this._s = ""; + this._i = 0; + this._end = 0; + this._cp1 = -1; + this._w1 = 1; + this._cp2 = -1; + this._w2 = 1; + this._cp3 = -1; + this._w3 = 1; + this._cp4 = -1; + } + get source() { + return this._s; + } + get index() { + return this._i; + } + get currentCodePoint() { + return this._cp1; + } + get nextCodePoint() { + return this._cp2; + } + get nextCodePoint2() { + return this._cp3; + } + get nextCodePoint3() { + return this._cp4; + } + reset(source, start, end, uFlag) { + this._impl = uFlag ? unicodeImpl : legacyImpl; + this._s = source; + this._end = end; + this.rewind(start); + } + rewind(index) { + const impl = this._impl; + this._i = index; + this._cp1 = impl.at(this._s, this._end, index); + this._w1 = impl.width(this._cp1); + this._cp2 = impl.at(this._s, this._end, index + this._w1); + this._w2 = impl.width(this._cp2); + this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2); + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3); + } + advance() { + if (this._cp1 !== -1) { + const impl = this._impl; + this._i += this._w1; + this._cp1 = this._cp2; + this._w1 = this._w2; + this._cp2 = this._cp3; + this._w2 = impl.width(this._cp2); + this._cp3 = this._cp4; + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3); + } + } + eat(cp) { + if (this._cp1 === cp) { + this.advance(); + return true; + } + return false; + } + eat2(cp1, cp2) { + if (this._cp1 === cp1 && this._cp2 === cp2) { + this.advance(); + this.advance(); + return true; + } + return false; + } + eat3(cp1, cp2, cp3) { + if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) { + this.advance(); + this.advance(); + this.advance(); + return true; + } + return false; + } +} + +class RegExpSyntaxError extends SyntaxError { + constructor(source, uFlag, index, message) { + if (source) { + if (!source.startsWith("/")) { + source = `/${source}/${uFlag ? "u" : ""}`; + } + source = `: ${source}`; + } + super(`Invalid regular expression${source}: ${message}`); + this.index = index; + } +} + +function isSyntaxCharacter(cp) { + return (cp === CircumflexAccent || + cp === DollarSign || + cp === ReverseSolidus || + cp === FullStop || + cp === Asterisk || + cp === PlusSign || + cp === QuestionMark || + cp === LeftParenthesis || + cp === RightParenthesis || + cp === LeftSquareBracket || + cp === RightSquareBracket || + cp === LeftCurlyBracket || + cp === RightCurlyBracket || + cp === VerticalLine); +} +function isRegExpIdentifierStart(cp) { + return isIdStart(cp) || cp === DollarSign || cp === LowLine; +} +function isRegExpIdentifierPart(cp) { + return (isIdContinue(cp) || + cp === DollarSign || + cp === LowLine || + cp === ZeroWidthNonJoiner || + cp === ZeroWidthJoiner); +} +function isUnicodePropertyNameCharacter(cp) { + return isLatinLetter(cp) || cp === LowLine; +} +function isUnicodePropertyValueCharacter(cp) { + return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); +} +class RegExpValidator { + constructor(options) { + this._reader = new Reader(); + this._uFlag = false; + this._nFlag = false; + this._lastIntValue = 0; + this._lastMinValue = 0; + this._lastMaxValue = 0; + this._lastStrValue = ""; + this._lastKeyValue = ""; + this._lastValValue = ""; + this._lastAssertionIsQuantifiable = false; + this._numCapturingParens = 0; + this._groupNames = new Set(); + this._backreferenceNames = new Set(); + this._options = options || {}; + } + validateLiteral(source, start = 0, end = source.length) { + this._uFlag = this._nFlag = false; + this.reset(source, start, end); + this.onLiteralEnter(start); + if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) { + const flagStart = this.index; + const uFlag = source.includes("u", flagStart); + this.validateFlags(source, flagStart, end); + this.validatePattern(source, start + 1, flagStart - 1, uFlag); + } + else if (start >= end) { + this.raise("Empty"); + } + else { + const c = String.fromCodePoint(this.currentCodePoint); + this.raise(`Unexpected character '${c}'`); + } + this.onLiteralLeave(start, end); + } + validateFlags(source, start = 0, end = source.length) { + const existingFlags = new Set(); + let global = false; + let ignoreCase = false; + let multiline = false; + let sticky = false; + let unicode = false; + let dotAll = false; + let hasIndices = false; + for (let i = start; i < end; ++i) { + const flag = source.charCodeAt(i); + if (existingFlags.has(flag)) { + this.raise(`Duplicated flag '${source[i]}'`); + } + existingFlags.add(flag); + if (flag === LatinSmallLetterG) { + global = true; + } + else if (flag === LatinSmallLetterI) { + ignoreCase = true; + } + else if (flag === LatinSmallLetterM) { + multiline = true; + } + else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) { + unicode = true; + } + else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) { + sticky = true; + } + else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) { + dotAll = true; + } + else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) { + hasIndices = true; + } + else { + this.raise(`Invalid flag '${source[i]}'`); + } + } + this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices); + } + validatePattern(source, start = 0, end = source.length, uFlag = false) { + this._uFlag = uFlag && this.ecmaVersion >= 2015; + this._nFlag = uFlag && this.ecmaVersion >= 2018; + this.reset(source, start, end); + this.consumePattern(); + if (!this._nFlag && + this.ecmaVersion >= 2018 && + this._groupNames.size > 0) { + this._nFlag = true; + this.rewind(start); + this.consumePattern(); + } + } + get strict() { + return Boolean(this._options.strict || this._uFlag); + } + get ecmaVersion() { + return this._options.ecmaVersion || 2022; + } + onLiteralEnter(start) { + if (this._options.onLiteralEnter) { + this._options.onLiteralEnter(start); + } + } + onLiteralLeave(start, end) { + if (this._options.onLiteralLeave) { + this._options.onLiteralLeave(start, end); + } + } + onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) { + if (this._options.onFlags) { + this._options.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices); + } + } + onPatternEnter(start) { + if (this._options.onPatternEnter) { + this._options.onPatternEnter(start); + } + } + onPatternLeave(start, end) { + if (this._options.onPatternLeave) { + this._options.onPatternLeave(start, end); + } + } + onDisjunctionEnter(start) { + if (this._options.onDisjunctionEnter) { + this._options.onDisjunctionEnter(start); + } + } + onDisjunctionLeave(start, end) { + if (this._options.onDisjunctionLeave) { + this._options.onDisjunctionLeave(start, end); + } + } + onAlternativeEnter(start, index) { + if (this._options.onAlternativeEnter) { + this._options.onAlternativeEnter(start, index); + } + } + onAlternativeLeave(start, end, index) { + if (this._options.onAlternativeLeave) { + this._options.onAlternativeLeave(start, end, index); + } + } + onGroupEnter(start) { + if (this._options.onGroupEnter) { + this._options.onGroupEnter(start); + } + } + onGroupLeave(start, end) { + if (this._options.onGroupLeave) { + this._options.onGroupLeave(start, end); + } + } + onCapturingGroupEnter(start, name) { + if (this._options.onCapturingGroupEnter) { + this._options.onCapturingGroupEnter(start, name); + } + } + onCapturingGroupLeave(start, end, name) { + if (this._options.onCapturingGroupLeave) { + this._options.onCapturingGroupLeave(start, end, name); + } + } + onQuantifier(start, end, min, max, greedy) { + if (this._options.onQuantifier) { + this._options.onQuantifier(start, end, min, max, greedy); + } + } + onLookaroundAssertionEnter(start, kind, negate) { + if (this._options.onLookaroundAssertionEnter) { + this._options.onLookaroundAssertionEnter(start, kind, negate); + } + } + onLookaroundAssertionLeave(start, end, kind, negate) { + if (this._options.onLookaroundAssertionLeave) { + this._options.onLookaroundAssertionLeave(start, end, kind, negate); + } + } + onEdgeAssertion(start, end, kind) { + if (this._options.onEdgeAssertion) { + this._options.onEdgeAssertion(start, end, kind); + } + } + onWordBoundaryAssertion(start, end, kind, negate) { + if (this._options.onWordBoundaryAssertion) { + this._options.onWordBoundaryAssertion(start, end, kind, negate); + } + } + onAnyCharacterSet(start, end, kind) { + if (this._options.onAnyCharacterSet) { + this._options.onAnyCharacterSet(start, end, kind); + } + } + onEscapeCharacterSet(start, end, kind, negate) { + if (this._options.onEscapeCharacterSet) { + this._options.onEscapeCharacterSet(start, end, kind, negate); + } + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) { + if (this._options.onUnicodePropertyCharacterSet) { + this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate); + } + } + onCharacter(start, end, value) { + if (this._options.onCharacter) { + this._options.onCharacter(start, end, value); + } + } + onBackreference(start, end, ref) { + if (this._options.onBackreference) { + this._options.onBackreference(start, end, ref); + } + } + onCharacterClassEnter(start, negate) { + if (this._options.onCharacterClassEnter) { + this._options.onCharacterClassEnter(start, negate); + } + } + onCharacterClassLeave(start, end, negate) { + if (this._options.onCharacterClassLeave) { + this._options.onCharacterClassLeave(start, end, negate); + } + } + onCharacterClassRange(start, end, min, max) { + if (this._options.onCharacterClassRange) { + this._options.onCharacterClassRange(start, end, min, max); + } + } + get source() { + return this._reader.source; + } + get index() { + return this._reader.index; + } + get currentCodePoint() { + return this._reader.currentCodePoint; + } + get nextCodePoint() { + return this._reader.nextCodePoint; + } + get nextCodePoint2() { + return this._reader.nextCodePoint2; + } + get nextCodePoint3() { + return this._reader.nextCodePoint3; + } + reset(source, start, end) { + this._reader.reset(source, start, end, this._uFlag); + } + rewind(index) { + this._reader.rewind(index); + } + advance() { + this._reader.advance(); + } + eat(cp) { + return this._reader.eat(cp); + } + eat2(cp1, cp2) { + return this._reader.eat2(cp1, cp2); + } + eat3(cp1, cp2, cp3) { + return this._reader.eat3(cp1, cp2, cp3); + } + raise(message) { + throw new RegExpSyntaxError(this.source, this._uFlag, this.index, message); + } + eatRegExpBody() { + const start = this.index; + let inClass = false; + let escaped = false; + for (;;) { + const cp = this.currentCodePoint; + if (cp === -1 || isLineTerminator(cp)) { + const kind = inClass ? "character class" : "regular expression"; + this.raise(`Unterminated ${kind}`); + } + if (escaped) { + escaped = false; + } + else if (cp === ReverseSolidus) { + escaped = true; + } + else if (cp === LeftSquareBracket) { + inClass = true; + } + else if (cp === RightSquareBracket) { + inClass = false; + } + else if ((cp === Solidus && !inClass) || + (cp === Asterisk && this.index === start)) { + break; + } + this.advance(); + } + return this.index !== start; + } + consumePattern() { + const start = this.index; + this._numCapturingParens = this.countCapturingParens(); + this._groupNames.clear(); + this._backreferenceNames.clear(); + this.onPatternEnter(start); + this.consumeDisjunction(); + const cp = this.currentCodePoint; + if (this.currentCodePoint !== -1) { + if (cp === RightParenthesis) { + this.raise("Unmatched ')'"); + } + if (cp === ReverseSolidus) { + this.raise("\\ at end of pattern"); + } + if (cp === RightSquareBracket || cp === RightCurlyBracket) { + this.raise("Lone quantifier brackets"); + } + const c = String.fromCodePoint(cp); + this.raise(`Unexpected character '${c}'`); + } + for (const name of this._backreferenceNames) { + if (!this._groupNames.has(name)) { + this.raise("Invalid named capture referenced"); + } + } + this.onPatternLeave(start, this.index); + } + countCapturingParens() { + const start = this.index; + let inClass = false; + let escaped = false; + let count = 0; + let cp = 0; + while ((cp = this.currentCodePoint) !== -1) { + if (escaped) { + escaped = false; + } + else if (cp === ReverseSolidus) { + escaped = true; + } + else if (cp === LeftSquareBracket) { + inClass = true; + } + else if (cp === RightSquareBracket) { + inClass = false; + } + else if (cp === LeftParenthesis && + !inClass && + (this.nextCodePoint !== QuestionMark || + (this.nextCodePoint2 === LessThanSign && + this.nextCodePoint3 !== EqualsSign && + this.nextCodePoint3 !== ExclamationMark))) { + count += 1; + } + this.advance(); + } + this.rewind(start); + return count; + } + consumeDisjunction() { + const start = this.index; + let i = 0; + this.onDisjunctionEnter(start); + do { + this.consumeAlternative(i++); + } while (this.eat(VerticalLine)); + if (this.consumeQuantifier(true)) { + this.raise("Nothing to repeat"); + } + if (this.eat(LeftCurlyBracket)) { + this.raise("Lone quantifier brackets"); + } + this.onDisjunctionLeave(start, this.index); + } + consumeAlternative(i) { + const start = this.index; + this.onAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && this.consumeTerm()) { + } + this.onAlternativeLeave(start, this.index, i); + } + consumeTerm() { + if (this._uFlag || this.strict) { + return (this.consumeAssertion() || + (this.consumeAtom() && this.consumeOptionalQuantifier())); + } + return ((this.consumeAssertion() && + (!this._lastAssertionIsQuantifiable || + this.consumeOptionalQuantifier())) || + (this.consumeExtendedAtom() && this.consumeOptionalQuantifier())); + } + consumeOptionalQuantifier() { + this.consumeQuantifier(); + return true; + } + consumeAssertion() { + const start = this.index; + this._lastAssertionIsQuantifiable = false; + if (this.eat(CircumflexAccent)) { + this.onEdgeAssertion(start, this.index, "start"); + return true; + } + if (this.eat(DollarSign)) { + this.onEdgeAssertion(start, this.index, "end"); + return true; + } + if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) { + this.onWordBoundaryAssertion(start, this.index, "word", true); + return true; + } + if (this.eat2(ReverseSolidus, LatinSmallLetterB)) { + this.onWordBoundaryAssertion(start, this.index, "word", false); + return true; + } + if (this.eat2(LeftParenthesis, QuestionMark)) { + const lookbehind = this.ecmaVersion >= 2018 && this.eat(LessThanSign); + let negate = false; + if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) { + const kind = lookbehind ? "lookbehind" : "lookahead"; + this.onLookaroundAssertionEnter(start, kind, negate); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this._lastAssertionIsQuantifiable = !lookbehind && !this.strict; + this.onLookaroundAssertionLeave(start, this.index, kind, negate); + return true; + } + this.rewind(start); + } + return false; + } + consumeQuantifier(noConsume = false) { + const start = this.index; + let min = 0; + let max = 0; + let greedy = false; + if (this.eat(Asterisk)) { + min = 0; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(PlusSign)) { + min = 1; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(QuestionMark)) { + min = 0; + max = 1; + } + else if (this.eatBracedQuantifier(noConsume)) { + min = this._lastMinValue; + max = this._lastMaxValue; + } + else { + return false; + } + greedy = !this.eat(QuestionMark); + if (!noConsume) { + this.onQuantifier(start, this.index, min, max, greedy); + } + return true; + } + eatBracedQuantifier(noError) { + const start = this.index; + if (this.eat(LeftCurlyBracket)) { + this._lastMinValue = 0; + this._lastMaxValue = Number.POSITIVE_INFINITY; + if (this.eatDecimalDigits()) { + this._lastMinValue = this._lastMaxValue = this._lastIntValue; + if (this.eat(Comma)) { + this._lastMaxValue = this.eatDecimalDigits() + ? this._lastIntValue + : Number.POSITIVE_INFINITY; + } + if (this.eat(RightCurlyBracket)) { + if (!noError && this._lastMaxValue < this._lastMinValue) { + this.raise("numbers out of order in {} quantifier"); + } + return true; + } + } + if (!noError && (this._uFlag || this.strict)) { + this.raise("Incomplete quantifier"); + } + this.rewind(start); + } + return false; + } + consumeAtom() { + return (this.consumePatternCharacter() || + this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeCharacterClass() || + this.consumeUncapturingGroup() || + this.consumeCapturingGroup()); + } + consumeDot() { + if (this.eat(FullStop)) { + this.onAnyCharacterSet(this.index - 1, this.index, "any"); + return true; + } + return false; + } + consumeReverseSolidusAtomEscape() { + const start = this.index; + if (this.eat(ReverseSolidus)) { + if (this.consumeAtomEscape()) { + return true; + } + this.rewind(start); + } + return false; + } + consumeUncapturingGroup() { + const start = this.index; + if (this.eat3(LeftParenthesis, QuestionMark, Colon)) { + this.onGroupEnter(start); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this.onGroupLeave(start, this.index); + return true; + } + return false; + } + consumeCapturingGroup() { + const start = this.index; + if (this.eat(LeftParenthesis)) { + let name = null; + if (this.ecmaVersion >= 2018) { + if (this.consumeGroupSpecifier()) { + name = this._lastStrValue; + } + } + else if (this.currentCodePoint === QuestionMark) { + this.raise("Invalid group"); + } + this.onCapturingGroupEnter(start, name); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this.onCapturingGroupLeave(start, this.index, name); + return true; + } + return false; + } + consumeExtendedAtom() { + return (this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeReverseSolidusFollowedByC() || + this.consumeCharacterClass() || + this.consumeUncapturingGroup() || + this.consumeCapturingGroup() || + this.consumeInvalidBracedQuantifier() || + this.consumeExtendedPatternCharacter()); + } + consumeReverseSolidusFollowedByC() { + const start = this.index; + if (this.currentCodePoint === ReverseSolidus && + this.nextCodePoint === LatinSmallLetterC) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, ReverseSolidus); + return true; + } + return false; + } + consumeInvalidBracedQuantifier() { + if (this.eatBracedQuantifier(true)) { + this.raise("Nothing to repeat"); + } + return false; + } + consumePatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && !isSyntaxCharacter(cp)) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeExtendedPatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== CircumflexAccent && + cp !== DollarSign && + cp !== ReverseSolidus && + cp !== FullStop && + cp !== Asterisk && + cp !== PlusSign && + cp !== QuestionMark && + cp !== LeftParenthesis && + cp !== RightParenthesis && + cp !== LeftSquareBracket && + cp !== VerticalLine) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeGroupSpecifier() { + if (this.eat(QuestionMark)) { + if (this.eatGroupName()) { + if (!this._groupNames.has(this._lastStrValue)) { + this._groupNames.add(this._lastStrValue); + return true; + } + this.raise("Duplicate capture group name"); + } + this.raise("Invalid group"); + } + return false; + } + consumeAtomEscape() { + if (this.consumeBackreference() || + this.consumeCharacterClassEscape() || + this.consumeCharacterEscape() || + (this._nFlag && this.consumeKGroupName())) { + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + return false; + } + consumeBackreference() { + const start = this.index; + if (this.eatDecimalEscape()) { + const n = this._lastIntValue; + if (n <= this._numCapturingParens) { + this.onBackreference(start - 1, this.index, n); + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeCharacterClassEscape() { + const start = this.index; + if (this.eat(LatinSmallLetterD)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", false); + return true; + } + if (this.eat(LatinCapitalLetterD)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", true); + return true; + } + if (this.eat(LatinSmallLetterS)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", false); + return true; + } + if (this.eat(LatinCapitalLetterS)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", true); + return true; + } + if (this.eat(LatinSmallLetterW)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", false); + return true; + } + if (this.eat(LatinCapitalLetterW)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", true); + return true; + } + let negate = false; + if (this._uFlag && + this.ecmaVersion >= 2018 && + (this.eat(LatinSmallLetterP) || + (negate = this.eat(LatinCapitalLetterP)))) { + this._lastIntValue = -1; + if (this.eat(LeftCurlyBracket) && + this.eatUnicodePropertyValueExpression() && + this.eat(RightCurlyBracket)) { + this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate); + return true; + } + this.raise("Invalid property name"); + } + return false; + } + consumeCharacterEscape() { + const start = this.index; + if (this.eatControlEscape() || + this.eatCControlLetter() || + this.eatZero() || + this.eatHexEscapeSequence() || + this.eatRegExpUnicodeEscapeSequence() || + (!this.strict && + !this._uFlag && + this.eatLegacyOctalEscapeSequence()) || + this.eatIdentityEscape()) { + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return false; + } + consumeKGroupName() { + const start = this.index; + if (this.eat(LatinSmallLetterK)) { + if (this.eatGroupName()) { + const groupName = this._lastStrValue; + this._backreferenceNames.add(groupName); + this.onBackreference(start - 1, this.index, groupName); + return true; + } + this.raise("Invalid named reference"); + } + return false; + } + consumeCharacterClass() { + const start = this.index; + if (this.eat(LeftSquareBracket)) { + const negate = this.eat(CircumflexAccent); + this.onCharacterClassEnter(start, negate); + this.consumeClassRanges(); + if (!this.eat(RightSquareBracket)) { + this.raise("Unterminated character class"); + } + this.onCharacterClassLeave(start, this.index, negate); + return true; + } + return false; + } + consumeClassRanges() { + const strict = this.strict || this._uFlag; + for (;;) { + const rangeStart = this.index; + if (!this.consumeClassAtom()) { + break; + } + const min = this._lastIntValue; + if (!this.eat(HyphenMinus)) { + continue; + } + this.onCharacter(this.index - 1, this.index, HyphenMinus); + if (!this.consumeClassAtom()) { + break; + } + const max = this._lastIntValue; + if (min === -1 || max === -1) { + if (strict) { + this.raise("Invalid character class"); + } + continue; + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(rangeStart, this.index, min, max); + } + } + consumeClassAtom() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && cp !== ReverseSolidus && cp !== RightSquareBracket) { + this.advance(); + this._lastIntValue = cp; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(ReverseSolidus)) { + if (this.consumeClassEscape()) { + return true; + } + if (!this.strict && this.currentCodePoint === LatinSmallLetterC) { + this._lastIntValue = ReverseSolidus; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeClassEscape() { + const start = this.index; + if (this.eat(LatinSmallLetterB)) { + this._lastIntValue = Backspace; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + if (this._uFlag && this.eat(HyphenMinus)) { + this._lastIntValue = HyphenMinus; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + let cp = 0; + if (!this.strict && + !this._uFlag && + this.currentCodePoint === LatinSmallLetterC && + (isDecimalDigit((cp = this.nextCodePoint)) || cp === LowLine)) { + this.advance(); + this.advance(); + this._lastIntValue = cp % 0x20; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return (this.consumeCharacterClassEscape() || this.consumeCharacterEscape()); + } + eatGroupName() { + if (this.eat(LessThanSign)) { + if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) { + return true; + } + this.raise("Invalid capture group name"); + } + return false; + } + eatRegExpIdentifierName() { + if (this.eatRegExpIdentifierStart()) { + this._lastStrValue = String.fromCodePoint(this._lastIntValue); + while (this.eatRegExpIdentifierPart()) { + this._lastStrValue += String.fromCodePoint(this._lastIntValue); + } + return true; + } + return false; + } + eatRegExpIdentifierStart() { + const start = this.index; + const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === ReverseSolidus && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isRegExpIdentifierStart(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatRegExpIdentifierPart() { + const start = this.index; + const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === ReverseSolidus && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isRegExpIdentifierPart(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatCControlLetter() { + const start = this.index; + if (this.eat(LatinSmallLetterC)) { + if (this.eatControlLetter()) { + return true; + } + this.rewind(start); + } + return false; + } + eatZero() { + if (this.currentCodePoint === DigitZero && + !isDecimalDigit(this.nextCodePoint)) { + this._lastIntValue = 0; + this.advance(); + return true; + } + return false; + } + eatControlEscape() { + if (this.eat(LatinSmallLetterF)) { + this._lastIntValue = FormFeed; + return true; + } + if (this.eat(LatinSmallLetterN)) { + this._lastIntValue = LineFeed; + return true; + } + if (this.eat(LatinSmallLetterR)) { + this._lastIntValue = CarriageReturn; + return true; + } + if (this.eat(LatinSmallLetterT)) { + this._lastIntValue = CharacterTabulation; + return true; + } + if (this.eat(LatinSmallLetterV)) { + this._lastIntValue = LineTabulation; + return true; + } + return false; + } + eatControlLetter() { + const cp = this.currentCodePoint; + if (isLatinLetter(cp)) { + this.advance(); + this._lastIntValue = cp % 0x20; + return true; + } + return false; + } + eatRegExpUnicodeEscapeSequence(forceUFlag = false) { + const start = this.index; + const uFlag = forceUFlag || this._uFlag; + if (this.eat(LatinSmallLetterU)) { + if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) || + this.eatFixedHexDigits(4) || + (uFlag && this.eatRegExpUnicodeCodePointEscape())) { + return true; + } + if (this.strict || uFlag) { + this.raise("Invalid unicode escape"); + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeSurrogatePairEscape() { + const start = this.index; + if (this.eatFixedHexDigits(4)) { + const lead = this._lastIntValue; + if (isLeadSurrogate(lead) && + this.eat(ReverseSolidus) && + this.eat(LatinSmallLetterU) && + this.eatFixedHexDigits(4)) { + const trail = this._lastIntValue; + if (isTrailSurrogate(trail)) { + this._lastIntValue = combineSurrogatePair(lead, trail); + return true; + } + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeCodePointEscape() { + const start = this.index; + if (this.eat(LeftCurlyBracket) && + this.eatHexDigits() && + this.eat(RightCurlyBracket) && + isValidUnicode(this._lastIntValue)) { + return true; + } + this.rewind(start); + return false; + } + eatIdentityEscape() { + const cp = this.currentCodePoint; + if (this.isValidIdentityEscape(cp)) { + this._lastIntValue = cp; + this.advance(); + return true; + } + return false; + } + isValidIdentityEscape(cp) { + if (cp === -1) { + return false; + } + if (this._uFlag) { + return isSyntaxCharacter(cp) || cp === Solidus; + } + if (this.strict) { + return !isIdContinue(cp); + } + if (this._nFlag) { + return !(cp === LatinSmallLetterC || cp === LatinSmallLetterK); + } + return cp !== LatinSmallLetterC; + } + eatDecimalEscape() { + this._lastIntValue = 0; + let cp = this.currentCodePoint; + if (cp >= DigitOne && cp <= DigitNine) { + do { + this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero); + this.advance(); + } while ((cp = this.currentCodePoint) >= DigitZero && + cp <= DigitNine); + return true; + } + return false; + } + eatUnicodePropertyValueExpression() { + const start = this.index; + if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) { + this._lastKeyValue = this._lastStrValue; + if (this.eatUnicodePropertyValue()) { + this._lastValValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, this._lastKeyValue, this._lastValValue)) { + return true; + } + this.raise("Invalid property name"); + } + } + this.rewind(start); + if (this.eatLoneUnicodePropertyNameOrValue()) { + const nameOrValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { + this._lastKeyValue = "General_Category"; + this._lastValValue = nameOrValue; + return true; + } + if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { + this._lastKeyValue = nameOrValue; + this._lastValValue = ""; + return true; + } + this.raise("Invalid property name"); + } + return false; + } + eatUnicodePropertyName() { + this._lastStrValue = ""; + while (isUnicodePropertyNameCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatUnicodePropertyValue() { + this._lastStrValue = ""; + while (isUnicodePropertyValueCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatLoneUnicodePropertyNameOrValue() { + return this.eatUnicodePropertyValue(); + } + eatHexEscapeSequence() { + const start = this.index; + if (this.eat(LatinSmallLetterX)) { + if (this.eatFixedHexDigits(2)) { + return true; + } + if (this._uFlag || this.strict) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + eatDecimalDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isDecimalDigit(this.currentCodePoint)) { + this._lastIntValue = + 10 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatHexDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isHexDigit(this.currentCodePoint)) { + this._lastIntValue = + 16 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatLegacyOctalEscapeSequence() { + if (this.eatOctalDigit()) { + const n1 = this._lastIntValue; + if (this.eatOctalDigit()) { + const n2 = this._lastIntValue; + if (n1 <= 3 && this.eatOctalDigit()) { + this._lastIntValue = n1 * 64 + n2 * 8 + this._lastIntValue; + } + else { + this._lastIntValue = n1 * 8 + n2; + } + } + else { + this._lastIntValue = n1; + } + return true; + } + return false; + } + eatOctalDigit() { + const cp = this.currentCodePoint; + if (isOctalDigit(cp)) { + this.advance(); + this._lastIntValue = cp - DigitZero; + return true; + } + this._lastIntValue = 0; + return false; + } + eatFixedHexDigits(length) { + const start = this.index; + this._lastIntValue = 0; + for (let i = 0; i < length; ++i) { + const cp = this.currentCodePoint; + if (!isHexDigit(cp)) { + this.rewind(start); + return false; + } + this._lastIntValue = 16 * this._lastIntValue + digitToInt(cp); + this.advance(); + } + return true; + } +} + +const DummyPattern = {}; +const DummyFlags = {}; +const DummyCapturingGroup = {}; +class RegExpParserState { + constructor(options) { + this._node = DummyPattern; + this._flags = DummyFlags; + this._backreferences = []; + this._capturingGroups = []; + this.source = ""; + this.strict = Boolean(options && options.strict); + this.ecmaVersion = (options && options.ecmaVersion) || 2022; + } + get pattern() { + if (this._node.type !== "Pattern") { + throw new Error("UnknownError"); + } + return this._node; + } + get flags() { + if (this._flags.type !== "Flags") { + throw new Error("UnknownError"); + } + return this._flags; + } + onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) { + this._flags = { + type: "Flags", + parent: null, + start, + end, + raw: this.source.slice(start, end), + global, + ignoreCase, + multiline, + unicode, + sticky, + dotAll, + hasIndices, + }; + } + onPatternEnter(start) { + this._node = { + type: "Pattern", + parent: null, + start, + end: start, + raw: "", + alternatives: [], + }; + this._backreferences.length = 0; + this._capturingGroups.length = 0; + } + onPatternLeave(start, end) { + this._node.end = end; + this._node.raw = this.source.slice(start, end); + for (const reference of this._backreferences) { + const ref = reference.ref; + const group = typeof ref === "number" + ? this._capturingGroups[ref - 1] + : this._capturingGroups.find(g => g.name === ref); + reference.resolved = group; + group.references.push(reference); + } + } + onAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "Assertion" && + parent.type !== "CapturingGroup" && + parent.type !== "Group" && + parent.type !== "Pattern") { + throw new Error("UnknownError"); + } + this._node = { + type: "Alternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onGroupEnter(start) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "Group", + parent, + start, + end: start, + raw: "", + alternatives: [], + }; + parent.elements.push(this._node); + } + onGroupLeave(start, end) { + const node = this._node; + if (node.type !== "Group" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onCapturingGroupEnter(start, name) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CapturingGroup", + parent, + start, + end: start, + raw: "", + name, + alternatives: [], + references: [], + }; + parent.elements.push(this._node); + this._capturingGroups.push(this._node); + } + onCapturingGroupLeave(start, end) { + const node = this._node; + if (node.type !== "CapturingGroup" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onQuantifier(start, end, min, max, greedy) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const element = parent.elements.pop(); + if (element == null || + element.type === "Quantifier" || + (element.type === "Assertion" && element.kind !== "lookahead")) { + throw new Error("UnknownError"); + } + const node = { + type: "Quantifier", + parent, + start: element.start, + end, + raw: this.source.slice(element.start, end), + min, + max, + greedy, + element, + }; + parent.elements.push(node); + element.parent = node; + } + onLookaroundAssertionEnter(start, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = (this._node = { + type: "Assertion", + parent, + start, + end: start, + raw: "", + kind, + negate, + alternatives: [], + }); + parent.elements.push(node); + } + onLookaroundAssertionLeave(start, end) { + const node = this._node; + if (node.type !== "Assertion" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onEdgeAssertion(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onWordBoundaryAssertion(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onAnyCharacterSet(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onEscapeCharacterSet(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + key, + value, + negate, + }); + } + onCharacter(start, end, value) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Character", + parent, + start, + end, + raw: this.source.slice(start, end), + value, + }); + } + onBackreference(start, end, ref) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = { + type: "Backreference", + parent, + start, + end, + raw: this.source.slice(start, end), + ref, + resolved: DummyCapturingGroup, + }; + parent.elements.push(node); + this._backreferences.push(node); + } + onCharacterClassEnter(start, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CharacterClass", + parent, + start, + end: start, + raw: "", + negate, + elements: [], + }; + parent.elements.push(this._node); + } + onCharacterClassLeave(start, end) { + const node = this._node; + if (node.type !== "CharacterClass" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onCharacterClassRange(start, end) { + const parent = this._node; + if (parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const elements = parent.elements; + const max = elements.pop(); + const hyphen = elements.pop(); + const min = elements.pop(); + if (!min || + !max || + !hyphen || + min.type !== "Character" || + max.type !== "Character" || + hyphen.type !== "Character" || + hyphen.value !== HyphenMinus) { + throw new Error("UnknownError"); + } + const node = { + type: "CharacterClassRange", + parent, + start, + end, + raw: this.source.slice(start, end), + min, + max, + }; + min.parent = node; + max.parent = node; + elements.push(node); + } +} +class RegExpParser { + constructor(options) { + this._state = new RegExpParserState(options); + this._validator = new RegExpValidator(this._state); + } + parseLiteral(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateLiteral(source, start, end); + const pattern = this._state.pattern; + const flags = this._state.flags; + const literal = { + type: "RegExpLiteral", + parent: null, + start, + end, + raw: source, + pattern, + flags, + }; + pattern.parent = literal; + flags.parent = literal; + return literal; + } + parseFlags(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateFlags(source, start, end); + return this._state.flags; + } + parsePattern(source, start = 0, end = source.length, uFlag = false) { + this._state.source = source; + this._validator.validatePattern(source, start, end, uFlag); + return this._state.pattern; + } +} + +class RegExpVisitor { + constructor(handlers) { + this._handlers = handlers; + } + visit(node) { + switch (node.type) { + case "Alternative": + this.visitAlternative(node); + break; + case "Assertion": + this.visitAssertion(node); + break; + case "Backreference": + this.visitBackreference(node); + break; + case "CapturingGroup": + this.visitCapturingGroup(node); + break; + case "Character": + this.visitCharacter(node); + break; + case "CharacterClass": + this.visitCharacterClass(node); + break; + case "CharacterClassRange": + this.visitCharacterClassRange(node); + break; + case "CharacterSet": + this.visitCharacterSet(node); + break; + case "Flags": + this.visitFlags(node); + break; + case "Group": + this.visitGroup(node); + break; + case "Pattern": + this.visitPattern(node); + break; + case "Quantifier": + this.visitQuantifier(node); + break; + case "RegExpLiteral": + this.visitRegExpLiteral(node); + break; + default: + throw new Error(`Unknown type: ${node.type}`); + } + } + visitAlternative(node) { + if (this._handlers.onAlternativeEnter) { + this._handlers.onAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onAlternativeLeave) { + this._handlers.onAlternativeLeave(node); + } + } + visitAssertion(node) { + if (this._handlers.onAssertionEnter) { + this._handlers.onAssertionEnter(node); + } + if (node.kind === "lookahead" || node.kind === "lookbehind") { + node.alternatives.forEach(this.visit, this); + } + if (this._handlers.onAssertionLeave) { + this._handlers.onAssertionLeave(node); + } + } + visitBackreference(node) { + if (this._handlers.onBackreferenceEnter) { + this._handlers.onBackreferenceEnter(node); + } + if (this._handlers.onBackreferenceLeave) { + this._handlers.onBackreferenceLeave(node); + } + } + visitCapturingGroup(node) { + if (this._handlers.onCapturingGroupEnter) { + this._handlers.onCapturingGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onCapturingGroupLeave) { + this._handlers.onCapturingGroupLeave(node); + } + } + visitCharacter(node) { + if (this._handlers.onCharacterEnter) { + this._handlers.onCharacterEnter(node); + } + if (this._handlers.onCharacterLeave) { + this._handlers.onCharacterLeave(node); + } + } + visitCharacterClass(node) { + if (this._handlers.onCharacterClassEnter) { + this._handlers.onCharacterClassEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onCharacterClassLeave) { + this._handlers.onCharacterClassLeave(node); + } + } + visitCharacterClassRange(node) { + if (this._handlers.onCharacterClassRangeEnter) { + this._handlers.onCharacterClassRangeEnter(node); + } + this.visitCharacter(node.min); + this.visitCharacter(node.max); + if (this._handlers.onCharacterClassRangeLeave) { + this._handlers.onCharacterClassRangeLeave(node); + } + } + visitCharacterSet(node) { + if (this._handlers.onCharacterSetEnter) { + this._handlers.onCharacterSetEnter(node); + } + if (this._handlers.onCharacterSetLeave) { + this._handlers.onCharacterSetLeave(node); + } + } + visitFlags(node) { + if (this._handlers.onFlagsEnter) { + this._handlers.onFlagsEnter(node); + } + if (this._handlers.onFlagsLeave) { + this._handlers.onFlagsLeave(node); + } + } + visitGroup(node) { + if (this._handlers.onGroupEnter) { + this._handlers.onGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onGroupLeave) { + this._handlers.onGroupLeave(node); + } + } + visitPattern(node) { + if (this._handlers.onPatternEnter) { + this._handlers.onPatternEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onPatternLeave) { + this._handlers.onPatternLeave(node); + } + } + visitQuantifier(node) { + if (this._handlers.onQuantifierEnter) { + this._handlers.onQuantifierEnter(node); + } + this.visit(node.element); + if (this._handlers.onQuantifierLeave) { + this._handlers.onQuantifierLeave(node); + } + } + visitRegExpLiteral(node) { + if (this._handlers.onRegExpLiteralEnter) { + this._handlers.onRegExpLiteralEnter(node); + } + this.visitPattern(node.pattern); + this.visitFlags(node.flags); + if (this._handlers.onRegExpLiteralLeave) { + this._handlers.onRegExpLiteralLeave(node); + } + } +} + +function parseRegExpLiteral(source, options) { + return new RegExpParser(options).parseLiteral(String(source)); +} +function validateRegExpLiteral(source, options) { + return new RegExpValidator(options).validateLiteral(source); +} +function visitRegExpAST(node, handlers) { + new RegExpVisitor(handlers).visit(node); +} + +exports.AST = ast; +exports.RegExpParser = RegExpParser; +exports.RegExpValidator = RegExpValidator; +exports.parseRegExpLiteral = parseRegExpLiteral; +exports.validateRegExpLiteral = validateRegExpLiteral; +exports.visitRegExpAST = visitRegExpAST; +//# sourceMappingURL=index.js.map diff --git a/node_modules/regexpp/index.js.map b/node_modules/regexpp/index.js.map new file mode 100644 index 0000000..db15135 --- /dev/null +++ b/node_modules/regexpp/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js.map","sources":[".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/reader.ts",".temp/src/regexp-syntax-error.ts",".temp/src/validator.ts",".temp/src/parser.ts",".temp/src/visitor.ts",".temp/src/index.ts"],"sourcesContent":[{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\ids.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\properties.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\index.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\reader.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\regexp-syntax-error.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\validator.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\parser.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\visitor.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\index.ts"}],"names":[],"mappings":";;;;;;;;;;;AAIA,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAE3D,SAAgB,SAAS,CAAC,EAAU;IAChC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,OAAO,cAAc,CAAC,EAAE,CAAC,CAAA;CAC5B;AAED,SAAgB,YAAY,CAAC,EAAU;IACnC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAC5B,IAAI,EAAE,GAAG,IAAI;QAA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,IAAI,CAAC,CAAA;SAC5C;KACJ;CACJ;;SCzLe,kBAAkB,CAC9B,MAAuB,EACvB,OAA8B;IAE9B,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;CAChE;AAOD,SAAgB,qBAAqB,CACjC,MAAc,EACd,OAAiC;IAEjC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;CAC9D;AAED,SAAgB,cAAc,CAC1B,IAAc,EACd,QAAgC;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;CAC1C;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/regexpp/index.mjs b/node_modules/regexpp/index.mjs new file mode 100644 index 0000000..bc1f59c --- /dev/null +++ b/node_modules/regexpp/index.mjs @@ -0,0 +1,2087 @@ +/*! @author Toru Nagashima */ + + +var ast = /*#__PURE__*/Object.freeze({ + +}); + +let largeIdStartRanges = undefined; +let largeIdContinueRanges = undefined; +function isIdStart(cp) { + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp); +} +function isIdContinue(cp) { + if (cp < 0x30) + return false; + if (cp < 0x3a) + return true; + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp === 0x5f) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp) || isLargeIdContinue(cp); +} +function isLargeIdStart(cp) { + return isInRange(cp, largeIdStartRanges || (largeIdStartRanges = initLargeIdStartRanges())); +} +function isLargeIdContinue(cp) { + return isInRange(cp, largeIdContinueRanges || + (largeIdContinueRanges = initLargeIdContinueRanges())); +} +function initLargeIdStartRanges() { + return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 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 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t g70 4 wc 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 1g 3 8 17 c 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f 4d 8m a l b 7 49 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 1z 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 9p 15 7 1 27 s b 0 9 l 2z k s m d 1g 24 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o 2d 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 4f 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 6e 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 z 1k 7c 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 94 i 5a 0 28 pl 2v 32 i 5f 24d tq 34i g6 6nu fs 8 u 36 t j 1b h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 y 2 3 9 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 1 1s 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1l 2 4 g0 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 n7q 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 ji 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 aa 1 4a a 4w 2 1i e w 9 g 3 1a a 1i 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 4h b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 5d h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 2c e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f ba 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 96 3 ewa 9 3r 4 1o 6 q 9 s6 0 2 1i 8 3 2a 0 c 1 f58 1 43r 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 7a 6 a 9 bn d 15j 6 32 6 6 9 3o7 9 gvt3 6n"); +} +function isInRange(cp, ranges) { + let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0; + while (l < r) { + i = ((l + r) / 2) | 0; + min = ranges[2 * i]; + max = ranges[2 * i + 1]; + if (cp < min) { + r = i; + } + else if (cp > max) { + l = i + 1; + } + else { + return true; + } + } + return false; +} +function restoreRanges(data) { + let last = 0; + return data.split(" ").map(s => (last += parseInt(s, 36) | 0)); +} + +class DataSet { + constructor(raw2018, raw2019, raw2020, raw2021) { + this._raw2018 = raw2018; + this._raw2019 = raw2019; + this._raw2020 = raw2020; + this._raw2021 = raw2021; + } + get es2018() { + return (this._set2018 || (this._set2018 = new Set(this._raw2018.split(" ")))); + } + get es2019() { + return (this._set2019 || (this._set2019 = new Set(this._raw2019.split(" ")))); + } + get es2020() { + return (this._set2020 || (this._set2020 = new Set(this._raw2020.split(" ")))); + } + get es2021() { + return (this._set2021 || (this._set2021 = new Set(this._raw2021.split(" ")))); + } +} +const gcNameSet = new Set(["General_Category", "gc"]); +const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]); +const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", ""); +const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"); +const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict"); +function isValidUnicodeProperty(version, name, value) { + if (gcNameSet.has(name)) { + return version >= 2018 && gcValueSets.es2018.has(value); + } + if (scNameSet.has(name)) { + return ((version >= 2018 && scValueSets.es2018.has(value)) || + (version >= 2019 && scValueSets.es2019.has(value)) || + (version >= 2020 && scValueSets.es2020.has(value)) || + (version >= 2021 && scValueSets.es2021.has(value))); + } + return false; +} +function isValidLoneUnicodeProperty(version, value) { + return ((version >= 2018 && binPropertySets.es2018.has(value)) || + (version >= 2019 && binPropertySets.es2019.has(value)) || + (version >= 2021 && binPropertySets.es2021.has(value))); +} + +const Backspace = 0x08; +const CharacterTabulation = 0x09; +const LineFeed = 0x0a; +const LineTabulation = 0x0b; +const FormFeed = 0x0c; +const CarriageReturn = 0x0d; +const ExclamationMark = 0x21; +const DollarSign = 0x24; +const LeftParenthesis = 0x28; +const RightParenthesis = 0x29; +const Asterisk = 0x2a; +const PlusSign = 0x2b; +const Comma = 0x2c; +const HyphenMinus = 0x2d; +const FullStop = 0x2e; +const Solidus = 0x2f; +const DigitZero = 0x30; +const DigitOne = 0x31; +const DigitSeven = 0x37; +const DigitNine = 0x39; +const Colon = 0x3a; +const LessThanSign = 0x3c; +const EqualsSign = 0x3d; +const GreaterThanSign = 0x3e; +const QuestionMark = 0x3f; +const LatinCapitalLetterA = 0x41; +const LatinCapitalLetterB = 0x42; +const LatinCapitalLetterD = 0x44; +const LatinCapitalLetterF = 0x46; +const LatinCapitalLetterP = 0x50; +const LatinCapitalLetterS = 0x53; +const LatinCapitalLetterW = 0x57; +const LatinCapitalLetterZ = 0x5a; +const LowLine = 0x5f; +const LatinSmallLetterA = 0x61; +const LatinSmallLetterB = 0x62; +const LatinSmallLetterC = 0x63; +const LatinSmallLetterD = 0x64; +const LatinSmallLetterF = 0x66; +const LatinSmallLetterG = 0x67; +const LatinSmallLetterI = 0x69; +const LatinSmallLetterK = 0x6b; +const LatinSmallLetterM = 0x6d; +const LatinSmallLetterN = 0x6e; +const LatinSmallLetterP = 0x70; +const LatinSmallLetterR = 0x72; +const LatinSmallLetterS = 0x73; +const LatinSmallLetterT = 0x74; +const LatinSmallLetterU = 0x75; +const LatinSmallLetterV = 0x76; +const LatinSmallLetterW = 0x77; +const LatinSmallLetterX = 0x78; +const LatinSmallLetterY = 0x79; +const LatinSmallLetterZ = 0x7a; +const LeftSquareBracket = 0x5b; +const ReverseSolidus = 0x5c; +const RightSquareBracket = 0x5d; +const CircumflexAccent = 0x5e; +const LeftCurlyBracket = 0x7b; +const VerticalLine = 0x7c; +const RightCurlyBracket = 0x7d; +const ZeroWidthNonJoiner = 0x200c; +const ZeroWidthJoiner = 0x200d; +const LineSeparator = 0x2028; +const ParagraphSeparator = 0x2029; +const MinCodePoint = 0x00; +const MaxCodePoint = 0x10ffff; +function isLatinLetter(code) { + return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) || + (code >= LatinSmallLetterA && code <= LatinSmallLetterZ)); +} +function isDecimalDigit(code) { + return code >= DigitZero && code <= DigitNine; +} +function isOctalDigit(code) { + return code >= DigitZero && code <= DigitSeven; +} +function isHexDigit(code) { + return ((code >= DigitZero && code <= DigitNine) || + (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) || + (code >= LatinSmallLetterA && code <= LatinSmallLetterF)); +} +function isLineTerminator(code) { + return (code === LineFeed || + code === CarriageReturn || + code === LineSeparator || + code === ParagraphSeparator); +} +function isValidUnicode(code) { + return code >= MinCodePoint && code <= MaxCodePoint; +} +function digitToInt(code) { + if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) { + return code - LatinSmallLetterA + 10; + } + if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) { + return code - LatinCapitalLetterA + 10; + } + return code - DigitZero; +} +function isLeadSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} +function isTrailSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +function combineSurrogatePair(lead, trail) { + return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; +} + +const legacyImpl = { + at(s, end, i) { + return i < end ? s.charCodeAt(i) : -1; + }, + width(c) { + return 1; + }, +}; +const unicodeImpl = { + at(s, end, i) { + return i < end ? s.codePointAt(i) : -1; + }, + width(c) { + return c > 0xffff ? 2 : 1; + }, +}; +class Reader { + constructor() { + this._impl = legacyImpl; + this._s = ""; + this._i = 0; + this._end = 0; + this._cp1 = -1; + this._w1 = 1; + this._cp2 = -1; + this._w2 = 1; + this._cp3 = -1; + this._w3 = 1; + this._cp4 = -1; + } + get source() { + return this._s; + } + get index() { + return this._i; + } + get currentCodePoint() { + return this._cp1; + } + get nextCodePoint() { + return this._cp2; + } + get nextCodePoint2() { + return this._cp3; + } + get nextCodePoint3() { + return this._cp4; + } + reset(source, start, end, uFlag) { + this._impl = uFlag ? unicodeImpl : legacyImpl; + this._s = source; + this._end = end; + this.rewind(start); + } + rewind(index) { + const impl = this._impl; + this._i = index; + this._cp1 = impl.at(this._s, this._end, index); + this._w1 = impl.width(this._cp1); + this._cp2 = impl.at(this._s, this._end, index + this._w1); + this._w2 = impl.width(this._cp2); + this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2); + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3); + } + advance() { + if (this._cp1 !== -1) { + const impl = this._impl; + this._i += this._w1; + this._cp1 = this._cp2; + this._w1 = this._w2; + this._cp2 = this._cp3; + this._w2 = impl.width(this._cp2); + this._cp3 = this._cp4; + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3); + } + } + eat(cp) { + if (this._cp1 === cp) { + this.advance(); + return true; + } + return false; + } + eat2(cp1, cp2) { + if (this._cp1 === cp1 && this._cp2 === cp2) { + this.advance(); + this.advance(); + return true; + } + return false; + } + eat3(cp1, cp2, cp3) { + if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) { + this.advance(); + this.advance(); + this.advance(); + return true; + } + return false; + } +} + +class RegExpSyntaxError extends SyntaxError { + constructor(source, uFlag, index, message) { + if (source) { + if (!source.startsWith("/")) { + source = `/${source}/${uFlag ? "u" : ""}`; + } + source = `: ${source}`; + } + super(`Invalid regular expression${source}: ${message}`); + this.index = index; + } +} + +function isSyntaxCharacter(cp) { + return (cp === CircumflexAccent || + cp === DollarSign || + cp === ReverseSolidus || + cp === FullStop || + cp === Asterisk || + cp === PlusSign || + cp === QuestionMark || + cp === LeftParenthesis || + cp === RightParenthesis || + cp === LeftSquareBracket || + cp === RightSquareBracket || + cp === LeftCurlyBracket || + cp === RightCurlyBracket || + cp === VerticalLine); +} +function isRegExpIdentifierStart(cp) { + return isIdStart(cp) || cp === DollarSign || cp === LowLine; +} +function isRegExpIdentifierPart(cp) { + return (isIdContinue(cp) || + cp === DollarSign || + cp === LowLine || + cp === ZeroWidthNonJoiner || + cp === ZeroWidthJoiner); +} +function isUnicodePropertyNameCharacter(cp) { + return isLatinLetter(cp) || cp === LowLine; +} +function isUnicodePropertyValueCharacter(cp) { + return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); +} +class RegExpValidator { + constructor(options) { + this._reader = new Reader(); + this._uFlag = false; + this._nFlag = false; + this._lastIntValue = 0; + this._lastMinValue = 0; + this._lastMaxValue = 0; + this._lastStrValue = ""; + this._lastKeyValue = ""; + this._lastValValue = ""; + this._lastAssertionIsQuantifiable = false; + this._numCapturingParens = 0; + this._groupNames = new Set(); + this._backreferenceNames = new Set(); + this._options = options || {}; + } + validateLiteral(source, start = 0, end = source.length) { + this._uFlag = this._nFlag = false; + this.reset(source, start, end); + this.onLiteralEnter(start); + if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) { + const flagStart = this.index; + const uFlag = source.includes("u", flagStart); + this.validateFlags(source, flagStart, end); + this.validatePattern(source, start + 1, flagStart - 1, uFlag); + } + else if (start >= end) { + this.raise("Empty"); + } + else { + const c = String.fromCodePoint(this.currentCodePoint); + this.raise(`Unexpected character '${c}'`); + } + this.onLiteralLeave(start, end); + } + validateFlags(source, start = 0, end = source.length) { + const existingFlags = new Set(); + let global = false; + let ignoreCase = false; + let multiline = false; + let sticky = false; + let unicode = false; + let dotAll = false; + let hasIndices = false; + for (let i = start; i < end; ++i) { + const flag = source.charCodeAt(i); + if (existingFlags.has(flag)) { + this.raise(`Duplicated flag '${source[i]}'`); + } + existingFlags.add(flag); + if (flag === LatinSmallLetterG) { + global = true; + } + else if (flag === LatinSmallLetterI) { + ignoreCase = true; + } + else if (flag === LatinSmallLetterM) { + multiline = true; + } + else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) { + unicode = true; + } + else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) { + sticky = true; + } + else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) { + dotAll = true; + } + else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) { + hasIndices = true; + } + else { + this.raise(`Invalid flag '${source[i]}'`); + } + } + this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices); + } + validatePattern(source, start = 0, end = source.length, uFlag = false) { + this._uFlag = uFlag && this.ecmaVersion >= 2015; + this._nFlag = uFlag && this.ecmaVersion >= 2018; + this.reset(source, start, end); + this.consumePattern(); + if (!this._nFlag && + this.ecmaVersion >= 2018 && + this._groupNames.size > 0) { + this._nFlag = true; + this.rewind(start); + this.consumePattern(); + } + } + get strict() { + return Boolean(this._options.strict || this._uFlag); + } + get ecmaVersion() { + return this._options.ecmaVersion || 2022; + } + onLiteralEnter(start) { + if (this._options.onLiteralEnter) { + this._options.onLiteralEnter(start); + } + } + onLiteralLeave(start, end) { + if (this._options.onLiteralLeave) { + this._options.onLiteralLeave(start, end); + } + } + onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) { + if (this._options.onFlags) { + this._options.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices); + } + } + onPatternEnter(start) { + if (this._options.onPatternEnter) { + this._options.onPatternEnter(start); + } + } + onPatternLeave(start, end) { + if (this._options.onPatternLeave) { + this._options.onPatternLeave(start, end); + } + } + onDisjunctionEnter(start) { + if (this._options.onDisjunctionEnter) { + this._options.onDisjunctionEnter(start); + } + } + onDisjunctionLeave(start, end) { + if (this._options.onDisjunctionLeave) { + this._options.onDisjunctionLeave(start, end); + } + } + onAlternativeEnter(start, index) { + if (this._options.onAlternativeEnter) { + this._options.onAlternativeEnter(start, index); + } + } + onAlternativeLeave(start, end, index) { + if (this._options.onAlternativeLeave) { + this._options.onAlternativeLeave(start, end, index); + } + } + onGroupEnter(start) { + if (this._options.onGroupEnter) { + this._options.onGroupEnter(start); + } + } + onGroupLeave(start, end) { + if (this._options.onGroupLeave) { + this._options.onGroupLeave(start, end); + } + } + onCapturingGroupEnter(start, name) { + if (this._options.onCapturingGroupEnter) { + this._options.onCapturingGroupEnter(start, name); + } + } + onCapturingGroupLeave(start, end, name) { + if (this._options.onCapturingGroupLeave) { + this._options.onCapturingGroupLeave(start, end, name); + } + } + onQuantifier(start, end, min, max, greedy) { + if (this._options.onQuantifier) { + this._options.onQuantifier(start, end, min, max, greedy); + } + } + onLookaroundAssertionEnter(start, kind, negate) { + if (this._options.onLookaroundAssertionEnter) { + this._options.onLookaroundAssertionEnter(start, kind, negate); + } + } + onLookaroundAssertionLeave(start, end, kind, negate) { + if (this._options.onLookaroundAssertionLeave) { + this._options.onLookaroundAssertionLeave(start, end, kind, negate); + } + } + onEdgeAssertion(start, end, kind) { + if (this._options.onEdgeAssertion) { + this._options.onEdgeAssertion(start, end, kind); + } + } + onWordBoundaryAssertion(start, end, kind, negate) { + if (this._options.onWordBoundaryAssertion) { + this._options.onWordBoundaryAssertion(start, end, kind, negate); + } + } + onAnyCharacterSet(start, end, kind) { + if (this._options.onAnyCharacterSet) { + this._options.onAnyCharacterSet(start, end, kind); + } + } + onEscapeCharacterSet(start, end, kind, negate) { + if (this._options.onEscapeCharacterSet) { + this._options.onEscapeCharacterSet(start, end, kind, negate); + } + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) { + if (this._options.onUnicodePropertyCharacterSet) { + this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate); + } + } + onCharacter(start, end, value) { + if (this._options.onCharacter) { + this._options.onCharacter(start, end, value); + } + } + onBackreference(start, end, ref) { + if (this._options.onBackreference) { + this._options.onBackreference(start, end, ref); + } + } + onCharacterClassEnter(start, negate) { + if (this._options.onCharacterClassEnter) { + this._options.onCharacterClassEnter(start, negate); + } + } + onCharacterClassLeave(start, end, negate) { + if (this._options.onCharacterClassLeave) { + this._options.onCharacterClassLeave(start, end, negate); + } + } + onCharacterClassRange(start, end, min, max) { + if (this._options.onCharacterClassRange) { + this._options.onCharacterClassRange(start, end, min, max); + } + } + get source() { + return this._reader.source; + } + get index() { + return this._reader.index; + } + get currentCodePoint() { + return this._reader.currentCodePoint; + } + get nextCodePoint() { + return this._reader.nextCodePoint; + } + get nextCodePoint2() { + return this._reader.nextCodePoint2; + } + get nextCodePoint3() { + return this._reader.nextCodePoint3; + } + reset(source, start, end) { + this._reader.reset(source, start, end, this._uFlag); + } + rewind(index) { + this._reader.rewind(index); + } + advance() { + this._reader.advance(); + } + eat(cp) { + return this._reader.eat(cp); + } + eat2(cp1, cp2) { + return this._reader.eat2(cp1, cp2); + } + eat3(cp1, cp2, cp3) { + return this._reader.eat3(cp1, cp2, cp3); + } + raise(message) { + throw new RegExpSyntaxError(this.source, this._uFlag, this.index, message); + } + eatRegExpBody() { + const start = this.index; + let inClass = false; + let escaped = false; + for (;;) { + const cp = this.currentCodePoint; + if (cp === -1 || isLineTerminator(cp)) { + const kind = inClass ? "character class" : "regular expression"; + this.raise(`Unterminated ${kind}`); + } + if (escaped) { + escaped = false; + } + else if (cp === ReverseSolidus) { + escaped = true; + } + else if (cp === LeftSquareBracket) { + inClass = true; + } + else if (cp === RightSquareBracket) { + inClass = false; + } + else if ((cp === Solidus && !inClass) || + (cp === Asterisk && this.index === start)) { + break; + } + this.advance(); + } + return this.index !== start; + } + consumePattern() { + const start = this.index; + this._numCapturingParens = this.countCapturingParens(); + this._groupNames.clear(); + this._backreferenceNames.clear(); + this.onPatternEnter(start); + this.consumeDisjunction(); + const cp = this.currentCodePoint; + if (this.currentCodePoint !== -1) { + if (cp === RightParenthesis) { + this.raise("Unmatched ')'"); + } + if (cp === ReverseSolidus) { + this.raise("\\ at end of pattern"); + } + if (cp === RightSquareBracket || cp === RightCurlyBracket) { + this.raise("Lone quantifier brackets"); + } + const c = String.fromCodePoint(cp); + this.raise(`Unexpected character '${c}'`); + } + for (const name of this._backreferenceNames) { + if (!this._groupNames.has(name)) { + this.raise("Invalid named capture referenced"); + } + } + this.onPatternLeave(start, this.index); + } + countCapturingParens() { + const start = this.index; + let inClass = false; + let escaped = false; + let count = 0; + let cp = 0; + while ((cp = this.currentCodePoint) !== -1) { + if (escaped) { + escaped = false; + } + else if (cp === ReverseSolidus) { + escaped = true; + } + else if (cp === LeftSquareBracket) { + inClass = true; + } + else if (cp === RightSquareBracket) { + inClass = false; + } + else if (cp === LeftParenthesis && + !inClass && + (this.nextCodePoint !== QuestionMark || + (this.nextCodePoint2 === LessThanSign && + this.nextCodePoint3 !== EqualsSign && + this.nextCodePoint3 !== ExclamationMark))) { + count += 1; + } + this.advance(); + } + this.rewind(start); + return count; + } + consumeDisjunction() { + const start = this.index; + let i = 0; + this.onDisjunctionEnter(start); + do { + this.consumeAlternative(i++); + } while (this.eat(VerticalLine)); + if (this.consumeQuantifier(true)) { + this.raise("Nothing to repeat"); + } + if (this.eat(LeftCurlyBracket)) { + this.raise("Lone quantifier brackets"); + } + this.onDisjunctionLeave(start, this.index); + } + consumeAlternative(i) { + const start = this.index; + this.onAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && this.consumeTerm()) { + } + this.onAlternativeLeave(start, this.index, i); + } + consumeTerm() { + if (this._uFlag || this.strict) { + return (this.consumeAssertion() || + (this.consumeAtom() && this.consumeOptionalQuantifier())); + } + return ((this.consumeAssertion() && + (!this._lastAssertionIsQuantifiable || + this.consumeOptionalQuantifier())) || + (this.consumeExtendedAtom() && this.consumeOptionalQuantifier())); + } + consumeOptionalQuantifier() { + this.consumeQuantifier(); + return true; + } + consumeAssertion() { + const start = this.index; + this._lastAssertionIsQuantifiable = false; + if (this.eat(CircumflexAccent)) { + this.onEdgeAssertion(start, this.index, "start"); + return true; + } + if (this.eat(DollarSign)) { + this.onEdgeAssertion(start, this.index, "end"); + return true; + } + if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) { + this.onWordBoundaryAssertion(start, this.index, "word", true); + return true; + } + if (this.eat2(ReverseSolidus, LatinSmallLetterB)) { + this.onWordBoundaryAssertion(start, this.index, "word", false); + return true; + } + if (this.eat2(LeftParenthesis, QuestionMark)) { + const lookbehind = this.ecmaVersion >= 2018 && this.eat(LessThanSign); + let negate = false; + if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) { + const kind = lookbehind ? "lookbehind" : "lookahead"; + this.onLookaroundAssertionEnter(start, kind, negate); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this._lastAssertionIsQuantifiable = !lookbehind && !this.strict; + this.onLookaroundAssertionLeave(start, this.index, kind, negate); + return true; + } + this.rewind(start); + } + return false; + } + consumeQuantifier(noConsume = false) { + const start = this.index; + let min = 0; + let max = 0; + let greedy = false; + if (this.eat(Asterisk)) { + min = 0; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(PlusSign)) { + min = 1; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(QuestionMark)) { + min = 0; + max = 1; + } + else if (this.eatBracedQuantifier(noConsume)) { + min = this._lastMinValue; + max = this._lastMaxValue; + } + else { + return false; + } + greedy = !this.eat(QuestionMark); + if (!noConsume) { + this.onQuantifier(start, this.index, min, max, greedy); + } + return true; + } + eatBracedQuantifier(noError) { + const start = this.index; + if (this.eat(LeftCurlyBracket)) { + this._lastMinValue = 0; + this._lastMaxValue = Number.POSITIVE_INFINITY; + if (this.eatDecimalDigits()) { + this._lastMinValue = this._lastMaxValue = this._lastIntValue; + if (this.eat(Comma)) { + this._lastMaxValue = this.eatDecimalDigits() + ? this._lastIntValue + : Number.POSITIVE_INFINITY; + } + if (this.eat(RightCurlyBracket)) { + if (!noError && this._lastMaxValue < this._lastMinValue) { + this.raise("numbers out of order in {} quantifier"); + } + return true; + } + } + if (!noError && (this._uFlag || this.strict)) { + this.raise("Incomplete quantifier"); + } + this.rewind(start); + } + return false; + } + consumeAtom() { + return (this.consumePatternCharacter() || + this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeCharacterClass() || + this.consumeUncapturingGroup() || + this.consumeCapturingGroup()); + } + consumeDot() { + if (this.eat(FullStop)) { + this.onAnyCharacterSet(this.index - 1, this.index, "any"); + return true; + } + return false; + } + consumeReverseSolidusAtomEscape() { + const start = this.index; + if (this.eat(ReverseSolidus)) { + if (this.consumeAtomEscape()) { + return true; + } + this.rewind(start); + } + return false; + } + consumeUncapturingGroup() { + const start = this.index; + if (this.eat3(LeftParenthesis, QuestionMark, Colon)) { + this.onGroupEnter(start); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this.onGroupLeave(start, this.index); + return true; + } + return false; + } + consumeCapturingGroup() { + const start = this.index; + if (this.eat(LeftParenthesis)) { + let name = null; + if (this.ecmaVersion >= 2018) { + if (this.consumeGroupSpecifier()) { + name = this._lastStrValue; + } + } + else if (this.currentCodePoint === QuestionMark) { + this.raise("Invalid group"); + } + this.onCapturingGroupEnter(start, name); + this.consumeDisjunction(); + if (!this.eat(RightParenthesis)) { + this.raise("Unterminated group"); + } + this.onCapturingGroupLeave(start, this.index, name); + return true; + } + return false; + } + consumeExtendedAtom() { + return (this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeReverseSolidusFollowedByC() || + this.consumeCharacterClass() || + this.consumeUncapturingGroup() || + this.consumeCapturingGroup() || + this.consumeInvalidBracedQuantifier() || + this.consumeExtendedPatternCharacter()); + } + consumeReverseSolidusFollowedByC() { + const start = this.index; + if (this.currentCodePoint === ReverseSolidus && + this.nextCodePoint === LatinSmallLetterC) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, ReverseSolidus); + return true; + } + return false; + } + consumeInvalidBracedQuantifier() { + if (this.eatBracedQuantifier(true)) { + this.raise("Nothing to repeat"); + } + return false; + } + consumePatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && !isSyntaxCharacter(cp)) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeExtendedPatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== CircumflexAccent && + cp !== DollarSign && + cp !== ReverseSolidus && + cp !== FullStop && + cp !== Asterisk && + cp !== PlusSign && + cp !== QuestionMark && + cp !== LeftParenthesis && + cp !== RightParenthesis && + cp !== LeftSquareBracket && + cp !== VerticalLine) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeGroupSpecifier() { + if (this.eat(QuestionMark)) { + if (this.eatGroupName()) { + if (!this._groupNames.has(this._lastStrValue)) { + this._groupNames.add(this._lastStrValue); + return true; + } + this.raise("Duplicate capture group name"); + } + this.raise("Invalid group"); + } + return false; + } + consumeAtomEscape() { + if (this.consumeBackreference() || + this.consumeCharacterClassEscape() || + this.consumeCharacterEscape() || + (this._nFlag && this.consumeKGroupName())) { + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + return false; + } + consumeBackreference() { + const start = this.index; + if (this.eatDecimalEscape()) { + const n = this._lastIntValue; + if (n <= this._numCapturingParens) { + this.onBackreference(start - 1, this.index, n); + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeCharacterClassEscape() { + const start = this.index; + if (this.eat(LatinSmallLetterD)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", false); + return true; + } + if (this.eat(LatinCapitalLetterD)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", true); + return true; + } + if (this.eat(LatinSmallLetterS)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", false); + return true; + } + if (this.eat(LatinCapitalLetterS)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", true); + return true; + } + if (this.eat(LatinSmallLetterW)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", false); + return true; + } + if (this.eat(LatinCapitalLetterW)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", true); + return true; + } + let negate = false; + if (this._uFlag && + this.ecmaVersion >= 2018 && + (this.eat(LatinSmallLetterP) || + (negate = this.eat(LatinCapitalLetterP)))) { + this._lastIntValue = -1; + if (this.eat(LeftCurlyBracket) && + this.eatUnicodePropertyValueExpression() && + this.eat(RightCurlyBracket)) { + this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate); + return true; + } + this.raise("Invalid property name"); + } + return false; + } + consumeCharacterEscape() { + const start = this.index; + if (this.eatControlEscape() || + this.eatCControlLetter() || + this.eatZero() || + this.eatHexEscapeSequence() || + this.eatRegExpUnicodeEscapeSequence() || + (!this.strict && + !this._uFlag && + this.eatLegacyOctalEscapeSequence()) || + this.eatIdentityEscape()) { + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return false; + } + consumeKGroupName() { + const start = this.index; + if (this.eat(LatinSmallLetterK)) { + if (this.eatGroupName()) { + const groupName = this._lastStrValue; + this._backreferenceNames.add(groupName); + this.onBackreference(start - 1, this.index, groupName); + return true; + } + this.raise("Invalid named reference"); + } + return false; + } + consumeCharacterClass() { + const start = this.index; + if (this.eat(LeftSquareBracket)) { + const negate = this.eat(CircumflexAccent); + this.onCharacterClassEnter(start, negate); + this.consumeClassRanges(); + if (!this.eat(RightSquareBracket)) { + this.raise("Unterminated character class"); + } + this.onCharacterClassLeave(start, this.index, negate); + return true; + } + return false; + } + consumeClassRanges() { + const strict = this.strict || this._uFlag; + for (;;) { + const rangeStart = this.index; + if (!this.consumeClassAtom()) { + break; + } + const min = this._lastIntValue; + if (!this.eat(HyphenMinus)) { + continue; + } + this.onCharacter(this.index - 1, this.index, HyphenMinus); + if (!this.consumeClassAtom()) { + break; + } + const max = this._lastIntValue; + if (min === -1 || max === -1) { + if (strict) { + this.raise("Invalid character class"); + } + continue; + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(rangeStart, this.index, min, max); + } + } + consumeClassAtom() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && cp !== ReverseSolidus && cp !== RightSquareBracket) { + this.advance(); + this._lastIntValue = cp; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(ReverseSolidus)) { + if (this.consumeClassEscape()) { + return true; + } + if (!this.strict && this.currentCodePoint === LatinSmallLetterC) { + this._lastIntValue = ReverseSolidus; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.strict || this._uFlag) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeClassEscape() { + const start = this.index; + if (this.eat(LatinSmallLetterB)) { + this._lastIntValue = Backspace; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + if (this._uFlag && this.eat(HyphenMinus)) { + this._lastIntValue = HyphenMinus; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + let cp = 0; + if (!this.strict && + !this._uFlag && + this.currentCodePoint === LatinSmallLetterC && + (isDecimalDigit((cp = this.nextCodePoint)) || cp === LowLine)) { + this.advance(); + this.advance(); + this._lastIntValue = cp % 0x20; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return (this.consumeCharacterClassEscape() || this.consumeCharacterEscape()); + } + eatGroupName() { + if (this.eat(LessThanSign)) { + if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) { + return true; + } + this.raise("Invalid capture group name"); + } + return false; + } + eatRegExpIdentifierName() { + if (this.eatRegExpIdentifierStart()) { + this._lastStrValue = String.fromCodePoint(this._lastIntValue); + while (this.eatRegExpIdentifierPart()) { + this._lastStrValue += String.fromCodePoint(this._lastIntValue); + } + return true; + } + return false; + } + eatRegExpIdentifierStart() { + const start = this.index; + const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === ReverseSolidus && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isRegExpIdentifierStart(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatRegExpIdentifierPart() { + const start = this.index; + const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === ReverseSolidus && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isRegExpIdentifierPart(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatCControlLetter() { + const start = this.index; + if (this.eat(LatinSmallLetterC)) { + if (this.eatControlLetter()) { + return true; + } + this.rewind(start); + } + return false; + } + eatZero() { + if (this.currentCodePoint === DigitZero && + !isDecimalDigit(this.nextCodePoint)) { + this._lastIntValue = 0; + this.advance(); + return true; + } + return false; + } + eatControlEscape() { + if (this.eat(LatinSmallLetterF)) { + this._lastIntValue = FormFeed; + return true; + } + if (this.eat(LatinSmallLetterN)) { + this._lastIntValue = LineFeed; + return true; + } + if (this.eat(LatinSmallLetterR)) { + this._lastIntValue = CarriageReturn; + return true; + } + if (this.eat(LatinSmallLetterT)) { + this._lastIntValue = CharacterTabulation; + return true; + } + if (this.eat(LatinSmallLetterV)) { + this._lastIntValue = LineTabulation; + return true; + } + return false; + } + eatControlLetter() { + const cp = this.currentCodePoint; + if (isLatinLetter(cp)) { + this.advance(); + this._lastIntValue = cp % 0x20; + return true; + } + return false; + } + eatRegExpUnicodeEscapeSequence(forceUFlag = false) { + const start = this.index; + const uFlag = forceUFlag || this._uFlag; + if (this.eat(LatinSmallLetterU)) { + if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) || + this.eatFixedHexDigits(4) || + (uFlag && this.eatRegExpUnicodeCodePointEscape())) { + return true; + } + if (this.strict || uFlag) { + this.raise("Invalid unicode escape"); + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeSurrogatePairEscape() { + const start = this.index; + if (this.eatFixedHexDigits(4)) { + const lead = this._lastIntValue; + if (isLeadSurrogate(lead) && + this.eat(ReverseSolidus) && + this.eat(LatinSmallLetterU) && + this.eatFixedHexDigits(4)) { + const trail = this._lastIntValue; + if (isTrailSurrogate(trail)) { + this._lastIntValue = combineSurrogatePair(lead, trail); + return true; + } + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeCodePointEscape() { + const start = this.index; + if (this.eat(LeftCurlyBracket) && + this.eatHexDigits() && + this.eat(RightCurlyBracket) && + isValidUnicode(this._lastIntValue)) { + return true; + } + this.rewind(start); + return false; + } + eatIdentityEscape() { + const cp = this.currentCodePoint; + if (this.isValidIdentityEscape(cp)) { + this._lastIntValue = cp; + this.advance(); + return true; + } + return false; + } + isValidIdentityEscape(cp) { + if (cp === -1) { + return false; + } + if (this._uFlag) { + return isSyntaxCharacter(cp) || cp === Solidus; + } + if (this.strict) { + return !isIdContinue(cp); + } + if (this._nFlag) { + return !(cp === LatinSmallLetterC || cp === LatinSmallLetterK); + } + return cp !== LatinSmallLetterC; + } + eatDecimalEscape() { + this._lastIntValue = 0; + let cp = this.currentCodePoint; + if (cp >= DigitOne && cp <= DigitNine) { + do { + this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero); + this.advance(); + } while ((cp = this.currentCodePoint) >= DigitZero && + cp <= DigitNine); + return true; + } + return false; + } + eatUnicodePropertyValueExpression() { + const start = this.index; + if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) { + this._lastKeyValue = this._lastStrValue; + if (this.eatUnicodePropertyValue()) { + this._lastValValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, this._lastKeyValue, this._lastValValue)) { + return true; + } + this.raise("Invalid property name"); + } + } + this.rewind(start); + if (this.eatLoneUnicodePropertyNameOrValue()) { + const nameOrValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { + this._lastKeyValue = "General_Category"; + this._lastValValue = nameOrValue; + return true; + } + if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { + this._lastKeyValue = nameOrValue; + this._lastValValue = ""; + return true; + } + this.raise("Invalid property name"); + } + return false; + } + eatUnicodePropertyName() { + this._lastStrValue = ""; + while (isUnicodePropertyNameCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatUnicodePropertyValue() { + this._lastStrValue = ""; + while (isUnicodePropertyValueCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatLoneUnicodePropertyNameOrValue() { + return this.eatUnicodePropertyValue(); + } + eatHexEscapeSequence() { + const start = this.index; + if (this.eat(LatinSmallLetterX)) { + if (this.eatFixedHexDigits(2)) { + return true; + } + if (this._uFlag || this.strict) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + eatDecimalDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isDecimalDigit(this.currentCodePoint)) { + this._lastIntValue = + 10 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatHexDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isHexDigit(this.currentCodePoint)) { + this._lastIntValue = + 16 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatLegacyOctalEscapeSequence() { + if (this.eatOctalDigit()) { + const n1 = this._lastIntValue; + if (this.eatOctalDigit()) { + const n2 = this._lastIntValue; + if (n1 <= 3 && this.eatOctalDigit()) { + this._lastIntValue = n1 * 64 + n2 * 8 + this._lastIntValue; + } + else { + this._lastIntValue = n1 * 8 + n2; + } + } + else { + this._lastIntValue = n1; + } + return true; + } + return false; + } + eatOctalDigit() { + const cp = this.currentCodePoint; + if (isOctalDigit(cp)) { + this.advance(); + this._lastIntValue = cp - DigitZero; + return true; + } + this._lastIntValue = 0; + return false; + } + eatFixedHexDigits(length) { + const start = this.index; + this._lastIntValue = 0; + for (let i = 0; i < length; ++i) { + const cp = this.currentCodePoint; + if (!isHexDigit(cp)) { + this.rewind(start); + return false; + } + this._lastIntValue = 16 * this._lastIntValue + digitToInt(cp); + this.advance(); + } + return true; + } +} + +const DummyPattern = {}; +const DummyFlags = {}; +const DummyCapturingGroup = {}; +class RegExpParserState { + constructor(options) { + this._node = DummyPattern; + this._flags = DummyFlags; + this._backreferences = []; + this._capturingGroups = []; + this.source = ""; + this.strict = Boolean(options && options.strict); + this.ecmaVersion = (options && options.ecmaVersion) || 2022; + } + get pattern() { + if (this._node.type !== "Pattern") { + throw new Error("UnknownError"); + } + return this._node; + } + get flags() { + if (this._flags.type !== "Flags") { + throw new Error("UnknownError"); + } + return this._flags; + } + onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) { + this._flags = { + type: "Flags", + parent: null, + start, + end, + raw: this.source.slice(start, end), + global, + ignoreCase, + multiline, + unicode, + sticky, + dotAll, + hasIndices, + }; + } + onPatternEnter(start) { + this._node = { + type: "Pattern", + parent: null, + start, + end: start, + raw: "", + alternatives: [], + }; + this._backreferences.length = 0; + this._capturingGroups.length = 0; + } + onPatternLeave(start, end) { + this._node.end = end; + this._node.raw = this.source.slice(start, end); + for (const reference of this._backreferences) { + const ref = reference.ref; + const group = typeof ref === "number" + ? this._capturingGroups[ref - 1] + : this._capturingGroups.find(g => g.name === ref); + reference.resolved = group; + group.references.push(reference); + } + } + onAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "Assertion" && + parent.type !== "CapturingGroup" && + parent.type !== "Group" && + parent.type !== "Pattern") { + throw new Error("UnknownError"); + } + this._node = { + type: "Alternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onGroupEnter(start) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "Group", + parent, + start, + end: start, + raw: "", + alternatives: [], + }; + parent.elements.push(this._node); + } + onGroupLeave(start, end) { + const node = this._node; + if (node.type !== "Group" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onCapturingGroupEnter(start, name) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CapturingGroup", + parent, + start, + end: start, + raw: "", + name, + alternatives: [], + references: [], + }; + parent.elements.push(this._node); + this._capturingGroups.push(this._node); + } + onCapturingGroupLeave(start, end) { + const node = this._node; + if (node.type !== "CapturingGroup" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onQuantifier(start, end, min, max, greedy) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const element = parent.elements.pop(); + if (element == null || + element.type === "Quantifier" || + (element.type === "Assertion" && element.kind !== "lookahead")) { + throw new Error("UnknownError"); + } + const node = { + type: "Quantifier", + parent, + start: element.start, + end, + raw: this.source.slice(element.start, end), + min, + max, + greedy, + element, + }; + parent.elements.push(node); + element.parent = node; + } + onLookaroundAssertionEnter(start, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = (this._node = { + type: "Assertion", + parent, + start, + end: start, + raw: "", + kind, + negate, + alternatives: [], + }); + parent.elements.push(node); + } + onLookaroundAssertionLeave(start, end) { + const node = this._node; + if (node.type !== "Assertion" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onEdgeAssertion(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onWordBoundaryAssertion(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onAnyCharacterSet(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onEscapeCharacterSet(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + key, + value, + negate, + }); + } + onCharacter(start, end, value) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Character", + parent, + start, + end, + raw: this.source.slice(start, end), + value, + }); + } + onBackreference(start, end, ref) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = { + type: "Backreference", + parent, + start, + end, + raw: this.source.slice(start, end), + ref, + resolved: DummyCapturingGroup, + }; + parent.elements.push(node); + this._backreferences.push(node); + } + onCharacterClassEnter(start, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CharacterClass", + parent, + start, + end: start, + raw: "", + negate, + elements: [], + }; + parent.elements.push(this._node); + } + onCharacterClassLeave(start, end) { + const node = this._node; + if (node.type !== "CharacterClass" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onCharacterClassRange(start, end) { + const parent = this._node; + if (parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const elements = parent.elements; + const max = elements.pop(); + const hyphen = elements.pop(); + const min = elements.pop(); + if (!min || + !max || + !hyphen || + min.type !== "Character" || + max.type !== "Character" || + hyphen.type !== "Character" || + hyphen.value !== HyphenMinus) { + throw new Error("UnknownError"); + } + const node = { + type: "CharacterClassRange", + parent, + start, + end, + raw: this.source.slice(start, end), + min, + max, + }; + min.parent = node; + max.parent = node; + elements.push(node); + } +} +class RegExpParser { + constructor(options) { + this._state = new RegExpParserState(options); + this._validator = new RegExpValidator(this._state); + } + parseLiteral(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateLiteral(source, start, end); + const pattern = this._state.pattern; + const flags = this._state.flags; + const literal = { + type: "RegExpLiteral", + parent: null, + start, + end, + raw: source, + pattern, + flags, + }; + pattern.parent = literal; + flags.parent = literal; + return literal; + } + parseFlags(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateFlags(source, start, end); + return this._state.flags; + } + parsePattern(source, start = 0, end = source.length, uFlag = false) { + this._state.source = source; + this._validator.validatePattern(source, start, end, uFlag); + return this._state.pattern; + } +} + +class RegExpVisitor { + constructor(handlers) { + this._handlers = handlers; + } + visit(node) { + switch (node.type) { + case "Alternative": + this.visitAlternative(node); + break; + case "Assertion": + this.visitAssertion(node); + break; + case "Backreference": + this.visitBackreference(node); + break; + case "CapturingGroup": + this.visitCapturingGroup(node); + break; + case "Character": + this.visitCharacter(node); + break; + case "CharacterClass": + this.visitCharacterClass(node); + break; + case "CharacterClassRange": + this.visitCharacterClassRange(node); + break; + case "CharacterSet": + this.visitCharacterSet(node); + break; + case "Flags": + this.visitFlags(node); + break; + case "Group": + this.visitGroup(node); + break; + case "Pattern": + this.visitPattern(node); + break; + case "Quantifier": + this.visitQuantifier(node); + break; + case "RegExpLiteral": + this.visitRegExpLiteral(node); + break; + default: + throw new Error(`Unknown type: ${node.type}`); + } + } + visitAlternative(node) { + if (this._handlers.onAlternativeEnter) { + this._handlers.onAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onAlternativeLeave) { + this._handlers.onAlternativeLeave(node); + } + } + visitAssertion(node) { + if (this._handlers.onAssertionEnter) { + this._handlers.onAssertionEnter(node); + } + if (node.kind === "lookahead" || node.kind === "lookbehind") { + node.alternatives.forEach(this.visit, this); + } + if (this._handlers.onAssertionLeave) { + this._handlers.onAssertionLeave(node); + } + } + visitBackreference(node) { + if (this._handlers.onBackreferenceEnter) { + this._handlers.onBackreferenceEnter(node); + } + if (this._handlers.onBackreferenceLeave) { + this._handlers.onBackreferenceLeave(node); + } + } + visitCapturingGroup(node) { + if (this._handlers.onCapturingGroupEnter) { + this._handlers.onCapturingGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onCapturingGroupLeave) { + this._handlers.onCapturingGroupLeave(node); + } + } + visitCharacter(node) { + if (this._handlers.onCharacterEnter) { + this._handlers.onCharacterEnter(node); + } + if (this._handlers.onCharacterLeave) { + this._handlers.onCharacterLeave(node); + } + } + visitCharacterClass(node) { + if (this._handlers.onCharacterClassEnter) { + this._handlers.onCharacterClassEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onCharacterClassLeave) { + this._handlers.onCharacterClassLeave(node); + } + } + visitCharacterClassRange(node) { + if (this._handlers.onCharacterClassRangeEnter) { + this._handlers.onCharacterClassRangeEnter(node); + } + this.visitCharacter(node.min); + this.visitCharacter(node.max); + if (this._handlers.onCharacterClassRangeLeave) { + this._handlers.onCharacterClassRangeLeave(node); + } + } + visitCharacterSet(node) { + if (this._handlers.onCharacterSetEnter) { + this._handlers.onCharacterSetEnter(node); + } + if (this._handlers.onCharacterSetLeave) { + this._handlers.onCharacterSetLeave(node); + } + } + visitFlags(node) { + if (this._handlers.onFlagsEnter) { + this._handlers.onFlagsEnter(node); + } + if (this._handlers.onFlagsLeave) { + this._handlers.onFlagsLeave(node); + } + } + visitGroup(node) { + if (this._handlers.onGroupEnter) { + this._handlers.onGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onGroupLeave) { + this._handlers.onGroupLeave(node); + } + } + visitPattern(node) { + if (this._handlers.onPatternEnter) { + this._handlers.onPatternEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onPatternLeave) { + this._handlers.onPatternLeave(node); + } + } + visitQuantifier(node) { + if (this._handlers.onQuantifierEnter) { + this._handlers.onQuantifierEnter(node); + } + this.visit(node.element); + if (this._handlers.onQuantifierLeave) { + this._handlers.onQuantifierLeave(node); + } + } + visitRegExpLiteral(node) { + if (this._handlers.onRegExpLiteralEnter) { + this._handlers.onRegExpLiteralEnter(node); + } + this.visitPattern(node.pattern); + this.visitFlags(node.flags); + if (this._handlers.onRegExpLiteralLeave) { + this._handlers.onRegExpLiteralLeave(node); + } + } +} + +function parseRegExpLiteral(source, options) { + return new RegExpParser(options).parseLiteral(String(source)); +} +function validateRegExpLiteral(source, options) { + return new RegExpValidator(options).validateLiteral(source); +} +function visitRegExpAST(node, handlers) { + new RegExpVisitor(handlers).visit(node); +} + +export { ast as AST, RegExpParser, RegExpValidator, parseRegExpLiteral, validateRegExpLiteral, visitRegExpAST }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/regexpp/index.mjs.map b/node_modules/regexpp/index.mjs.map new file mode 100644 index 0000000..4263dfa --- /dev/null +++ b/node_modules/regexpp/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs.map","sources":[".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/reader.ts",".temp/src/regexp-syntax-error.ts",".temp/src/validator.ts",".temp/src/parser.ts",".temp/src/visitor.ts",".temp/src/index.ts"],"sourcesContent":[{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\ids.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\properties.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\unicode\\src\\unicode\\index.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\reader.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\regexp-syntax-error.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\validator.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\parser.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\visitor.ts"},{"errno":-4058,"code":"ENOENT","syscall":"open","path":"C:\\Users\\t-nagashima.MSS\\dev\\regexpp\\.temp\\src\\index.ts"}],"names":[],"mappings":";;;;;;;AAIA,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAE3D,SAAgB,SAAS,CAAC,EAAU;IAChC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,KAA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C,iBAAiB,EAAE;YAClC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;SACzC;KACJ;IACO,kBAAkB,CAAC,IAAmB;QAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;SAC5C;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;SAC5C;KACJ;CACJ;;SCzLe,kBAAkB,CAC9B,MAAuB,EACvB,OAA8B;IAE9B,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;CAChE;AAOD,SAAgB,qBAAqB,CACjC,MAAc,EACd,OAAiC;IAEjC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;CAC9D;AAED,SAAgB,cAAc,CAC1B,IAAc,EACd,QAAgC;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;CAC1C;;;;"} \ No newline at end of file diff --git a/node_modules/regexpp/package.json b/node_modules/regexpp/package.json new file mode 100644 index 0000000..92dadd8 --- /dev/null +++ b/node_modules/regexpp/package.json @@ -0,0 +1,91 @@ +{ + "name": "regexpp", + "version": "3.2.0", + "description": "Regular expression parser for ECMAScript.", + "engines": { + "node": ">=8" + }, + "main": "index", + "files": [ + "index.*" + ], + "exports": { + ".": { + "import": "./index.mjs", + "default": "./index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": {}, + "devDependencies": { + "@mysticatea/eslint-plugin": "^11.0.0", + "@types/eslint": "^4.16.2", + "@types/jsdom": "^12.2.4", + "@types/mocha": "^5.2.2", + "@types/node": "^12.6.8", + "codecov": "^3.5.0", + "dts-bundle": "^0.7.3", + "eslint": "^6.1.0", + "jsdom": "^15.1.1", + "mocha": "^6.2.0", + "npm-run-all": "^4.1.5", + "nyc": "^14.1.1", + "rimraf": "^2.6.2", + "rollup": "^1.17.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "ts-node": "^8.3.0", + "typescript": "^3.5.3" + }, + "scripts": { + "prebuild": "npm run -s clean", + "build": "run-s build:*", + "build:tsc": "tsc --module es2015", + "build:rollup": "rollup -c", + "build:dts": "dts-bundle --name regexpp --main .temp/index.d.ts --out ../index.d.ts", + "clean": "rimraf .temp index.*", + "codecov": "nyc report -r lcovonly && codecov -t ${CODECOV_TOKEN} --disable=gcov", + "lint": "eslint scripts src test --ext .ts", + "pretest": "run-s build lint", + "test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000", + "update:test": "ts-node scripts/update-fixtures.ts", + "update:unicode": "run-s update:unicode:*", + "update:unicode:ids": "ts-node scripts/update-unicode-ids.ts", + "update:unicode:props": "ts-node scripts/update-unicode-properties.ts", + "preversion": "npm test", + "version": "npm run -s build", + "postversion": "git push && git push --tags", + "prewatch": "npm run -s clean", + "watch": "_mocha \"test/*.ts\" --require ts-node/register --reporter dot --timeout 10000 --watch-extensions ts --watch --growl" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mysticatea/regexpp.git" + }, + "keywords": [ + "regexp", + "regular", + "expression", + "parser", + "validator", + "ast", + "abstract", + "syntax", + "tree", + "ecmascript", + "es2015", + "es2016", + "es2017", + "es2018", + "es2019", + "es2020", + "annexB" + ], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "MIT", + "bugs": { + "url": "https://github.com/mysticatea/regexpp/issues" + }, + "homepage": "https://github.com/mysticatea/regexpp#readme", + "funding": "https://github.com/sponsors/mysticatea" +} diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js new file mode 100644 index 0000000..d092447 --- /dev/null +++ b/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDir, moduleId, silent) => { + if (typeof fromDir !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDir = fs.realpathSync(fromDir); + } catch (err) { + if (err.code === 'ENOENT') { + fromDir = path.resolve(fromDir); + } else if (silent) { + return null; + } else { + throw err; + } + } + + const fromFile = path.join(fromDir, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (err) { + return null; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); +module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); diff --git a/node_modules/resolve-from/license b/node_modules/resolve-from/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/resolve-from/license @@ -0,0 +1,9 @@ +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/resolve-from/package.json b/node_modules/resolve-from/package.json new file mode 100644 index 0000000..96bade5 --- /dev/null +++ b/node_modules/resolve-from/package.json @@ -0,0 +1,34 @@ +{ + "name": "resolve-from", + "version": "4.0.0", + "description": "Resolve the path of a module like `require.resolve()` but from a given path", + "license": "MIT", + "repository": "sindresorhus/resolve-from", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/resolve-from/readme.md b/node_modules/resolve-from/readme.md new file mode 100644 index 0000000..e539f85 --- /dev/null +++ b/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDir, moduleId) + +Returns `null` instead of throwing when the module can't be found. + +#### fromDir + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/resolve/.editorconfig b/node_modules/resolve/.editorconfig new file mode 100644 index 0000000..d63f0bb --- /dev/null +++ b/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[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/.eslintrc b/node_modules/resolve/.eslintrc new file mode 100644 index 0000000..ce1be6e --- /dev/null +++ b/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 30 }], + "max-lines": [2, 350], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/node_modules/resolve/.github/FUNDING.yml b/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 0000000..d9c0595 --- /dev/null +++ b/node_modules/resolve/.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/resolve +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/resolve/LICENSE b/node_modules/resolve/LICENSE new file mode 100644 index 0000000..ff4fce2 --- /dev/null +++ b/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +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/resolve/SECURITY.md b/node_modules/resolve/SECURITY.md new file mode 100644 index 0000000..82e4285 --- /dev/null +++ b/node_modules/resolve/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/node_modules/resolve/async.js b/node_modules/resolve/async.js new file mode 100644 index 0000000..f38c581 --- /dev/null +++ b/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/node_modules/resolve/bin/resolve b/node_modules/resolve/bin/resolve new file mode 100755 index 0000000..5ee329a --- /dev/null +++ b/node_modules/resolve/bin/resolve @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +if ( + String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve ' + && ( + !process.argv + || process.argv.length < 2 + || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino) + || (process.env._ && path.resolve(process.env._) !== __filename) + ) +) { + console.error('Error: `resolve` must be run directly as an executable'); + process.exit(1); +} + +var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag'); + +var preserveSymlinks = false; +for (var i = 2; i < process.argv.length; i += 1) { + if (process.argv[i].slice(0, 2) === '--') { + if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') { + preserveSymlinks = true; + } else if (process.argv[i].length > 2) { + console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, '')); + process.exit(2); + } + process.argv.splice(i, 1); + i -= 1; + if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax + } +} + +if (process.argv.length < 3) { + console.error('Error: `resolve` expects a specifier'); + process.exit(2); +} + +var resolve = require('../'); + +var result = resolve.sync(process.argv[2], { + basedir: process.cwd(), + preserveSymlinks: preserveSymlinks +}); + +console.log(result); diff --git a/node_modules/resolve/example/async.js b/node_modules/resolve/example/async.js new file mode 100644 index 0000000..20e65dc --- /dev/null +++ b/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/node_modules/resolve/example/sync.js b/node_modules/resolve/example/sync.js new file mode 100644 index 0000000..54b2cc1 --- /dev/null +++ b/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/node_modules/resolve/index.js b/node_modules/resolve/index.js new file mode 100644 index 0000000..125d814 --- /dev/null +++ b/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/node_modules/resolve/lib/async.js b/node_modules/resolve/lib/async.js new file mode 100644 index 0000000..60d2555 --- /dev/null +++ b/node_modules/resolve/lib/async.js @@ -0,0 +1,329 @@ +var fs = require('fs'); +var getHomedir = require('./homedir'); +var path = require('path'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var readPackage = opts.readPackage || defaultReadPackage; + if (opts.readFile && opts.readPackage) { + var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.'); + return process.nextTick(function () { + cb(conflictErr); + }); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) return cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; diff --git a/node_modules/resolve/lib/caller.js b/node_modules/resolve/lib/caller.js new file mode 100644 index 0000000..b14a280 --- /dev/null +++ b/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/node_modules/resolve/lib/core.js b/node_modules/resolve/lib/core.js new file mode 100644 index 0000000..ecc5b2e --- /dev/null +++ b/node_modules/resolve/lib/core.js @@ -0,0 +1,52 @@ +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + +function specifierIncluded(specifier) { + 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(current[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; + } else if (op === '>=') { + return cur >= ver; + } + return false; + } + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { return false; } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { return false; } + } + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { return specifierValue; } + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { return true; } + } + return false; + } + return matchesRange(specifierValue); +} + +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); + } +} +module.exports = core; diff --git a/node_modules/resolve/lib/core.json b/node_modules/resolve/lib/core.json new file mode 100644 index 0000000..058584b --- /dev/null +++ b/node_modules/resolve/lib/core.json @@ -0,0 +1,153 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "node:test": ">= 18", + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/node_modules/resolve/lib/homedir.js b/node_modules/resolve/lib/homedir.js new file mode 100644 index 0000000..5ffdf73 --- /dev/null +++ b/node_modules/resolve/lib/homedir.js @@ -0,0 +1,24 @@ +'use strict'; + +var os = require('os'); + +// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js + +module.exports = os.homedir || function homedir() { + var home = process.env.HOME; + var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME; + + if (process.platform === 'win32') { + return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens + } + + return home || null; +}; diff --git a/node_modules/resolve/lib/is-core.js b/node_modules/resolve/lib/is-core.js new file mode 100644 index 0000000..537f5c7 --- /dev/null +++ b/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/node_modules/resolve/lib/node-modules-paths.js b/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 0000000..1cff010 --- /dev/null +++ b/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,42 @@ +var path = require('path'); +var parse = path.parse || require('path-parse'); // eslint-disable-line global-require + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/node_modules/resolve/lib/normalize-options.js b/node_modules/resolve/lib/normalize-options.js new file mode 100644 index 0000000..4b56904 --- /dev/null +++ b/node_modules/resolve/lib/normalize-options.js @@ -0,0 +1,10 @@ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; diff --git a/node_modules/resolve/lib/sync.js b/node_modules/resolve/lib/sync.js new file mode 100644 index 0000000..0b6cd58 --- /dev/null +++ b/node_modules/resolve/lib/sync.js @@ -0,0 +1,208 @@ +var isCore = require('is-core-module'); +var fs = require('fs'); +var path = require('path'); +var getHomedir = require('./homedir'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && (stat.isFile() || stat.isFIFO()); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; + if (opts.readFileSync && opts.readPackageSync) { + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var pkg = readPackageSync(readFileSync, pkgfile); + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var pkg = readPackageSync(readFileSync, pkgfile); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; diff --git a/node_modules/resolve/package.json b/node_modules/resolve/package.json new file mode 100644 index 0000000..7177e0f --- /dev/null +++ b/node_modules/resolve/package.json @@ -0,0 +1,71 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.1", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "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 && aud --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "array.prototype.map": "^1.0.4", + "aud": "^2.0.0", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "npmignore": "^0.3.0", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tap": "0.4.13", + "tape": "^5.5.3", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "appveyor.yml" + ] + } +} diff --git a/node_modules/resolve/readme.markdown b/node_modules/resolve/readme.markdown new file mode 100644 index 0000000..ad34d60 --- /dev/null +++ b/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + 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); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/node_modules/resolve/sync.js b/node_modules/resolve/sync.js new file mode 100644 index 0000000..cd0ee04 --- /dev/null +++ b/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/node_modules/resolve/test/core.js b/node_modules/resolve/test/core.js new file mode 100644 index 0000000..a477adc --- /dev/null +++ b/node_modules/resolve/test/core.js @@ -0,0 +1,88 @@ +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); + +var resolve = require('../'); + +var brokenNode = semver.satisfies(process.version, '11.11 - 11.13'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + // note: this must be require, not require.resolve, due to https://github.com/nodejs/node/issues/43274 + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + t.comment(mod + ': ' + resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else if (brokenNode) { + st.ok(true, 'this version of node is broken: attempting to require things that fail to resolve breaks "home_paths" tests'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[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: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_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 (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[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/resolve/test/dotdot.js b/node_modules/resolve/test/dotdot.js new file mode 100644 index 0000000..3080665 --- /dev/null +++ b/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 0000000..67f2534 --- /dev/null +++ b/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/node_modules/resolve/test/dotdot/index.js b/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 0000000..643f9fc --- /dev/null +++ b/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/node_modules/resolve/test/faulty_basedir.js b/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 0000000..5f2141a --- /dev/null +++ b/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/node_modules/resolve/test/filter.js b/node_modules/resolve/test/filter.js new file mode 100644 index 0000000..8f8cccd --- /dev/null +++ b/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/node_modules/resolve/test/filter_sync.js b/node_modules/resolve/test/filter_sync.js new file mode 100644 index 0000000..8a43b98 --- /dev/null +++ b/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/node_modules/resolve/test/home_paths.js b/node_modules/resolve/test/home_paths.js new file mode 100644 index 0000000..3b8c9b3 --- /dev/null +++ b/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/node_modules/resolve/test/home_paths_sync.js b/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 0000000..5d2c56f --- /dev/null +++ b/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/node_modules/resolve/test/mock.js b/node_modules/resolve/test/mock.js new file mode 100644 index 0000000..6116275 --- /dev/null +++ b/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/node_modules/resolve/test/mock_sync.js b/node_modules/resolve/test/mock_sync.js new file mode 100644 index 0000000..c5a7e2a --- /dev/null +++ b/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/node_modules/resolve/test/module_dir.js b/node_modules/resolve/test/module_dir.js new file mode 100644 index 0000000..b50e5bb --- /dev/null +++ b/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 0000000..dd7cf7b --- /dev/null +++ b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 0000000..ef2d4d4 --- /dev/null +++ b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 0000000..e8ba629 --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 0000000..c13b8cf --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/node_modules/resolve/test/node-modules-paths.js b/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 0000000..675441d --- /dev/null +++ b/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/node_modules/resolve/test/node_path.js b/node_modules/resolve/test/node_path.js new file mode 100644 index 0000000..e463d6c --- /dev/null +++ b/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 0000000..ad70d0b --- /dev/null +++ b/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 0000000..a64132e --- /dev/null +++ b/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 0000000..4d0f32e --- /dev/null +++ b/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 0000000..793315e --- /dev/null +++ b/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/node_modules/resolve/test/nonstring.js b/node_modules/resolve/test/nonstring.js new file mode 100644 index 0000000..ef63c40 --- /dev/null +++ b/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/pathfilter.js b/node_modules/resolve/test/pathfilter.js new file mode 100644 index 0000000..16519ae --- /dev/null +++ b/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/precedence.js b/node_modules/resolve/test/precedence.js new file mode 100644 index 0000000..2febb59 --- /dev/null +++ b/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/precedence/aaa.js b/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 0000000..b83a3e7 --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 0000000..e0f8f6a --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 0000000..93542a9 --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/node_modules/resolve/test/precedence/bbb.js b/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 0000000..2298f47 --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 0000000..716b81d --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/node_modules/resolve/test/resolver.js b/node_modules/resolve/test/resolver.js new file mode 100644 index 0000000..4903165 --- /dev/null +++ b/node_modules/resolve/test/resolver.js @@ -0,0 +1,595 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('missing index', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) { + t.ok(err instanceof Error); + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('missing main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('null main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + + resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + }); +}); + +test('main: false', function (t) { + t.plan(2); + + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + resolve('./false_main', { basedir: basedir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal( + res, + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + t.deepEqual(pkg, { + name: 'false_main', + main: false + }); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +test('malformed package.json', function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/baz/package.json b/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 0000000..2f77720 --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/browser_field/a.js b/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/browser_field/b.js b/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/browser_field/package.json b/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 0000000..bf406f0 --- /dev/null +++ b/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/node_modules/resolve/test/resolver/cup.coffee b/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 0000000..d7f4fc8 --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 0000000..f51287b --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/node_modules/resolve/test/resolver/false_main/index.js b/node_modules/resolve/test/resolver/false_main/index.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/false_main/package.json b/node_modules/resolve/test/resolver/false_main/package.json new file mode 100644 index 0000000..a7416c0 --- /dev/null +++ b/node_modules/resolve/test/resolver/false_main/package.json @@ -0,0 +1,4 @@ +{ + "name": "false_main", + "main": false +} diff --git a/node_modules/resolve/test/resolver/foo.js b/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 0000000..bc1fb0a --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 0000000..b718804 --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/node_modules/resolve/test/resolver/invalid_main/package.json b/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 0000000..0590748 --- /dev/null +++ b/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/node_modules/resolve/test/resolver/malformed_package_json/index.js b/node_modules/resolve/test/resolver/malformed_package_json/index.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/malformed_package_json/package.json b/node_modules/resolve/test/resolver/malformed_package_json/package.json new file mode 100644 index 0000000..98232c6 --- /dev/null +++ b/node_modules/resolve/test/resolver/malformed_package_json/package.json @@ -0,0 +1 @@ +{ diff --git a/node_modules/resolve/test/resolver/mug.coffee b/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/mug.js b/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/multirepo/lerna.json b/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 0000000..d6707ca --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/node_modules/resolve/test/resolver/multirepo/package.json b/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 0000000..8508f9d --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 0000000..8875a32 --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 0000000..204de51 --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 0000000..f57c3b5 --- /dev/null +++ b/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 0000000..9b4846a --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 0000000..acfe9e9 --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 0000000..3283efc --- /dev/null +++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 0000000..888cae3 --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/symlinked/package/bar.js b/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 0000000..cb1c2c0 --- /dev/null +++ b/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/node_modules/resolve/test/resolver/symlinked/package/package.json b/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 0000000..8e1b585 --- /dev/null +++ b/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 0000000..5b31975 --- /dev/null +++ b/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/node_modules/resolve/test/resolver_sync.js b/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 0000000..53453d6 --- /dev/null +++ b/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,726 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('missing index', function (t) { + t.plan(requireResolveSupportsPaths ? 2 : 1); + + var resolverDir = path.join(__dirname, 'resolver'); + try { + resolve.sync('./missing_index', { basedir: resolverDir }); + t.fail('did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + require.resolve('./missing_index', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } +}); + +test('missing main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./missing_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('null main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + if (requireResolveSupportsPaths) { + try { + resolve.sync('./null_main', { basedir: resolverDir }); + t.fail('require.resolve did not fail'); + } catch (err) { + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code'); + } + } + + t.end(); +}); + +test('main: false', function (t) { + var basedir = path.join(__dirname, 'resolver'); + var dir = path.join(basedir, 'false_main'); + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + path.join(dir, 'index.js'), + '`"main": false`: resolves to `index.js`' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./false_main', { basedir: basedir }), + require.resolve('./false_main', { paths: [basedir] }), + '`"main": false`: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('malformed package.json', function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/node_modules/resolve/test/shadowed_core.js b/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 0000000..3a5f4fc --- /dev/null +++ b/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/subdirs.js b/node_modules/resolve/test/subdirs.js new file mode 100644 index 0000000..b7b8450 --- /dev/null +++ b/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/node_modules/resolve/test/symlinks.js b/node_modules/resolve/test/symlinks.js new file mode 100644 index 0000000..35f881a --- /dev/null +++ b/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +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.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/node_modules/rimraf/CHANGELOG.md b/node_modules/rimraf/CHANGELOG.md new file mode 100644 index 0000000..f116f14 --- /dev/null +++ b/node_modules/rimraf/CHANGELOG.md @@ -0,0 +1,65 @@ +# v3.0 + +- Add `--preserve-root` option to executable (default true) +- Drop support for Node.js below version 6 + +# v2.7 + +- Make `glob` an optional dependency + +# 2.6 + +- Retry on EBUSY on non-windows platforms as well +- Make `rimraf.sync` 10000% more reliable on Windows + +# 2.5 + +- Handle Windows EPERM when lstat-ing read-only dirs +- Add glob option to pass options to glob + +# 2.4 + +- Add EPERM to delay/retry loop +- Add `disableGlob` option + +# 2.3 + +- Make maxBusyTries and emfileWait configurable +- Handle weird SunOS unlink-dir issue +- Glob the CLI arg for better Windows support + +# 2.2 + +- Handle ENOENT properly on Windows +- Allow overriding fs methods +- Treat EPERM as indicative of non-empty dir +- Remove optional graceful-fs dep +- Consistently return null error instead of undefined on success +- win32: Treat ENOTEMPTY the same as EBUSY +- Add `rimraf` binary + +# 2.1 + +- Fix SunOS error code for a non-empty directory +- Try rmdir before readdir +- Treat EISDIR like EPERM +- Remove chmod +- Remove lstat polyfill, node 0.7 is not supported + +# 2.0 + +- Fix myGid call to check process.getgid +- Simplify the EBUSY backoff logic. +- Use fs.lstat in node >= 0.7.9 +- Remove gently option +- remove fiber implementation +- Delete files that are marked read-only + +# 1.0 + +- Allow ENOENT in sync method +- Throw when no callback is provided +- Make opts.gently an absolute path +- use 'stat' if 'lstat' is not available +- Consistent error naming, and rethrow non-ENOENT stat errors +- add fiber implementation diff --git a/node_modules/rimraf/LICENSE b/node_modules/rimraf/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/rimraf/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/rimraf/README.md b/node_modules/rimraf/README.md new file mode 100644 index 0000000..423b8cf --- /dev/null +++ b/node_modules/rimraf/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) + +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [opts], callback)` + +The first parameter will be interpreted as a globbing pattern for files. If you +want to disable globbing you can do so with `opts.disableGlob` (defaults to +`false`). This might be handy, for instance, if you have filenames that contain +globbing wildcard characters. + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. +* `ENOENT` - If the file doesn't exist, rimraf will return + successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. + +## options + +* unlink, chmod, stat, lstat, rmdir, readdir, + unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync + + In order to use a custom file system library, you can override + specific fs functions on the options object. + + If any of these functions are present on the options object, then + the supplied function will be used instead of the default fs + method. + + Sync methods are only relevant for `rimraf.sync()`, of course. + + For example: + + ```javascript + var myCustomFS = require('some-custom-fs') + + rimraf('some-thing', myCustomFS, callback) + ``` + +* maxBusyTries + + If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered + on Windows systems, then rimraf will retry with a linear backoff + wait of 100ms longer on each try. The default maxBusyTries is 3. + + Only relevant for async usage. + +* emfileWait + + If an `EMFILE` error is encountered, then rimraf will retry + repeatedly with a linear backoff of 1ms longer on each try, until + the timeout counter hits this max. The default limit is 1000. + + If you repeatedly encounter `EMFILE` errors, then consider using + [graceful-fs](http://npm.im/graceful-fs) in your program. + + Only relevant for async usage. + +* glob + + Set to `false` to disable [glob](http://npm.im/glob) pattern + matching. + + Set to an object to pass options to the glob module. The default + glob options are `{ nosort: true, silent: true }`. + + Glob version 6 is used in this module. + + Relevant for both sync and async usage. + +* disableGlob + + Set to any non-falsey value to disable globbing entirely. + (Equivalent to setting `glob: false`.) + +## rimraf.sync + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. + +## CLI + +If installed with `npm install rimraf -g` it can be used as a global +command `rimraf [ ...]` which is useful for cross platform support. + +## mkdirp + +If you need to create a directory recursively, check out +[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/node_modules/rimraf/bin.js b/node_modules/rimraf/bin.js new file mode 100755 index 0000000..023814c --- /dev/null +++ b/node_modules/rimraf/bin.js @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +const rimraf = require('./') + +const path = require('path') + +const isRoot = arg => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg)) +const filterOutRoot = arg => { + const ok = preserveRoot === false || !isRoot(arg) + if (!ok) { + console.error(`refusing to remove ${arg}`) + console.error('Set --no-preserve-root to allow this') + } + return ok +} + +let help = false +let dashdash = false +let noglob = false +let preserveRoot = true +const args = process.argv.slice(2).filter(arg => { + if (dashdash) + return !!arg + else if (arg === '--') + dashdash = true + else if (arg === '--no-glob' || arg === '-G') + noglob = true + else if (arg === '--glob' || arg === '-g') + noglob = false + else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) + help = true + else if (arg === '--preserve-root') + preserveRoot = true + else if (arg === '--no-preserve-root') + preserveRoot = false + else + return !!arg +}).filter(arg => !preserveRoot || filterOutRoot(arg)) + +const go = n => { + if (n >= args.length) + return + const options = noglob ? { glob: false } : {} + rimraf(args[n], options, er => { + if (er) + throw er + go(n+1) + }) +} + +if (help || args.length === 0) { + // If they didn't ask for help, then this is not a "success" + const log = help ? console.log : console.error + log('Usage: rimraf [ ...]') + log('') + log(' Deletes all files and folders at "path" recursively.') + log('') + log('Options:') + log('') + log(' -h, --help Display this usage info') + log(' -G, --no-glob Do not expand glob patterns in arguments') + log(' -g, --glob Expand glob patterns in arguments (default)') + log(' --preserve-root Do not remove \'/\' (default)') + log(' --no-preserve-root Do not treat \'/\' specially') + log(' -- Stop parsing flags') + process.exit(help ? 0 : 1) +} else + go(0) diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json new file mode 100644 index 0000000..1bf8d5e --- /dev/null +++ b/node_modules/rimraf/package.json @@ -0,0 +1,32 @@ +{ + "name": "rimraf", + "version": "3.0.2", + "main": "rimraf.js", + "description": "A deep deletion module for node (like `rm -rf`)", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": "git://github.com/isaacs/rimraf.git", + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "tap test/*.js" + }, + "bin": "./bin.js", + "dependencies": { + "glob": "^7.1.3" + }, + "files": [ + "LICENSE", + "README.md", + "bin.js", + "rimraf.js" + ], + "devDependencies": { + "mkdirp": "^0.5.1", + "tap": "^12.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js new file mode 100644 index 0000000..34da417 --- /dev/null +++ b/node_modules/rimraf/rimraf.js @@ -0,0 +1,360 @@ +const assert = require("assert") +const path = require("path") +const fs = require("fs") +let glob = undefined +try { + glob = require("glob") +} catch (_err) { + // treat glob as optional. +} + +const defaultGlobOpts = { + nosort: true, + silent: true +} + +// for EMFILE handling +let timeout = 0 + +const isWindows = (process.platform === "win32") + +const defaults = options => { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + if (options.disableGlob !== true && glob === undefined) { + throw Error('glob dependency not found, set `options.disableGlob = true` if intentional') + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} + +const rimraf = (p, options, cb) => { + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + let busyTries = 0 + let errState = null + let n = 0 + + const next = (er) => { + errState = errState || er + if (--n === 0) + cb(errState) + } + + const afterGlob = (er, results) => { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(p => { + const CB = (er) => { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), busyTries * 100) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(() => rimraf_(p, options, CB), timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + } + rimraf_(p, options, CB) + }) + } + + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) + + options.lstat(p, (er, stat) => { + if (!er) + return afterGlob(null, [p]) + + glob(p, options.glob, afterGlob) + }) + +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +const rimraf_ = (p, options, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === "ENOENT") + return cb(null) + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, er => { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} + +const fixWinEPERM = (p, options, er, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.chmod(p, 0o666, er2 => { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, (er3, stats) => { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} + +const fixWinEPERMSync = (p, options, er) => { + assert(p) + assert(options) + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } + + let stats + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} + +const rmdir = (p, options, originalEr, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) +} + +const rmkids = (p, options, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) + return cb(er) + let n = files.length + if (n === 0) + return options.rmdir(p, cb) + let errState + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +const rimrafSync = (p, options) => { + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + let results + + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } + } + + if (!results.length) + return + + for (let i = 0; i < results.length; i++) { + const p = results[i] + + let st + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + + rmdirSync(p, options, er) + } + } +} + +const rmdirSync = (p, options, originalEr) => { + assert(p) + assert(options) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} + +const rmkidsSync = (p, options) => { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const retries = isWindows ? 100 : 1 + let i = 0 + do { + let threw = true + try { + const ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} + +module.exports = rimraf +rimraf.sync = rimrafSync diff --git a/node_modules/semver/LICENSE b/node_modules/semver/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/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/semver/README.md b/node_modules/semver/README.md new file mode 100644 index 0000000..df54e7a --- /dev/null +++ b/node_modules/semver/README.md @@ -0,0 +1,568 @@ +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' +``` + +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: + +``` +$ 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-0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.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 non-prerelease version satisfies, unless + `includePrerelease` is specified, in which case any version at all + satisfies) +* `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-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-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 + 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` +* `^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-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. + +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.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` +* `^0.x` := `>=0.0.0 <1.0.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 +* `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 +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 `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 +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` + +## 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 new file mode 100755 index 0000000..8d1b557 --- /dev/null +++ b/node_modules/semver/bin/semver.js @@ -0,0 +1,183 @@ +#!/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. + +const argv = process.argv.slice(2) + +let versions = [] + +const range = [] + +let inc = null + +const version = require('../package.json').version + +let loose = false + +let includePrerelease = false + +let coerce = false + +let rtl = false + +let identifier + +const semver = require('../') + +let reverse = false + +let options = {} + +const main = () => { + if (!argv.length) { + return help() + } + while (argv.length) { + let a = argv.shift() + const indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + const value = a.slice(indexOfEqualSign + 1) + a = a.slice(0, indexOfEqualSign) + argv.unshift(value) + } + 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 + } + } + + options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map((v) => { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter((v) => { + return semver.valid(v) + }) + if (!versions.length) { + return fail() + } + if (inc && (versions.length !== 1 || range.length)) { + return failInc() + } + + 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() + } + } + return success(versions) +} + +const failInc = () => { + console.error('--inc can only be used on a single version with no range') + fail() +} + +const fail = () => process.exit(1) + +const success = () => { + const compare = reverse ? 'rcompare' : 'compare' + versions.sort((a, b) => { + return semver[compare](a, b, options) + }).map((v) => { + return semver.clean(v, options) + }).map((v) => { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach((v, i, _) => { + console.log(v) + }) +} + +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 0000000..62cd204 --- /dev/null +++ b/node_modules/semver/classes/comparator.js @@ -0,0 +1,136 @@ +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + + constructor (comp, options) { + options = parseOptions(options) + + 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 parseOptions = require('../internal/parse-options') +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 0000000..5e3f5c9 --- /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 0000000..7dc24bc --- /dev/null +++ b/node_modules/semver/classes/range.js @@ -0,0 +1,519 @@ +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + 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('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.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}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.format() + } + + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + range = range.trim() + + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = Object.keys(this.options).join(',') + const memoKey = `parseRange:${memoOpts}:${range}` + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `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) + + // `~ 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. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + 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 LRU = require('lru-cache') +const cache = new LRU({ max: 1000 }) + +const parseOptions = require('../internal/parse-options') +const Comparator = require('./comparator') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = require('../internal/re') + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// 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((c) => { + return replaceTilde(c, 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((c) => { + return replaceCaret(c, 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((c) => { + return replaceXRange(c, 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 0000000..af62955 --- /dev/null +++ b/node_modules/semver/classes/semver.js @@ -0,0 +1,287 @@ +const debug = require('../internal/debug') +const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') +const { re, t } = require('../internal/re') + +const parseOptions = require('../internal/parse-options') +const { compareIdentifiers } = require('../internal/identifiers') +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + 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 (compareIdentifiers(this.prerelease[0], identifier) === 0) { + 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 0000000..811fe6b --- /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 0000000..4011909 --- /dev/null +++ b/node_modules/semver/functions/cmp.js @@ -0,0 +1,52 @@ +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 0000000..2e01452 --- /dev/null +++ b/node_modules/semver/functions/coerce.js @@ -0,0 +1,52 @@ +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 0000000..9eb881b --- /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 0000000..4881fbe --- /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 0000000..748b7af --- /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 0000000..87200ef --- /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 0000000..271fed9 --- /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 0000000..d9b2156 --- /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 0000000..5aeaa63 --- /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 0000000..62d1da2 --- /dev/null +++ b/node_modules/semver/functions/inc.js @@ -0,0 +1,18 @@ +const SemVer = require('../classes/semver') + +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : 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 0000000..b440ab7 --- /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 0000000..6dcc956 --- /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 0000000..4283165 --- /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 0000000..57b3455 --- /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 0000000..f944c01 --- /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 0000000..a66663a --- /dev/null +++ b/node_modules/semver/functions/parse.js @@ -0,0 +1,33 @@ +const { MAX_LENGTH } = require('../internal/constants') +const { re, t } = require('../internal/re') +const SemVer = require('../classes/semver') + +const parseOptions = require('../internal/parse-options') +const parse = (version, options) => { + options = parseOptions(options) + + 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 0000000..63afca2 --- /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 0000000..06aa132 --- /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 0000000..0ac509e --- /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 0000000..82404c5 --- /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 0000000..50af1c1 --- /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 0000000..4d10917 --- /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 0000000..f27bae1 --- /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 0000000..57e2ae6 --- /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 0000000..4f0de59 --- /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 0000000..1c00e13 --- /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 0000000..e612d0a --- /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/parse-options.js b/node_modules/semver/internal/parse-options.js new file mode 100644 index 0000000..bbd9ec7 --- /dev/null +++ b/node_modules/semver/internal/parse-options.js @@ -0,0 +1,11 @@ +// parse out just the options we care about so we always get a consistent +// obj with keys in a consistent order. +const opts = ['includePrerelease', 'loose', 'rtl'] +const parseOptions = options => + !options ? {} + : typeof options !== 'object' ? { loose: true } + : opts.filter(k => options[k]).reduce((o, k) => { + o[k] = true + return o + }, {}) +module.exports = parseOptions diff --git a/node_modules/semver/internal/re.js b/node_modules/semver/internal/re.js new file mode 100644 index 0000000..ed88398 --- /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(name, 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 new file mode 100644 index 0000000..7898f59 --- /dev/null +++ b/node_modules/semver/package.json @@ -0,0 +1,75 @@ +{ + "name": "semver", + "version": "7.3.7", + "description": "The semantic version parser used by npm.", + "main": "index.js", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" + }, + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.3.2", + "tap": "^16.0.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "bin/semver.js" + }, + "files": [ + "bin/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "tap": { + "check-coverage": true, + "coverage-map": "map.js" + }, + "engines": { + "node": ">=10" + }, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.3.2", + "engines": ">=10", + "ciVersions": [ + "10.0.0", + "10.x", + "12.x", + "14.x", + "16.x" + ], + "distPaths": [ + "bin/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ] + } +} diff --git a/node_modules/semver/preload.js b/node_modules/semver/preload.js new file mode 100644 index 0000000..947cd4f --- /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/range.bnf b/node_modules/semver/range.bnf new file mode 100644 index 0000000..d4c6ae0 --- /dev/null +++ b/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/ranges/gtr.js b/node_modules/semver/ranges/gtr.js new file mode 100644 index 0000000..db7e355 --- /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 0000000..3d1a6f3 --- /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 0000000..528a885 --- /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 0000000..6e3d993 --- /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 0000000..9b60974 --- /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 0000000..350e1f7 --- /dev/null +++ b/node_modules/semver/ranges/min-version.js @@ -0,0 +1,61 @@ +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] + + let setMin = null + 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 (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + 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 0000000..ae99b10 --- /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 satisfies 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 0000000..618d5b6 --- /dev/null +++ b/node_modules/semver/ranges/simplify.js @@ -0,0 +1,47 @@ +// 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 first = 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 (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, 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 0000000..e0dea43 --- /dev/null +++ b/node_modules/semver/ranges/subset.js @@ -0,0 +1,244 @@ +const Range = require('../classes/range.js') +const Comparator = require('../classes/comparator.js') +const { ANY } = Comparator +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 null set, OR +// - Every simple range `r1, r2, ...` which is not a null set 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 if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - 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 any C is a = range, and GT or LT are set, return false +// - 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.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + 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 === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = [new Comparator('>=0.0.0-0')] + } else { + sub = [new Comparator('>=0.0.0')] + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = [new Comparator('>=0.0.0')] + } + } + + 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 + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + 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 + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + 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 0000000..6c8bc7e --- /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 0000000..365f356 --- /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/shebang-command/index.js b/node_modules/shebang-command/index.js new file mode 100644 index 0000000..f35db30 --- /dev/null +++ b/node_modules/shebang-command/index.js @@ -0,0 +1,19 @@ +'use strict'; +const shebangRegex = require('shebang-regex'); + +module.exports = (string = '') => { + const match = string.match(shebangRegex); + + if (!match) { + return null; + } + + const [path, argument] = match[0].replace(/#! ?/, '').split(' '); + const binary = path.split('/').pop(); + + if (binary === 'env') { + return argument; + } + + return argument ? `${binary} ${argument}` : binary; +}; diff --git a/node_modules/shebang-command/license b/node_modules/shebang-command/license new file mode 100644 index 0000000..db6bc32 --- /dev/null +++ b/node_modules/shebang-command/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Kevin Mårtensson (github.com/kevva) + +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/shebang-command/package.json b/node_modules/shebang-command/package.json new file mode 100644 index 0000000..18e3c04 --- /dev/null +++ b/node_modules/shebang-command/package.json @@ -0,0 +1,34 @@ +{ + "name": "shebang-command", + "version": "2.0.0", + "description": "Get the command from a shebang", + "license": "MIT", + "repository": "kevva/shebang-command", + "author": { + "name": "Kevin Mårtensson", + "email": "kevinmartensson@gmail.com", + "url": "github.com/kevva" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "cmd", + "command", + "parse", + "shebang" + ], + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "devDependencies": { + "ava": "^2.3.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/shebang-command/readme.md b/node_modules/shebang-command/readme.md new file mode 100644 index 0000000..84feb44 --- /dev/null +++ b/node_modules/shebang-command/readme.md @@ -0,0 +1,34 @@ +# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) + +> Get the command from a shebang + + +## Install + +``` +$ npm install shebang-command +``` + + +## Usage + +```js +const shebangCommand = require('shebang-command'); + +shebangCommand('#!/usr/bin/env node'); +//=> 'node' + +shebangCommand('#!/bin/bash'); +//=> 'bash' +``` + + +## API + +### shebangCommand(string) + +#### string + +Type: `string` + +String containing a shebang. diff --git a/node_modules/shebang-regex/index.d.ts b/node_modules/shebang-regex/index.d.ts new file mode 100644 index 0000000..61d034b --- /dev/null +++ b/node_modules/shebang-regex/index.d.ts @@ -0,0 +1,22 @@ +/** +Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line. + +@example +``` +import shebangRegex = require('shebang-regex'); + +const string = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(string); +//=> true + +shebangRegex.exec(string)[0]; +//=> '#!/usr/bin/env node' + +shebangRegex.exec(string)[1]; +//=> '/usr/bin/env node' +``` +*/ +declare const shebangRegex: RegExp; + +export = shebangRegex; diff --git a/node_modules/shebang-regex/index.js b/node_modules/shebang-regex/index.js new file mode 100644 index 0000000..63fc4a0 --- /dev/null +++ b/node_modules/shebang-regex/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = /^#!(.*)/; diff --git a/node_modules/shebang-regex/license b/node_modules/shebang-regex/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/shebang-regex/license @@ -0,0 +1,9 @@ +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/shebang-regex/package.json b/node_modules/shebang-regex/package.json new file mode 100644 index 0000000..00ab30f --- /dev/null +++ b/node_modules/shebang-regex/package.json @@ -0,0 +1,35 @@ +{ + "name": "shebang-regex", + "version": "3.0.0", + "description": "Regular expression for matching a shebang line", + "license": "MIT", + "repository": "sindresorhus/shebang-regex", + "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": [ + "regex", + "regexp", + "shebang", + "match", + "test", + "line" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/shebang-regex/readme.md b/node_modules/shebang-regex/readme.md new file mode 100644 index 0000000..5ecf863 --- /dev/null +++ b/node_modules/shebang-regex/readme.md @@ -0,0 +1,33 @@ +# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex) + +> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line + + +## Install + +``` +$ npm install shebang-regex +``` + + +## Usage + +```js +const shebangRegex = require('shebang-regex'); + +const string = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(string); +//=> true + +shebangRegex.exec(string)[0]; +//=> '#!/usr/bin/env node' + +shebangRegex.exec(string)[1]; +//=> '/usr/bin/env node' +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/string.prototype.trimend/.editorconfig b/node_modules/string.prototype.trimend/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/string.prototype.trimend/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/string.prototype.trimend/.eslintrc b/node_modules/string.prototype.trimend/.eslintrc new file mode 100644 index 0000000..8056b20 --- /dev/null +++ b/node_modules/string.prototype.trimend/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "RequireObjectCoercible", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "id-length": 0, + "no-invalid-this": 1, + }, + }, + ], +} diff --git a/node_modules/string.prototype.trimend/.nycrc b/node_modules/string.prototype.trimend/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/string.prototype.trimend/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/string.prototype.trimend/CHANGELOG.md b/node_modules/string.prototype.trimend/CHANGELOG.md new file mode 100644 index 0000000..428e9ad --- /dev/null +++ b/node_modules/string.prototype.trimend/CHANGELOG.md @@ -0,0 +1,92 @@ +# 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). + +## [v1.0.5](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.4...v1.0.5) - 2022-05-02 + +### Commits + +- [actions] reuse common workflows [`69a56ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/69a56ce95343848d5e498f8e939a0697db8ac9f2) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5d7db31`](https://github.com/es-shims/String.prototype.trimEnd/commit/5d7db314948faac975705db56305b6cc3dae7ba9) +- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`bb1983d`](https://github.com/es-shims/String.prototype.trimEnd/commit/bb1983dc27504733ab883a42f55b134f679a642d) +- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`10a1091`](https://github.com/es-shims/String.prototype.trimEnd/commit/10a10916e1ffc8cdab78515b2cc521cc74c08277) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`a08e14b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a08e14bfea5e27d419ef742e83f467a169a69971) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`1c4c8da`](https://github.com/es-shims/String.prototype.trimEnd/commit/1c4c8dab4aefc1c5823a61b5a0286bb6fe1e036c) +- [actions] update codecov uploader [`70c4a7c`](https://github.com/es-shims/String.prototype.trimEnd/commit/70c4a7c566fd5bf72475df9318ec2cd218ceca26) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`4b08ed7`](https://github.com/es-shims/String.prototype.trimEnd/commit/4b08ed78a579585b593b3ca4ac7919d13906e840) +- [readme] add github actions/codecov badges [`9805501`](https://github.com/es-shims/String.prototype.trimEnd/commit/980550105b304385bcccb8ec05a247e02c24d04a) +- [Dev Deps] update `eslint`, `tape` [`50ec335`](https://github.com/es-shims/String.prototype.trimEnd/commit/50ec335ed42b59d1ab626dbe412f4ae23ab99b4b) +- [actions] update workflows [`bf9c32e`](https://github.com/es-shims/String.prototype.trimEnd/commit/bf9c32efe08e98b53302df67581dc971b7a758cd) +- [meta] use `prepublishOnly` script for npm 7+ [`9d921bd`](https://github.com/es-shims/String.prototype.trimEnd/commit/9d921bdbcaf8cebebbc302e6df518cbc3e4907bd) +- [Deps] update `define-properties` [`15617ce`](https://github.com/es-shims/String.prototype.trimEnd/commit/15617ced8ac2ea3ab8324a04d16fd294b12059b5) + +## [v1.0.4](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.3...v1.0.4) - 2021-02-23 + +### Commits + +- [meta] do not publish github action workflow files [`08e735c`](https://github.com/es-shims/String.prototype.trimEnd/commit/08e735cd55b00ae78a9dc16c6b4e786f7931085b) +- [readme] remove travis badge [`10e0e47`](https://github.com/es-shims/String.prototype.trimEnd/commit/10e0e47cb2ecfd171e68b40f8486c5d007dcf3ef) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `has-strict-mode`, `tape` [`0871432`](https://github.com/es-shims/String.prototype.trimEnd/commit/0871432c70c2f6a3929acd740a5d1f57c939f345) +- [Tests] increase coverage [`711e6a6`](https://github.com/es-shims/String.prototype.trimEnd/commit/711e6a66660f30f7a30fef536be435af1a13d05c) +- [actions] update workflows [`deb0d06`](https://github.com/es-shims/String.prototype.trimEnd/commit/deb0d06f41ac1c3e1e640ecd1cf0e69303ab5799) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`e250b4a`](https://github.com/es-shims/String.prototype.trimEnd/commit/e250b4a38401e7c02a067dab26cc68316da47ef7) +- [meta] gitignore coverage output [`55231df`](https://github.com/es-shims/String.prototype.trimEnd/commit/55231dfd9829277ba5c3f07be5434dc385703ca9) +- [Deps] update `call-bind` [`0580f5f`](https://github.com/es-shims/String.prototype.trimEnd/commit/0580f5f915ecb87677764d03fe3cf023e3bee7d8) + +## [v1.0.3](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.2...v1.0.3) - 2020-11-21 + +### Commits + +- [Tests] migrate tests to Github Actions [`23e7a09`](https://github.com/es-shims/String.prototype.trimEnd/commit/23e7a09a4ad37c21c3db3d7761212c7d84a371a2) +- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`26e8623`](https://github.com/es-shims/String.prototype.trimEnd/commit/26e8623cf35c1859d0b482d4bb5b3450d101a810) +- [Tests] run `nyc` on all tests [`a72a546`](https://github.com/es-shims/String.prototype.trimEnd/commit/a72a546f671c5d3ac65dff68b4db1a1cc7089bfd) +- [Deps] replace `es-abstract` with `call-bind` [`f07b87d`](https://github.com/es-shims/String.prototype.trimEnd/commit/f07b87dd452090a2601d666edceb1daa90d45f24) +- [Dev Deps] update `eslint`, `aud`; add `safe-publish-latest` [`122ecb7`](https://github.com/es-shims/String.prototype.trimEnd/commit/122ecb726b1dc043b9ef27fa5a7b4172a4d5df37) + +## [v1.0.2](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.1...v1.0.2) - 2020-10-20 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a003e71`](https://github.com/es-shims/String.prototype.trimEnd/commit/a003e7166d8de16c551a14b0ec855187357cce43) +- [actions] add "Allow Edits" workflow [`0b4b43c`](https://github.com/es-shims/String.prototype.trimEnd/commit/0b4b43cb605f7b3532e61c43dfc7f1795296c5a4) +- [Deps] update `es-abstract` [`75ca6b0`](https://github.com/es-shims/String.prototype.trimEnd/commit/75ca6b0e9757d64013ae863cfaac49ebcb36f1cf) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`552016c`](https://github.com/es-shims/String.prototype.trimEnd/commit/552016cb631ac13c12bbbc0d6dd65012e5e79583) + +## [v1.0.1](https://github.com/es-shims/String.prototype.trimEnd/compare/v1.0.0...v1.0.1) - 2020-04-09 + +### Commits + +- [meta] add some missing repo metadata [`6abe248`](https://github.com/es-shims/String.prototype.trimEnd/commit/6abe248ba0b57a8b0e16bbe01de07a4d37c421bc) +- [Dev Deps] update `auto-changelog` [`e2eaab2`](https://github.com/es-shims/String.prototype.trimEnd/commit/e2eaab2fd1bc27a3d224b3d76db16190c1dd6d08) + +## [v1.0.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.1.0...v1.0.0) - 2020-03-30 + +### Commits + +- [Breaking] convert to es-shim API [`2c6ef13`](https://github.com/es-shims/String.prototype.trimEnd/commit/2c6ef13d3f0b07a9bc55e367b311dbb731780405) +- [meta] add `auto-changelog` [`6f1fcc1`](https://github.com/es-shims/String.prototype.trimEnd/commit/6f1fcc1739de1e9541bd603b659807646a13dd7f) +- [meta] update readme [`ed4ce0d`](https://github.com/es-shims/String.prototype.trimEnd/commit/ed4ce0d84d53e626b48375c5959be20332464eaf) +- [Tests] add `npm run lint` [`eadaf2c`](https://github.com/es-shims/String.prototype.trimEnd/commit/eadaf2c83f2d791b54d80d7b30a9961ebc0f246f) +- Only apps should have lockfiles [`44d355f`](https://github.com/es-shims/String.prototype.trimEnd/commit/44d355f7dafcb0b51c5001824b07f7a2b9f1d06e) +- [actions] add automatic rebasing / merge commit blocking [`e78bf8e`](https://github.com/es-shims/String.prototype.trimEnd/commit/e78bf8e5fc04fcb3379dd1c98360d7df4f9ea7d6) +- [Tests] use shared travis-ci configs [`983c563`](https://github.com/es-shims/String.prototype.trimEnd/commit/983c5639efca2c9bb8b93ebbb917fbcb2561b94c) +- [meta] add `funding` field [`35139d6`](https://github.com/es-shims/String.prototype.trimEnd/commit/35139d6236ceacfc1501d08fb196d18a936ee583) +- [meta] fix non-updated version number [`a2d308b`](https://github.com/es-shims/String.prototype.trimEnd/commit/a2d308b99967ca427936c54747175794ca7336e1) + +## [v0.1.0](https://github.com/es-shims/String.prototype.trimEnd/compare/v0.0.1...v0.1.0) - 2017-12-19 + +### Commits + +- updated README [`f1c71a0`](https://github.com/es-shims/String.prototype.trimEnd/commit/f1c71a0a882e89e1c207ed2b316d91670be2b075) + +## v0.0.1 - 2017-12-19 + +### Commits + +- finished polyfill [`e58d550`](https://github.com/es-shims/String.prototype.trimEnd/commit/e58d550ab8695924ff4221ebe91f00f29801aa4b) +- created README file [`f78628a`](https://github.com/es-shims/String.prototype.trimEnd/commit/f78628ab123171f8b7759bba331d6a589702584f) +- Initial commit [`9199478`](https://github.com/es-shims/String.prototype.trimEnd/commit/9199478256da953e2f5bddfc4d82a161f4537e85) +- typo [`d1f4558`](https://github.com/es-shims/String.prototype.trimEnd/commit/d1f4558a51157833f14d8a424426d038d06576ce) diff --git a/node_modules/string.prototype.trimend/LICENSE b/node_modules/string.prototype.trimend/LICENSE new file mode 100644 index 0000000..e48a1b5 --- /dev/null +++ b/node_modules/string.prototype.trimend/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Khaled Al-Ansari + +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/string.prototype.trimend/README.md b/node_modules/string.prototype.trimend/README.md new file mode 100644 index 0000000..292bda9 --- /dev/null +++ b/node_modules/string.prototype.trimend/README.md @@ -0,0 +1,46 @@ +# String.prototype.trimEnd [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2019-spec-compliant `String.prototype.trimEnd` shim. Invoke its "shim" method to shim `String.prototype.trimEnd` if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Most common usage: +```js +var trimEnd = require('string.prototype.trimend'); + +assert(trimEnd(' \t\na \t\n') === 'a \t\n'); + +if (!String.prototype.trimEnd) { + trimEnd.shim(); +} + +assert(trimEnd(' \t\na \t\n ') === ' \t\na \t\n '.trimEnd()); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/string.prototype.trimend +[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimEnd.svg +[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd.svg +[deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd +[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimEnd/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimEnd#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/string.prototype.trimend.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/string.prototype.trimend.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimend.svg +[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimend +[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimEnd/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimEnd/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimEnd +[actions-url]: https://github.com/es-shims/String.prototype.trimEnd/actions diff --git a/node_modules/string.prototype.trimend/auto.js b/node_modules/string.prototype.trimend/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/string.prototype.trimend/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/string.prototype.trimend/implementation.js b/node_modules/string.prototype.trimend/implementation.js new file mode 100644 index 0000000..4628aba --- /dev/null +++ b/node_modules/string.prototype.trimend/implementation.js @@ -0,0 +1,15 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var $replace = callBound('String.prototype.replace'); + +var mvsIsWS = (/^\s$/).test('\u180E'); +/* eslint-disable no-control-regex */ +var endWhitespace = mvsIsWS + ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/ + : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/; +/* eslint-enable no-control-regex */ + +module.exports = function trimEnd() { + return $replace(this, endWhitespace, ''); +}; diff --git a/node_modules/string.prototype.trimend/index.js b/node_modules/string.prototype.trimend/index.js new file mode 100644 index 0000000..7aa6140 --- /dev/null +++ b/node_modules/string.prototype.trimend/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); +var RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; + +define(boundMethod, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundMethod; diff --git a/node_modules/string.prototype.trimend/package.json b/node_modules/string.prototype.trimend/package.json new file mode 100644 index 0000000..0b208d6 --- /dev/null +++ b/node_modules/string.prototype.trimend/package.json @@ -0,0 +1,71 @@ +{ + "name": "string.prototype.trimend", + "version": "1.0.5", + "author": "Jordan Harband ", + "contributors": [ + "Jordan Harband ", + "Khaled Al-Ansari " + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES2019 spec-compliant String.prototype.trimEnd shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "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://github.com/es-shims/String.prototype.trimEnd.git" + }, + "keywords": [ + "es6", + "es7", + "es8", + "javascript", + "prototype", + "polyfill", + "utility", + "trim", + "trimLeft", + "trimRight", + "trimStart", + "trimEnd", + "tc39" + ], + "devDependencies": { + "@es-shims/api": "^2.2.3", + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } +} diff --git a/node_modules/string.prototype.trimend/polyfill.js b/node_modules/string.prototype.trimend/polyfill.js new file mode 100644 index 0000000..0fa4f70 --- /dev/null +++ b/node_modules/string.prototype.trimend/polyfill.js @@ -0,0 +1,15 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + if (!String.prototype.trimEnd && !String.prototype.trimRight) { + return implementation; + } + var zeroWidthSpace = '\u200b'; + var trimmed = zeroWidthSpace.trimEnd ? zeroWidthSpace.trimEnd() : zeroWidthSpace.trimRight(); + if (trimmed !== zeroWidthSpace) { + return implementation; + } + return String.prototype.trimEnd || String.prototype.trimRight; +}; diff --git a/node_modules/string.prototype.trimend/shim.js b/node_modules/string.prototype.trimend/shim.js new file mode 100644 index 0000000..5a8f477 --- /dev/null +++ b/node_modules/string.prototype.trimend/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimTrimEnd() { + var polyfill = getPolyfill(); + define( + String.prototype, + { trimEnd: polyfill }, + { trimEnd: function () { return String.prototype.trimEnd !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/string.prototype.trimend/test/implementation.js b/node_modules/string.prototype.trimend/test/implementation.js new file mode 100644 index 0000000..7fdf95b --- /dev/null +++ b/node_modules/string.prototype.trimend/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/index.js b/node_modules/string.prototype.trimend/test/index.js new file mode 100644 index 0000000..2ee8f67 --- /dev/null +++ b/node_modules/string.prototype.trimend/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var trimEnd = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { trimEnd(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trimEnd(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(trimEnd, t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/shimmed.js b/node_modules/string.prototype.trimend/test/shimmed.js new file mode 100644 index 0000000..1a01ceb --- /dev/null +++ b/node_modules/string.prototype.trimend/test/shimmed.js @@ -0,0 +1,36 @@ +'use strict'; + +require('../auto'); + +var runTests = require('./tests'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +test('shimmed', function (t) { + t.equal(String.prototype.trimEnd.length, 0, 'String#trimEnd has a length of 0'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimEnd.name), true, 'String#trimEnd has name "trimRight" or "trimEnd"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(String.prototype.trimEnd), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimend/test/tests.js b/node_modules/string.prototype.trimend/test/tests.js new file mode 100644 index 0000000..03a8c5c --- /dev/null +++ b/node_modules/string.prototype.trimend/test/tests.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = function (trimEnd, t) { + t.test('normal cases', function (st) { + st.equal(trimEnd(' \t\na \t\n'), ' \t\na', 'strips whitespace off the left side'); + st.equal(trimEnd('a'), 'a', 'noop when no whitespace'); + + var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + st.equal(trimEnd(allWhitespaceChars + 'a' + allWhitespaceChars), allWhitespaceChars + 'a', 'all expected whitespace chars are trimmed'); + + st.end(); + }); + + // see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ + var mongolianVowelSeparator = '\u180E'; + var mvsIsWS = (/^\s$/).test(mongolianVowelSeparator); + t.test('mongolian vowel separator: unicode >= 4 && < 6.3', function (st) { + st.equal( + trimEnd(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), + mongolianVowelSeparator + 'a' + (mvsIsWS ? '' : mongolianVowelSeparator), + 'mongolian vowel separator is ' + (mvsIsWS ? '' : 'not ') + 'whitespace' + ); + st.end(); + }); + + t.test('zero-width spaces', function (st) { + var zeroWidth = '\u200b'; + st.equal(trimEnd(zeroWidth), zeroWidth, 'zero width space does not trim'); + st.end(); + }); +}; diff --git a/node_modules/string.prototype.trimstart/.editorconfig b/node_modules/string.prototype.trimstart/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/string.prototype.trimstart/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/string.prototype.trimstart/.eslintrc b/node_modules/string.prototype.trimstart/.eslintrc new file mode 100644 index 0000000..8056b20 --- /dev/null +++ b/node_modules/string.prototype.trimstart/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "RequireObjectCoercible", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "id-length": 0, + "no-invalid-this": 1, + }, + }, + ], +} diff --git a/node_modules/string.prototype.trimstart/.nycrc b/node_modules/string.prototype.trimstart/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/string.prototype.trimstart/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/string.prototype.trimstart/CHANGELOG.md b/node_modules/string.prototype.trimstart/CHANGELOG.md new file mode 100644 index 0000000..fd936dd --- /dev/null +++ b/node_modules/string.prototype.trimstart/CHANGELOG.md @@ -0,0 +1,92 @@ +# 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). + +## [v1.0.5](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.4...v1.0.5) - 2022-05-02 + +### Commits + +- [actions] reuse common workflows [`61d4009`](https://github.com/es-shims/String.prototype.trimStart/commit/61d40098a96b3dcc6cf963c9d03dd1b23b6eb13d) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`bfe39c4`](https://github.com/es-shims/String.prototype.trimStart/commit/bfe39c498e26a4ad75c64cce27ff3df9bfef2cc1) +- [Fix] ensure main entry point properly checks the receiver in ES3 engines [`36e3730`](https://github.com/es-shims/String.prototype.trimStart/commit/36e37307bb06fb5dc34d861a4bf6f7db931340d9) +- [Fix] as of unicode v6, the mongolian vowel separator is no longer whitespace [`4f77eed`](https://github.com/es-shims/String.prototype.trimStart/commit/4f77eed5aa64e6f781310847d7831563fce90f5c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`59fcb99`](https://github.com/es-shims/String.prototype.trimStart/commit/59fcb995ef8d4723a83e28d46dbe41a14253b681) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `tape` [`486ffcf`](https://github.com/es-shims/String.prototype.trimStart/commit/486ffcfa93c75516601169a3973b81fdfeb7de8b) +- [actions] update codecov uploader [`b33ac48`](https://github.com/es-shims/String.prototype.trimStart/commit/b33ac48ccc86f6b894d8fde5162bd1c806904972) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`3c89fa5`](https://github.com/es-shims/String.prototype.trimStart/commit/3c89fa571d1c4b8894230d93caaf3b3d9885534d) +- [readme] add github actions/codecov badges [`00be6b3`](https://github.com/es-shims/String.prototype.trimStart/commit/00be6b34fdd989950b934b4471087362b78d4b0c) +- [Dev Deps] update `eslint`, `tape` [`13a08f5`](https://github.com/es-shims/String.prototype.trimStart/commit/13a08f578c53cf5f129fb6ebe486e8bbcc40c14e) +- [actions] update workflows [`6ac576d`](https://github.com/es-shims/String.prototype.trimStart/commit/6ac576dde99f73d19492777efed29ec069e89bf1) +- [meta] use `prepublishOnly` script for npm 7+ [`fa382ca`](https://github.com/es-shims/String.prototype.trimStart/commit/fa382caa5c8e9a868572605ce215a3db1dc9ef21) +- [Deps] update `define-properties` [`d57bffe`](https://github.com/es-shims/String.prototype.trimStart/commit/d57bffef7d89384c8888627c5ee33b80e24d54e0) + +## [v1.0.4](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.3...v1.0.4) - 2021-02-23 + +### Commits + +- [meta] do not publish github action workflow files [`9c434ec`](https://github.com/es-shims/String.prototype.trimStart/commit/9c434eceb50141cf36e8e65f514226b0b547b568) +- [readme] remove travis badge [`7843160`](https://github.com/es-shims/String.prototype.trimStart/commit/7843160a3e8feaa2213feb0da9c5ad7d9bf21b59) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `has-strict-mode`, `tape` [`8b52646`](https://github.com/es-shims/String.prototype.trimStart/commit/8b52646510aea20473da5491fe0876117a2251b1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`badeda2`](https://github.com/es-shims/String.prototype.trimStart/commit/badeda2b01d2e266e4d1c2e7dc0e4fca0f066f3e) +- [Tests] increase coverage [`bf8777d`](https://github.com/es-shims/String.prototype.trimStart/commit/bf8777d54c4b05c093559021cfaf0670306120f8) +- [actions] update workflows [`61be1c6`](https://github.com/es-shims/String.prototype.trimStart/commit/61be1c649ae859faa40286e57fa22cef65ae1229) +- [meta] gitignore coverage output [`c9c98d7`](https://github.com/es-shims/String.prototype.trimStart/commit/c9c98d75d7708e8906a39b55a0ad7a0ed6a9e4b0) +- [Deps] update `call-bind` [`c8645e8`](https://github.com/es-shims/String.prototype.trimStart/commit/c8645e89f9ace7681660ba66c724cf00c798f3d4) + +## [v1.0.3](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.2...v1.0.3) - 2020-11-21 + +### Commits + +- [Tests] migrate tests to Github Actions [`fbc7519`](https://github.com/es-shims/String.prototype.trimStart/commit/fbc7519cce2b5bfff9fe28dea96fb5f6f82e19fd) +- [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner [`3c9330b`](https://github.com/es-shims/String.prototype.trimStart/commit/3c9330be9ad02497f78ff0fd94b7c918c3a4bc21) +- [Tests] run `nyc` on all tests [`52229ca`](https://github.com/es-shims/String.prototype.trimStart/commit/52229ca28426be516c3826743e417be85144673e) +- [Deps] replace `es-abstract` with `call-bind` [`5e5068d`](https://github.com/es-shims/String.prototype.trimStart/commit/5e5068d2cc85d0a6f2a441ea984521ee70470537) +- [Dev Deps] update `eslint`, `aud`; add `safe-publish-latest` [`42a853e`](https://github.com/es-shims/String.prototype.trimStart/commit/42a853e2cb419378085098cb66e421ee94eed3ab) + +## [v1.0.2](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.1...v1.0.2) - 2020-10-20 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`d032b38`](https://github.com/es-shims/String.prototype.trimStart/commit/d032b38aac7e9ebae7bf5c4195492c508af2815a) +- [actions] add "Allow Edits" workflow [`83e30ba`](https://github.com/es-shims/String.prototype.trimStart/commit/83e30bac01572b6dba6358fec6e339c55dc431c9) +- [Deps] update `es-abstract` [`707d85d`](https://github.com/es-shims/String.prototype.trimStart/commit/707d85d827d9c537a144f199fdecc47edaade1cd) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`096c6d9`](https://github.com/es-shims/String.prototype.trimStart/commit/096c6d9dc142286c750da7024e7a88ed698a4953) + +## [v1.0.1](https://github.com/es-shims/String.prototype.trimStart/compare/v1.0.0...v1.0.1) - 2020-04-09 + +### Commits + +- [meta] add some missing repo metadata [`3385da3`](https://github.com/es-shims/String.prototype.trimStart/commit/3385da3bbb87819de11a869981ca954887a6a092) +- [Dev Deps] update `auto-changelog` [`879377d`](https://github.com/es-shims/String.prototype.trimStart/commit/879377df9c1ff97d8f0b3eac800683f1d68a304c) + +## [v1.0.0](https://github.com/es-shims/String.prototype.trimStart/compare/v0.1.0...v1.0.0) - 2020-03-30 + +### Commits + +- [Breaking] convert to es-shim API [`970922c`](https://github.com/es-shims/String.prototype.trimStart/commit/970922c494c78b033c351c77f61a8aefd49c30d9) +- [meta] add `auto-changelog` [`ff30c09`](https://github.com/es-shims/String.prototype.trimStart/commit/ff30c0996289113d2c3dbbfca7e280ff151bf36d) +- [meta] update readme [`816291d`](https://github.com/es-shims/String.prototype.trimStart/commit/816291d01e0eaf85da9b732c179cfb2454bd282e) +- [Tests] add `npm run lint` [`3341104`](https://github.com/es-shims/String.prototype.trimStart/commit/3341104450bc6ac84f3b70a6d6c0fbeb4df5131e) +- Only apps should have lockfiles [`f008df7`](https://github.com/es-shims/String.prototype.trimStart/commit/f008df73fbf3dcf8dfad6d5cad86de7050d0ae09) +- [actions] add automatic rebasing / merge commit blocking [`e5ba35c`](https://github.com/es-shims/String.prototype.trimStart/commit/e5ba35c1a14fcf652336cc9c4be49d232981161e) +- [Tests] use shared travis-ci configs [`46516b1`](https://github.com/es-shims/String.prototype.trimStart/commit/46516b137a8c07ed5807d751bd61199688ef9baa) +- [meta] add `funding` field [`34ae856`](https://github.com/es-shims/String.prototype.trimStart/commit/34ae8563f115bd4a5e5f5d2d786c0fa0a420fa2a) +- [meta] fix non-updated version number [`3b0e262`](https://github.com/es-shims/String.prototype.trimStart/commit/3b0e262e2f4eeee2e1b99fe890f8ca17bed8f2fd) + +## [v0.1.0](https://github.com/es-shims/String.prototype.trimStart/compare/v0.0.1...v0.1.0) - 2017-12-19 + +### Commits + +- updated README [`ab2f6ac`](https://github.com/es-shims/String.prototype.trimStart/commit/ab2f6ac8813ed336a0f2dc3aa8cdb52f4d52814b) + +## v0.0.1 - 2017-12-19 + +### Commits + +- finished polyfill [`1c7ca20`](https://github.com/es-shims/String.prototype.trimStart/commit/1c7ca2043e3383b6e743870bc622ad4a38477147) +- created README file: [`192ecad`](https://github.com/es-shims/String.prototype.trimStart/commit/192ecaded4e0d5baaa65cd41e590b8d837520d44) +- Initial commit [`14044f8`](https://github.com/es-shims/String.prototype.trimStart/commit/14044f8a0fe1d155fe7403a8327bdbaf135da2d6) +- updated README [`d4fb6be`](https://github.com/es-shims/String.prototype.trimStart/commit/d4fb6be15455dd68fc4b306bee1d30dd4afc96e7) diff --git a/node_modules/string.prototype.trimstart/LICENSE b/node_modules/string.prototype.trimstart/LICENSE new file mode 100644 index 0000000..e48a1b5 --- /dev/null +++ b/node_modules/string.prototype.trimstart/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Khaled Al-Ansari + +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/string.prototype.trimstart/README.md b/node_modules/string.prototype.trimstart/README.md new file mode 100644 index 0000000..5ec7613 --- /dev/null +++ b/node_modules/string.prototype.trimstart/README.md @@ -0,0 +1,46 @@ +# String.prototype.trimStart [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +An ES2019-spec-compliant `String.prototype.trimStart` shim. Invoke its "shim" method to shim `String.prototype.trimStart` if it is unavailable. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s. + +Most common usage: +```js +var trimStart = require('string.prototype.trimstart'); + +assert(trimStart(' \t\na \t\n') === 'a \t\n'); + +if (!String.prototype.trimStart) { + trimStart.shim(); +} + +assert(trimStart(' \t\na \t\n') === ' \t\na \t\n'.trimStart()); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.com/package/string.prototype.trimstart +[npm-version-svg]: https://vb.teelaun.ch/es-shims/String.prototype.trimStart.svg +[deps-svg]: https://david-dm.org/es-shims/String.prototype.trimStart.svg +[deps-url]: https://david-dm.org/es-shims/String.prototype.trimStart +[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.trimStart/dev-status.svg +[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.trimStart#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/string.prototype.trimstart.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/string.prototype.trimstart.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/string.prototype.trimstart.svg +[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.trimstart +[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.trimStart/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.trimStart/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.trimStart +[actions-url]: https://github.com/es-shims/String.prototype.trimStart/actions diff --git a/node_modules/string.prototype.trimstart/auto.js b/node_modules/string.prototype.trimstart/auto.js new file mode 100644 index 0000000..8ebf606 --- /dev/null +++ b/node_modules/string.prototype.trimstart/auto.js @@ -0,0 +1,3 @@ +'use strict'; + +require('./shim')(); diff --git a/node_modules/string.prototype.trimstart/implementation.js b/node_modules/string.prototype.trimstart/implementation.js new file mode 100644 index 0000000..882e711 --- /dev/null +++ b/node_modules/string.prototype.trimstart/implementation.js @@ -0,0 +1,15 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var $replace = callBound('String.prototype.replace'); + +var mvsIsWS = (/^\s$/).test('\u180E'); +/* eslint-disable no-control-regex */ +var startWhitespace = mvsIsWS + ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/ + : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/; +/* eslint-enable no-control-regex */ + +module.exports = function trimStart() { + return $replace(this, startWhitespace, ''); +}; diff --git a/node_modules/string.prototype.trimstart/index.js b/node_modules/string.prototype.trimstart/index.js new file mode 100644 index 0000000..7aa6140 --- /dev/null +++ b/node_modules/string.prototype.trimstart/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var callBind = require('call-bind'); +var define = require('define-properties'); +var RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +var bound = callBind(getPolyfill()); +var boundMethod = function trim(receiver) { + RequireObjectCoercible(receiver); + return bound(receiver); +}; + +define(boundMethod, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundMethod; diff --git a/node_modules/string.prototype.trimstart/package.json b/node_modules/string.prototype.trimstart/package.json new file mode 100644 index 0000000..a0caf8b --- /dev/null +++ b/node_modules/string.prototype.trimstart/package.json @@ -0,0 +1,71 @@ +{ + "name": "string.prototype.trimstart", + "version": "1.0.5", + "author": "Jordan Harband ", + "contributors": [ + "Jordan Harband ", + "Khaled Al-Ansari " + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "ES2019 spec-compliant String.prototype.trimStart shim.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "es-shim-api --bound", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "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://github.com/es-shims/String.prototype.trimStart.git" + }, + "keywords": [ + "es6", + "es7", + "es8", + "javascript", + "prototype", + "polyfill", + "utility", + "trim", + "trimLeft", + "trimRight", + "trimStart", + "trimEnd", + "tc39" + ], + "devDependencies": { + "@es-shims/api": "^2.2.3", + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } +} diff --git a/node_modules/string.prototype.trimstart/polyfill.js b/node_modules/string.prototype.trimstart/polyfill.js new file mode 100644 index 0000000..9adaccd --- /dev/null +++ b/node_modules/string.prototype.trimstart/polyfill.js @@ -0,0 +1,15 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + if (!String.prototype.trimStart && !String.prototype.trimLeft) { + return implementation; + } + var zeroWidthSpace = '\u200b'; + var trimmed = zeroWidthSpace.trimStart ? zeroWidthSpace.trimStart() : zeroWidthSpace.trimLeft(); + if (trimmed !== zeroWidthSpace) { + return implementation; + } + return String.prototype.trimStart || String.prototype.trimLeft; +}; diff --git a/node_modules/string.prototype.trimstart/shim.js b/node_modules/string.prototype.trimstart/shim.js new file mode 100644 index 0000000..5ea6dfd --- /dev/null +++ b/node_modules/string.prototype.trimstart/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-properties'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimTrimStart() { + var polyfill = getPolyfill(); + define( + String.prototype, + { trimStart: polyfill }, + { trimStart: function () { return String.prototype.trimStart !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/string.prototype.trimstart/test/implementation.js b/node_modules/string.prototype.trimstart/test/implementation.js new file mode 100644 index 0000000..7fdf95b --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/implementation.js @@ -0,0 +1,20 @@ +'use strict'; + +var implementation = require('../implementation'); +var callBind = require('call-bind'); +var test = require('tape'); +var hasStrictMode = require('has-strict-mode')(); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', { skip: !hasStrictMode }, function (st) { + /* eslint no-useless-call: 0 */ + st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object'); + st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(implementation), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/index.js b/node_modules/string.prototype.trimstart/test/index.js new file mode 100644 index 0000000..baff6b5 --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var trimStart = require('../'); +var test = require('tape'); + +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad array/this value', function (st) { + st['throws'](function () { trimStart(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { trimStart(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(trimStart, t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/shimmed.js b/node_modules/string.prototype.trimstart/test/shimmed.js new file mode 100644 index 0000000..bfdbe48 --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/shimmed.js @@ -0,0 +1,36 @@ +'use strict'; + +require('../auto'); + +var runTests = require('./tests'); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var callBind = require('call-bind'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = require('functions-have-names')(); + +test('shimmed', function (t) { + t.equal(String.prototype.trimStart.length, 0, 'String#trimStart has a length of 0'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal((/^(?:trimLeft|trimStart)$/).test(String.prototype.trimStart.name), true, 'String#trimStart has name "trimLeft" or "trimStart"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(String.prototype, 'trimStart'), 'String#trimStart is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) { + st['throws'](function () { return String.prototype.trimStart.call(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st['throws'](function () { return String.prototype.trimStart.call(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(callBind(String.prototype.trimStart), t); + + t.end(); +}); diff --git a/node_modules/string.prototype.trimstart/test/tests.js b/node_modules/string.prototype.trimstart/test/tests.js new file mode 100644 index 0000000..526aac1 --- /dev/null +++ b/node_modules/string.prototype.trimstart/test/tests.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = function (trimStart, t) { + t.test('normal cases', function (st) { + st.equal(trimStart(' \t\na \t\n'), 'a \t\n', 'strips whitespace off the left side'); + st.equal(trimStart('a'), 'a', 'noop when no whitespace'); + + var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + st.equal(trimStart(allWhitespaceChars + 'a' + allWhitespaceChars), 'a' + allWhitespaceChars, 'all expected whitespace chars are trimmed'); + + st.end(); + }); + + // see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ + var mongolianVowelSeparator = '\u180E'; + var mvsIsWS = (/^\s$/).test(mongolianVowelSeparator); + t.test('mongolian vowel separator: unicode >= 4 && < 6.3', function (st) { + st.equal( + trimStart(mongolianVowelSeparator + 'a' + mongolianVowelSeparator), + (mvsIsWS ? '' : mongolianVowelSeparator) + 'a' + mongolianVowelSeparator, + 'mongolian vowel separator is ' + (mvsIsWS ? '' : 'not ') + 'whitespace' + ); + st.end(); + }); + + t.test('zero-width spaces', function (st) { + var zeroWidth = '\u200b'; + st.equal(trimStart(zeroWidth), zeroWidth, 'zero width space does not trim'); + st.end(); + }); +}; diff --git a/node_modules/strip-ansi/index.d.ts b/node_modules/strip-ansi/index.d.ts new file mode 100644 index 0000000..907fccc --- /dev/null +++ b/node_modules/strip-ansi/index.d.ts @@ -0,0 +1,17 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/node_modules/strip-ansi/index.js b/node_modules/strip-ansi/index.js new file mode 100644 index 0000000..9a593df --- /dev/null +++ b/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/strip-ansi/license b/node_modules/strip-ansi/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +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/strip-ansi/package.json b/node_modules/strip-ansi/package.json new file mode 100644 index 0000000..1a41108 --- /dev/null +++ b/node_modules/strip-ansi/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "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": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/strip-ansi/readme.md b/node_modules/strip-ansi/readme.md new file mode 100644 index 0000000..7c4b56d --- /dev/null +++ b/node_modules/strip-ansi/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` + + +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi 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-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + diff --git a/node_modules/strip-bom/index.js b/node_modules/strip-bom/index.js new file mode 100644 index 0000000..b00feb9 --- /dev/null +++ b/node_modules/strip-bom/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = x => { + if (typeof x !== 'string') { + throw new TypeError('Expected a string, got ' + typeof x); + } + + // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string + // conversion translates it to FEFF (UTF-16 BOM) + if (x.charCodeAt(0) === 0xFEFF) { + return x.slice(1); + } + + return x; +}; diff --git a/node_modules/strip-bom/license b/node_modules/strip-bom/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/strip-bom/license @@ -0,0 +1,21 @@ +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/strip-bom/package.json b/node_modules/strip-bom/package.json new file mode 100644 index 0000000..10f8fdd --- /dev/null +++ b/node_modules/strip-bom/package.json @@ -0,0 +1,40 @@ +{ + "name": "strip-bom", + "version": "3.0.0", + "description": "Strip UTF-8 byte order mark (BOM) from a string", + "license": "MIT", + "repository": "sindresorhus/strip-bom", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "bom", + "byte", + "order", + "mark", + "unicode", + "utf8", + "utf-8", + "remove", + "delete", + "trim", + "text", + "string" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/strip-bom/readme.md b/node_modules/strip-bom/readme.md new file mode 100644 index 0000000..812a980 --- /dev/null +++ b/node_modules/strip-bom/readme.md @@ -0,0 +1,36 @@ +# strip-bom [![Build Status](https://travis-ci.org/sindresorhus/strip-bom.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom) + +> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string + +From Wikipedia: + +> The Unicode Standard permits the BOM in UTF-8, but does not require nor recommend its use. Byte order has no meaning in UTF-8. + + +## Install + +``` +$ npm install --save strip-bom +``` + + +## Usage + +```js +const stripBom = require('strip-bom'); + +stripBom('\uFEFFunicorn'); +//=> 'unicorn' +``` + + +## Related + +- [strip-bom-cli](https://github.com/sindresorhus/strip-bom-cli) - CLI for this module +- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module +- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/strip-json-comments/index.d.ts b/node_modules/strip-json-comments/index.d.ts new file mode 100644 index 0000000..28ba3c8 --- /dev/null +++ b/node_modules/strip-json-comments/index.d.ts @@ -0,0 +1,36 @@ +declare namespace stripJsonComments { + interface Options { + /** + Replace comments with whitespace instead of stripping them entirely. + + @default true + */ + readonly whitespace?: boolean; + } +} + +/** +Strip comments from JSON. Lets you use comments in your JSON files! + +It will replace single-line comments `//` and multi-line comments `/**\/` with whitespace. This allows JSON error positions to remain as close as possible to the original source. + +@param jsonString - Accepts a string with JSON. +@returns A JSON string without comments. + +@example +``` +const json = `{ + // Rainbows + "unicorn": "cake" +}`; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` +*/ +declare function stripJsonComments( + jsonString: string, + options?: stripJsonComments.Options +): string; + +export = stripJsonComments; diff --git a/node_modules/strip-json-comments/index.js b/node_modules/strip-json-comments/index.js new file mode 100644 index 0000000..bb00b38 --- /dev/null +++ b/node_modules/strip-json-comments/index.js @@ -0,0 +1,77 @@ +'use strict'; +const singleComment = Symbol('singleComment'); +const multiComment = Symbol('multiComment'); +const stripWithoutWhitespace = () => ''; +const stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, ' '); + +const isEscaped = (jsonString, quotePosition) => { + let index = quotePosition - 1; + let backslashCount = 0; + + while (jsonString[index] === '\\') { + index -= 1; + backslashCount += 1; + } + + return Boolean(backslashCount % 2); +}; + +module.exports = (jsonString, options = {}) => { + if (typeof jsonString !== 'string') { + throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``); + } + + const strip = options.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + + let insideString = false; + let insideComment = false; + let offset = 0; + let result = ''; + + for (let i = 0; i < jsonString.length; i++) { + const currentCharacter = jsonString[i]; + const nextCharacter = jsonString[i + 1]; + + if (!insideComment && currentCharacter === '"') { + const escaped = isEscaped(jsonString, i); + if (!escaped) { + insideString = !insideString; + } + } + + if (insideString) { + continue; + } + + if (!insideComment && currentCharacter + nextCharacter === '//') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = singleComment; + i++; + } else if (insideComment === singleComment && currentCharacter + nextCharacter === '\r\n') { + i++; + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + continue; + } else if (insideComment === singleComment && currentCharacter === '\n') { + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + } else if (!insideComment && currentCharacter + nextCharacter === '/*') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = multiComment; + i++; + continue; + } else if (insideComment === multiComment && currentCharacter + nextCharacter === '*/') { + i++; + insideComment = false; + result += strip(jsonString, offset, i + 1); + offset = i + 1; + continue; + } + } + + return result + (insideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset)); +}; diff --git a/node_modules/strip-json-comments/license b/node_modules/strip-json-comments/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/strip-json-comments/license @@ -0,0 +1,9 @@ +MIT License + +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: + +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/strip-json-comments/package.json b/node_modules/strip-json-comments/package.json new file mode 100644 index 0000000..ce7875a --- /dev/null +++ b/node_modules/strip-json-comments/package.json @@ -0,0 +1,47 @@ +{ + "name": "strip-json-comments", + "version": "3.1.1", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "license": "MIT", + "repository": "sindresorhus/strip-json-comments", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "json", + "strip", + "comments", + "remove", + "delete", + "trim", + "multiline", + "parse", + "config", + "configuration", + "settings", + "util", + "env", + "environment", + "jsonc" + ], + "devDependencies": { + "ava": "^1.4.1", + "matcha": "^0.7.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/strip-json-comments/readme.md b/node_modules/strip-json-comments/readme.md new file mode 100644 index 0000000..cc542e5 --- /dev/null +++ b/node_modules/strip-json-comments/readme.md @@ -0,0 +1,78 @@ +# strip-json-comments [![Build Status](https://travis-ci.com/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.com/github/sindresorhus/strip-json-comments) + +> Strip comments from JSON. Lets you use comments in your JSON files! + +This is now possible: + +```js +{ + // Rainbows + "unicorn": /* ❤ */ "cake" +} +``` + +It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source. + +Also available as a [Gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[Grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[Broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin. + +## Install + +``` +$ npm install strip-json-comments +``` + +## Usage + +```js +const json = `{ + // Rainbows + "unicorn": /* ❤ */ "cake" +}`; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + +## API + +### stripJsonComments(jsonString, options?) + +#### jsonString + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + +#### options + +Type: `object` + +##### whitespace + +Type: `boolean`\ +Default: `true` + +Replace comments with whitespace instead of stripping them entirely. + +## Benchmark + +``` +$ npm run bench +``` + +## Related + +- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module +- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS + +--- + +
+ + 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/supports-preserve-symlinks-flag/.eslintrc b/node_modules/supports-preserve-symlinks-flag/.eslintrc new file mode 100644 index 0000000..346ffec --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "browser": true, + "node": true, + }, + + "rules": { + "id-length": "off", + }, +} diff --git a/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml b/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml new file mode 100644 index 0000000..e8d64f3 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.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/supports-preserve-symlink-flag +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/supports-preserve-symlinks-flag/.nycrc b/node_modules/supports-preserve-symlinks-flag/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md new file mode 100644 index 0000000..61f607f --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md @@ -0,0 +1,22 @@ +# 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). + +## v1.0.0 - 2022-01-02 + +### Commits + +- Tests [`e2f59ad`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/e2f59ad74e2ae0f5f4899fcde6a6f693ab7cc074) +- Initial commit [`dc222aa`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/dc222aad3c0b940d8d3af1ca9937d108bd2dc4b9) +- [meta] do not publish workflow files [`5ef77f7`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/5ef77f7cb6946d16ee38672be9ec0f1bbdf63262) +- npm init [`992b068`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/992b068503a461f7e8676f40ca2aab255fd8d6ff) +- read me [`6c9afa9`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c9afa9fabc8eaf0814aaed6dd01e6df0931b76d) +- Initial implementation [`2f98925`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2f9892546396d4ab0ad9f1ff83e76c3f01234ae8) +- [meta] add `auto-changelog` [`6c476ae`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c476ae1ed7ce68b0480344f090ac2844f35509d) +- [Dev Deps] add `eslint`, `@ljharb/eslint-config` [`d0fffc8`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/d0fffc886d25fba119355520750a909d64da0087) +- Only apps should have lockfiles [`ab318ed`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/ab318ed7ae62f6c2c0e80a50398d40912afd8f69) +- [meta] add `safe-publish-latest` [`2bb23b3`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2bb23b3ebab02dc4135c4cdf0217db82835b9fca) +- [meta] add `sideEffects` flag [`600223b`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/600223ba24f30779f209d9097721eff35ed62741) diff --git a/node_modules/supports-preserve-symlinks-flag/LICENSE b/node_modules/supports-preserve-symlinks-flag/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +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/supports-preserve-symlinks-flag/README.md b/node_modules/supports-preserve-symlinks-flag/README.md new file mode 100644 index 0000000..eb05b12 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/README.md @@ -0,0 +1,42 @@ +# node-supports-preserve-symlinks-flag [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Determine if the current node version supports the `--preserve-symlinks` flag. + +## Example + +```js +var supportsPreserveSymlinks = require('node-supports-preserve-symlinks-flag'); +var assert = require('assert'); + +assert.equal(supportsPreserveSymlinks, null); // in a browser +assert.equal(supportsPreserveSymlinks, false); // in node < v6.2 +assert.equal(supportsPreserveSymlinks, true); // in node v6.2+ +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/node-supports-preserve-symlinks-flag +[npm-version-svg]: https://versionbadg.es/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag.svg +[deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag +[dev-deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/node-supports-preserve-symlinks-flag.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/node-supports-preserve-symlinks-flag.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/node-supports-preserve-symlinks-flag.svg +[downloads-url]: https://npm-stat.com/charts.html?package=node-supports-preserve-symlinks-flag +[codecov-image]: https://codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-supports-preserve-symlinks-flag +[actions-url]: https://github.com/inspect-js/node-supports-preserve-symlinks-flag/actions diff --git a/node_modules/supports-preserve-symlinks-flag/browser.js b/node_modules/supports-preserve-symlinks-flag/browser.js new file mode 100644 index 0000000..087be1f --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/browser.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = null; diff --git a/node_modules/supports-preserve-symlinks-flag/index.js b/node_modules/supports-preserve-symlinks-flag/index.js new file mode 100644 index 0000000..86fd5d3 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/index.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = ( +// node 12+ + process.allowedNodeEnvironmentFlags && process.allowedNodeEnvironmentFlags.has('--preserve-symlinks') +) || ( +// node v6.2 - v11 + String(module.constructor._findPath).indexOf('preserveSymlinks') >= 0 // eslint-disable-line no-underscore-dangle +); diff --git a/node_modules/supports-preserve-symlinks-flag/package.json b/node_modules/supports-preserve-symlinks-flag/package.json new file mode 100644 index 0000000..56edadc --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/package.json @@ -0,0 +1,70 @@ +{ + "name": "supports-preserve-symlinks-flag", + "version": "1.0.0", + "description": "Determine if the current node version supports the `--preserve-symlinks` flag.", + "main": "./index.js", + "browser": "./browser.js", + "exports": { + ".": [ + { + "browser": "./browser.js", + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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/node-supports-preserve-symlinks-flag.git" + }, + "keywords": [ + "node", + "flag", + "symlink", + "symlinks", + "preserve-symlinks" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag/issues" + }, + "homepage": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.1.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^8.6.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tape": "^5.4.0" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/supports-preserve-symlinks-flag/test/index.js b/node_modules/supports-preserve-symlinks-flag/test/index.js new file mode 100644 index 0000000..9938d67 --- /dev/null +++ b/node_modules/supports-preserve-symlinks-flag/test/index.js @@ -0,0 +1,29 @@ +'use strict'; + +var test = require('tape'); +var semver = require('semver'); + +var supportsPreserveSymlinks = require('../'); +var browser = require('../browser'); + +test('supportsPreserveSymlinks', function (t) { + t.equal(typeof supportsPreserveSymlinks, 'boolean', 'is a boolean'); + + t.equal(browser, null, 'browser file is `null`'); + t.equal( + supportsPreserveSymlinks, + null, + 'in a browser, is null', + { skip: typeof window === 'undefined' } + ); + + var expected = semver.satisfies(process.version, '>= 6.2'); + t.equal( + supportsPreserveSymlinks, + expected, + 'is true in node v6.2+, false otherwise (actual: ' + supportsPreserveSymlinks + ', expected ' + expected + ')', + { skip: typeof window !== 'undefined' } + ); + + t.end(); +}); diff --git a/node_modules/text-table/.travis.yml b/node_modules/text-table/.travis.yml new file mode 100644 index 0000000..cc4dba2 --- /dev/null +++ b/node_modules/text-table/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/text-table/LICENSE b/node_modules/text-table/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/node_modules/text-table/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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/text-table/example/align.js b/node_modules/text-table/example/align.js new file mode 100644 index 0000000..9be4309 --- /dev/null +++ b/node_modules/text-table/example/align.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); diff --git a/node_modules/text-table/example/center.js b/node_modules/text-table/example/center.js new file mode 100644 index 0000000..52b1c69 --- /dev/null +++ b/node_modules/text-table/example/center.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); diff --git a/node_modules/text-table/example/dotalign.js b/node_modules/text-table/example/dotalign.js new file mode 100644 index 0000000..2cea629 --- /dev/null +++ b/node_modules/text-table/example/dotalign.js @@ -0,0 +1,9 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); diff --git a/node_modules/text-table/example/doubledot.js b/node_modules/text-table/example/doubledot.js new file mode 100644 index 0000000..bab983b --- /dev/null +++ b/node_modules/text-table/example/doubledot.js @@ -0,0 +1,11 @@ +var table = require('../'); +var t = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] +], { align: [ '.' ] }); +console.log(t); diff --git a/node_modules/text-table/example/table.js b/node_modules/text-table/example/table.js new file mode 100644 index 0000000..903ea4c --- /dev/null +++ b/node_modules/text-table/example/table.js @@ -0,0 +1,6 @@ +var table = require('../'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); diff --git a/node_modules/text-table/index.js b/node_modules/text-table/index.js new file mode 100644 index 0000000..5c0ba98 --- /dev/null +++ b/node_modules/text-table/index.js @@ -0,0 +1,86 @@ +module.exports = function (rows_, opts) { + if (!opts) opts = {}; + var hsep = opts.hsep === undefined ? ' ' : opts.hsep; + var align = opts.align || []; + var stringLength = opts.stringLength + || function (s) { return String(s).length; } + ; + + var dotsizes = reduce(rows_, function (acc, row) { + forEach(row, function (c, ix) { + var n = dotindex(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + var rows = map(rows_, function (row) { + return map(row, function (c_, ix) { + var c = String(c_); + if (align[ix] === '.') { + var index = dotindex(c); + var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) + - (stringLength(c) - index) + ; + return c + Array(size).join(' '); + } + else return c; + }); + }); + + var sizes = reduce(rows, function (acc, row) { + forEach(row, function (c, ix) { + var n = stringLength(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + return map(rows, function (row) { + return map(row, function (c, ix) { + var n = (sizes[ix] - stringLength(c)) || 0; + var s = Array(Math.max(n + 1, 1)).join(' '); + if (align[ix] === 'r' || align[ix] === '.') { + return s + c; + } + if (align[ix] === 'c') { + return Array(Math.ceil(n / 2 + 1)).join(' ') + + c + Array(Math.floor(n / 2 + 1)).join(' ') + ; + } + + return c + s; + }).join(hsep).replace(/\s+$/, ''); + }).join('\n'); +}; + +function dotindex (c) { + var m = /\.[^.]*$/.exec(c); + return m ? m.index + 1 : c.length; +} + +function reduce (xs, f, init) { + if (xs.reduce) return xs.reduce(f, init); + var i = 0; + var acc = arguments.length >= 3 ? init : xs[i++]; + for (; i < xs.length; i++) { + f(acc, xs[i], i); + } + return acc; +} + +function forEach (xs, f) { + if (xs.forEach) return xs.forEach(f); + for (var i = 0; i < xs.length; i++) { + f.call(xs, xs[i], i); + } +} + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f.call(xs, xs[i], i)); + } + return res; +} diff --git a/node_modules/text-table/package.json b/node_modules/text-table/package.json new file mode 100644 index 0000000..b4d17a4 --- /dev/null +++ b/node_modules/text-table/package.json @@ -0,0 +1,44 @@ +{ + "name": "text-table", + "version": "0.2.0", + "description": "borderless text tables with alignment", + "main": "index.js", + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "cli-color": "~0.2.3" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/text-table.git" + }, + "homepage": "https://github.com/substack/text-table", + "keywords": [ + "text", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/node_modules/text-table/readme.markdown b/node_modules/text-table/readme.markdown new file mode 100644 index 0000000..18806ac --- /dev/null +++ b/node_modules/text-table/readme.markdown @@ -0,0 +1,134 @@ +# text-table + +generate borderless text table strings suitable for printing to stdout + +[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table) + +[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table) + +# example + +## default align + +``` js +var table = require('text-table'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); +``` + +``` +master 0123456789abcdef +staging fedcba9876543210 +``` + +## left-right align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 33450 +foo 1006 +bar 45 +``` + +## dotted align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 334.212 +foo 1006 +bar 45.6 +baz 123. +``` + +## centered + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); +``` + +``` +beep 1024 xyz +boop 3388450 tuv +foo 10106 qrstuv +bar 45 lmno +``` + +# methods + +``` js +var table = require('text-table') +``` + +## var s = table(rows, opts={}) + +Return a formatted table string `s` from an array of `rows` and some options +`opts`. + +`rows` should be an array of arrays containing strings, numbers, or other +printable values. + +options can be: + +* `opts.hsep` - separator to use between columns, default `' '` +* `opts.align` - array of alignment types for each column, default `['l','l',...]` +* `opts.stringLength` - callback function to use when calculating the string length + +alignment types are: + +* `'l'` - left +* `'r'` - right +* `'c'` - center +* `'.'` - decimal + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install text-table +``` + +# Use with ANSI-colors + +Since the string length of ANSI color schemes does not equal the length +JavaScript sees internally it is necessary to pass the a custom string length +calculator during the main function call. + +See the `test/ansi-colors.js` file for an example. + +# license + +MIT diff --git a/node_modules/text-table/test/align.js b/node_modules/text-table/test/align.js new file mode 100644 index 0000000..245357f --- /dev/null +++ b/node_modules/text-table/test/align.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] + ], { align: [ 'l', 'r' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 33450', + 'foo 1006', + 'bar 45' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/ansi-colors.js b/node_modules/text-table/test/ansi-colors.js new file mode 100644 index 0000000..fbc5bb1 --- /dev/null +++ b/node_modules/text-table/test/ansi-colors.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var table = require('../'); +var color = require('cli-color'); +var ansiTrim = require('cli-color/lib/trim'); + +test('center', function (t) { + t.plan(1); + var opts = { + align: [ 'l', 'c', 'l' ], + stringLength: function(s) { return ansiTrim(s).length } + }; + var s = table([ + [ + color.red('Red'), color.green('Green'), color.blue('Blue') + ], + [ + color.bold('Bold'), color.underline('Underline'), + color.italic('Italic') + ], + [ + color.inverse('Inverse'), color.strike('Strike'), + color.blink('Blink') + ], + [ 'bar', '45', 'lmno' ] + ], opts); + t.equal(ansiTrim(s), [ + 'Red Green Blue', + 'Bold Underline Italic', + 'Inverse Strike Blink', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/center.js b/node_modules/text-table/test/center.js new file mode 100644 index 0000000..c2c7a62 --- /dev/null +++ b/node_modules/text-table/test/center.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('center', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] + ], { align: [ 'l', 'c', 'l' ] }); + t.equal(s, [ + 'beep 1024 xyz', + 'boop 3388450 tuv', + 'foo 10106 qrstuv', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/dotalign.js b/node_modules/text-table/test/dotalign.js new file mode 100644 index 0000000..f804f92 --- /dev/null +++ b/node_modules/text-table/test/dotalign.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] + ], { align: [ 'l', '.' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 334.212', + 'foo 1006', + 'bar 45.6', + 'baz 123.' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/doubledot.js b/node_modules/text-table/test/doubledot.js new file mode 100644 index 0000000..659b57c --- /dev/null +++ b/node_modules/text-table/test/doubledot.js @@ -0,0 +1,24 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] + ], { align: [ '.' ] }); + t.equal(s, [ + ' 0.1.2', + '11.22.33', + ' 5.6.7', + ' 1.22222', + '12345.', + ' 5555.', + ' 123' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/table.js b/node_modules/text-table/test/table.js new file mode 100644 index 0000000..9c67014 --- /dev/null +++ b/node_modules/text-table/test/table.js @@ -0,0 +1,14 @@ +var test = require('tape'); +var table = require('../'); + +test('table', function (t) { + t.plan(1); + var s = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] + ]); + t.equal(s, [ + 'master 0123456789abcdef', + 'staging fedcba9876543210' + ].join('\n')); +}); diff --git a/node_modules/tsconfig-paths/CHANGELOG.md b/node_modules/tsconfig-paths/CHANGELOG.md new file mode 100644 index 0000000..6fd484c --- /dev/null +++ b/node_modules/tsconfig-paths/CHANGELOG.md @@ -0,0 +1,365 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +## [3.14.1] - 2022-03-22 + +### Fixed + +- Use minimist 1.2.6 for all depencencies becuase of pollution vulnerability. See PR [#197](https://github.com/dividab/tsconfig-paths/pull/197). Thanks to [@gopijaganthan](https://github.com/gopijaganthan) for this fix! + +## [3.14.0] - 2022-03-13 + +### Added + +- Support for path mapping starting with `/`. See PR [#180](https://github.com/dividab/tsconfig-paths/pull/180), issue [#113](https://github.com/dividab/tsconfig-paths/issues/113), and issue [#128](https://github.com/dividab/tsconfig-paths/issues/128). Thanks to [@benevbright](https://github.com/benevbright) for this fix! + +## [3.13.0] - 2022-03-03 + +### Added + +- Include file extension in paths resolved from package.json "main" field. See PR [#135](https://github.com/dividab/tsconfig-paths/pull/135) and issue [#133](https://github.com/dividab/tsconfig-paths/issues/133). Thanks to [@katywings](https://github.com/katywings) for this fix! + +## [3.12.0] - 2021-08-24 + +- Add support for baseUrl override using TS_NODE_BASEURL env var #185 and #114. Thanks to @ejhayes and @information-security for these PRs! + +## [3.11.0] - 2021-08-24 + +- Reverted upgrade of json5 due to being a breaking change. See PR #173. + +## [3.10.1] - 2021-07-06 + +### Fixed + +- Add register.js to published files + +## [3.10.0] - 2021-07-06 + +### Added + +- feat(tsconfig-loader): extends config from node_modules (#106). Thanks to @zorji for this PR! + +### Fixed + +- Update CHANGELOG.md (#96). Thanks to @OliverJAsh for this PR! +- Fix "bootstraping" typo (#111). Thanks to @KRMisha for this PR! +- Update Readme fixes #116 (#123). Thanks to @benwinding for this PR! +- Fixed typo (#144). Thanks to @mprinc for this PR! +- [TYPO] src/mapping-entry.ts (#145). Thanks to @mprinc for this PR! +- docs(README): fix typos (#156). Thanks to @PiDelport for this PR! +- deps: bump json5 to use type definition provided officially (#158). Thanks to @koba04 for this PR! +- Update tsconfig-loader.ts (#161). Thanks to @fecqs for this PR! +- fix typo (#165). Thanks to @wonda-tea-coffee for this PR! +- Add file extenstion to typings property value (#151). Thanks to @dangrussell for this PR! + +## [3.9.0] - 2019-09-12 + +### Added + +- Make extension config override instead of deep merge. See PR [#95](https://github.com/dividab/tsconfig-paths/pull/95) and issue [#94](https://github.com/dividab/tsconfig-paths/issues/94). Thanks to [@OliverJAsh](https://github.com/OliverJAsh) for this addition! + +## [3.8.0] - 2019-02-05 + +### Added + +- Add option to avoid adding a match-all rule. See PR [#73](https://github.com/dividab/tsconfig-paths/pull/73) and issue [72](https://github.com/dividab/tsconfig-paths/issues/72). Thanks to [@Swatinem](https://github.com/Swatinem) for this addition! + +## [3.7.0] - 2018-11-11 + +### Added + +- Allow cleanup of register(). See PR [#64](https://github.com/dividab/tsconfig-paths/pull/64) and issue [63](https://github.com/dividab/tsconfig-paths/issues/63). Thanks to [@TylorS](https://github.com/TylorS) for this addition! + +## [3.6.0] - 2018-09-10 + +### Added + +- Prefer Node's core modules over file modules. See PR [#60](https://github.com/dividab/tsconfig-paths/pull/60) and issue [56](https://github.com/dividab/tsconfig-paths/issues/56). Thanks to @ljani for this addition! + +## [3.5.0] - 2018-07-28 + +### Added + +- Add support for trailing commas in tsconfig.json (use JSON5 to parse). See issue [#48](https://github.com/dividab/tsconfig-paths/issues/48), and PR [#58](https://github.com/dividab/tsconfig-paths/pull/58). Thanks to [@jshado1](https://github.com/jshado1) for this addition! + +## [3.4.2] - 2018-06-30 + +### Fixed + +- Do not resolve directories, only files, sse issue [#51](https://github.com/dividab/tsconfig-paths/issues/51). + +## [3.4.1] - 2018-06-24 + +### Fixed + +- Ignore field name mappings in package.json files that are not paths of existing files [#46](https://github.com/dividab/tsconfig-paths/pull/45). Thanks to [@christoffer](https://github.com/christoffer) for this fix! + +## [3.4.0] - 2018-06-12 + +### Added + +- Add support for providing a list of field names to try instead of just using "main", [#45](https://github.com/dividab/tsconfig-paths/pull/45). Thanks to [@christoffer-dropbox](https://github.com/christoffer-dropbox) for this addition! + +## [3.3.2] - 2018-05-07 + +### Fixed + +- Adding json file extension to extends property, [#40](https://github.com/dividab/tsconfig-paths/pull/40). Thanks to [@cwhite-connectfirst](https://github.com/cwhite-connectfirst) for this fixing this! + +## [3.3.1] - 2018-04-17 + +### Fixed + +- Fix project undefined error when calling register, [#37](https://github.com/dividab/tsconfig-paths/issues/37). Thanks to [@natedanner](https://github.com/natedanner) for this fixing this! + +## [3.3.0] - 2018-04-14 + +### Added + +- Add possibility to indicate explicitly tsconfig location, [#35](https://github.com/dividab/tsconfig-paths/issues/35). Thanks to [@procopenco](https://github.com/procopenco) for this adding this! + +## [3.2.0] - 2018-03-31 + +### Added + +- Added support for passing a filename as cwd, see issue [#31](https://github.com/dividab/tsconfig-paths/issues/31) and PR [#32](https://github.com/dividab/tsconfig-paths/pull/32). Thanks to [@amodm](https://github.com/amodm) for this adding this! + +## [3.1.3] - 2018-03-14 + +### Fixed + +- Fix async recursion, see [#30](https://github.com/dividab/tsconfig-paths/pull/30). Thanks to [@Nayni](https://github.com/Nayni) for this fix! + +## [3.1.2] - 2018-03-13 + +### Fixed + +- Fix a forgotten return when doneCallback is invoked, see [#29](https://github.com/dividab/tsconfig-paths/pull/29). Thanks to [@Nayni](https://github.com/Nayni) for this fix! + +## [3.1.1] - 2018-01-13 + +### Fixed + +- Fix read json async when it does not exist + +## [3.1.0] - 2018-01-13 + +### Added + +- Implement default async json reader function. + +## [3.0.0] - 2018-01-13 + +### Changed + +- Remove parameter `absoluteSourceFileName` from the `MatchPath` and `matchFromAbsolutePaths` functions. It was not used internally. +- `matchFromAbsolutePaths` now accepts a pre-sorted array of `MappingEntry`s instead of a dictionary. This was done so the sorting could be done once which should give better performance. + +### Added + +- `createMatchPathAsync`, creates an async version of the `MatchPath` function. Can be used for example by webpack plugins. +- `matchFromAbsolutePathsAsync`, async version of `matchFromAbsolutePaths`. + +## [2.7.3] + +### Fixed + +- Only resolve path if tsconfig present [#25](https://github.com/dividab/tsconfig-paths/pull/25). Thanks to @nicoschoenmaker for the PR. + +## [2.7.2] + +### Fixed + +- Return absolute path to tsconfig.json. + +## [2.7.1] + +### Fixed + +- Remove left over console.log. + +## [2.7.0] + +### Added + +- Support `baseUrl` to exist in base tsconfig.json when using `extends`, see [#23](https://github.com/dividab/tsconfig-paths/issues/23). + +## [2.6.0] + +### Added + +- Add `baseUrl` and `configFileAbsolutePath` to the result of `loadConfig`. + +## [2.5.0] + +### Added + +- New function in Programmatic API `loadConfig`. + +## [2.4.3] + +### Fixed + +- Export MatchPth typing. + +## [2.4.2] + +### Fixed + +- Add missing types field in package.json. + +## [2.4.1] + +### Fixed + +- Include declaration files. Fixes [#22](https://github.com/dividab/tsconfig-paths/issues/22). + +## [2.4.0] + +### Changed + +- Removed dependency for package `tsconfig`. + +### Fixed + +- Support for config inheritance with `extends`. Fixes [#17](https://github.com/dividab/tsconfig-paths/issues/17). + +## [2.2.0] + +### Fixed + +- Fixed issue [#7](https://github.com/dividab/tsconfig-paths/issues/7). + +## [2.1.2] + +### Fixed + +- Fixed issue [#6](https://github.com/dividab/tsconfig-paths/issues/6). + +## [2.1.1] + +### Fixed + +- Fixed issue [#4](https://github.com/dividab/tsconfig-paths/issues/4) + +## [2.1.0] + +### Fixed + +- Fixed issue [#3](https://github.com/dividab/tsconfig-paths/issues/3) + +## [2.0.0] + +### Added + +- We now look at `process.env.TS_NODE_PROJECT` +- Functionality to bootstrap tsconfig-paths. Documentation in [README](https://github.com/dividab/tsconfig-paths/blob/master/README.md) + +### Changed + +- Changed signature for `createMatchPath`. Now only takes absoluteUrl and paths. + +## [1.1.0] + +### Added + +- More explanation to readme. +- Match all extensions in require.extensions. +- Match longest pattern prefix first as typesript does. +- Match file in main field of package.json. +- Check for index files explicitly. + +## [1.0.0] - 2016-12-30 + +- First stable release. + +## [0.4.0] - 2016-12-30 + +### Changed + +- Renamed project to `tsocnfig-paths`. + +## [0.3.0] - 2016-12-30 + +### Added + +- API documentation. +- `createMatchPath` function. +- `matchFromAbsolutePaths` function. + +### Removed + +- `findPath` function. + +## [0.2.1] - 2016-12-29 + +### Fixed + +- `tsconfig-paths/register` was not available. + +## [0.2.0] - 2016-12-29 + +### Fixed + +- Paths for files in sub-dirs. + +### Added + +- Programmatic use. + +## [0.1.2] - 2016-12-28 + +### Fixed + +- Fixed wrong name of the package in README. +- Add missing files on publish. + +## [0.1.1] - 2016-12-28 + +### Added + +- Loading of tsconfig. +- Example. +- Publish scripts. + +## [0.1.0] - 2016-12-28 + +- Initial version. + +[unreleased]: https://github.com/dividab/tsconfig-paths/compare/v3.9.0...master +[3.9.0]: https://github.com/dividab/tsconfig-paths/compare/v3.8.0...v3.9.0 +[3.8.0]: https://github.com/dividab/tsconfig-paths/compare/3.7.0...3.8.0 +[3.7.0]: https://github.com/dividab/tsconfig-paths/compare/3.6.0...3.7.0 +[3.6.0]: https://github.com/dividab/tsconfig-paths/compare/3.5.0...3.6.0 +[3.5.0]: https://github.com/dividab/tsconfig-paths/compare/3.4.2...3.5.0 +[3.4.2]: https://github.com/dividab/tsconfig-paths/compare/3.4.1...3.4.2 +[3.4.1]: https://github.com/dividab/tsconfig-paths/compare/3.4.0...3.4.1 +[3.4.0]: https://github.com/dividab/tsconfig-paths/compare/3.3.2...3.4.0 +[3.3.2]: https://github.com/dividab/tsconfig-paths/compare/3.3.1...3.3.2 +[3.3.1]: https://github.com/dividab/tsconfig-paths/compare/3.3.0...3.3.1 +[3.3.0]: https://github.com/dividab/tsconfig-paths/compare/3.2.0...3.3.0 +[3.2.0]: https://github.com/dividab/tsconfig-paths/compare/3.1.3...3.2.0 +[3.1.3]: https://github.com/dividab/tsconfig-paths/compare/3.1.2...3.1.3 +[3.1.2]: https://github.com/dividab/tsconfig-paths/compare/3.1.1...3.1.2 +[3.1.1]: https://github.com/dividab/tsconfig-paths/compare/3.1.0...3.1.1 +[3.1.0]: https://github.com/dividab/tsconfig-paths/compare/3.0.0...3.1.0 +[3.0.0]: https://github.com/dividab/tsconfig-paths/compare/2.7.3...3.0.0 +[2.7.3]: https://github.com/dividab/tsconfig-paths/compare/2.7.2...2.7.3 +[2.7.2]: https://github.com/dividab/tsconfig-paths/compare/2.7.1...2.7.2 +[2.7.1]: https://github.com/dividab/tsconfig-paths/compare/2.7.0...2.7.1 +[2.7.0]: https://github.com/dividab/tsconfig-paths/compare/2.6.0...2.7.0 +[2.6.0]: https://github.com/dividab/tsconfig-paths/compare/2.5.0...2.6.0 +[2.5.0]: https://github.com/dividab/tsconfig-paths/compare/2.4.3...2.5.0 +[2.4.3]: https://github.com/dividab/tsconfig-paths/compare/2.4.2...2.4.3 +[2.4.2]: https://github.com/dividab/tsconfig-paths/compare/2.4.1...2.4.2 +[2.4.1]: https://github.com/dividab/tsconfig-paths/compare/2.4.0...2.4.1 +[2.4.0]: https://github.com/dividab/tsconfig-paths/compare/2.2.0...2.4.0 +[2.2.0]: https://github.com/dividab/tsconfig-paths/compare/2.1.2...2.2.0 +[2.1.2]: https://github.com/dividab/tsconfig-paths/compare/2.1.1...2.1.2 +[2.1.1]: https://github.com/dividab/tsconfig-paths/compare/2.1.0...2.1.1 diff --git a/node_modules/tsconfig-paths/LICENSE b/node_modules/tsconfig-paths/LICENSE new file mode 100644 index 0000000..884c7e3 --- /dev/null +++ b/node_modules/tsconfig-paths/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Jonas Kello + +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/tsconfig-paths/README.md b/node_modules/tsconfig-paths/README.md new file mode 100644 index 0000000..768119e --- /dev/null +++ b/node_modules/tsconfig-paths/README.md @@ -0,0 +1,268 @@ +# tsconfig-paths + +[![npm version][version-image]][version-url] +[![build][build-image]][build-url] +[![Coverage Status][codecov-image]][codecov-url] +[![MIT license][license-image]][license-url] +[![code style: prettier][prettier-image]][prettier-url] + +Use this to load modules whose location is specified in the `paths` section of `tsconfig.json`. Both loading at run-time and via API are supported. + +Typescript by default mimics the Node.js runtime resolution strategy of modules. But it also allows the use of [path mapping](https://www.typescriptlang.org/docs/handbook/module-resolution.html) which allows arbitrary module paths (that doesn't start with "/" or ".") to be specified and mapped to physical paths in the filesystem. The typescript compiler can resolve these paths from `tsconfig` so it will compile OK. But if you then try to execute the compiled files with node (or ts-node), it will only look in the `node_modules` folders all the way up to the root of the filesystem and thus will not find the modules specified by `paths` in `tsconfig`. + +If you require this package's `tsconfig-paths/register` module it will read the `paths` from `tsconfig.json` and convert node's module loading calls into to physical file paths that node can load. + +## How to install + +``` +yarn add --dev tsconfig-paths +``` + +or + +``` +npm install --save-dev tsconfig-paths +``` + +## How to use + +### With node + +`node -r tsconfig-paths/register main.js` + +If `process.env.TS_NODE_BASEURL` is set it will override the value of `baseUrl` in tsconfig.json: + +`TS_NODE_BASEURL=./dist node -r tsconfig-paths/register main.js` + +### With ts-node + +`ts-node -r tsconfig-paths/register main.ts` + +If `process.env.TS_NODE_PROJECT` is set it will be used to resolved tsconfig.json + +### With webpack + +For webpack please use the [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin). + +### With mocha and ts-node + +As of Mocha >= 4.0.0 the `--compiler` was [deprecated](https://github.com/mochajs/mocha/wiki/compilers-deprecation). Instead `--require` should be used. You also have to specify a glob that includes `.ts` files because mocha looks after files with `.js` extension by default. + +```bash +mocha -r ts-node/register -r tsconfig-paths/register "test/**/*.ts" +``` + +### With other commands + +As long as the command has something similar to a `--require` option that can load a module before it starts, tsconfig-paths should be able to work with it. + +### With `ts-node` and VSCode + +The following is an example configuration for the `.vscode/launch.json`. + +```js +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Functions", + "request": "launch", + "type": "node", + "runtimeArgs": [ + "-r", + "${workspaceFolder}/functions/node_modules/ts-node/register", + "-r", + "${workspaceFolder}/functions/node_modules/tsconfig-paths/register" + ], + "args": ["${workspaceFolder}/functions/src/index.ts"], + "cwd": "${workspaceFolder}", + "protocol": "inspector", + "env": { + "NODE_ENV": "development", + "TS_NODE_PROJECT": "${workspaceFolder}/functions/tsconfig.json" + }, + "outFiles": ["${workspaceFolder}/functions/lib/**/*.js"] + } + ] +} +``` + +## Bootstrapping with explicit params + +If you want more granular control over tsconfig-paths you can bootstrap it. This can be useful if you for instance have compiled with `tsc` to another directory where `tsconfig.json` doesn't exists. + +For example, create a wrapper script called `tsconfig-paths-bootstrap.js` with the contents below: + +```javascript +const tsConfig = require("./tsconfig.json"); +const tsConfigPaths = require("tsconfig-paths"); + +const baseUrl = "./"; // Either absolute or relative path. If relative it's resolved to current working directory. +const cleanup = tsConfigPaths.register({ + baseUrl, + paths: tsConfig.compilerOptions.paths, +}); + +// When path registration is no longer needed +cleanup(); +``` + +Then run with: + +`node -r ./tsconfig-paths-bootstrap.js main.js` + +## Configuration Options + +You can set options by passing them before the script path, via programmatic usage or via environment variables. + +```bash +ts-node --project customLocation/tsconfig.json -r tsconfig-paths/register "test/**/*.ts" +``` + +### CLI and Programmatic Options + +_Environment variable denoted in parentheses._ + +- `-P, --project [path]` Path to TypeScript JSON project file (`TS_NODE_PROJECT`) + +## Config loading process + +1. Use explicit params passed to register +2. Use `process.env.TS_NODE_PROJECT` to resolve tsConfig.json and the specified baseUrl and paths. +3. Resolves tsconfig.json from current working directory and the specified baseUrl and paths. + +## Programmatic use + +The public API consists of these functions: + +- [register](#register) +- [loadConfig](#loadConfig) +- [createMatchPath](#createMatchPath) / [createMatchPathAsync](#createMatchPathAsync) +- [matchFromAbsolutePaths](#matchFromAbsolutePaths) / [matchFromAbsolutePathsAsync](#matchFromAbsolutePathsAsync) + +### register + +```typescript +export interface ExplicitParams { + baseUrl: string; + paths: { [key: string]: Array }; + mainFields?: Array; + addMatchAll?: boolean; +} + +/** + * Installs a custom module load function that can adhere to paths in tsconfig. + */ +export function register(explicitParams: ExplicitParams): () => void; +``` + +This function will patch the node's module loading so it will look for modules in paths specified by tsconfig.json. +A function is returned for you to reinstate Node's original module loading. + +### loadConfig + +```typescript +export function loadConfig(cwd: string = process.cwd()): ConfigLoaderResult; + +export type ConfigLoaderResult = + | ConfigLoaderSuccessResult + | ConfigLoaderFailResult; + +export interface ConfigLoaderSuccessResult { + resultType: "success"; + absoluteBaseUrl: string; + paths: { [key: string]: Array }; +} + +export interface ConfigLoaderFailResult { + resultType: "failed"; + message: string; +} +``` + +This function loads the tsconfig.json. It will start searching from the specified `cwd` directory. Passing the tsconfig.json file directly instead of a directory also works. + +### createMatchPath + +```typescript +/** + * Function that can match a path + */ +export interface MatchPath { + ( + requestedModule: string, + readJson?: Filesystem.ReadJsonSync, + fileExists?: (name: string) => boolean, + extensions?: ReadonlyArray + ): string | undefined; +} + +/** + * Creates a function that can resolve paths according to tsconfig paths property. + * @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig. + * @param paths The paths as specified in tsconfig. + * @param mainFields A list of package.json field names to try when resolving module files. + * @param addMatchAll Add a match-all "*" rule if none is present + * @returns a function that can resolve paths. + */ +export function createMatchPath( + absoluteBaseUrl: string, + paths: { [key: string]: Array }, + mainFields: string[] = ["main"], + addMatchAll: boolean = true +): MatchPath { +``` + +The `createMatchPath` function will create a function that can match paths. It accepts `baseUrl` and `paths` directly as they are specified in tsconfig and will handle resolving paths to absolute form. The created function has the signature specified by the type `MatchPath` above. + +### matchFromAbsolutePaths + +```typescript +/** + * Finds a path from tsconfig that matches a module load request. + * @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form. + * @param requestedModule The required module name. + * @param readJson Function that can read json from a path (useful for testing). + * @param fileExists Function that checks for existence of a file at a path (useful for testing). + * @param extensions File extensions to probe for (useful for testing). + * @param mainFields A list of package.json field names to try when resolving module files. + * @returns the found path, or undefined if no path was found. + */ +export function matchFromAbsolutePaths( + absolutePathMappings: ReadonlyArray, + requestedModule: string, + readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync, + fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync, + extensions: Array = Object.keys(require.extensions), + mainFields: string[] = ["main"] +): string | undefined { +``` + +This function is lower level and requires that the paths as already been resolved to absolute form and sorted in correct order into an array. + +### createMatchPathAsync + +This is the async version of `createMatchPath`. It has the same signature but with a callback parameter for the result. + +### matchFromAbsolutePathsAsync + +This is the async version of `matchFromAbsolutePaths`. It has the same signature but with a callback parameter for the result. + +## How to publish + +``` +yarn version --patch +yarn version --minor +yarn version --major +``` + +[version-image]: https://img.shields.io/npm/v/tsconfig-paths.svg?style=flat +[version-url]: https://www.npmjs.com/package/tsconfig-paths +[build-image]: https://github.com/dividab/tsconfig-paths/workflows/CI/badge.svg +[build-url]: https://github.com/dividab/tsconfig-paths/actions/workflows/ci.yml?query=branch%3Amaster +[codecov-image]: https://codecov.io/gh/dividab/tsconfig-paths/branch/master/graph/badge.svg +[codecov-url]: https://codecov.io/gh/dividab/tsconfig-paths +[license-image]: https://img.shields.io/github/license/dividab/tsconfig-paths.svg?style=flat +[license-url]: https://opensource.org/licenses/MIT +[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg +[prettier-url]: https://github.com/prettier/prettier diff --git a/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js new file mode 100644 index 0000000..4cfdd47 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var config_loader_1 = require("../config-loader"); +var path_1 = require("path"); +describe("config-loader", function () { + it("should use explicitParams when set", function () { + var result = (0, config_loader_1.configLoader)({ + explicitParams: { + baseUrl: "/foo/bar", + paths: { + asd: ["asd"], + }, + }, + cwd: "/baz", + }); + var successResult = result; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, "/foo/bar"); + // assert.equal(successResult.paths["asd"][0], "asd"); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe("/foo/bar"); + expect(successResult.paths["asd"][0]).toBe("asd"); + }); + it("should use explicitParams when set and add cwd when path is relative", function () { + var result = (0, config_loader_1.configLoader)({ + explicitParams: { + baseUrl: "bar/", + paths: { + asd: ["asd"], + }, + }, + cwd: "/baz", + }); + var successResult = result; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, join("/baz", "bar/")); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "bar/")); + }); + it("should fallback to tsConfigLoader when explicitParams is not set", function () { + var result = (0, config_loader_1.configLoader)({ + explicitParams: undefined, + cwd: "/baz", + // tslint:disable-next-line:no-any + tsConfigLoader: function (_) { return ({ + tsConfigPath: "/baz/tsconfig.json", + baseUrl: "./src", + paths: {}, + }); }, + }); + var successResult = result; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, join("/baz", "src")); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "src")); + }); + it("should show an error message when baseUrl is missing", function () { + var result = (0, config_loader_1.configLoader)({ + explicitParams: undefined, + cwd: "/baz", + // tslint:disable-next-line:no-any + tsConfigLoader: function (_) { return ({ + tsConfigPath: "/baz/tsconfig.json", + baseUrl: undefined, + paths: {}, + }); }, + }); + var failResult = result; + // assert.equal(failResult.resultType, "failed"); + // assert.isTrue(failResult.message.indexOf("baseUrl") > -1); + expect(failResult.resultType).toBe("failed"); + expect(failResult.message.indexOf("baseUrl") > -1).toBeTruthy(); + }); + it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", function () { + // using tsconfig-named.json to ensure that future changes to fix + // https://github.com/dividab/tsconfig-paths/issues/31 + // do not pass this test case just because of a directory walk looking + // for tsconfig.json + var configFile = (0, path_1.join)(__dirname, "tsconfig-named.json"); + var result = (0, config_loader_1.loadConfig)(configFile); + var successResult = result; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.configFileAbsolutePath, configFile); + expect(successResult.resultType).toBe("success"); + expect(successResult.configFileAbsolutePath).toBe(configFile); + }); +}); +//# sourceMappingURL=config-loader.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map new file mode 100644 index 0000000..0a6bae3 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/config-loader.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-loader.test.js","sourceRoot":"","sources":["../../src/__tests__/config-loader.test.ts"],"names":[],"mappings":";;AAAA,kDAK0B;AAC1B,6BAA4B;AAE5B,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE;QACvC,IAAM,MAAM,GAAG,IAAA,4BAAY,EAAC;YAC1B,cAAc,EAAE;gBACd,OAAO,EAAE,UAAU;gBACnB,KAAK,EAAE;oBACL,GAAG,EAAE,CAAC,KAAK,CAAC;iBACb;aACF;YACD,GAAG,EAAE,MAAM;SACZ,CAAC,CAAC;QAEH,IAAM,aAAa,GAAG,MAAmC,CAAC;QAC1D,qDAAqD;QACrD,2DAA2D;QAC3D,sDAAsD;QACtD,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE;QACzE,IAAM,MAAM,GAAG,IAAA,4BAAY,EAAC;YAC1B,cAAc,EAAE;gBACd,OAAO,EAAE,MAAM;gBACf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EAAE,EAAE;aACV,CAAC,EAJ0B,CAI1B;SACH,CAAC,CAAC;QAEH,IAAM,UAAU,GAAG,MAAgC,CAAC;QACpD,iDAAiD;QACjD,6DAA6D;QAC7D,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wGAAwG,EAAE;QAC3G,iEAAiE;QACjE,sDAAsD;QACtD,sEAAsE;QACtE,oBAAoB;QACpB,IAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;QAC1D,IAAM,MAAM,GAAG,IAAA,0BAAU,EAAC,UAAU,CAAC,CAAC;QAEtC,IAAM,aAAa,GAAG,MAAmC,CAAC;QAC1D,qDAAqD;QACrD,kEAAkE;QAClE,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts new file mode 100644 index 0000000..b1bc050 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.d.ts @@ -0,0 +1,17 @@ +export interface OneTest { + readonly name: string; + readonly only?: boolean; + readonly skip?: boolean; + readonly absoluteBaseUrl: string; + readonly paths: { + [key: string]: Array; + }; + readonly mainFields?: string[]; + readonly addMatchAll?: boolean; + readonly existingFiles: ReadonlyArray; + readonly requestedModule: string; + readonly extensions: ReadonlyArray; + readonly packageJson?: {}; + readonly expectedPath: string | undefined; +} +export declare const tests: ReadonlyArray; diff --git a/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js new file mode 100644 index 0000000..b826523 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js @@ -0,0 +1,205 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.tests = void 0; +var path_1 = require("path"); +var filesystem_1 = require("../../filesystem"); +var defaultExtensionsWhenRunningInTsNode = [ + ".js", + ".json", + ".node", + ".ts", + ".tsx", +]; +exports.tests = [ + { + name: "should locate path that matches with star and exists", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["location/*"], + }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve to correct path when many are specified", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["foo1/*", "foo2/*", "location/*", "foo3/*"], + }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + extensions: [".ts"], + expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")), + }, + { + name: "should locate path that matches with star and prioritize pattern with longest prefix", + absoluteBaseUrl: "/root/", + paths: { + "*": ["location/*"], + "lib/*": ["location/*"], + }, + existingFiles: [ + (0, path_1.join)("/root", "location", "lib", "mylib", "index.ts"), + (0, path_1.join)("/root", "location", "mylib", "index.ts"), + ], + requestedModule: "lib/mylib", + expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should locate path that matches with star and exists with extension", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib.myext")], + requestedModule: "lib/mylib", + extensions: [".js", ".myext"], + expectedPath: (0, filesystem_1.removeExtension)((0, path_1.join)("/root", "location", "mylib.myext")), + }, + { + name: "should resolve request with extension specified", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("/root", "location", "test.jpg")], + requestedModule: "lib/test.jpg", + expectedPath: (0, path_1.join)("/root", "location", "test.jpg"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should locate path that matches without star and exists", + absoluteBaseUrl: "/root/", + paths: { + "lib/foo": ["location/foo"], + }, + existingFiles: [(0, path_1.join)("/root", "location", "foo.ts")], + requestedModule: "lib/foo", + expectedPath: (0, filesystem_1.removeExtension)((0, path_1.join)("/root", "location", "foo.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve to parent folder when filename is in subfolder", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve from main field in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib", "kalle.ts")], + packageJson: { main: "./kalle.ts" }, + requestedModule: "lib/mylib", + expectedPath: (0, path_1.join)("/root", "location", "mylib", "kalle.ts"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve from main field in package.json (js)", + absoluteBaseUrl: "/root", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib.js", "kalle.js")], + packageJson: { main: "./kalle.js" }, + requestedModule: "lib/mylib.js", + extensions: [".ts", ".js"], + expectedPath: (0, path_1.join)("/root", "location", "mylib.js", "kalle.js"), + }, + { + name: "should resolve from list of fields by priority in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + mainFields: ["missing", "browser", "main"], + packageJson: { main: "./main.js", browser: "./browser.js" }, + existingFiles: [ + (0, path_1.join)("/root", "location", "mylibjs", "main.js"), + (0, path_1.join)("/root", "location", "mylibjs", "browser.js"), // browserFilePath + ], + extensions: [".ts", ".js"], + requestedModule: "lib/mylibjs", + expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "browser.js"), + }, + { + name: "should ignore field mappings to missing files in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + mainFields: ["browser", "main"], + existingFiles: [(0, path_1.join)("/root", "location", "mylibjs", "kalle.js")], + requestedModule: "lib/mylibjs", + packageJson: { + main: "./kalle.js", + browser: "./nope.js", + }, + extensions: [".ts", ".js"], + expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "kalle.js"), + }, + { + name: "should ignore advanced field mappings in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [ + (0, path_1.join)("/root", "location", "mylibjs", "kalle.js"), + (0, path_1.join)("/root", "location", "mylibjs", "browser.js"), + ], + requestedModule: "lib/mylibjs", + packageJson: { + main: "./kalle.js", + browser: { mylibjs: "./browser.js", "./kalle.js": "./browser.js" }, + }, + extensions: [".ts", ".js"], + expectedPath: (0, path_1.join)("/root", "location", "mylibjs", "kalle.js"), + }, + { + name: "should resolve to with the help of baseUrl when not explicitly set", + absoluteBaseUrl: "/root/", + paths: {}, + existingFiles: [(0, path_1.join)("/root", "mylib", "index.ts")], + requestedModule: "mylib", + expectedPath: (0, path_1.dirname)((0, path_1.join)("/root", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not resolve with the help of baseUrl when asked not to", + absoluteBaseUrl: "/root/", + paths: {}, + addMatchAll: false, + existingFiles: [(0, path_1.join)("/root", "mylib", "index.ts")], + requestedModule: "mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not locate path that does not match", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [(0, path_1.join)("root", "location", "mylib")], + requestedModule: "mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not resolve typings file (index.d.ts)", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["location/*"], + }, + existingFiles: [(0, path_1.join)("/root", "location", "mylib", "index.d.ts")], + requestedModule: "lib/mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve main file with cjs file extension", + absoluteBaseUrl: "/root/", + paths: {}, + existingFiles: [(0, path_1.join)("/root", "mylib", "index.cjs")], + packageJson: { + main: "./index.cjs", + }, + requestedModule: "mylib", + expectedPath: (0, path_1.join)("/root", "mylib", "index.cjs"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, +]; +//# sourceMappingURL=match-path-data.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map new file mode 100644 index 0000000..ae8372f --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/data/match-path-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"match-path-data.js","sourceRoot":"","sources":["../../../src/__tests__/data/match-path-data.ts"],"names":[],"mappings":";;;AAAA,6BAAqC;AACrC,+CAAmD;AAiBnD,IAAM,oCAAoC,GAAG;IAC3C,KAAK;IACL,OAAO;IACP,OAAO;IACP,KAAK;IACL,MAAM;CACP,CAAC;AAEW,QAAA,KAAK,GAA2B;IAC3C;QACE,IAAI,EAAE,sDAAsD;QAC5D,eAAe,EAAE,QAAQ;QACzB,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,YAAY,CAAC;SACxB;QACD,aAAa,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC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AAU,EAAE,oCAAoC;KACjD;IACD;QACE,IAAI,EAAE,kDAAkD;QACxD,eAAe,EAAE,QAAQ;QACzB,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,aAAa;SACpB;QACD,eAAe,EAAE,OAAO;QACxB,YAAY,EAAE,IAAA,WAAI,EAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC;QACjD,UAAU,EAAE,oCAAoC;KACjD;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js new file mode 100644 index 0000000..9334535 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var Filesystem = require("../filesystem"); +var path = require("path"); +describe("filesystem", function () { + var fileThatExists = path.join(__dirname, "../../package.json"); + var fileThatNotExists = path.join(__dirname, "../../package2.json"); + it("should find file that exists, sync", function () { + var result = Filesystem.fileExistsSync(fileThatExists); + // assert.equal(result, true); + expect(result).toBe(true); + }); + it("should not find file that not exists, sync", function () { + var result = Filesystem.fileExistsSync(fileThatNotExists); + // assert.equal(result, false); + expect(result).toBe(false); + }); + it("should find file that exists, async", function (done) { + Filesystem.fileExistsAsync(fileThatExists, function (_err, result) { + try { + // assert.equal(result, true); + expect(result).toBe(true); + done(); + } + catch (error) { + done(error); + } + }); + }); + it("should not find file that not exists, async", function (done) { + Filesystem.fileExistsAsync(fileThatNotExists, function (_err, result) { + try { + // assert.equal(result, false); + expect(result).toBe(false); + done(); + } + catch (error) { + done(error); + } + }); + }); + it("should load json, sync", function () { + var result = Filesystem.readJsonFromDiskSync(fileThatExists); + // assert.isOk(result); + expect(result); + // assert.equal(result.main, "lib/index.js"); + expect(result.main).toBe("lib/index.js"); + }); + it("should load json, async", function (done) { + Filesystem.readJsonFromDiskAsync(fileThatExists, function (_err, result) { + try { + // assert.isOk(result); // Asserts that object is truthy. + expect(result).toBeTruthy(); + // assert.equal(result.main, "lib/index.js"); + expect(result.main).toBe("lib/index.js"); + done(); + } + catch (error) { + done(error); + } + }); + }); +}); +//# sourceMappingURL=filesystem.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map new file mode 100644 index 0000000..5ad0591 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/filesystem.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filesystem.test.js","sourceRoot":"","sources":["../../src/__tests__/filesystem.test.ts"],"names":[],"mappings":";;AAAA,0CAA4C;AAC5C,2BAA6B;AAE7B,QAAQ,CAAC,YAAY,EAAE;IACrB,IAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAClE,IAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEtE,EAAE,CAAC,oCAAoC,EAAE;QACvC,IAAM,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACzD,8BAA8B;QAC9B,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE;QAC/C,IAAM,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;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,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;gBAC5B,6CAA6C;gBAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACzC,IAAI,EAAE,CAAC;aACR;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js new file mode 100644 index 0000000..1276f75 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var mapping_entry_1 = require("../mapping-entry"); +var path_1 = require("path"); +describe("mapping-entry", function () { + it("should change to absolute paths and sort in longest prefix order", function () { + var result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", { + "*": ["/foo1", "/foo2"], + "longest/pre/fix/*": ["/foo2/bar"], + "pre/fix/*": ["/foo3"], + }, true); + // assert.deepEqual(result, [ + // { + // pattern: "longest/pre/fix/*", + // paths: [join("/absolute", "base", "url", "foo2", "bar")], + // }, + // { + // pattern: "pre/fix/*", + // paths: [join("/absolute", "base", "url", "foo3")], + // }, + // { + // pattern: "*", + // paths: [ + // join("/absolute", "base", "url", "foo1"), + // join("/absolute", "base", "url", "foo2"), + // ], + // }, + // ]); + expect(result).toEqual([ + { + pattern: "longest/pre/fix/*", + paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")], + }, + { + pattern: "pre/fix/*", + paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")], + }, + { + pattern: "*", + paths: [ + (0, path_1.join)("/absolute", "base", "url", "foo1"), + (0, path_1.join)("/absolute", "base", "url", "foo2"), + ], + }, + ]); + }); + it("should should add a match-all pattern when requested", function () { + var result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", {}, true); + // assert.deepEqual(result, [ + // { + // pattern: "*", + // paths: [join("/absolute", "base", "url", "*")], + // }, + // ]); + expect(result).toEqual([ + { + pattern: "*", + paths: [(0, path_1.join)("/absolute", "base", "url", "*")], + }, + ]); + result = (0, mapping_entry_1.getAbsoluteMappingEntries)("/absolute/base/url", {}, false); + // assert.deepEqual(result, []); + expect(result).toEqual([]); + }); +}); +//# sourceMappingURL=mapping-entry.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map new file mode 100644 index 0000000..212fc02 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/mapping-entry.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapping-entry.test.js","sourceRoot":"","sources":["../../src/__tests__/mapping-entry.test.ts"],"names":[],"mappings":";;AAAA,kDAA6D;AAC7D,6BAA4B;AAE5B,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,kEAAkE,EAAE;QACrE,IAAM,MAAM,GAAG,IAAA,yCAAyB,EACtC,oBAAoB,EACpB;YACE,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;YACvB,mBAAmB,EAAE,CAAC,WAAW,CAAC;YAClC,WAAW,EAAE,CAAC,OAAO,CAAC;SACvB,EACD,IAAI,CACL,CAAC;QACF,6BAA6B;QAC7B,MAAM;QACN,oCAAoC;QACpC,gEAAgE;QAChE,OAAO;QACP,MAAM;QACN,4BAA4B;QAC5B,yDAAyD;QACz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AC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js new file mode 100644 index 0000000..eddcd8e --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var match_path_async_1 = require("../match-path-async"); +var Tests = require("./data/match-path-data"); +describe("match-path-async", function () { + Tests.tests.forEach(function (t) { + return it(t.name, function (done) { + var matchPath = (0, match_path_async_1.createMatchPathAsync)(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll); + matchPath(t.requestedModule, function (_path, callback) { return callback(undefined, t.packageJson); }, function (path, callback) { + return callback(undefined, t.existingFiles.indexOf(path) !== -1); + }, t.extensions, function (_err, result) { + // assert.equal(result, t.expectedPath); + expect(result).toBe(t.expectedPath); + done(); + }); + }); + }); +}); +//# sourceMappingURL=match-path-async.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map new file mode 100644 index 0000000..72f42f2 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-async.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"match-path-async.test.js","sourceRoot":"","sources":["../../src/__tests__/match-path-async.test.ts"],"names":[],"mappings":";;AAAA,wDAA2D;AAC3D,8CAAgD;AAEhD,QAAQ,CAAC,kBAAkB,EAAE;IAC3B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC;QACpB,OAAA,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,UAAC,IAAI;YACd,IAAM,SAAS,GAAG,IAAA,uCAAoB,EACpC,CAAC,CAAC,eAAe,EACjB,CAAC,CAAC,KAAK,EACP,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,WAAW,CACd,CAAC;YACF,SAAS,CACP,CAAC,CAAC,eAAe,EACjB,UAAC,KAAK,EAAE,QAAQ,IAAK,OAAA,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EAAlC,CAAkC,EACvD,UAAC,IAAI,EAAE,QAAQ;gBACb,OAAA,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAAzD,CAAyD,EAC3D,CAAC,CAAC,UAAU,EACZ,UAAC,IAAI,EAAE,MAAM;gBACX,wCAAwC;gBACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;gBACpC,IAAI,EAAE,CAAC;YACT,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IAnBF,CAmBE,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js new file mode 100644 index 0000000..96e40f5 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var match_path_sync_1 = require("../match-path-sync"); +var Tests = require("./data/match-path-data"); +describe("match-path-sync", function () { + Tests.tests.forEach(function (t) { + return it(t.name, function () { + var matchPath = (0, match_path_sync_1.createMatchPath)(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll); + var result = matchPath(t.requestedModule, function (_) { return t.packageJson; }, function (name) { return t.existingFiles.indexOf(name) !== -1; }, t.extensions); + // assert.equal(result, t.expectedPath); + expect(result).toBe(t.expectedPath); + }); + }); +}); +//# sourceMappingURL=match-path-sync.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map new file mode 100644 index 0000000..ee00edb --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/match-path-sync.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"match-path-sync.test.js","sourceRoot":"","sources":["../../src/__tests__/match-path-sync.test.ts"],"names":[],"mappings":";;AAAA,sDAAqD;AACrD,8CAAgD;AAEhD,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC;QACpB,OAAA,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YACT,IAAM,SAAS,GAAG,IAAA,iCAAe,EAC/B,CAAC,CAAC,eAAe,EACjB,CAAC,CAAC,KAAK,EACP,CAAC,CAAC,UAAU,EACZ,CAAC,CAAC,WAAW,CACd,CAAC;YACF,IAAM,MAAM,GAAG,SAAS,CACtB,CAAC,CAAC,eAAe,EACjB,UAAC,CAAS,IAAK,OAAA,CAAC,CAAC,WAAW,EAAb,CAAa,EAC5B,UAAC,IAAY,IAAK,OAAA,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAApC,CAAoC,EACtD,CAAC,CAAC,UAAU,CACb,CAAC;YACF,wCAAwC;YACxC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC,CAAC;IAfF,CAeE,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js new file mode 100644 index 0000000..245d001 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js @@ -0,0 +1,175 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var try_path_1 = require("../try-path"); +var path_1 = require("path"); +describe("mapping-entry", function () { + var abosolutePathMappings = [ + { + pattern: "longest/pre/fix/*", + paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")], + }, + { pattern: "pre/fix/*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")] }, + { pattern: "*", paths: [(0, path_1.join)("/absolute", "base", "url", "foo1")] }, + ]; + var abosolutePathMappingsStarstWithSlash = [ + { + pattern: "/opt/*", + paths: [(0, path_1.join)("/absolute", "src", "aws-layer")], + }, + { + pattern: "*", + paths: [(0, path_1.join)("/absolute", "src")], + }, + ]; + it("should return no paths for relative requested module", function () { + var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], abosolutePathMappings, "./requested-module"); + // assert.deepEqual(result, undefined); + expect(result).toBeUndefined(); + }); + it("should return no paths if no pattern match the requested module", function () { + var result = (0, try_path_1.getPathsToTry)([".ts", "tsx"], [ + { + pattern: "longest/pre/fix/*", + paths: [(0, path_1.join)("/absolute", "base", "url", "foo2", "bar")], + }, + { + pattern: "pre/fix/*", + paths: [(0, path_1.join)("/absolute", "base", "url", "foo3")], + }, + ], "requested-module"); + expect(result).toBeUndefined(); + }); + it("should get all paths that matches requested module", function () { + var result = (0, try_path_1.getPathsToTry)([".ts", ".tsx"], abosolutePathMappings, "longest/pre/fix/requested-module"); + // assert.deepEqual(result, [ + // // "longest/pre/fix/*" + // { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") }, + // { + // type: "extension", + // path: join("/absolute", "base", "url", "foo2", "bar.ts"), + // }, + // { + // type: "extension", + // path: join("/absolute", "base", "url", "foo2", "bar.tsx"), + // }, + // { + // type: "package", + // path: join("/absolute", "base", "url", "foo2", "bar", "package.json"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"), + // }, + // // "*" + // { type: "file", path: join("/absolute", "base", "url", "foo1") }, + // { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") }, + // { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") }, + // { + // type: "package", + // path: join("/absolute", "base", "url", "foo1", "package.json"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo1", "index.ts"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo1", "index.tsx"), + // }, + // ]); + expect(result).toEqual([ + // "longest/pre/fix/*" + { type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar") }, + { + type: "extension", + path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.ts"), + }, + { + type: "extension", + path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar.tsx"), + }, + { + type: "package", + path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "package.json"), + }, + { + type: "index", + path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.ts"), + }, + { + type: "index", + path: (0, path_1.join)("/absolute", "base", "url", "foo2", "bar", "index.tsx"), + }, + // "*" + { type: "file", path: (0, path_1.join)("/absolute", "base", "url", "foo1") }, + { type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.ts") }, + { type: "extension", path: (0, path_1.join)("/absolute", "base", "url", "foo1.tsx") }, + { + type: "package", + path: (0, path_1.join)("/absolute", "base", "url", "foo1", "package.json"), + }, + { + type: "index", + path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.ts"), + }, + { + type: "index", + path: (0, path_1.join)("/absolute", "base", "url", "foo1", "index.tsx"), + }, + ]); + }); + it("should resolve paths starting with a slash", function () { + var result = (0, try_path_1.getPathsToTry)([".ts"], abosolutePathMappingsStarstWithSlash, "/opt/utils"); + expect(result).toEqual([ + // "opt/*" + { + path: (0, path_1.join)("/absolute", "src", "aws-layer"), + type: "file", + }, + { + path: (0, path_1.join)("/absolute", "src", "aws-layer.ts"), + type: "extension", + }, + { + path: (0, path_1.join)("/absolute", "src", "aws-layer", "package.json"), + type: "package", + }, + { + path: (0, path_1.join)("/absolute", "src", "aws-layer", "index.ts"), + type: "index", + }, + // "*" + { + path: (0, path_1.join)("/absolute", "src"), + type: "file", + }, + { + path: (0, path_1.join)("/absolute", "src.ts"), + type: "extension", + }, + { + path: (0, path_1.join)("/absolute", "src", "package.json"), + type: "package", + }, + { + path: (0, path_1.join)("/absolute", "src", "index.ts"), + type: "index", + }, + ]); + }); +}); +// describe("match-star", () => { +// it("should match star in last position", () => { +// const result = matchStar("lib/*", "lib/mylib"); +// assert.equal(result, "mylib"); +// }); +// it("should match star in first position", () => { +// const result = matchStar("*/lib", "mylib/lib"); +// assert.equal(result, "mylib"); +// }); +// }); +//# sourceMappingURL=try-path.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map new file mode 100644 index 0000000..af98dcc --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/try-path.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"try-path.test.js","sourceRoot":"","sources":["../../src/__tests__/try-path.test.ts"],"names":[],"mappings":";;AAAA,wCAA4C;AAC5C,6BAA4B;AAE5B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,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,iCAAiC;AACjC,qDAAqD;AACrD,sDAAsD;AACtD,qCAAqC;AACrC,QAAQ;AACR,sDAAsD;AACtD,sDAAsD;AACtD,qCAAqC;AACrC,QAAQ;AACR,MAAM"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js new file mode 100644 index 0000000..0e35282 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js @@ -0,0 +1,246 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tsconfig_loader_1 = require("../tsconfig-loader"); +var path_1 = require("path"); +describe("tsconfig-loader", function () { + it("should find tsconfig in cwd", function () { + var result = (0, tsconfig_loader_1.tsConfigLoader)({ + cwd: "/foo/bar", + getEnv: function (_) { return undefined; }, + loadSync: function (cwd) { + return { + tsConfigPath: "".concat(cwd, "/tsconfig.json"), + baseUrl: "./", + paths: {}, + }; + }, + }); + // assert.equal(result.tsConfigPath, "/foo/bar/tsconfig.json"); + expect(result.tsConfigPath).toBe("/foo/bar/tsconfig.json"); + }); + it("should return loaderResult.tsConfigPath as undefined when not found", function () { + var result = (0, tsconfig_loader_1.tsConfigLoader)({ + cwd: "/foo/bar", + getEnv: function (_) { return undefined; }, + loadSync: function (_) { + return { + tsConfigPath: undefined, + baseUrl: "./", + paths: {}, + }; + }, + }); + // assert.isUndefined(result.tsConfigPath); + expect(result.tsConfigPath).toBeUndefined(); + }); + it("should use TS_NODE_PROJECT env if exists", function () { + var result = (0, tsconfig_loader_1.tsConfigLoader)({ + cwd: "/foo/bar", + getEnv: function (key) { + return key === "TS_NODE_PROJECT" ? "/foo/baz" : undefined; + }, + loadSync: function (cwd, fileName) { + if (cwd === "/foo/bar" && fileName === "/foo/baz") { + return { + tsConfigPath: "/foo/baz/tsconfig.json", + baseUrl: "./", + paths: {}, + }; + } + return { + tsConfigPath: undefined, + baseUrl: "./", + paths: {}, + }; + }, + }); + // assert.equal(result.tsConfigPath, "/foo/baz/tsconfig.json"); + expect(result.tsConfigPath).toBe("/foo/baz/tsconfig.json"); + }); + it("should use TS_NODE_BASEURL env if exists", function () { + var result = (0, tsconfig_loader_1.tsConfigLoader)({ + cwd: "/foo/bar", + getEnv: function (key) { + return key === "TS_NODE_BASEURL" ? "SOME_BASEURL" : undefined; + }, + loadSync: function (_0, _1, baseUrl) { + return { + tsConfigPath: undefined, + baseUrl: baseUrl, + paths: {}, + }; + }, + }); + // assert.equal(result.baseUrl, "SOME_BASEURL"); + expect(result.baseUrl).toBe("SOME_BASEURL"); + }); + it("should not use TS_NODE_BASEURL env if it does not exist", function () { + var result = (0, tsconfig_loader_1.tsConfigLoader)({ + cwd: "/foo/bar", + getEnv: function (_) { + return undefined; + }, + loadSync: function (_0, _1, baseUrl) { + return { + tsConfigPath: undefined, + baseUrl: baseUrl, + paths: {}, + }; + }, + }); + // assert.equal(result.baseUrl, undefined); + expect(result.baseUrl).toBeUndefined(); + }); +}); +describe("walkForTsConfig", function () { + it("should find tsconfig in starting directory", function () { + var pathToTsconfig = (0, path_1.join)("/root", "dir1", "tsconfig.json"); + var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1"), function (path) { return path === pathToTsconfig; }); + // assert.equal(res, pathToTsconfig); + expect(res).toBe(pathToTsconfig); + }); + it("should find tsconfig in parent directory", function () { + var pathToTsconfig = (0, path_1.join)("/root", "tsconfig.json"); + var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1"), function (path) { return path === pathToTsconfig; }); + // assert.equal(res, pathToTsconfig); + expect(res).toBe(pathToTsconfig); + }); + it("should return undefined when reaching the top", function () { + var res = (0, tsconfig_loader_1.walkForTsConfig)((0, path_1.join)("/root", "dir1", "kalle"), function () { return false; }); + // assert.equal(res, undefined); + expect(res).toBeUndefined(); + }); +}); +describe("loadConfig", function () { + it("It should load a config", function () { + var config = { compilerOptions: { baseUrl: "hej" } }; + var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return JSON.stringify(config); }); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + it("It should load a config with comments", function () { + var config = { compilerOptions: { baseUrl: "hej" } }; + var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n // my comment\n \"compilerOptions\": { \n \"baseUrl\": \"hej\"\n }\n }"; }); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + it("It should load a config with trailing commas", function () { + var config = { compilerOptions: { baseUrl: "hej" } }; + var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n \"compilerOptions\": { \n \"baseUrl\": \"hej\",\n },\n }"; }); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + it("It should load a config with extends and overwrite all options", function () { + var firstConfig = { + extends: "../base-config.json", + compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } }, + }; + var firstConfigPath = (0, path_1.join)("/root", "dir1", "tsconfig.json"); + var baseConfig = { + compilerOptions: { + baseUrl: "olle", + paths: { foo: ["bar1"] }, + strict: true, + }, + }; + var baseConfigPath = (0, path_1.join)("/root", "base-config.json"); + var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "tsconfig.json"), function (path) { return path === firstConfigPath || path === baseConfigPath; }, function (path) { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === baseConfigPath) { + return JSON.stringify(baseConfig); + } + return ""; + }); + // assert.deepEqual(res, { + // extends: "../base-config.json", + // compilerOptions: { + // baseUrl: "kalle", + // paths: { foo: ["bar2"] }, + // strict: true, + // }, + // }); + expect(res).toEqual({ + extends: "../base-config.json", + compilerOptions: { + baseUrl: "kalle", + paths: { foo: ["bar2"] }, + strict: true, + }, + }); + }); + it("It should load a config with extends from node_modules and overwrite all options", function () { + var firstConfig = { + extends: "my-package/base-config.json", + compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } }, + }; + var firstConfigPath = (0, path_1.join)("/root", "dir1", "tsconfig.json"); + var baseConfig = { + compilerOptions: { + baseUrl: "olle", + paths: { foo: ["bar1"] }, + strict: true, + }, + }; + var baseConfigPath = (0, path_1.join)("/root", "dir1", "node_modules", "my-package", "base-config.json"); + var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "tsconfig.json"), function (path) { return path === firstConfigPath || path === baseConfigPath; }, function (path) { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === baseConfigPath) { + return JSON.stringify(baseConfig); + } + return ""; + }); + // assert.deepEqual(res, { + // extends: "my-package/base-config.json", + // compilerOptions: { + // baseUrl: "kalle", + // paths: { foo: ["bar2"] }, + // strict: true, + // }, + // }); + expect(res).toEqual({ + extends: "my-package/base-config.json", + compilerOptions: { + baseUrl: "kalle", + paths: { foo: ["bar2"] }, + strict: true, + }, + }); + }); + it("Should use baseUrl relative to location of extended tsconfig", function () { + var firstConfig = { compilerOptions: { baseUrl: "." } }; + var firstConfigPath = (0, path_1.join)("/root", "first-config.json"); + var secondConfig = { extends: "../first-config.json" }; + var secondConfigPath = (0, path_1.join)("/root", "dir1", "second-config.json"); + var thirdConfig = { extends: "../second-config.json" }; + var thirdConfigPath = (0, path_1.join)("/root", "dir1", "dir2", "third-config.json"); + var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "dir1", "dir2", "third-config.json"), function (path) { + return path === firstConfigPath || + path === secondConfigPath || + path === thirdConfigPath; + }, function (path) { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === secondConfigPath) { + return JSON.stringify(secondConfig); + } + if (path === thirdConfigPath) { + return JSON.stringify(thirdConfig); + } + return ""; + }); + // assert.deepEqual(res, { + // extends: "../second-config.json", + // compilerOptions: { baseUrl: join("..", "..") }, + // }); + expect(res).toEqual({ + extends: "../second-config.json", + compilerOptions: { baseUrl: (0, path_1.join)("..", "..") }, + }); + }); +}); +//# sourceMappingURL=tsconfig-loader.test.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map new file mode 100644 index 0000000..7ffcd8c --- /dev/null +++ b/node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tsconfig-loader.test.js","sourceRoot":"","sources":["../../src/__tests__/tsconfig-loader.test.ts"],"names":[],"mappings":";;AAAA,sDAI4B;AAC5B,6BAA4B;AAE5B,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,EAAE,CAAC,6BAA6B,EAAE;QAChC,IAAM,MAAM,GAAG,IAAA,gCAAc,EAAC;YAC5B,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,UAAC,CAAS,IAAK,OAAA,SAAS,EAAT,CAAS;YAChC,QAAQ,EAAE,UAAC,GAAW;gBACpB,OAAO;oBACL,YAAY,EAAE,UAAG,GAAG,mBAAgB;oBACpC,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,EAAE;iBACV,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;QAEH,+DAA+D;QAC/D,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE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AC;QACzD,IAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC;QACrE,IAAM,WAAW,GAAG,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;QACzD,IAAM,eAAe,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAC3E,IAAM,GAAG,GAAG,IAAA,8BAAY,EACtB,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAClD,UAAC,IAAI;YACH,OAAA,IAAI,KAAK,eAAe;gBACxB,IAAI,KAAK,gBAAgB;gBACzB,IAAI,KAAK,eAAe;QAFxB,CAEwB,EAC1B,UAAC,IAAI;YACH,IAAI,IAAI,KAAK,eAAe,EAAE;gBAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;aACpC;YACD,IAAI,IAAI,KAAK,gBAAgB,EAAE;gBAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;aACrC;YACD,IAAI,IAAI,KAAK,eAAe,EAAE;gBAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;aACpC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CACF,CAAC;QAEF,0BAA0B;QAC1B,sCAAsC;QACtC,oDAAoD;QACpD,MAAM;QACN,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YAClB,OAAO,EAAE,uBAAuB;YAChC,eAAe,EAAE,EAAE,OAAO,EAAE,IAAA,WAAI,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/config-loader.d.ts b/node_modules/tsconfig-paths/lib/config-loader.d.ts new file mode 100644 index 0000000..2eb8730 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/config-loader.d.ts @@ -0,0 +1,33 @@ +import * as TsConfigLoader2 from "./tsconfig-loader"; +export interface ExplicitParams { + baseUrl: string; + paths: { + [key: string]: Array; + }; + mainFields?: Array; + addMatchAll?: boolean; +} +export declare type TsConfigLoader = (params: TsConfigLoader2.TsConfigLoaderParams) => TsConfigLoader2.TsConfigLoaderResult; +export interface ConfigLoaderParams { + cwd: string; + explicitParams?: ExplicitParams; + tsConfigLoader?: TsConfigLoader; +} +export interface ConfigLoaderSuccessResult { + resultType: "success"; + configFileAbsolutePath: string; + baseUrl: string; + absoluteBaseUrl: string; + paths: { + [key: string]: Array; + }; + mainFields?: Array; + addMatchAll?: boolean; +} +export interface ConfigLoaderFailResult { + resultType: "failed"; + message: string; +} +export declare type ConfigLoaderResult = ConfigLoaderSuccessResult | ConfigLoaderFailResult; +export declare function loadConfig(cwd?: string): ConfigLoaderResult; +export declare function configLoader({ cwd, explicitParams, tsConfigLoader, }: ConfigLoaderParams): ConfigLoaderResult; diff --git a/node_modules/tsconfig-paths/lib/config-loader.js b/node_modules/tsconfig-paths/lib/config-loader.js new file mode 100644 index 0000000..727da0f --- /dev/null +++ b/node_modules/tsconfig-paths/lib/config-loader.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.configLoader = exports.loadConfig = void 0; +var TsConfigLoader2 = require("./tsconfig-loader"); +var path = require("path"); +var options_1 = require("./options"); +function loadConfig(cwd) { + if (cwd === void 0) { cwd = options_1.options.cwd; } + return configLoader({ cwd: cwd }); +} +exports.loadConfig = loadConfig; +function configLoader(_a) { + var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b; + if (explicitParams) { + // tslint:disable-next-line:no-shadowed-variable + var absoluteBaseUrl_1 = path.isAbsolute(explicitParams.baseUrl) + ? explicitParams.baseUrl + : path.join(cwd, explicitParams.baseUrl); + return { + resultType: "success", + configFileAbsolutePath: "", + baseUrl: explicitParams.baseUrl, + absoluteBaseUrl: absoluteBaseUrl_1, + paths: explicitParams.paths, + mainFields: explicitParams.mainFields, + addMatchAll: explicitParams.addMatchAll, + }; + } + // Load tsconfig and create path matching function + var loadResult = tsConfigLoader({ + cwd: cwd, + getEnv: function (key) { return process.env[key]; }, + }); + if (!loadResult.tsConfigPath) { + return { + resultType: "failed", + message: "Couldn't find tsconfig.json", + }; + } + if (!loadResult.baseUrl) { + return { + resultType: "failed", + message: "Missing baseUrl in compilerOptions", + }; + } + var tsConfigDir = path.dirname(loadResult.tsConfigPath); + var absoluteBaseUrl = path.join(tsConfigDir, loadResult.baseUrl); + return { + resultType: "success", + configFileAbsolutePath: loadResult.tsConfigPath, + baseUrl: loadResult.baseUrl, + absoluteBaseUrl: absoluteBaseUrl, + paths: loadResult.paths || {}, + }; +} +exports.configLoader = configLoader; +//# sourceMappingURL=config-loader.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/config-loader.js.map b/node_modules/tsconfig-paths/lib/config-loader.js.map new file mode 100644 index 0000000..c41d3e3 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/config-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,2BAA6B;AAC7B,qCAAoC;AAsCpC,SAAgB,UAAU,CAAC,GAAyB;IAAzB,oBAAA,EAAA,MAAc,iBAAO,CAAC,GAAG;IAClD,OAAO,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAAC,EAIR;QAHnB,GAAG,SAAA,EACH,cAAc,oBAAA,EACd,sBAA+C,EAA/C,cAAc,mBAAG,eAAe,CAAC,cAAc,KAAA;IAE/C,IAAI,cAAc,EAAE;QAClB,gDAAgD;QAChD,IAAM,iB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DC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/filesystem.d.ts b/node_modules/tsconfig-paths/lib/filesystem.d.ts new file mode 100644 index 0000000..44cfdae --- /dev/null +++ b/node_modules/tsconfig-paths/lib/filesystem.d.ts @@ -0,0 +1,33 @@ +/** + * Typing for the fields of package.json we care about + */ +export interface PackageJson { + [key: string]: string; +} +/** + * A function that json from a file + */ +export interface ReadJsonSync { + (packageJsonPath: string): any | undefined; +} +export interface FileExistsSync { + (name: string): boolean; +} +export interface FileExistsAsync { + (path: string, callback: (err?: Error, exists?: boolean) => void): void; +} +export interface ReadJsonAsyncCallback { + (err?: Error, content?: any): void; +} +export interface ReadJsonAsync { + (path: string, callback: ReadJsonAsyncCallback): void; +} +export declare function fileExistsSync(path: string): boolean; +/** + * Reads package.json from disk + * @param file Path to package.json + */ +export declare function readJsonFromDiskSync(packageJsonPath: string): any | undefined; +export declare function readJsonFromDiskAsync(path: string, callback: (err?: Error, content?: any) => void): void; +export declare function fileExistsAsync(path2: string, callback2: (err?: Error, exists?: boolean) => void): void; +export declare function removeExtension(path: string): string; diff --git a/node_modules/tsconfig-paths/lib/filesystem.js b/node_modules/tsconfig-paths/lib/filesystem.js new file mode 100644 index 0000000..662ba09 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/filesystem.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0; +var fs = require("fs"); +function fileExistsSync(path) { + try { + var stats = fs.statSync(path); + return stats.isFile(); + } + catch (err) { + // If error, assume file did not exist + return false; + } +} +exports.fileExistsSync = fileExistsSync; +/** + * Reads package.json from disk + * @param file Path to package.json + */ +// tslint:disable-next-line:no-any +function readJsonFromDiskSync(packageJsonPath) { + if (!fs.existsSync(packageJsonPath)) { + return undefined; + } + return require(packageJsonPath); +} +exports.readJsonFromDiskSync = readJsonFromDiskSync; +function readJsonFromDiskAsync(path, +// tslint:disable-next-line:no-any +callback) { + fs.readFile(path, "utf8", function (err, result) { + // If error, assume file did not exist + if (err || !result) { + return callback(); + } + var json = JSON.parse(result); + return callback(undefined, json); + }); +} +exports.readJsonFromDiskAsync = readJsonFromDiskAsync; +function fileExistsAsync(path2, callback2) { + fs.stat(path2, function (err, stats) { + if (err) { + // If error assume file does not exist + return callback2(undefined, false); + } + callback2(undefined, stats ? stats.isFile() : false); + }); +} +exports.fileExistsAsync = fileExistsAsync; +function removeExtension(path) { + return path.substring(0, path.lastIndexOf(".")) || path; +} +exports.removeExtension = removeExtension; +//# sourceMappingURL=filesystem.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/filesystem.js.map b/node_modules/tsconfig-paths/lib/filesystem.js.map new file mode 100644 index 0000000..a802539 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/filesystem.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":";;;AAAA,uBAAyB;AAkCzB,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI;QACF,IAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;KACvB;IAAC,OAAO,GAAG,EAAE;QACZ,sCAAsC;QACtC,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AARD,wCAQC;AAED;;;GAGG;AACH,kCAAkC;AAClC,SAAgB,oBAAoB,CAAC,eAAuB;IAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC;AALD,oDAKC;AAED,SAAgB,qBAAqB,CACnC,IAAY;AACZ,kCAAkC;AAClC,QAA8C;IAE9C,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAC,GAAG,EAAE,MAAM;QACpC,sCAAsC;QACtC,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE;YAClB,OAAO,QAAQ,EAAE,CAAC;SACnB;QACD,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC;AAbD,sDAaC;AAED,SAAgB,eAAe,CAC7B,KAAa,EACb,SAAkD;IAElD,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,GAAU,EAAE,KAAe;QACzC,IAAI,GAAG,EAAE;YACP,sCAAsC;YACtC,OAAO,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SACpC;QACD,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,0CAWC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AAC1D,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/index.d.ts b/node_modules/tsconfig-paths/lib/index.d.ts new file mode 100644 index 0000000..8a3d685 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/index.d.ts @@ -0,0 +1,5 @@ +export { createMatchPath, matchFromAbsolutePaths, MatchPath, } from "./match-path-sync"; +export { createMatchPathAsync, matchFromAbsolutePathsAsync, MatchPathAsync, } from "./match-path-async"; +export { register } from "./register"; +export { loadConfig, ConfigLoaderResult, ConfigLoaderSuccessResult, ConfigLoaderFailResult, } from "./config-loader"; +export { ReadJsonSync, ReadJsonAsync, FileExistsSync, FileExistsAsync, } from "./filesystem"; diff --git a/node_modules/tsconfig-paths/lib/index.js b/node_modules/tsconfig-paths/lib/index.js new file mode 100644 index 0000000..dbd54cc --- /dev/null +++ b/node_modules/tsconfig-paths/lib/index.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.loadConfig = exports.register = exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = exports.matchFromAbsolutePaths = exports.createMatchPath = void 0; +// register is used from register.js in root dir +var match_path_sync_1 = require("./match-path-sync"); +Object.defineProperty(exports, "createMatchPath", { enumerable: true, get: function () { return match_path_sync_1.createMatchPath; } }); +Object.defineProperty(exports, "matchFromAbsolutePaths", { enumerable: true, get: function () { return match_path_sync_1.matchFromAbsolutePaths; } }); +var match_path_async_1 = require("./match-path-async"); +Object.defineProperty(exports, "createMatchPathAsync", { enumerable: true, get: function () { return match_path_async_1.createMatchPathAsync; } }); +Object.defineProperty(exports, "matchFromAbsolutePathsAsync", { enumerable: true, get: function () { return match_path_async_1.matchFromAbsolutePathsAsync; } }); +var register_1 = require("./register"); +Object.defineProperty(exports, "register", { enumerable: true, get: function () { return register_1.register; } }); +var config_loader_1 = require("./config-loader"); +Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_loader_1.loadConfig; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/index.js.map b/node_modules/tsconfig-paths/lib/index.js.map new file mode 100644 index 0000000..c1f1d82 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAChD,qDAI2B;AAHzB,kHAAA,eAAe,OAAA;AACf,yHAAA,sBAAsB,OAAA;AAGxB,uDAI4B;AAH1B,wHAAA,oBAAoB,OAAA;AACpB,+HAAA,2BAA2B,OAAA;AAG7B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,iDAKyB;AAJvB,2GAAA,UAAU,OAAA"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/mapping-entry.d.ts b/node_modules/tsconfig-paths/lib/mapping-entry.d.ts new file mode 100644 index 0000000..35669f7 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/mapping-entry.d.ts @@ -0,0 +1,17 @@ +export interface MappingEntry { + readonly pattern: string; + readonly paths: ReadonlyArray; +} +export interface Paths { + readonly [key: string]: ReadonlyArray; +} +/** + * Converts an absolute baseUrl and paths to an array of absolute mapping entries. + * The array is sorted by longest prefix. + * Having an array with entries allows us to keep a sorting order rather than + * sort by keys each time we use the mappings. + * @param absoluteBaseUrl + * @param paths + * @param addMatchAll + */ +export declare function getAbsoluteMappingEntries(absoluteBaseUrl: string, paths: Paths, addMatchAll: boolean): ReadonlyArray; diff --git a/node_modules/tsconfig-paths/lib/mapping-entry.js b/node_modules/tsconfig-paths/lib/mapping-entry.js new file mode 100644 index 0000000..bcb24fe --- /dev/null +++ b/node_modules/tsconfig-paths/lib/mapping-entry.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getAbsoluteMappingEntries = void 0; +var path = require("path"); +/** + * Converts an absolute baseUrl and paths to an array of absolute mapping entries. + * The array is sorted by longest prefix. + * Having an array with entries allows us to keep a sorting order rather than + * sort by keys each time we use the mappings. + * @param absoluteBaseUrl + * @param paths + * @param addMatchAll + */ +function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) { + // Resolve all paths to absolute form once here, and sort them by + // longest prefix once here, this saves time on each request later. + // We need to put them in an array to preserve the sorting order. + var sortedKeys = sortByLongestPrefix(Object.keys(paths)); + var absolutePaths = []; + for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) { + var key = sortedKeys_1[_i]; + absolutePaths.push({ + pattern: key, + paths: paths[key].map(function (pathToResolve) { + return path.join(absoluteBaseUrl, pathToResolve); + }), + }); + } + // If there is no match-all path specified in the paths section of tsconfig, then try to match + // all paths relative to baseUrl, this is how typescript works. + if (!paths["*"] && addMatchAll) { + absolutePaths.push({ + pattern: "*", + paths: ["".concat(absoluteBaseUrl.replace(/\/$/, ""), "/*")], + }); + } + return absolutePaths; +} +exports.getAbsoluteMappingEntries = getAbsoluteMappingEntries; +/** + * Sort path patterns. + * If a module name can be matched with multiple patterns then pattern with the longest prefix will be picked. + */ +function sortByLongestPrefix(arr) { + return arr + .concat() + .sort(function (a, b) { return getPrefixLength(b) - getPrefixLength(a); }); +} +function getPrefixLength(pattern) { + var prefixLength = pattern.indexOf("*"); + return pattern.substr(0, prefixLength).length; +} +//# sourceMappingURL=mapping-entry.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/mapping-entry.js.map b/node_modules/tsconfig-paths/lib/mapping-entry.js.map new file mode 100644 index 0000000..b408a48 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/mapping-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapping-entry.js","sourceRoot":"","sources":["../src/mapping-entry.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAW7B;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CACvC,eAAuB,EACvB,KAAY,EACZ,WAAoB;IAEpB,iEAAiE;IACjE,mEAAmE;IACnE,iEAAiE;IACjE,IAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAM,aAAa,GAAwB,EAAE,CAAC;IAC9C,KAAkB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;QAAzB,IAAM,GAAG,mBAAA;QACZ,aAAa,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,GAAG;YACZ,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,aAAa;gBAClC,OAAA,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC;YAAzC,CAAyC,CAC1C;SACF,CAAC,CAAC;KACJ;IACD,8FAA8F;IAC9F,+DAA+D;IAC/D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,WAAW,EAAE;QAC9B,aAAa,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,GAAG;YACZ,KAAK,EAAE,CAAC,UAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAI,CAAC;SACnD,CAAC,CAAC;KACJ;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AA5BD,8DA4BC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAkB;IAC7C,OAAO,GAAG;SACP,MAAM,EAAE;SACR,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAvC,CAAuC,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,IAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/match-path-async.d.ts b/node_modules/tsconfig-paths/lib/match-path-async.d.ts new file mode 100644 index 0000000..bf35c64 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-async.d.ts @@ -0,0 +1,21 @@ +import * as MappingEntry from "./mapping-entry"; +import * as Filesystem from "./filesystem"; +/** + * Function that can match a path async + */ +export interface MatchPathAsync { + (requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: ReadonlyArray | undefined, callback: MatchPathAsyncCallback): void; +} +export interface MatchPathAsyncCallback { + (err?: Error, path?: string): void; +} +/** + * See the sync version for docs. + */ +export declare function createMatchPathAsync(absoluteBaseUrl: string, paths: { + [key: string]: Array; +}, mainFields?: string[], addMatchAll?: boolean): MatchPathAsync; +/** + * See the sync version for docs. + */ +export declare function matchFromAbsolutePathsAsync(absolutePathMappings: ReadonlyArray, requestedModule: string, readJson: Filesystem.ReadJsonAsync | undefined, fileExists: Filesystem.FileExistsAsync | undefined, extensions: readonly string[] | undefined, callback: MatchPathAsyncCallback, mainFields?: string[]): void; diff --git a/node_modules/tsconfig-paths/lib/match-path-async.js b/node_modules/tsconfig-paths/lib/match-path-async.js new file mode 100644 index 0000000..d78e421 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-async.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0; +var path = require("path"); +var TryPath = require("./try-path"); +var MappingEntry = require("./mapping-entry"); +var Filesystem = require("./filesystem"); +/** + * See the sync version for docs. + */ +function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) { + if (mainFields === void 0) { mainFields = ["main"]; } + if (addMatchAll === void 0) { addMatchAll = true; } + var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll); + return function (requestedModule, readJson, fileExists, extensions, callback) { + return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields); + }; +} +exports.createMatchPathAsync = createMatchPathAsync; +/** + * See the sync version for docs. + */ +function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) { + if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskAsync; } + if (fileExists === void 0) { fileExists = Filesystem.fileExistsAsync; } + if (extensions === void 0) { extensions = Object.keys(require.extensions); } + if (mainFields === void 0) { mainFields = ["main"]; } + var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule); + if (!tryPaths) { + return callback(); + } + findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields); +} +exports.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync; +function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index) { + if (index === void 0) { index = 0; } + if (index >= mainFields.length) { + return doneCallback(undefined, undefined); + } + var tryNext = function () { + return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index + 1); + }; + var mainFieldMapping = packageJson[mainFields[index]]; + if (typeof mainFieldMapping !== "string") { + // Skip mappings that are not pointers to replacement files + return tryNext(); + } + var mappedFilePath = path.join(path.dirname(packageJsonPath), mainFieldMapping); + fileExistsAsync(mappedFilePath, function (err, exists) { + if (err) { + return doneCallback(err); + } + if (exists) { + return doneCallback(undefined, mappedFilePath); + } + return tryNext(); + }); +} +// Recursive loop to probe for physical files +function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index, mainFields) { + if (index === void 0) { index = 0; } + if (mainFields === void 0) { mainFields = ["main"]; } + var tryPath = tryPaths[index]; + if (tryPath.type === "file" || + tryPath.type === "extension" || + tryPath.type === "index") { + fileExists(tryPath.path, function (err, exists) { + if (err) { + return doneCallback(err); + } + if (exists) { + return doneCallback(undefined, TryPath.getStrippedPath(tryPath)); + } + if (index === tryPaths.length - 1) { + return doneCallback(); + } + // Continue with the next path + return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields); + }); + } + else if (tryPath.type === "package") { + readJson(tryPath.path, function (err, packageJson) { + if (err) { + return doneCallback(err); + } + if (packageJson) { + return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function (mainFieldErr, mainFieldMappedFile) { + if (mainFieldErr) { + return doneCallback(mainFieldErr); + } + if (mainFieldMappedFile) { + return doneCallback(undefined, mainFieldMappedFile); + } + // No field in package json was a valid option. Continue with the next path. + return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields); + }); + } + // This is async code, we need to return unconditionally, otherwise the code still falls + // through and keeps recursing. While this might work in general, libraries that use neo-async + // like Webpack will actually not allow you to call the same callback twice. + // + // An example of where this caused issues: + // https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/11 + // + // Continue with the next path + return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields); + }); + } + else { + TryPath.exhaustiveTypeException(tryPath.type); + } +} +//# sourceMappingURL=match-path-async.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/match-path-async.js.map b/node_modules/tsconfig-paths/lib/match-path-async.js.map new file mode 100644 index 0000000..386d64b --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-async.js.map @@ -0,0 +1 @@ +{"version":3,"file":"match-path-async.js","sourceRoot":"","sources":["../src/match-path-async.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,oCAAsC;AACtC,8CAAgD;AAChD,yCAA2C;AAmB3C;;GAEG;AACH,SAAgB,oBAAoB,CAClC,eAAuB,EACvB,KAAuC,EACvC,UAA+B,EAC/B,WAA2B;IAD3B,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAC/B,4BAAA,EAAA,kBAA2B;IAE3B,IAAM,aAAa,GAAG,YAAY,CAAC,yBAAyB,CAC1D,eAAe,EACf,KAAK,EACL,WAAW,CACZ,CAAC;IAEF,OAAO,UACL,eAAuB,EACvB,QAA8C,EAC9C,UAAkD,EAClD,UAA6C,EAC7C,QAAgC;QAEhC,OAAA,2BAA2B,CACzB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,CACX;IARD,CAQC,CAAC;AACN,CAAC;AA5BD,oDA4BC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CACzC,oBAA8D,EAC9D,eAAuB,EACvB,QAAqE,EACrE,UAAmE,EACnE,UAAmE,EACnE,QAAgC,EAChC,UAA+B;IAJ/B,yBAAA,EAAA,WAAqC,UAAU,CAAC,qBAAqB;IACrE,2BAAA,EAAA,aAAyC,UAAU,CAAC,eAAe;IACn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AAO,CAAC,IAAI,EACZ,UAAU,EACV,UAAC,YAAoB,EAAE,mBAA4B;oBACjD,IAAI,YAAY,EAAE;wBAChB,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;qBACnC;oBACD,IAAI,mBAAmB,EAAE;wBACvB,OAAO,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;qBACrD;oBAED,4EAA4E;oBAC5E,OAAO,qBAAqB,CAC1B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,UAAU,CACX,CAAC;gBACJ,CAAC,CACF,CAAC;aACH;YAED,wFAAwF;YACxF,8FAA8F;YAC9F,4EAA4E;YAC5E,EAAE;YACF,0CAA0C;YAC1C,qEAAqE;YACrE,EAAE;YACF,8BAA8B;YAC9B,OAAO,qBAAqB,CAC1B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,UAAU,CACX,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC/C;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/match-path-sync.d.ts b/node_modules/tsconfig-paths/lib/match-path-sync.d.ts new file mode 100644 index 0000000..3c622cb --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-sync.d.ts @@ -0,0 +1,30 @@ +import * as Filesystem from "./filesystem"; +import * as MappingEntry from "./mapping-entry"; +/** + * Function that can match a path + */ +export interface MatchPath { + (requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: (name: string) => boolean, extensions?: ReadonlyArray): string | undefined; +} +/** + * Creates a function that can resolve paths according to tsconfig paths property. + * @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig. + * @param paths The paths as specified in tsconfig. + * @param mainFields A list of package.json field names to try when resolving module files. + * @param addMatchAll Add a match-all "*" rule if none is present + * @returns a function that can resolve paths. + */ +export declare function createMatchPath(absoluteBaseUrl: string, paths: { + [key: string]: Array; +}, mainFields?: string[], addMatchAll?: boolean): MatchPath; +/** + * Finds a path from tsconfig that matches a module load request. + * @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form. + * @param requestedModule The required module name. + * @param readJson Function that can read json from a path (useful for testing). + * @param fileExists Function that checks for existence of a file at a path (useful for testing). + * @param extensions File extensions to probe for (useful for testing). + * @param mainFields A list of package.json field names to try when resolving module files. + * @returns the found path, or undefined if no path was found. + */ +export declare function matchFromAbsolutePaths(absolutePathMappings: ReadonlyArray, requestedModule: string, readJson?: Filesystem.ReadJsonSync, fileExists?: Filesystem.FileExistsSync, extensions?: Array, mainFields?: string[]): string | undefined; diff --git a/node_modules/tsconfig-paths/lib/match-path-sync.js b/node_modules/tsconfig-paths/lib/match-path-sync.js new file mode 100644 index 0000000..b6df1af --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-sync.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.matchFromAbsolutePaths = exports.createMatchPath = void 0; +var path = require("path"); +var Filesystem = require("./filesystem"); +var MappingEntry = require("./mapping-entry"); +var TryPath = require("./try-path"); +/** + * Creates a function that can resolve paths according to tsconfig paths property. + * @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig. + * @param paths The paths as specified in tsconfig. + * @param mainFields A list of package.json field names to try when resolving module files. + * @param addMatchAll Add a match-all "*" rule if none is present + * @returns a function that can resolve paths. + */ +function createMatchPath(absoluteBaseUrl, paths, mainFields, addMatchAll) { + if (mainFields === void 0) { mainFields = ["main"]; } + if (addMatchAll === void 0) { addMatchAll = true; } + var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll); + return function (requestedModule, readJson, fileExists, extensions) { + return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields); + }; +} +exports.createMatchPath = createMatchPath; +/** + * Finds a path from tsconfig that matches a module load request. + * @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form. + * @param requestedModule The required module name. + * @param readJson Function that can read json from a path (useful for testing). + * @param fileExists Function that checks for existence of a file at a path (useful for testing). + * @param extensions File extensions to probe for (useful for testing). + * @param mainFields A list of package.json field names to try when resolving module files. + * @returns the found path, or undefined if no path was found. + */ +function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) { + if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskSync; } + if (fileExists === void 0) { fileExists = Filesystem.fileExistsSync; } + if (extensions === void 0) { extensions = Object.keys(require.extensions); } + if (mainFields === void 0) { mainFields = ["main"]; } + var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule); + if (!tryPaths) { + return undefined; + } + return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields); +} +exports.matchFromAbsolutePaths = matchFromAbsolutePaths; +function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) { + for (var index = 0; index < mainFields.length; index++) { + var mainFieldName = mainFields[index]; + var candidateMapping = packageJson[mainFieldName]; + if (candidateMapping && typeof candidateMapping === "string") { + var candidateFilePath = path.join(path.dirname(packageJsonPath), candidateMapping); + if (fileExists(candidateFilePath)) { + return candidateFilePath; + } + } + } + return undefined; +} +function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) { + if (readJson === void 0) { readJson = Filesystem.readJsonFromDiskSync; } + if (mainFields === void 0) { mainFields = ["main"]; } + for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) { + var tryPath = tryPaths_1[_i]; + if (tryPath.type === "file" || + tryPath.type === "extension" || + tryPath.type === "index") { + if (fileExists(tryPath.path)) { + return TryPath.getStrippedPath(tryPath); + } + } + else if (tryPath.type === "package") { + var packageJson = readJson(tryPath.path); + if (packageJson) { + var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists); + if (mainFieldMappedFile) { + return mainFieldMappedFile; + } + } + } + else { + TryPath.exhaustiveTypeException(tryPath.type); + } + } + return undefined; +} +//# sourceMappingURL=match-path-sync.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/match-path-sync.js.map b/node_modules/tsconfig-paths/lib/match-path-sync.js.map new file mode 100644 index 0000000..0c49981 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/match-path-sync.js.map @@ -0,0 +1 @@ +{"version":3,"file":"match-path-sync.js","sourceRoot":"","sources":["../src/match-path-sync.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,yCAA2C;AAC3C,8CAAgD;AAChD,oCAAsC;AActC;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,eAAuB,EACvB,KAAuC,EACvC,UAA+B,EAC/B,WAA2B;IAD3B,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAC/B,4BAAA,EAAA,kBAA2B;IAE3B,IAAM,aAAa,GAAG,YAAY,CAAC,yBAAyB,CAC1D,eAAe,EACf,KAAK,EACL,WAAW,CACZ,CAAC;IAEF,OAAO,UACL,eAAuB,EACvB,QAAkC,EAClC,UAAsC,EACtC,UAA0B;QAE1B,OAAA,sBAAsB,CACpB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,CACX;IAPD,CAOC,CAAC;AACN,CAAC;AA1BD,0CA0BC;AAED;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CACpC,oBAA8D,EAC9D,eAAuB,EACvB,QAAmE,EACnE,UAAiE,EACjE,UAA2D,EAC3D,UAA+B;IAH/B,yBAAA,EAAA,WAAoC,UAAU,CAAC,oBAAoB;IACnE,2BAAA,EAAA,aAAwC,UAAU,CAAC,cAAc;IACjE,2BAAA,EAAA,aAA4B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3D,2BAAA,EAAA,cAAwB,MAAM,CAAC;IAE/B,IAAM,QAAQ,GAAG,OAAO,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AC,EAAE;gBAC5B,OAAO,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;aACzC;SACF;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;YACrC,IAAM,WAAW,GAA2B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnE,IAAI,WAAW,EAAE;gBACf,IAAM,mBAAmB,GAAG,oCAAoC,CAC9D,WAAW,EACX,UAAU,EACV,OAAO,CAAC,IAAI,EACZ,UAAU,CACX,CAAC;gBACF,IAAI,mBAAmB,EAAE;oBACvB,OAAO,mBAAmB,CAAC;iBAC5B;aACF;SACF;aAAM;YACL,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/options.d.ts b/node_modules/tsconfig-paths/lib/options.d.ts new file mode 100644 index 0000000..dc7748e --- /dev/null +++ b/node_modules/tsconfig-paths/lib/options.d.ts @@ -0,0 +1,4 @@ +export interface Options { + cwd: string; +} +export declare const options: Options; diff --git a/node_modules/tsconfig-paths/lib/options.js b/node_modules/tsconfig-paths/lib/options.js new file mode 100644 index 0000000..4c3d9ab --- /dev/null +++ b/node_modules/tsconfig-paths/lib/options.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.options = void 0; +var minimist = require("minimist"); +var argv = minimist(process.argv.slice(2), { + string: ["project"], + alias: { + project: ["P"], + }, +}); +var project = argv && argv.project; +exports.options = { + cwd: project || process.cwd(), +}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/options.js.map b/node_modules/tsconfig-paths/lib/options.js.map new file mode 100644 index 0000000..ff3a9e4 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,IAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC3C,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,GAAG,CAAC;KACf;CACF,CAAC,CAAC;AAEH,IAAM,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC;AAMxB,QAAA,OAAO,GAAY;IAC9B,GAAG,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;CAC9B,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/register.d.ts b/node_modules/tsconfig-paths/lib/register.d.ts new file mode 100644 index 0000000..7487226 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/register.d.ts @@ -0,0 +1,6 @@ +import { ExplicitParams } from "./config-loader"; +/** + * Installs a custom module load function that can adhere to paths in tsconfig. + * Returns a function to undo paths registration. + */ +export declare function register(explicitParams: ExplicitParams): () => void; diff --git a/node_modules/tsconfig-paths/lib/register.js b/node_modules/tsconfig-paths/lib/register.js new file mode 100644 index 0000000..b00a772 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/register.js @@ -0,0 +1,93 @@ +"use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.register = void 0; +var match_path_sync_1 = require("./match-path-sync"); +var config_loader_1 = require("./config-loader"); +var options_1 = require("./options"); +var noOp = function () { return void 0; }; +function getCoreModules(builtinModules) { + builtinModules = builtinModules || [ + "assert", + "buffer", + "child_process", + "cluster", + "crypto", + "dgram", + "dns", + "domain", + "events", + "fs", + "http", + "https", + "net", + "os", + "path", + "punycode", + "querystring", + "readline", + "stream", + "string_decoder", + "tls", + "tty", + "url", + "util", + "v8", + "vm", + "zlib", + ]; + var coreModules = {}; + for (var _i = 0, builtinModules_1 = builtinModules; _i < builtinModules_1.length; _i++) { + var module_1 = builtinModules_1[_i]; + coreModules[module_1] = true; + } + return coreModules; +} +/** + * Installs a custom module load function that can adhere to paths in tsconfig. + * Returns a function to undo paths registration. + */ +function register(explicitParams) { + var configLoaderResult = (0, config_loader_1.configLoader)({ + cwd: options_1.options.cwd, + explicitParams: explicitParams, + }); + if (configLoaderResult.resultType === "failed") { + console.warn("".concat(configLoaderResult.message, ". tsconfig-paths will be skipped")); + return noOp; + } + var matchPath = (0, match_path_sync_1.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll); + // Patch node's module loading + // tslint:disable-next-line:no-require-imports variable-name + var Module = require("module"); + var originalResolveFilename = Module._resolveFilename; + var coreModules = getCoreModules(Module.builtinModules); + // tslint:disable-next-line:no-any + Module._resolveFilename = function (request, _parent) { + var isCoreModule = coreModules.hasOwnProperty(request); + if (!isCoreModule) { + var found = matchPath(request); + if (found) { + var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true); // Passes all arguments. Even those that is not specified above. + // tslint:disable-next-line:no-invalid-this + return originalResolveFilename.apply(this, modifiedArguments); + } + } + // tslint:disable-next-line:no-invalid-this + return originalResolveFilename.apply(this, arguments); + }; + return function () { + // Return node's module loading to original state. + Module._resolveFilename = originalResolveFilename; + }; +} +exports.register = register; +//# sourceMappingURL=register.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/register.js.map b/node_modules/tsconfig-paths/lib/register.js.map new file mode 100644 index 0000000..3c10fa5 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/register.js.map @@ -0,0 +1 @@ +{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":";;;;;;;;;;;;A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M,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAM,uBAAuB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACxD,IAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC1D,kCAAkC;IAClC,MAAM,CAAC,gBAAgB,GAAG,UAAU,OAAe,EAAE,OAAY;QAC/D,IAAM,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,YAAY,EAAE;YACjB,IAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,KAAK,EAAE;gBACT,IAAM,iBAAiB,kBAAI,KAAK,GAAK,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,OAAC,CAAC,CAAC,gEAAgE;gBACnI,2CAA2C;gBAC3C,OAAO,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;aAC/D;SACF;QACD,2CAA2C;QAC3C,OAAO,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,OAAO;QACL,kDAAkD;QAClD,MAAM,CAAC,gBAAgB,GAAG,uBAAuB,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC;AA7CD,4BA6CC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/try-path.d.ts b/node_modules/tsconfig-paths/lib/try-path.d.ts new file mode 100644 index 0000000..5130fc5 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/try-path.d.ts @@ -0,0 +1,15 @@ +import { MappingEntry } from "./mapping-entry"; +export interface TryPath { + readonly type: "file" | "extension" | "index" | "package"; + readonly path: string; +} +/** + * Builds a list of all physical paths to try by: + * 1. Check for file named exactly as request. + * 2. Check for files named as request ending in any of the extensions. + * 3. Check for file specified in package.json's main property. + * 4. Check for files named as request ending in "index" with any of the extensions. + */ +export declare function getPathsToTry(extensions: ReadonlyArray, absolutePathMappings: ReadonlyArray, requestedModule: string): ReadonlyArray | undefined; +export declare function getStrippedPath(tryPath: TryPath): string; +export declare function exhaustiveTypeException(check: never): never; diff --git a/node_modules/tsconfig-paths/lib/try-path.js b/node_modules/tsconfig-paths/lib/try-path.js new file mode 100644 index 0000000..de11ccb --- /dev/null +++ b/node_modules/tsconfig-paths/lib/try-path.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0; +var path = require("path"); +var path_1 = require("path"); +var filesystem_1 = require("./filesystem"); +/** + * Builds a list of all physical paths to try by: + * 1. Check for file named exactly as request. + * 2. Check for files named as request ending in any of the extensions. + * 3. Check for file specified in package.json's main property. + * 4. Check for files named as request ending in "index" with any of the extensions. + */ +function getPathsToTry(extensions, absolutePathMappings, requestedModule) { + if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") { + return undefined; + } + var pathsToTry = []; + for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) { + var entry = absolutePathMappings_1[_i]; + var starMatch = entry.pattern === requestedModule + ? "" + : matchStar(entry.pattern, requestedModule); + if (starMatch !== undefined) { + var _loop_1 = function (physicalPathPattern) { + var physicalPath = physicalPathPattern.replace("*", starMatch); + pathsToTry.push({ type: "file", path: physicalPath }); + pathsToTry.push.apply(pathsToTry, extensions.map(function (e) { return ({ type: "extension", path: physicalPath + e }); })); + pathsToTry.push({ + type: "package", + path: path.join(physicalPath, "/package.json"), + }); + var indexPath = path.join(physicalPath, "/index"); + pathsToTry.push.apply(pathsToTry, extensions.map(function (e) { return ({ type: "index", path: indexPath + e }); })); + }; + for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) { + var physicalPathPattern = _b[_a]; + _loop_1(physicalPathPattern); + } + } + } + return pathsToTry.length === 0 ? undefined : pathsToTry; +} +exports.getPathsToTry = getPathsToTry; +// Not sure why we don't just return the full found path? +function getStrippedPath(tryPath) { + return tryPath.type === "index" + ? (0, path_1.dirname)(tryPath.path) + : tryPath.type === "file" + ? tryPath.path + : tryPath.type === "extension" + ? (0, filesystem_1.removeExtension)(tryPath.path) + : tryPath.type === "package" + ? tryPath.path + : exhaustiveTypeException(tryPath.type); +} +exports.getStrippedPath = getStrippedPath; +function exhaustiveTypeException(check) { + throw new Error("Unknown type ".concat(check)); +} +exports.exhaustiveTypeException = exhaustiveTypeException; +/** + * Matches pattern with a single star against search. + * Star must match at least one character to be considered a match. + * @param patttern for example "foo*" + * @param search for example "fooawesomebar" + * @returns the part of search that * matches, or undefined if no match. + */ +function matchStar(pattern, search) { + if (search.length < pattern.length) { + return undefined; + } + if (pattern === "*") { + return search; + } + var star = pattern.indexOf("*"); + if (star === -1) { + return undefined; + } + var part1 = pattern.substring(0, star); + var part2 = pattern.substring(star + 1); + if (search.substr(0, star) !== part1) { + return undefined; + } + if (search.substr(search.length - part2.length) !== part2) { + return undefined; + } + return search.substr(star, search.length - part2.length); +} +//# sourceMappingURL=try-path.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/try-path.js.map b/node_modules/tsconfig-paths/lib/try-path.js.map new file mode 100644 index 0000000..30cda57 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/try-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"try-path.js","sourceRoot":"","sources":["../src/try-path.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAE7B,6BAA+B;AAC/B,2CAA+C;AAO/C;;;;;;GAMG;AACH,SAAgB,aAAa,CAC3B,UAAiC,EACjC,oBAAiD,EACjD,eAAuB;IAEvB,IAAI,CAAC,oBAAoB,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC3E,OAAO,SAAS,CAAC;KAClB;IAED,IAAM,UAAU,GAAmB,EAAE,CAAC;IACtC,KAAoB,UAAoB,EAApB,6CAAoB,EA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IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE;QACpC,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACzD,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts b/node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts new file mode 100644 index 0000000..649a804 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts @@ -0,0 +1,28 @@ +/** + * Typing for the parts of tsconfig that we care about + */ +export interface Tsconfig { + extends?: string; + compilerOptions?: { + baseUrl?: string; + paths?: { + [key: string]: Array; + }; + strict?: boolean; + }; +} +export interface TsConfigLoaderResult { + tsConfigPath: string | undefined; + baseUrl: string | undefined; + paths: { + [key: string]: Array; + } | undefined; +} +export interface TsConfigLoaderParams { + getEnv: (key: string) => string | undefined; + cwd: string; + loadSync?(cwd: string, filename?: string, baseUrl?: string): TsConfigLoaderResult; +} +export declare function tsConfigLoader({ getEnv, cwd, loadSync, }: TsConfigLoaderParams): TsConfigLoaderResult; +export declare function walkForTsConfig(directory: string, existsSync?: (path: string) => boolean): string | undefined; +export declare function loadTsconfig(configFilePath: string, existsSync?: (path: string) => boolean, readFileSync?: (filename: string) => string): Tsconfig | undefined; diff --git a/node_modules/tsconfig-paths/lib/tsconfig-loader.js b/node_modules/tsconfig-paths/lib/tsconfig-loader.js new file mode 100644 index 0000000..fd93153 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/tsconfig-loader.js @@ -0,0 +1,111 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0; +var path = require("path"); +var fs = require("fs"); +// tslint:disable:no-require-imports +var JSON5 = require("json5"); +var StripBom = require("strip-bom"); +function tsConfigLoader(_a) { + var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b; + var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT"); + var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL"); + // tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory + // and also overrides baseURL if TS_NODE_BASEURL is available. + var loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL); + return loadResult; +} +exports.tsConfigLoader = tsConfigLoader; +function loadSyncDefault(cwd, filename, baseUrl) { + // Tsconfig.loadSync uses path.resolve. This is why we can use an absolute path as filename + var configPath = resolveConfigPath(cwd, filename); + if (!configPath) { + return { + tsConfigPath: undefined, + baseUrl: undefined, + paths: undefined, + }; + } + var config = loadTsconfig(configPath); + return { + tsConfigPath: configPath, + baseUrl: baseUrl || + (config && config.compilerOptions && config.compilerOptions.baseUrl), + paths: config && config.compilerOptions && config.compilerOptions.paths, + }; +} +function resolveConfigPath(cwd, filename) { + if (filename) { + var absolutePath = fs.lstatSync(filename).isDirectory() + ? path.resolve(filename, "./tsconfig.json") + : path.resolve(cwd, filename); + return absolutePath; + } + if (fs.statSync(cwd).isFile()) { + return path.resolve(cwd); + } + var configAbsolutePath = walkForTsConfig(cwd); + return configAbsolutePath ? path.resolve(configAbsolutePath) : undefined; +} +function walkForTsConfig(directory, existsSync) { + if (existsSync === void 0) { existsSync = fs.existsSync; } + var configPath = path.join(directory, "./tsconfig.json"); + if (existsSync(configPath)) { + return configPath; + } + var parentDirectory = path.join(directory, "../"); + // If we reached the top + if (directory === parentDirectory) { + return undefined; + } + return walkForTsConfig(parentDirectory, existsSync); +} +exports.walkForTsConfig = walkForTsConfig; +function loadTsconfig(configFilePath, existsSync, readFileSync) { + if (existsSync === void 0) { existsSync = fs.existsSync; } + if (readFileSync === void 0) { readFileSync = function (filename) { + return fs.readFileSync(filename, "utf8"); + }; } + if (!existsSync(configFilePath)) { + return undefined; + } + var configString = readFileSync(configFilePath); + var cleanedJson = StripBom(configString); + var config = JSON5.parse(cleanedJson); + var extendedConfig = config.extends; + if (extendedConfig) { + if (typeof extendedConfig === "string" && + extendedConfig.indexOf(".json") === -1) { + extendedConfig += ".json"; + } + var currentDir = path.dirname(configFilePath); + var extendedConfigPath = path.join(currentDir, extendedConfig); + if (extendedConfig.indexOf("/") !== -1 && + extendedConfig.indexOf(".") !== -1 && + !existsSync(extendedConfigPath)) { + extendedConfigPath = path.join(currentDir, "node_modules", extendedConfig); + } + var base = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {}; + // baseUrl should be interpreted as relative to the base tsconfig, + // but we need to update it so it is relative to the original tsconfig being loaded + if (base.compilerOptions && base.compilerOptions.baseUrl) { + var extendsDir = path.dirname(extendedConfig); + base.compilerOptions.baseUrl = path.join(extendsDir, base.compilerOptions.baseUrl); + } + return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) }); + } + return config; +} +exports.loadTsconfig = loadTsconfig; +//# sourceMappingURL=tsconfig-loader.js.map \ No newline at end of file diff --git a/node_modules/tsconfig-paths/lib/tsconfig-loader.js.map b/node_modules/tsconfig-paths/lib/tsconfig-loader.js.map new file mode 100644 index 0000000..3bb4b71 --- /dev/null +++ b/node_modules/tsconfig-paths/lib/tsconfig-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tsconfig-loader.js","sourceRoot":"","sources":["../src/tsconfig-loader.ts"],"names":[],"mappings":";;;;;;;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AAe,GACpB,MAAM,CAAC,eAAe,KAE3B;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA3DD,oCA2DC"} \ No newline at end of file diff --git a/node_modules/tsconfig-paths/package.json b/node_modules/tsconfig-paths/package.json new file mode 100644 index 0000000..ad59c3e --- /dev/null +++ b/node_modules/tsconfig-paths/package.json @@ -0,0 +1,67 @@ +{ + "name": "tsconfig-paths", + "version": "3.14.1", + "description": "Load node modules according to tsconfig paths, in run-time or via API.", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "author": "Jonas Kello", + "license": "MIT", + "repository": "https://github.com/dividab/tsconfig-paths", + "files": [ + "/src", + "/lib", + "register.js", + "package.json", + "CHANGELOG.md", + "LICENSE", + "README.md" + ], + "devDependencies": { + "@types/jest": "^27.0.3", + "@types/minimist": "^1.2.2", + "@types/node": "^6.0.54", + "@types/strip-bom": "^3.0.0", + "@types/strip-json-comments": "^0.0.30", + "husky": "^4.2.5", + "jest": "^27.3.1", + "lint-staged": "^10.2.11", + "prettier": "^2.0.5", + "rimraf": "^2.6.2", + "ts-jest": "^27.0.7", + "ts-node": "^10.7.0", + "tslint": "^5.8.0", + "typescript": "^4.5.2" + }, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "scripts": { + "start": "cd src && ts-node index.ts", + "example:node": "yarn build && cd ./example/node && ts-node -r ../register.js main.ts", + "example:project": "yarn build && ts-node -r ./register.js -P ./example/project/tsconfig.json ./example/project/main.ts", + "example:api": "cd example/api && ts-node main.ts", + "example:perf": "cd example/perf && ts-node main.ts", + "test": "jest", + "test-coverage": "jest --coverage", + "build": "rimraf lib && tsc -p .", + "lint": "tslint './{src,tests}/**/*.ts{,x}'", + "verify": "yarn build && yarn lint && yarn test-coverage", + "preversion": "yarn verify", + "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\"" + }, + "lint-staged": { + "*.{ts,tsx}": "tslint", + "*.{ts,tsx,json,css}": [ + "prettier --write", + "git add" + ] + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + } +} diff --git a/node_modules/tsconfig-paths/register.js b/node_modules/tsconfig-paths/register.js new file mode 100644 index 0000000..c366c40 --- /dev/null +++ b/node_modules/tsconfig-paths/register.js @@ -0,0 +1 @@ +require("./").register(); diff --git a/node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts b/node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts new file mode 100644 index 0000000..b9f88af --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/config-loader.test.ts @@ -0,0 +1,100 @@ +import { + configLoader, + loadConfig, + ConfigLoaderFailResult, + ConfigLoaderSuccessResult, +} from "../config-loader"; +import { join } from "path"; + +describe("config-loader", (): void => { + it("should use explicitParams when set", () => { + const result = configLoader({ + explicitParams: { + baseUrl: "/foo/bar", + paths: { + asd: ["asd"], + }, + }, + cwd: "/baz", + }); + + const successResult = result as ConfigLoaderSuccessResult; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, "/foo/bar"); + // assert.equal(successResult.paths["asd"][0], "asd"); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe("/foo/bar"); + expect(successResult.paths["asd"][0]).toBe("asd"); + }); + + it("should use explicitParams when set and add cwd when path is relative", () => { + const result = configLoader({ + explicitParams: { + baseUrl: "bar/", + paths: { + asd: ["asd"], + }, + }, + cwd: "/baz", + }); + + const successResult = result as ConfigLoaderSuccessResult; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, join("/baz", "bar/")); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe(join("/baz", "bar/")); + }); + + it("should fallback to tsConfigLoader when explicitParams is not set", () => { + const result = configLoader({ + explicitParams: undefined, + cwd: "/baz", + // tslint:disable-next-line:no-any + tsConfigLoader: (_: any) => ({ + tsConfigPath: "/baz/tsconfig.json", + baseUrl: "./src", + paths: {}, + }), + }); + + const successResult = result as ConfigLoaderSuccessResult; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.absoluteBaseUrl, join("/baz", "src")); + expect(successResult.resultType).toBe("success"); + expect(successResult.absoluteBaseUrl).toBe(join("/baz", "src")); + }); + + it("should show an error message when baseUrl is missing", () => { + const result = configLoader({ + explicitParams: undefined, + cwd: "/baz", + // tslint:disable-next-line:no-any + tsConfigLoader: (_: any) => ({ + tsConfigPath: "/baz/tsconfig.json", + baseUrl: undefined, + paths: {}, + }), + }); + + const failResult = result as ConfigLoaderFailResult; + // assert.equal(failResult.resultType, "failed"); + // assert.isTrue(failResult.message.indexOf("baseUrl") > -1); + expect(failResult.resultType).toBe("failed"); + expect(failResult.message.indexOf("baseUrl") > -1).toBeTruthy(); + }); + + it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", () => { + // using tsconfig-named.json to ensure that future changes to fix + // https://github.com/dividab/tsconfig-paths/issues/31 + // do not pass this test case just because of a directory walk looking + // for tsconfig.json + const configFile = join(__dirname, "tsconfig-named.json"); + const result = loadConfig(configFile); + + const successResult = result as ConfigLoaderSuccessResult; + // assert.equal(successResult.resultType, "success"); + // assert.equal(successResult.configFileAbsolutePath, configFile); + expect(successResult.resultType).toBe("success"); + expect(successResult.configFileAbsolutePath).toBe(configFile); + }); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts b/node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts new file mode 100644 index 0000000..e9c07c2 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/data/match-path-data.ts @@ -0,0 +1,219 @@ +import { join, dirname } from "path"; +import { removeExtension } from "../../filesystem"; + +export interface OneTest { + readonly name: string; + readonly only?: boolean; + readonly skip?: boolean; + readonly absoluteBaseUrl: string; + readonly paths: { [key: string]: Array }; + readonly mainFields?: string[]; + readonly addMatchAll?: boolean; + readonly existingFiles: ReadonlyArray; + readonly requestedModule: string; + readonly extensions: ReadonlyArray; + readonly packageJson?: {}; + readonly expectedPath: string | undefined; +} + +const defaultExtensionsWhenRunningInTsNode = [ + ".js", + ".json", + ".node", + ".ts", + ".tsx", +]; + +export const tests: ReadonlyArray = [ + { + name: "should locate path that matches with star and exists", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["location/*"], + }, + existingFiles: [join("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + expectedPath: dirname(join("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve to correct path when many are specified", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["foo1/*", "foo2/*", "location/*", "foo3/*"], + }, + existingFiles: [join("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + extensions: [".ts"], + expectedPath: dirname(join("/root", "location", "mylib", "index.ts")), + }, + { + name: + "should locate path that matches with star and prioritize pattern with longest prefix", + absoluteBaseUrl: "/root/", + paths: { + "*": ["location/*"], + "lib/*": ["location/*"], + }, + existingFiles: [ + join("/root", "location", "lib", "mylib", "index.ts"), + join("/root", "location", "mylib", "index.ts"), + ], + requestedModule: "lib/mylib", + expectedPath: dirname(join("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should locate path that matches with star and exists with extension", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("/root", "location", "mylib.myext")], + requestedModule: "lib/mylib", + extensions: [".js", ".myext"], + expectedPath: removeExtension(join("/root", "location", "mylib.myext")), + }, + { + name: "should resolve request with extension specified", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("/root", "location", "test.jpg")], + requestedModule: "lib/test.jpg", + expectedPath: join("/root", "location", "test.jpg"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should locate path that matches without star and exists", + absoluteBaseUrl: "/root/", + paths: { + "lib/foo": ["location/foo"], + }, + existingFiles: [join("/root", "location", "foo.ts")], + requestedModule: "lib/foo", + expectedPath: removeExtension(join("/root", "location", "foo.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve to parent folder when filename is in subfolder", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("/root", "location", "mylib", "index.ts")], + requestedModule: "lib/mylib", + expectedPath: dirname(join("/root", "location", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve from main field in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("/root", "location", "mylib", "kalle.ts")], + packageJson: { main: "./kalle.ts" }, + requestedModule: "lib/mylib", + expectedPath: join("/root", "location", "mylib", "kalle.ts"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve from main field in package.json (js)", + absoluteBaseUrl: "/root", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("/root", "location", "mylib.js", "kalle.js")], + packageJson: { main: "./kalle.js" }, + requestedModule: "lib/mylib.js", + extensions: [".ts", ".js"], + expectedPath: join("/root", "location", "mylib.js", "kalle.js"), + }, + { + name: "should resolve from list of fields by priority in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + mainFields: ["missing", "browser", "main"], + packageJson: { main: "./main.js", browser: "./browser.js" }, + existingFiles: [ + join("/root", "location", "mylibjs", "main.js"), // mainFilePath + join("/root", "location", "mylibjs", "browser.js"), // browserFilePath + ], + extensions: [".ts", ".js"], + requestedModule: "lib/mylibjs", + expectedPath: join("/root", "location", "mylibjs", "browser.js"), + }, + { + name: "should ignore field mappings to missing files in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + mainFields: ["browser", "main"], + existingFiles: [join("/root", "location", "mylibjs", "kalle.js")], + requestedModule: "lib/mylibjs", + packageJson: { + main: "./kalle.js", + browser: "./nope.js", + }, + extensions: [".ts", ".js"], + expectedPath: join("/root", "location", "mylibjs", "kalle.js"), + }, + { + name: "should ignore advanced field mappings in package.json", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [ + join("/root", "location", "mylibjs", "kalle.js"), + join("/root", "location", "mylibjs", "browser.js"), + ], + requestedModule: "lib/mylibjs", + packageJson: { + main: "./kalle.js", + browser: { mylibjs: "./browser.js", "./kalle.js": "./browser.js" }, + }, + extensions: [".ts", ".js"], + expectedPath: join("/root", "location", "mylibjs", "kalle.js"), + }, + { + name: "should resolve to with the help of baseUrl when not explicitly set", + absoluteBaseUrl: "/root/", + paths: {}, + existingFiles: [join("/root", "mylib", "index.ts")], + requestedModule: "mylib", + expectedPath: dirname(join("/root", "mylib", "index.ts")), + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not resolve with the help of baseUrl when asked not to", + absoluteBaseUrl: "/root/", + paths: {}, + addMatchAll: false, + existingFiles: [join("/root", "mylib", "index.ts")], + requestedModule: "mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not locate path that does not match", + absoluteBaseUrl: "/root/", + paths: { "lib/*": ["location/*"] }, + existingFiles: [join("root", "location", "mylib")], + requestedModule: "mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should not resolve typings file (index.d.ts)", + absoluteBaseUrl: "/root/", + paths: { + "lib/*": ["location/*"], + }, + existingFiles: [join("/root", "location", "mylib", "index.d.ts")], + requestedModule: "lib/mylib", + expectedPath: undefined, + extensions: defaultExtensionsWhenRunningInTsNode, + }, + { + name: "should resolve main file with cjs file extension", + absoluteBaseUrl: "/root/", + paths: {}, + existingFiles: [join("/root", "mylib", "index.cjs")], + packageJson: { + main: "./index.cjs", + }, + requestedModule: "mylib", + expectedPath: join("/root", "mylib", "index.cjs"), + extensions: defaultExtensionsWhenRunningInTsNode, + }, +]; diff --git a/node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts b/node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts new file mode 100644 index 0000000..73585ce --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/filesystem.test.ts @@ -0,0 +1,65 @@ +import * as Filesystem from "../filesystem"; +import * as path from "path"; + +describe("filesystem", () => { + const fileThatExists = path.join(__dirname, "../../package.json"); + const fileThatNotExists = path.join(__dirname, "../../package2.json"); + + it("should find file that exists, sync", () => { + const result = Filesystem.fileExistsSync(fileThatExists); + // assert.equal(result, true); + expect(result).toBe(true); + }); + + it("should not find file that not exists, sync", () => { + const result = Filesystem.fileExistsSync(fileThatNotExists); + // assert.equal(result, false); + expect(result).toBe(false); + }); + + it("should find file that exists, async", (done) => { + Filesystem.fileExistsAsync(fileThatExists, (_err, result) => { + try { + // assert.equal(result, true); + expect(result).toBe(true); + done(); + } catch (error) { + done(error); + } + }); + }); + + it("should not find file that not exists, async", (done) => { + Filesystem.fileExistsAsync(fileThatNotExists, (_err, result) => { + try { + // assert.equal(result, false); + expect(result).toBe(false); + done(); + } catch (error) { + done(error); + } + }); + }); + + it("should load json, sync", () => { + const result = Filesystem.readJsonFromDiskSync(fileThatExists); + // assert.isOk(result); + expect(result); + // assert.equal(result.main, "lib/index.js"); + expect(result.main).toBe("lib/index.js"); + }); + + it("should load json, async", (done) => { + Filesystem.readJsonFromDiskAsync(fileThatExists, (_err, result) => { + try { + // assert.isOk(result); // Asserts that object is truthy. + expect(result).toBeTruthy(); + // assert.equal(result.main, "lib/index.js"); + expect(result.main).toBe("lib/index.js"); + done(); + } catch (error) { + done(error); + } + }); + }); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts b/node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts new file mode 100644 index 0000000..81f9ef8 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/mapping-entry.test.ts @@ -0,0 +1,70 @@ +import { getAbsoluteMappingEntries } from "../mapping-entry"; +import { join } from "path"; + +describe("mapping-entry", () => { + it("should change to absolute paths and sort in longest prefix order", () => { + const result = getAbsoluteMappingEntries( + "/absolute/base/url", + { + "*": ["/foo1", "/foo2"], + "longest/pre/fix/*": ["/foo2/bar"], + "pre/fix/*": ["/foo3"], + }, + true + ); + // assert.deepEqual(result, [ + // { + // pattern: "longest/pre/fix/*", + // paths: [join("/absolute", "base", "url", "foo2", "bar")], + // }, + // { + // pattern: "pre/fix/*", + // paths: [join("/absolute", "base", "url", "foo3")], + // }, + // { + // pattern: "*", + // paths: [ + // join("/absolute", "base", "url", "foo1"), + // join("/absolute", "base", "url", "foo2"), + // ], + // }, + // ]); + expect(result).toEqual([ + { + pattern: "longest/pre/fix/*", + paths: [join("/absolute", "base", "url", "foo2", "bar")], + }, + { + pattern: "pre/fix/*", + paths: [join("/absolute", "base", "url", "foo3")], + }, + { + pattern: "*", + paths: [ + join("/absolute", "base", "url", "foo1"), + join("/absolute", "base", "url", "foo2"), + ], + }, + ]); + }); + + it("should should add a match-all pattern when requested", () => { + let result = getAbsoluteMappingEntries("/absolute/base/url", {}, true); + // assert.deepEqual(result, [ + // { + // pattern: "*", + // paths: [join("/absolute", "base", "url", "*")], + // }, + // ]); + expect(result).toEqual([ + { + pattern: "*", + paths: [join("/absolute", "base", "url", "*")], + }, + ]); + + result = getAbsoluteMappingEntries("/absolute/base/url", {}, false); + // assert.deepEqual(result, []); + expect(result).toEqual([]); + }); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts b/node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts new file mode 100644 index 0000000..259ead9 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/match-path-async.test.ts @@ -0,0 +1,27 @@ +import { createMatchPathAsync } from "../match-path-async"; +import * as Tests from "./data/match-path-data"; + +describe("match-path-async", () => { + Tests.tests.forEach((t) => + it(t.name, (done) => { + const matchPath = createMatchPathAsync( + t.absoluteBaseUrl, + t.paths, + t.mainFields, + t.addMatchAll + ); + matchPath( + t.requestedModule, + (_path, callback) => callback(undefined, t.packageJson), + (path, callback) => + callback(undefined, t.existingFiles.indexOf(path) !== -1), + t.extensions, + (_err, result) => { + // assert.equal(result, t.expectedPath); + expect(result).toBe(t.expectedPath); + done(); + } + ); + }) + ); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts b/node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts new file mode 100644 index 0000000..c925d74 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/match-path-sync.test.ts @@ -0,0 +1,23 @@ +import { createMatchPath } from "../match-path-sync"; +import * as Tests from "./data/match-path-data"; + +describe("match-path-sync", () => { + Tests.tests.forEach((t) => + it(t.name, () => { + const matchPath = createMatchPath( + t.absoluteBaseUrl, + t.paths, + t.mainFields, + t.addMatchAll + ); + const result = matchPath( + t.requestedModule, + (_: string) => t.packageJson, + (name: string) => t.existingFiles.indexOf(name) !== -1, + t.extensions + ); + // assert.equal(result, t.expectedPath); + expect(result).toBe(t.expectedPath); + }) + ); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/try-path.test.ts b/node_modules/tsconfig-paths/src/__tests__/try-path.test.ts new file mode 100644 index 0000000..deb69a0 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/try-path.test.ts @@ -0,0 +1,193 @@ +import { getPathsToTry } from "../try-path"; +import { join } from "path"; + +describe("mapping-entry", () => { + const abosolutePathMappings = [ + { + pattern: "longest/pre/fix/*", + paths: [join("/absolute", "base", "url", "foo2", "bar")], + }, + { pattern: "pre/fix/*", paths: [join("/absolute", "base", "url", "foo3")] }, + { pattern: "*", paths: [join("/absolute", "base", "url", "foo1")] }, + ]; + const abosolutePathMappingsStarstWithSlash = [ + { + pattern: "/opt/*", + paths: [join("/absolute", "src", "aws-layer")], + }, + { + pattern: "*", + paths: [join("/absolute", "src")], + }, + ]; + it("should return no paths for relative requested module", () => { + const result = getPathsToTry( + [".ts", "tsx"], + abosolutePathMappings, + "./requested-module" + ); + // assert.deepEqual(result, undefined); + expect(result).toBeUndefined(); + }); + + it("should return no paths if no pattern match the requested module", () => { + const result = getPathsToTry( + [".ts", "tsx"], + [ + { + pattern: "longest/pre/fix/*", + paths: [join("/absolute", "base", "url", "foo2", "bar")], + }, + { + pattern: "pre/fix/*", + paths: [join("/absolute", "base", "url", "foo3")], + }, + ], + "requested-module" + ); + expect(result).toBeUndefined(); + }); + + it("should get all paths that matches requested module", () => { + const result = getPathsToTry( + [".ts", ".tsx"], + abosolutePathMappings, + "longest/pre/fix/requested-module" + ); + // assert.deepEqual(result, [ + // // "longest/pre/fix/*" + // { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") }, + // { + // type: "extension", + // path: join("/absolute", "base", "url", "foo2", "bar.ts"), + // }, + // { + // type: "extension", + // path: join("/absolute", "base", "url", "foo2", "bar.tsx"), + // }, + // { + // type: "package", + // path: join("/absolute", "base", "url", "foo2", "bar", "package.json"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"), + // }, + // // "*" + // { type: "file", path: join("/absolute", "base", "url", "foo1") }, + // { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") }, + // { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") }, + // { + // type: "package", + // path: join("/absolute", "base", "url", "foo1", "package.json"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo1", "index.ts"), + // }, + // { + // type: "index", + // path: join("/absolute", "base", "url", "foo1", "index.tsx"), + // }, + // ]); + expect(result).toEqual([ + // "longest/pre/fix/*" + { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") }, + { + type: "extension", + path: join("/absolute", "base", "url", "foo2", "bar.ts"), + }, + { + type: "extension", + path: join("/absolute", "base", "url", "foo2", "bar.tsx"), + }, + { + type: "package", + path: join("/absolute", "base", "url", "foo2", "bar", "package.json"), + }, + { + type: "index", + path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"), + }, + { + type: "index", + path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"), + }, + // "*" + { type: "file", path: join("/absolute", "base", "url", "foo1") }, + { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") }, + { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") }, + { + type: "package", + path: join("/absolute", "base", "url", "foo1", "package.json"), + }, + { + type: "index", + path: join("/absolute", "base", "url", "foo1", "index.ts"), + }, + { + type: "index", + path: join("/absolute", "base", "url", "foo1", "index.tsx"), + }, + ]); + }); + + it("should resolve paths starting with a slash", () => { + const result = getPathsToTry( + [".ts"], + abosolutePathMappingsStarstWithSlash, + "/opt/utils" + ); + expect(result).toEqual([ + // "opt/*" + { + path: join("/absolute", "src", "aws-layer"), + type: "file", + }, + { + path: join("/absolute", "src", "aws-layer.ts"), + type: "extension", + }, + { + path: join("/absolute", "src", "aws-layer", "package.json"), + type: "package", + }, + { + path: join("/absolute", "src", "aws-layer", "index.ts"), + type: "index", + }, + // "*" + { + path: join("/absolute", "src"), + type: "file", + }, + { + path: join("/absolute", "src.ts"), + type: "extension", + }, + { + path: join("/absolute", "src", "package.json"), + type: "package", + }, + { + path: join("/absolute", "src", "index.ts"), + type: "index", + }, + ]); + }); +}); + +// describe("match-star", () => { +// it("should match star in last position", () => { +// const result = matchStar("lib/*", "lib/mylib"); +// assert.equal(result, "mylib"); +// }); +// it("should match star in first position", () => { +// const result = matchStar("*/lib", "mylib/lib"); +// assert.equal(result, "mylib"); +// }); +// }); diff --git a/node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts b/node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts new file mode 100644 index 0000000..7394482 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts @@ -0,0 +1,312 @@ +import { + loadTsconfig, + tsConfigLoader, + walkForTsConfig, +} from "../tsconfig-loader"; +import { join } from "path"; + +describe("tsconfig-loader", () => { + it("should find tsconfig in cwd", () => { + const result = tsConfigLoader({ + cwd: "/foo/bar", + getEnv: (_: string) => undefined, + loadSync: (cwd: string) => { + return { + tsConfigPath: `${cwd}/tsconfig.json`, + baseUrl: "./", + paths: {}, + }; + }, + }); + + // assert.equal(result.tsConfigPath, "/foo/bar/tsconfig.json"); + expect(result.tsConfigPath).toBe("/foo/bar/tsconfig.json"); + }); + + it("should return loaderResult.tsConfigPath as undefined when not found", () => { + const result = tsConfigLoader({ + cwd: "/foo/bar", + getEnv: (_: string) => undefined, + loadSync: (_: string) => { + return { + tsConfigPath: undefined, + baseUrl: "./", + paths: {}, + }; + }, + }); + + // assert.isUndefined(result.tsConfigPath); + expect(result.tsConfigPath).toBeUndefined(); + }); + + it("should use TS_NODE_PROJECT env if exists", () => { + const result = tsConfigLoader({ + cwd: "/foo/bar", + getEnv: (key: string) => + key === "TS_NODE_PROJECT" ? "/foo/baz" : undefined, + loadSync: (cwd: string, fileName: string) => { + if (cwd === "/foo/bar" && fileName === "/foo/baz") { + return { + tsConfigPath: "/foo/baz/tsconfig.json", + baseUrl: "./", + paths: {}, + }; + } + + return { + tsConfigPath: undefined, + baseUrl: "./", + paths: {}, + }; + }, + }); + + // assert.equal(result.tsConfigPath, "/foo/baz/tsconfig.json"); + expect(result.tsConfigPath).toBe("/foo/baz/tsconfig.json"); + }); + + it("should use TS_NODE_BASEURL env if exists", () => { + const result = tsConfigLoader({ + cwd: "/foo/bar", + getEnv: (key: string) => + key === "TS_NODE_BASEURL" ? "SOME_BASEURL" : undefined, + loadSync: (_0: string, _1: string, baseUrl: string) => { + return { + tsConfigPath: undefined, + baseUrl, + paths: {}, + }; + }, + }); + + // assert.equal(result.baseUrl, "SOME_BASEURL"); + expect(result.baseUrl).toBe("SOME_BASEURL"); + }); + + it("should not use TS_NODE_BASEURL env if it does not exist", () => { + const result = tsConfigLoader({ + cwd: "/foo/bar", + getEnv: (_: string) => { + return undefined; + }, + loadSync: (_0: string, _1: string, baseUrl: string) => { + return { + tsConfigPath: undefined, + baseUrl, + paths: {}, + }; + }, + }); + + // assert.equal(result.baseUrl, undefined); + expect(result.baseUrl).toBeUndefined(); + }); +}); + +describe("walkForTsConfig", () => { + it("should find tsconfig in starting directory", () => { + const pathToTsconfig = join("/root", "dir1", "tsconfig.json"); + const res = walkForTsConfig( + join("/root", "dir1"), + (path) => path === pathToTsconfig + ); + // assert.equal(res, pathToTsconfig); + expect(res).toBe(pathToTsconfig); + }); + + it("should find tsconfig in parent directory", () => { + const pathToTsconfig = join("/root", "tsconfig.json"); + const res = walkForTsConfig( + join("/root", "dir1"), + (path) => path === pathToTsconfig + ); + // assert.equal(res, pathToTsconfig); + expect(res).toBe(pathToTsconfig); + }); + + it("should return undefined when reaching the top", () => { + const res = walkForTsConfig(join("/root", "dir1", "kalle"), () => false); + // assert.equal(res, undefined); + expect(res).toBeUndefined(); + }); +}); + +describe("loadConfig", () => { + it("It should load a config", () => { + const config = { compilerOptions: { baseUrl: "hej" } }; + const res = loadTsconfig( + "/root/dir1/tsconfig.json", + (path) => path === "/root/dir1/tsconfig.json", + (_) => JSON.stringify(config) + ); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + + it("It should load a config with comments", () => { + const config = { compilerOptions: { baseUrl: "hej" } }; + const res = loadTsconfig( + "/root/dir1/tsconfig.json", + (path) => path === "/root/dir1/tsconfig.json", + (_) => `{ + // my comment + "compilerOptions": { + "baseUrl": "hej" + } + }` + ); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + + it("It should load a config with trailing commas", () => { + const config = { compilerOptions: { baseUrl: "hej" } }; + const res = loadTsconfig( + "/root/dir1/tsconfig.json", + (path) => path === "/root/dir1/tsconfig.json", + (_) => `{ + "compilerOptions": { + "baseUrl": "hej", + }, + }` + ); + // assert.deepEqual(res, config); + expect(res).toStrictEqual(config); + }); + + it("It should load a config with extends and overwrite all options", () => { + const firstConfig = { + extends: "../base-config.json", + compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } }, + }; + const firstConfigPath = join("/root", "dir1", "tsconfig.json"); + const baseConfig = { + compilerOptions: { + baseUrl: "olle", + paths: { foo: ["bar1"] }, + strict: true, + }, + }; + const baseConfigPath = join("/root", "base-config.json"); + const res = loadTsconfig( + join("/root", "dir1", "tsconfig.json"), + (path) => path === firstConfigPath || path === baseConfigPath, + (path) => { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === baseConfigPath) { + return JSON.stringify(baseConfig); + } + return ""; + } + ); + + // assert.deepEqual(res, { + // extends: "../base-config.json", + // compilerOptions: { + // baseUrl: "kalle", + // paths: { foo: ["bar2"] }, + // strict: true, + // }, + // }); + expect(res).toEqual({ + extends: "../base-config.json", + compilerOptions: { + baseUrl: "kalle", + paths: { foo: ["bar2"] }, + strict: true, + }, + }); + }); + + it("It should load a config with extends from node_modules and overwrite all options", () => { + const firstConfig = { + extends: "my-package/base-config.json", + compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } }, + }; + const firstConfigPath = join("/root", "dir1", "tsconfig.json"); + const baseConfig = { + compilerOptions: { + baseUrl: "olle", + paths: { foo: ["bar1"] }, + strict: true, + }, + }; + const baseConfigPath = join( + "/root", + "dir1", + "node_modules", + "my-package", + "base-config.json" + ); + const res = loadTsconfig( + join("/root", "dir1", "tsconfig.json"), + (path) => path === firstConfigPath || path === baseConfigPath, + (path) => { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === baseConfigPath) { + return JSON.stringify(baseConfig); + } + return ""; + } + ); + + // assert.deepEqual(res, { + // extends: "my-package/base-config.json", + // compilerOptions: { + // baseUrl: "kalle", + // paths: { foo: ["bar2"] }, + // strict: true, + // }, + // }); + expect(res).toEqual({ + extends: "my-package/base-config.json", + compilerOptions: { + baseUrl: "kalle", + paths: { foo: ["bar2"] }, + strict: true, + }, + }); + }); + + it("Should use baseUrl relative to location of extended tsconfig", () => { + const firstConfig = { compilerOptions: { baseUrl: "." } }; + const firstConfigPath = join("/root", "first-config.json"); + const secondConfig = { extends: "../first-config.json" }; + const secondConfigPath = join("/root", "dir1", "second-config.json"); + const thirdConfig = { extends: "../second-config.json" }; + const thirdConfigPath = join("/root", "dir1", "dir2", "third-config.json"); + const res = loadTsconfig( + join("/root", "dir1", "dir2", "third-config.json"), + (path) => + path === firstConfigPath || + path === secondConfigPath || + path === thirdConfigPath, + (path) => { + if (path === firstConfigPath) { + return JSON.stringify(firstConfig); + } + if (path === secondConfigPath) { + return JSON.stringify(secondConfig); + } + if (path === thirdConfigPath) { + return JSON.stringify(thirdConfig); + } + return ""; + } + ); + + // assert.deepEqual(res, { + // extends: "../second-config.json", + // compilerOptions: { baseUrl: join("..", "..") }, + // }); + expect(res).toEqual({ + extends: "../second-config.json", + compilerOptions: { baseUrl: join("..", "..") }, + }); + }); +}); diff --git a/node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json b/node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json new file mode 100644 index 0000000..a337580 --- /dev/null +++ b/node_modules/tsconfig-paths/src/__tests__/tsconfig-named.json @@ -0,0 +1,10 @@ +{ + "extends": "../base-tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "module": "commonjs", + "target": "es6", + "sourceMap": true, + "outDir": "./js_out" + } +} diff --git a/node_modules/tsconfig-paths/src/config-loader.ts b/node_modules/tsconfig-paths/src/config-loader.ts new file mode 100644 index 0000000..3e1b17a --- /dev/null +++ b/node_modules/tsconfig-paths/src/config-loader.ts @@ -0,0 +1,97 @@ +import * as TsConfigLoader2 from "./tsconfig-loader"; +import * as path from "path"; +import { options } from "./options"; + +export interface ExplicitParams { + baseUrl: string; + paths: { [key: string]: Array }; + mainFields?: Array; + addMatchAll?: boolean; +} + +export type TsConfigLoader = ( + params: TsConfigLoader2.TsConfigLoaderParams +) => TsConfigLoader2.TsConfigLoaderResult; + +export interface ConfigLoaderParams { + cwd: string; + explicitParams?: ExplicitParams; + tsConfigLoader?: TsConfigLoader; +} + +export interface ConfigLoaderSuccessResult { + resultType: "success"; + configFileAbsolutePath: string; + baseUrl: string; + absoluteBaseUrl: string; + paths: { [key: string]: Array }; + mainFields?: Array; + addMatchAll?: boolean; +} + +export interface ConfigLoaderFailResult { + resultType: "failed"; + message: string; +} + +export type ConfigLoaderResult = + | ConfigLoaderSuccessResult + | ConfigLoaderFailResult; + +export function loadConfig(cwd: string = options.cwd): ConfigLoaderResult { + return configLoader({ cwd: cwd }); +} + +export function configLoader({ + cwd, + explicitParams, + tsConfigLoader = TsConfigLoader2.tsConfigLoader, +}: ConfigLoaderParams): ConfigLoaderResult { + if (explicitParams) { + // tslint:disable-next-line:no-shadowed-variable + const absoluteBaseUrl = path.isAbsolute(explicitParams.baseUrl) + ? explicitParams.baseUrl + : path.join(cwd, explicitParams.baseUrl); + + return { + resultType: "success", + configFileAbsolutePath: "", + baseUrl: explicitParams.baseUrl, + absoluteBaseUrl, + paths: explicitParams.paths, + mainFields: explicitParams.mainFields, + addMatchAll: explicitParams.addMatchAll, + }; + } + + // Load tsconfig and create path matching function + const loadResult = tsConfigLoader({ + cwd, + getEnv: (key: string) => process.env[key], + }); + + if (!loadResult.tsConfigPath) { + return { + resultType: "failed", + message: "Couldn't find tsconfig.json", + }; + } + + if (!loadResult.baseUrl) { + return { + resultType: "failed", + message: "Missing baseUrl in compilerOptions", + }; + } + + const tsConfigDir = path.dirname(loadResult.tsConfigPath); + const absoluteBaseUrl = path.join(tsConfigDir, loadResult.baseUrl); + + return { + resultType: "success", + configFileAbsolutePath: loadResult.tsConfigPath, + baseUrl: loadResult.baseUrl, + absoluteBaseUrl, + paths: loadResult.paths || {}, + }; +} diff --git a/node_modules/tsconfig-paths/src/filesystem.ts b/node_modules/tsconfig-paths/src/filesystem.ts new file mode 100644 index 0000000..a6773a7 --- /dev/null +++ b/node_modules/tsconfig-paths/src/filesystem.ts @@ -0,0 +1,87 @@ +import * as fs from "fs"; + +/** + * Typing for the fields of package.json we care about + */ +export interface PackageJson { + [key: string]: string; +} + +/** + * A function that json from a file + */ +export interface ReadJsonSync { + // tslint:disable-next-line:no-any + (packageJsonPath: string): any | undefined; +} + +export interface FileExistsSync { + (name: string): boolean; +} + +export interface FileExistsAsync { + (path: string, callback: (err?: Error, exists?: boolean) => void): void; +} + +export interface ReadJsonAsyncCallback { + // tslint:disable-next-line:no-any + (err?: Error, content?: any): void; +} + +export interface ReadJsonAsync { + (path: string, callback: ReadJsonAsyncCallback): void; +} + +export function fileExistsSync(path: string): boolean { + try { + const stats = fs.statSync(path); + return stats.isFile(); + } catch (err) { + // If error, assume file did not exist + return false; + } +} + +/** + * Reads package.json from disk + * @param file Path to package.json + */ +// tslint:disable-next-line:no-any +export function readJsonFromDiskSync(packageJsonPath: string): any | undefined { + if (!fs.existsSync(packageJsonPath)) { + return undefined; + } + return require(packageJsonPath); +} + +export function readJsonFromDiskAsync( + path: string, + // tslint:disable-next-line:no-any + callback: (err?: Error, content?: any) => void +): void { + fs.readFile(path, "utf8", (err, result) => { + // If error, assume file did not exist + if (err || !result) { + return callback(); + } + const json = JSON.parse(result); + return callback(undefined, json); + }); +} + +export function fileExistsAsync( + path2: string, + callback2: (err?: Error, exists?: boolean) => void +): void { + fs.stat(path2, (err: Error, stats: fs.Stats) => { + if (err) { + // If error assume file does not exist + return callback2(undefined, false); + } + callback2(undefined, stats ? stats.isFile() : false); + }); +} + +export function removeExtension(path: string): string { + return path.substring(0, path.lastIndexOf(".")) || path; +} diff --git a/node_modules/tsconfig-paths/src/index.ts b/node_modules/tsconfig-paths/src/index.ts new file mode 100644 index 0000000..650f185 --- /dev/null +++ b/node_modules/tsconfig-paths/src/index.ts @@ -0,0 +1,24 @@ +// register is used from register.js in root dir +export { + createMatchPath, + matchFromAbsolutePaths, + MatchPath, +} from "./match-path-sync"; +export { + createMatchPathAsync, + matchFromAbsolutePathsAsync, + MatchPathAsync, +} from "./match-path-async"; +export { register } from "./register"; +export { + loadConfig, + ConfigLoaderResult, + ConfigLoaderSuccessResult, + ConfigLoaderFailResult, +} from "./config-loader"; +export { + ReadJsonSync, + ReadJsonAsync, + FileExistsSync, + FileExistsAsync, +} from "./filesystem"; diff --git a/node_modules/tsconfig-paths/src/mapping-entry.ts b/node_modules/tsconfig-paths/src/mapping-entry.ts new file mode 100644 index 0000000..5d900b3 --- /dev/null +++ b/node_modules/tsconfig-paths/src/mapping-entry.ts @@ -0,0 +1,64 @@ +import * as path from "path"; + +export interface MappingEntry { + readonly pattern: string; + readonly paths: ReadonlyArray; +} + +export interface Paths { + readonly [key: string]: ReadonlyArray; +} + +/** + * Converts an absolute baseUrl and paths to an array of absolute mapping entries. + * The array is sorted by longest prefix. + * Having an array with entries allows us to keep a sorting order rather than + * sort by keys each time we use the mappings. + * @param absoluteBaseUrl + * @param paths + * @param addMatchAll + */ +export function getAbsoluteMappingEntries( + absoluteBaseUrl: string, + paths: Paths, + addMatchAll: boolean +): ReadonlyArray { + // Resolve all paths to absolute form once here, and sort them by + // longest prefix once here, this saves time on each request later. + // We need to put them in an array to preserve the sorting order. + const sortedKeys = sortByLongestPrefix(Object.keys(paths)); + const absolutePaths: Array = []; + for (const key of sortedKeys) { + absolutePaths.push({ + pattern: key, + paths: paths[key].map((pathToResolve) => + path.join(absoluteBaseUrl, pathToResolve) + ), + }); + } + // If there is no match-all path specified in the paths section of tsconfig, then try to match + // all paths relative to baseUrl, this is how typescript works. + if (!paths["*"] && addMatchAll) { + absolutePaths.push({ + pattern: "*", + paths: [`${absoluteBaseUrl.replace(/\/$/, "")}/*`], + }); + } + + return absolutePaths; +} + +/** + * Sort path patterns. + * If a module name can be matched with multiple patterns then pattern with the longest prefix will be picked. + */ +function sortByLongestPrefix(arr: Array): Array { + return arr + .concat() + .sort((a: string, b: string) => getPrefixLength(b) - getPrefixLength(a)); +} + +function getPrefixLength(pattern: string): number { + const prefixLength = pattern.indexOf("*"); + return pattern.substr(0, prefixLength).length; +} diff --git a/node_modules/tsconfig-paths/src/match-path-async.ts b/node_modules/tsconfig-paths/src/match-path-async.ts new file mode 100644 index 0000000..9673f2a --- /dev/null +++ b/node_modules/tsconfig-paths/src/match-path-async.ts @@ -0,0 +1,218 @@ +import * as path from "path"; +import * as TryPath from "./try-path"; +import * as MappingEntry from "./mapping-entry"; +import * as Filesystem from "./filesystem"; + +/** + * Function that can match a path async + */ +export interface MatchPathAsync { + ( + requestedModule: string, + readJson: Filesystem.ReadJsonAsync | undefined, + fileExists: Filesystem.FileExistsAsync | undefined, + extensions: ReadonlyArray | undefined, + callback: MatchPathAsyncCallback + ): void; +} + +export interface MatchPathAsyncCallback { + (err?: Error, path?: string): void; +} + +/** + * See the sync version for docs. + */ +export function createMatchPathAsync( + absoluteBaseUrl: string, + paths: { [key: string]: Array }, + mainFields: string[] = ["main"], + addMatchAll: boolean = true +): MatchPathAsync { + const absolutePaths = MappingEntry.getAbsoluteMappingEntries( + absoluteBaseUrl, + paths, + addMatchAll + ); + + return ( + requestedModule: string, + readJson: Filesystem.ReadJsonAsync | undefined, + fileExists: Filesystem.FileExistsAsync | undefined, + extensions: ReadonlyArray | undefined, + callback: MatchPathAsyncCallback + ) => + matchFromAbsolutePathsAsync( + absolutePaths, + requestedModule, + readJson, + fileExists, + extensions, + callback, + mainFields + ); +} + +/** + * See the sync version for docs. + */ +export function matchFromAbsolutePathsAsync( + absolutePathMappings: ReadonlyArray, + requestedModule: string, + readJson: Filesystem.ReadJsonAsync = Filesystem.readJsonFromDiskAsync, + fileExists: Filesystem.FileExistsAsync = Filesystem.fileExistsAsync, + extensions: ReadonlyArray = Object.keys(require.extensions), + callback: MatchPathAsyncCallback, + mainFields: string[] = ["main"] +): void { + const tryPaths = TryPath.getPathsToTry( + extensions, + absolutePathMappings, + requestedModule + ); + + if (!tryPaths) { + return callback(); + } + + findFirstExistingPath( + tryPaths, + readJson, + fileExists, + callback, + 0, + mainFields + ); +} + +function findFirstExistingMainFieldMappedFile( + packageJson: Filesystem.PackageJson, + mainFields: string[], + packageJsonPath: string, + fileExistsAsync: Filesystem.FileExistsAsync, + doneCallback: (err?: Error, filepath?: string) => void, + index: number = 0 +): void { + if (index >= mainFields.length) { + return doneCallback(undefined, undefined); + } + + const tryNext = () => + findFirstExistingMainFieldMappedFile( + packageJson, + mainFields, + packageJsonPath, + fileExistsAsync, + doneCallback, + index + 1 + ); + + const mainFieldMapping = packageJson[mainFields[index]]; + if (typeof mainFieldMapping !== "string") { + // Skip mappings that are not pointers to replacement files + return tryNext(); + } + + const mappedFilePath = path.join( + path.dirname(packageJsonPath), + mainFieldMapping + ); + fileExistsAsync(mappedFilePath, (err?: Error, exists?: boolean) => { + if (err) { + return doneCallback(err); + } + if (exists) { + return doneCallback(undefined, mappedFilePath); + } + return tryNext(); + }); +} + +// Recursive loop to probe for physical files +function findFirstExistingPath( + tryPaths: ReadonlyArray, + readJson: Filesystem.ReadJsonAsync, + fileExists: Filesystem.FileExistsAsync, + doneCallback: MatchPathAsyncCallback, + index: number = 0, + mainFields: string[] = ["main"] +): void { + const tryPath = tryPaths[index]; + if ( + tryPath.type === "file" || + tryPath.type === "extension" || + tryPath.type === "index" + ) { + fileExists(tryPath.path, (err: Error, exists: boolean) => { + if (err) { + return doneCallback(err); + } + if (exists) { + return doneCallback(undefined, TryPath.getStrippedPath(tryPath)); + } + if (index === tryPaths.length - 1) { + return doneCallback(); + } + // Continue with the next path + return findFirstExistingPath( + tryPaths, + readJson, + fileExists, + doneCallback, + index + 1, + mainFields + ); + }); + } else if (tryPath.type === "package") { + readJson(tryPath.path, (err, packageJson) => { + if (err) { + return doneCallback(err); + } + if (packageJson) { + return findFirstExistingMainFieldMappedFile( + packageJson, + mainFields, + tryPath.path, + fileExists, + (mainFieldErr?: Error, mainFieldMappedFile?: string) => { + if (mainFieldErr) { + return doneCallback(mainFieldErr); + } + if (mainFieldMappedFile) { + return doneCallback(undefined, mainFieldMappedFile); + } + + // No field in package json was a valid option. Continue with the next path. + return findFirstExistingPath( + tryPaths, + readJson, + fileExists, + doneCallback, + index + 1, + mainFields + ); + } + ); + } + + // This is async code, we need to return unconditionally, otherwise the code still falls + // through and keeps recursing. While this might work in general, libraries that use neo-async + // like Webpack will actually not allow you to call the same callback twice. + // + // An example of where this caused issues: + // https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/11 + // + // Continue with the next path + return findFirstExistingPath( + tryPaths, + readJson, + fileExists, + doneCallback, + index + 1, + mainFields + ); + }); + } else { + TryPath.exhaustiveTypeException(tryPath.type); + } +} diff --git a/node_modules/tsconfig-paths/src/match-path-sync.ts b/node_modules/tsconfig-paths/src/match-path-sync.ts new file mode 100644 index 0000000..953c8a6 --- /dev/null +++ b/node_modules/tsconfig-paths/src/match-path-sync.ts @@ -0,0 +1,141 @@ +import * as path from "path"; +import * as Filesystem from "./filesystem"; +import * as MappingEntry from "./mapping-entry"; +import * as TryPath from "./try-path"; + +/** + * Function that can match a path + */ +export interface MatchPath { + ( + requestedModule: string, + readJson?: Filesystem.ReadJsonSync, + fileExists?: (name: string) => boolean, + extensions?: ReadonlyArray + ): string | undefined; +} + +/** + * Creates a function that can resolve paths according to tsconfig paths property. + * @param absoluteBaseUrl Absolute version of baseUrl as specified in tsconfig. + * @param paths The paths as specified in tsconfig. + * @param mainFields A list of package.json field names to try when resolving module files. + * @param addMatchAll Add a match-all "*" rule if none is present + * @returns a function that can resolve paths. + */ +export function createMatchPath( + absoluteBaseUrl: string, + paths: { [key: string]: Array }, + mainFields: string[] = ["main"], + addMatchAll: boolean = true +): MatchPath { + const absolutePaths = MappingEntry.getAbsoluteMappingEntries( + absoluteBaseUrl, + paths, + addMatchAll + ); + + return ( + requestedModule: string, + readJson?: Filesystem.ReadJsonSync, + fileExists?: Filesystem.FileExistsSync, + extensions?: Array + ) => + matchFromAbsolutePaths( + absolutePaths, + requestedModule, + readJson, + fileExists, + extensions, + mainFields + ); +} + +/** + * Finds a path from tsconfig that matches a module load request. + * @param absolutePathMappings The paths to try as specified in tsconfig but resolved to absolute form. + * @param requestedModule The required module name. + * @param readJson Function that can read json from a path (useful for testing). + * @param fileExists Function that checks for existence of a file at a path (useful for testing). + * @param extensions File extensions to probe for (useful for testing). + * @param mainFields A list of package.json field names to try when resolving module files. + * @returns the found path, or undefined if no path was found. + */ +export function matchFromAbsolutePaths( + absolutePathMappings: ReadonlyArray, + requestedModule: string, + readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync, + fileExists: Filesystem.FileExistsSync = Filesystem.fileExistsSync, + extensions: Array = Object.keys(require.extensions), + mainFields: string[] = ["main"] +): string | undefined { + const tryPaths = TryPath.getPathsToTry( + extensions, + absolutePathMappings, + requestedModule + ); + + if (!tryPaths) { + return undefined; + } + + return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields); +} + +function findFirstExistingMainFieldMappedFile( + packageJson: Filesystem.PackageJson, + mainFields: string[], + packageJsonPath: string, + fileExists: Filesystem.FileExistsSync +): string | undefined { + for (let index = 0; index < mainFields.length; index++) { + const mainFieldName = mainFields[index]; + const candidateMapping = packageJson[mainFieldName]; + if (candidateMapping && typeof candidateMapping === "string") { + const candidateFilePath = path.join( + path.dirname(packageJsonPath), + candidateMapping + ); + if (fileExists(candidateFilePath)) { + return candidateFilePath; + } + } + } + + return undefined; +} + +function findFirstExistingPath( + tryPaths: ReadonlyArray, + readJson: Filesystem.ReadJsonSync = Filesystem.readJsonFromDiskSync, + fileExists: Filesystem.FileExistsSync, + mainFields: string[] = ["main"] +): string | undefined { + for (const tryPath of tryPaths) { + if ( + tryPath.type === "file" || + tryPath.type === "extension" || + tryPath.type === "index" + ) { + if (fileExists(tryPath.path)) { + return TryPath.getStrippedPath(tryPath); + } + } else if (tryPath.type === "package") { + const packageJson: Filesystem.PackageJson = readJson(tryPath.path); + if (packageJson) { + const mainFieldMappedFile = findFirstExistingMainFieldMappedFile( + packageJson, + mainFields, + tryPath.path, + fileExists + ); + if (mainFieldMappedFile) { + return mainFieldMappedFile; + } + } + } else { + TryPath.exhaustiveTypeException(tryPath.type); + } + } + return undefined; +} diff --git a/node_modules/tsconfig-paths/src/options.ts b/node_modules/tsconfig-paths/src/options.ts new file mode 100644 index 0000000..9733f0a --- /dev/null +++ b/node_modules/tsconfig-paths/src/options.ts @@ -0,0 +1,18 @@ +import * as minimist from "minimist"; + +const argv = minimist(process.argv.slice(2), { + string: ["project"], + alias: { + project: ["P"], + }, +}); + +const project = argv && argv.project; + +export interface Options { + cwd: string; +} + +export const options: Options = { + cwd: project || process.cwd(), +}; diff --git a/node_modules/tsconfig-paths/src/register.ts b/node_modules/tsconfig-paths/src/register.ts new file mode 100644 index 0000000..715e256 --- /dev/null +++ b/node_modules/tsconfig-paths/src/register.ts @@ -0,0 +1,97 @@ +import { createMatchPath } from "./match-path-sync"; +import { configLoader, ExplicitParams } from "./config-loader"; +import { options } from "./options"; + +const noOp = (): void => void 0; + +function getCoreModules( + builtinModules: string[] | undefined +): { [key: string]: boolean } { + builtinModules = builtinModules || [ + "assert", + "buffer", + "child_process", + "cluster", + "crypto", + "dgram", + "dns", + "domain", + "events", + "fs", + "http", + "https", + "net", + "os", + "path", + "punycode", + "querystring", + "readline", + "stream", + "string_decoder", + "tls", + "tty", + "url", + "util", + "v8", + "vm", + "zlib", + ]; + + const coreModules: { [key: string]: boolean } = {}; + for (let module of builtinModules) { + coreModules[module] = true; + } + + return coreModules; +} + +/** + * Installs a custom module load function that can adhere to paths in tsconfig. + * Returns a function to undo paths registration. + */ +export function register(explicitParams: ExplicitParams): () => void { + const configLoaderResult = configLoader({ + cwd: options.cwd, + explicitParams, + }); + + if (configLoaderResult.resultType === "failed") { + console.warn( + `${configLoaderResult.message}. tsconfig-paths will be skipped` + ); + + return noOp; + } + + const matchPath = createMatchPath( + configLoaderResult.absoluteBaseUrl, + configLoaderResult.paths, + configLoaderResult.mainFields, + configLoaderResult.addMatchAll + ); + + // Patch node's module loading + // tslint:disable-next-line:no-require-imports variable-name + const Module = require("module"); + const originalResolveFilename = Module._resolveFilename; + const coreModules = getCoreModules(Module.builtinModules); + // tslint:disable-next-line:no-any + Module._resolveFilename = function (request: string, _parent: any): string { + const isCoreModule = coreModules.hasOwnProperty(request); + if (!isCoreModule) { + const found = matchPath(request); + if (found) { + const modifiedArguments = [found, ...[].slice.call(arguments, 1)]; // Passes all arguments. Even those that is not specified above. + // tslint:disable-next-line:no-invalid-this + return originalResolveFilename.apply(this, modifiedArguments); + } + } + // tslint:disable-next-line:no-invalid-this + return originalResolveFilename.apply(this, arguments); + }; + + return () => { + // Return node's module loading to original state. + Module._resolveFilename = originalResolveFilename; + }; +} diff --git a/node_modules/tsconfig-paths/src/try-path.ts b/node_modules/tsconfig-paths/src/try-path.ts new file mode 100644 index 0000000..f7ebede --- /dev/null +++ b/node_modules/tsconfig-paths/src/try-path.ts @@ -0,0 +1,102 @@ +import * as path from "path"; +import { MappingEntry } from "./mapping-entry"; +import { dirname } from "path"; +import { removeExtension } from "./filesystem"; + +export interface TryPath { + readonly type: "file" | "extension" | "index" | "package"; + readonly path: string; +} + +/** + * Builds a list of all physical paths to try by: + * 1. Check for file named exactly as request. + * 2. Check for files named as request ending in any of the extensions. + * 3. Check for file specified in package.json's main property. + * 4. Check for files named as request ending in "index" with any of the extensions. + */ +export function getPathsToTry( + extensions: ReadonlyArray, + absolutePathMappings: ReadonlyArray, + requestedModule: string +): ReadonlyArray | undefined { + if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") { + return undefined; + } + + const pathsToTry: Array = []; + for (const entry of absolutePathMappings) { + const starMatch = + entry.pattern === requestedModule + ? "" + : matchStar(entry.pattern, requestedModule); + if (starMatch !== undefined) { + for (const physicalPathPattern of entry.paths) { + const physicalPath = physicalPathPattern.replace("*", starMatch); + pathsToTry.push({ type: "file", path: physicalPath }); + pathsToTry.push( + ...extensions.map( + (e) => ({ type: "extension", path: physicalPath + e } as TryPath) + ) + ); + pathsToTry.push({ + type: "package", + path: path.join(physicalPath, "/package.json"), + }); + const indexPath = path.join(physicalPath, "/index"); + pathsToTry.push( + ...extensions.map( + (e) => ({ type: "index", path: indexPath + e } as TryPath) + ) + ); + } + } + } + return pathsToTry.length === 0 ? undefined : pathsToTry; +} + +// Not sure why we don't just return the full found path? +export function getStrippedPath(tryPath: TryPath): string { + return tryPath.type === "index" + ? dirname(tryPath.path) + : tryPath.type === "file" + ? tryPath.path + : tryPath.type === "extension" + ? removeExtension(tryPath.path) + : tryPath.type === "package" + ? tryPath.path + : exhaustiveTypeException(tryPath.type); +} + +export function exhaustiveTypeException(check: never): never { + throw new Error(`Unknown type ${check}`); +} + +/** + * Matches pattern with a single star against search. + * Star must match at least one character to be considered a match. + * @param patttern for example "foo*" + * @param search for example "fooawesomebar" + * @returns the part of search that * matches, or undefined if no match. + */ +function matchStar(pattern: string, search: string): string | undefined { + if (search.length < pattern.length) { + return undefined; + } + if (pattern === "*") { + return search; + } + const star = pattern.indexOf("*"); + if (star === -1) { + return undefined; + } + const part1 = pattern.substring(0, star); + const part2 = pattern.substring(star + 1); + if (search.substr(0, star) !== part1) { + return undefined; + } + if (search.substr(search.length - part2.length) !== part2) { + return undefined; + } + return search.substr(star, search.length - part2.length); +} diff --git a/node_modules/tsconfig-paths/src/tsconfig-loader.ts b/node_modules/tsconfig-paths/src/tsconfig-loader.ts new file mode 100644 index 0000000..c2dfb04 --- /dev/null +++ b/node_modules/tsconfig-paths/src/tsconfig-loader.ts @@ -0,0 +1,172 @@ +import * as path from "path"; +import * as fs from "fs"; +// tslint:disable:no-require-imports +import JSON5 = require("json5"); +import StripBom = require("strip-bom"); +// tslint:enable:no-require-imports + +/** + * Typing for the parts of tsconfig that we care about + */ +export interface Tsconfig { + extends?: string; + compilerOptions?: { + baseUrl?: string; + paths?: { [key: string]: Array }; + strict?: boolean; + }; +} + +export interface TsConfigLoaderResult { + tsConfigPath: string | undefined; + baseUrl: string | undefined; + paths: { [key: string]: Array } | undefined; +} + +export interface TsConfigLoaderParams { + getEnv: (key: string) => string | undefined; + cwd: string; + loadSync?( + cwd: string, + filename?: string, + baseUrl?: string + ): TsConfigLoaderResult; +} + +export function tsConfigLoader({ + getEnv, + cwd, + loadSync = loadSyncDefault, +}: TsConfigLoaderParams): TsConfigLoaderResult { + const TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT"); + const TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL"); + + // tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory + // and also overrides baseURL if TS_NODE_BASEURL is available. + const loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL); + return loadResult; +} + +function loadSyncDefault( + cwd: string, + filename?: string, + baseUrl?: string +): TsConfigLoaderResult { + // Tsconfig.loadSync uses path.resolve. This is why we can use an absolute path as filename + + const configPath = resolveConfigPath(cwd, filename); + + if (!configPath) { + return { + tsConfigPath: undefined, + baseUrl: undefined, + paths: undefined, + }; + } + const config = loadTsconfig(configPath); + + return { + tsConfigPath: configPath, + baseUrl: + baseUrl || + (config && config.compilerOptions && config.compilerOptions.baseUrl), + paths: config && config.compilerOptions && config.compilerOptions.paths, + }; +} + +function resolveConfigPath(cwd: string, filename?: string): string | undefined { + if (filename) { + const absolutePath = fs.lstatSync(filename).isDirectory() + ? path.resolve(filename, "./tsconfig.json") + : path.resolve(cwd, filename); + + return absolutePath; + } + + if (fs.statSync(cwd).isFile()) { + return path.resolve(cwd); + } + + const configAbsolutePath = walkForTsConfig(cwd); + return configAbsolutePath ? path.resolve(configAbsolutePath) : undefined; +} + +export function walkForTsConfig( + directory: string, + existsSync: (path: string) => boolean = fs.existsSync +): string | undefined { + const configPath = path.join(directory, "./tsconfig.json"); + if (existsSync(configPath)) { + return configPath; + } + + const parentDirectory = path.join(directory, "../"); + + // If we reached the top + if (directory === parentDirectory) { + return undefined; + } + + return walkForTsConfig(parentDirectory, existsSync); +} + +export function loadTsconfig( + configFilePath: string, + existsSync: (path: string) => boolean = fs.existsSync, + readFileSync: (filename: string) => string = (filename: string) => + fs.readFileSync(filename, "utf8") +): Tsconfig | undefined { + if (!existsSync(configFilePath)) { + return undefined; + } + + const configString = readFileSync(configFilePath); + const cleanedJson = StripBom(configString); + const config: Tsconfig = JSON5.parse(cleanedJson); + let extendedConfig = config.extends; + + if (extendedConfig) { + if ( + typeof extendedConfig === "string" && + extendedConfig.indexOf(".json") === -1 + ) { + extendedConfig += ".json"; + } + const currentDir = path.dirname(configFilePath); + let extendedConfigPath = path.join(currentDir, extendedConfig); + if ( + extendedConfig.indexOf("/") !== -1 && + extendedConfig.indexOf(".") !== -1 && + !existsSync(extendedConfigPath) + ) { + extendedConfigPath = path.join( + currentDir, + "node_modules", + extendedConfig + ); + } + + const base = + loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {}; + + // baseUrl should be interpreted as relative to the base tsconfig, + // but we need to update it so it is relative to the original tsconfig being loaded + if (base.compilerOptions && base.compilerOptions.baseUrl) { + const extendsDir = path.dirname(extendedConfig); + base.compilerOptions.baseUrl = path.join( + extendsDir, + base.compilerOptions.baseUrl + ); + } + + return { + ...base, + ...config, + compilerOptions: { + ...base.compilerOptions, + ...config.compilerOptions, + }, + }; + } + return config; +} diff --git a/node_modules/type-check/LICENSE b/node_modules/type-check/LICENSE new file mode 100644 index 0000000..525b118 --- /dev/null +++ b/node_modules/type-check/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/type-check/README.md b/node_modules/type-check/README.md new file mode 100644 index 0000000..b170d67 --- /dev/null +++ b/node_modules/type-check/README.md @@ -0,0 +1,210 @@ +# type-check [![Build Status](https://travis-ci.org/gkz/type-check.png?branch=master)](https://travis-ci.org/gkz/type-check) + + + +`type-check` is a library which allows you to check the types of JavaScript values at runtime with a Haskell like type syntax. It is great for checking external input, for testing, or even for adding a bit of safety to your internal code. It is a major component of [levn](https://github.com/gkz/levn). MIT license. Version 0.4.0. Check out the [demo](http://gkz.github.io/type-check/). + +For updates on `type-check`, [follow me on twitter](https://twitter.com/gkzahariev). + + npm install type-check + +## Quick Examples + +```js +// Basic types: +var typeCheck = require('type-check').typeCheck; +typeCheck('Number', 1); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', validate: function(x) { return x % 2 === 0; }}}}; +typeCheck('Even', 2, opt); // true + +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true +``` + +Check out the [type syntax format](#syntax) and [guide](#guide). + +## Usage + +`require('type-check');` returns an object that exposes four properties. `VERSION` is the current version of the library as a string. `typeCheck`, `parseType`, and `parsedTypeCheck` are functions. + +```js +// typeCheck(type, input, options); +typeCheck('Number', 2); // true + +// parseType(type); +var parsedType = parseType('Number'); // object + +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true +``` + +### typeCheck(type, input, options) + +`typeCheck` checks a JavaScript value `input` against `type` written in the [type format](#type-format) (and taking account the optional `options`) and returns whether the `input` matches the `type`. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +typeCheck('Number', 2); // true +``` + +### parseType(type) + +`parseType` parses string `type` written in the [type format](#type-format) into an object representing the parsed type. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to parse + +##### returns +`Object` - an object in the parsed type format representing the parsed type + +##### example +```js +parseType('Number'); // [{type: 'Number'}] +``` +### parsedTypeCheck(parsedType, input, options) + +`parsedTypeCheck` checks a JavaScript value `input` against parsed `type` in the parsed type format (and taking account the optional `options`) and returns whether the `input` matches the `type`. Use this in conjunction with `parseType` if you are going to use a type more than once. + +##### arguments +* type - `Object` - the type in the parsed type format which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +parsedTypeCheck([{type: 'Number'}], 2); // true +var parsedType = parseType('String'); +parsedTypeCheck(parsedType, 'str'); // true +``` + + +## Type Format + +### Syntax + +White space is ignored. The root node is a __Types__. + +* __Identifier__ = `[\$\w]+` - a group of any lower or upper case letters, numbers, underscores, or dollar signs - eg. `String` +* __Type__ = an `Identifier`, an `Identifier` followed by a `Structure`, just a `Structure`, or a wildcard `*` - eg. `String`, `Object{x: Number}`, `{x: Number}`, `Array{0: String, 1: Boolean, length: Number}`, `*` +* __Types__ = optionally a comment (an `Identifier` followed by a `::`), optionally the identifier `Maybe`, one or more `Type`, separated by `|` - eg. `Number`, `String | Date`, `Maybe Number`, `Maybe Boolean | String` +* __Structure__ = `Fields`, or a `Tuple`, or an `Array` - eg. `{x: Number}`, `(String, Number)`, `[Date]` +* __Fields__ = a `{`, followed one or more `Field` separated by a comma `,` (trailing comma `,` is permitted), optionally an `...` (always preceded by a comma `,`), followed by a `}` - eg. `{x: Number, y: String}`, `{k: Function, ...}` +* __Field__ = an `Identifier`, followed by a colon `:`, followed by `Types` - eg. `x: Date | String`, `y: Boolean` +* __Tuple__ = a `(`, followed by one or more `Types` separated by a comma `,` (trailing comma `,` is permitted), followed by a `)` - eg `(Date)`, `(Number, Date)` +* __Array__ = a `[` followed by exactly one `Types` followed by a `]` - eg. `[Boolean]`, `[Boolean | Null]` + +### Guide + +`type-check` uses `Object.toString` to find out the basic type of a value. Specifically, + +```js +{}.toString.call(VALUE).slice(8, -1) +{}.toString.call(true).slice(8, -1) // 'Boolean' +``` +A basic type, eg. `Number`, uses this check. This is much more versatile than using `typeof` - for example, with `document`, `typeof` produces `'object'` which isn't that useful, and our technique produces `'HTMLDocument'`. + +You may check for multiple types by separating types with a `|`. The checker proceeds from left to right, and passes if the value is any of the types - eg. `String | Boolean` first checks if the value is a string, and then if it is a boolean. If it is none of those, then it returns false. + +Adding a `Maybe` in front of a list of multiple types is the same as also checking for `Null` and `Undefined` - eg. `Maybe String` is equivalent to `Undefined | Null | String`. + +You may add a comment to remind you of what the type is for by following an identifier with a `::` before a type (or multiple types). The comment is simply thrown out. + +The wildcard `*` matches all types. + +There are three types of structures for checking the contents of a value: 'fields', 'tuple', and 'array'. + +If used by itself, a 'fields' structure will pass with any type of object as long as it is an instance of `Object` and the properties pass - this allows for duck typing - eg. `{x: Boolean}`. + +To check if the properties pass, and the value is of a certain type, you can specify the type - eg. `Error{message: String}`. + +If you want to make a field optional, you can simply use `Maybe` - eg. `{x: Boolean, y: Maybe String}` will still pass if `y` is undefined (or null). + +If you don't care if the value has properties beyond what you have specified, you can use the 'etc' operator `...` - eg. `{x: Boolean, ...}` will match an object with an `x` property that is a boolean, and with zero or more other properties. + +For an array, you must specify one or more types (separated by `|`) - it will pass for something of any length as long as each element passes the types provided - eg. `[Number]`, `[Number | String]`. + +A tuple checks for a fixed number of elements, each of a potentially different type. Each element is separated by a comma - eg. `(String, Number)`. + +An array and tuple structure check that the value is of type `Array` by default, but if another type is specified, they will check for that instead - eg. `Int32Array[Number]`. You can use the wildcard `*` to search for any type at all. + +Check out the [type precedence](https://github.com/zaboco/type-precedence) library for type-check. + +## Options + +Options is an object. It is an optional parameter to the `typeCheck` and `parsedTypeCheck` functions. The only current option is `customTypes`. + + +### Custom Types + +__Example:__ + +```js +var options = { + customTypes: { + Even: { + typeOf: 'Number', + validate: function(x) { + return x % 2 === 0; + } + } + } +}; +typeCheck('Even', 2, options); // true +typeCheck('Even', 3, options); // false +``` + +`customTypes` allows you to set up custom types for validation. The value of this is an object. The keys of the object are the types you will be matching. Each value of the object will be an object having a `typeOf` property - a string, and `validate` property - a function. + +The `typeOf` property is the type the value should be (optional - if not set only `validate` will be used), and `validate` is a function which should return true if the value is of that type. `validate` receives one parameter, which is the value that we are checking. + +## Technical About + +`type-check` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/type-check/lib/check.js b/node_modules/type-check/lib/check.js new file mode 100644 index 0000000..f78687e --- /dev/null +++ b/node_modules/type-check/lib/check.js @@ -0,0 +1,128 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var ref$, any, all, isItNaN, types, defaultType, toString$ = {}.toString; + ref$ = require('prelude-ls'), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN; + types = { + Number: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it); + } + }, + NaN: { + typeOf: 'Number', + validate: isItNaN + }, + Int: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it) && it % 1 === 0; + } + }, + Float: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it); + } + }, + Date: { + typeOf: 'Date', + validate: function(it){ + return !isItNaN(it.getTime()); + } + } + }; + defaultType = { + array: 'Array', + tuple: 'Array' + }; + function checkArray(input, type, options){ + return all(function(it){ + return checkMultiple(it, type.of, options); + }, input); + } + function checkTuple(input, type, options){ + var i, i$, ref$, len$, types; + i = 0; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + types = ref$[i$]; + if (!checkMultiple(input[i], types, options)) { + return false; + } + i++; + } + return input.length <= i; + } + function checkFields(input, type, options){ + var inputKeys, numInputKeys, k, numOfKeys, key, ref$, types; + inputKeys = {}; + numInputKeys = 0; + for (k in input) { + inputKeys[k] = true; + numInputKeys++; + } + numOfKeys = 0; + for (key in ref$ = type.of) { + types = ref$[key]; + if (!checkMultiple(input[key], types, options)) { + return false; + } + if (inputKeys[key]) { + numOfKeys++; + } + } + return type.subset || numInputKeys === numOfKeys; + } + function checkStructure(input, type, options){ + if (!(input instanceof Object)) { + return false; + } + switch (type.structure) { + case 'fields': + return checkFields(input, type, options); + case 'array': + return checkArray(input, type, options); + case 'tuple': + return checkTuple(input, type, options); + } + } + function check(input, typeObj, options){ + var type, structure, setting, that; + type = typeObj.type, structure = typeObj.structure; + if (type) { + if (type === '*') { + return true; + } + setting = options.customTypes[type] || types[type]; + if (setting) { + return (setting.typeOf === void 8 || setting.typeOf === toString$.call(input).slice(8, -1)) && setting.validate(input); + } else { + return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj, options)); + } + } else if (structure) { + if (that = defaultType[structure]) { + if (that !== toString$.call(input).slice(8, -1)) { + return false; + } + } + return checkStructure(input, typeObj, options); + } else { + throw new Error("No type defined. Input: " + input + "."); + } + } + function checkMultiple(input, types, options){ + if (toString$.call(types).slice(8, -1) !== 'Array') { + throw new Error("Types must be in an array. Input: " + input + "."); + } + return any(function(it){ + return check(input, it, options); + }, types); + } + module.exports = function(parsedType, input, options){ + options == null && (options = {}); + if (options.customTypes == null) { + options.customTypes = {}; + } + return checkMultiple(input, parsedType, options); + }; +}).call(this); diff --git a/node_modules/type-check/lib/index.js b/node_modules/type-check/lib/index.js new file mode 100644 index 0000000..09db4cb --- /dev/null +++ b/node_modules/type-check/lib/index.js @@ -0,0 +1,16 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var VERSION, parseType, parsedTypeCheck, typeCheck; + VERSION = '0.4.0'; + parseType = require('./parse-type'); + parsedTypeCheck = require('./check'); + typeCheck = function(type, input, options){ + return parsedTypeCheck(parseType(type), input, options); + }; + module.exports = { + VERSION: VERSION, + typeCheck: typeCheck, + parsedTypeCheck: parsedTypeCheck, + parseType: parseType + }; +}).call(this); diff --git a/node_modules/type-check/lib/parse-type.js b/node_modules/type-check/lib/parse-type.js new file mode 100644 index 0000000..c360c97 --- /dev/null +++ b/node_modules/type-check/lib/parse-type.js @@ -0,0 +1,198 @@ +// Generated by LiveScript 1.6.0 +(function(){ + var identifierRegex, tokenRegex; + identifierRegex = /[\$\w]+/; + function peek(tokens){ + var token; + token = tokens[0]; + if (token == null) { + throw new Error('Unexpected end of input.'); + } + return token; + } + function consumeIdent(tokens){ + var token; + token = peek(tokens); + if (!identifierRegex.test(token)) { + throw new Error("Expected text, got '" + token + "' instead."); + } + return tokens.shift(); + } + function consumeOp(tokens, op){ + var token; + token = peek(tokens); + if (token !== op) { + throw new Error("Expected '" + op + "', got '" + token + "' instead."); + } + return tokens.shift(); + } + function maybeConsumeOp(tokens, op){ + var token; + token = tokens[0]; + if (token === op) { + return tokens.shift(); + } else { + return null; + } + } + function consumeArray(tokens){ + var types; + consumeOp(tokens, '['); + if (peek(tokens) === ']') { + throw new Error("Must specify type of Array - eg. [Type], got [] instead."); + } + types = consumeTypes(tokens); + consumeOp(tokens, ']'); + return { + structure: 'array', + of: types + }; + } + function consumeTuple(tokens){ + var components; + components = []; + consumeOp(tokens, '('); + if (peek(tokens) === ')') { + throw new Error("Tuple must be of at least length 1 - eg. (Type), got () instead."); + } + for (;;) { + components.push(consumeTypes(tokens)); + maybeConsumeOp(tokens, ','); + if (')' === peek(tokens)) { + break; + } + } + consumeOp(tokens, ')'); + return { + structure: 'tuple', + of: components + }; + } + function consumeFields(tokens){ + var fields, subset, ref$, key, types; + fields = {}; + consumeOp(tokens, '{'); + subset = false; + for (;;) { + if (maybeConsumeOp(tokens, '...')) { + subset = true; + break; + } + ref$ = consumeField(tokens), key = ref$[0], types = ref$[1]; + fields[key] = types; + maybeConsumeOp(tokens, ','); + if ('}' === peek(tokens)) { + break; + } + } + consumeOp(tokens, '}'); + return { + structure: 'fields', + of: fields, + subset: subset + }; + } + function consumeField(tokens){ + var key, types; + key = consumeIdent(tokens); + consumeOp(tokens, ':'); + types = consumeTypes(tokens); + return [key, types]; + } + function maybeConsumeStructure(tokens){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens); + case '(': + return consumeTuple(tokens); + case '{': + return consumeFields(tokens); + } + } + function consumeType(tokens){ + var token, wildcard, type, structure; + token = peek(tokens); + wildcard = token === '*'; + if (wildcard || identifierRegex.test(token)) { + type = wildcard + ? consumeOp(tokens, '*') + : consumeIdent(tokens); + structure = maybeConsumeStructure(tokens); + if (structure) { + return structure.type = type, structure; + } else { + return { + type: type + }; + } + } else { + structure = maybeConsumeStructure(tokens); + if (!structure) { + throw new Error("Unexpected character: " + token); + } + return structure; + } + } + function consumeTypes(tokens){ + var lookahead, types, typesSoFar, typeObj, type, structure; + if ('::' === peek(tokens)) { + throw new Error("No comment before comment separator '::' found."); + } + lookahead = tokens[1]; + if (lookahead != null && lookahead === '::') { + tokens.shift(); + tokens.shift(); + } + types = []; + typesSoFar = {}; + if ('Maybe' === peek(tokens)) { + tokens.shift(); + types = [ + { + type: 'Undefined' + }, { + type: 'Null' + } + ]; + typesSoFar = { + Undefined: true, + Null: true + }; + } + for (;;) { + typeObj = consumeType(tokens), type = typeObj.type, structure = typeObj.structure; + if (!typesSoFar[type]) { + types.push(typeObj); + } + if (structure == null) { + typesSoFar[type] = true; + } + if (!maybeConsumeOp(tokens, '|')) { + break; + } + } + return types; + } + tokenRegex = RegExp('\\.\\.\\.|::|->|' + identifierRegex.source + '|\\S', 'g'); + module.exports = function(input){ + var tokens, e; + if (!input.length) { + throw new Error('No type specified.'); + } + tokens = input.match(tokenRegex) || []; + if (in$('->', tokens)) { + throw new Error("Function types are not supported.\ To validate that something is a function, you may use 'Function'."); + } + try { + return consumeTypes(tokens); + } catch (e$) { + e = e$; + throw new Error(e.message + " - Remaining tokens: " + JSON.stringify(tokens) + " - Initial input: '" + input + "'"); + } + }; + function in$(x, xs){ + var i = -1, l = xs.length >>> 0; + while (++i < l) if (x === xs[i]) return true; + return false; + } +}).call(this); diff --git a/node_modules/type-check/package.json b/node_modules/type-check/package.json new file mode 100644 index 0000000..2a57ea0 --- /dev/null +++ b/node_modules/type-check/package.json @@ -0,0 +1,39 @@ +{ + "name": "type-check", + "version": "0.4.0", + "author": "George Zahariev ", + "description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.", + "homepage": "https://github.com/gkz/type-check", + "keywords": [ + "type", + "check", + "checking", + "library" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": "https://github.com/gkz/type-check/issues", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/type-check.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "devDependencies": { + "livescript": "^1.6.0", + "mocha": "^7.1.1", + "browserify": "^16.5.1" + } +} diff --git a/node_modules/type-fest/base.d.ts b/node_modules/type-fest/base.d.ts new file mode 100644 index 0000000..9005ef9 --- /dev/null +++ b/node_modules/type-fest/base.d.ts @@ -0,0 +1,38 @@ +// Types that are compatible with all supported TypeScript versions. +// It's shared between all TypeScript version-specific definitions. + +// Basic +export * from './source/basic'; + +// Utilities +export {Except} from './source/except'; +export {Mutable} from './source/mutable'; +export {Merge} from './source/merge'; +export {MergeExclusive} from './source/merge-exclusive'; +export {RequireAtLeastOne} from './source/require-at-least-one'; +export {RequireExactlyOne} from './source/require-exactly-one'; +export {PartialDeep} from './source/partial-deep'; +export {ReadonlyDeep} from './source/readonly-deep'; +export {LiteralUnion} from './source/literal-union'; +export {Promisable} from './source/promisable'; +export {Opaque} from './source/opaque'; +export {SetOptional} from './source/set-optional'; +export {SetRequired} from './source/set-required'; +export {ValueOf} from './source/value-of'; +export {PromiseValue} from './source/promise-value'; +export {AsyncReturnType} from './source/async-return-type'; +export {ConditionalExcept} from './source/conditional-except'; +export {ConditionalKeys} from './source/conditional-keys'; +export {ConditionalPick} from './source/conditional-pick'; +export {UnionToIntersection} from './source/union-to-intersection'; +export {Stringified} from './source/stringified'; +export {FixedLengthArray} from './source/fixed-length-array'; +export {IterableElement} from './source/iterable-element'; +export {Entry} from './source/entry'; +export {Entries} from './source/entries'; +export {SetReturnType} from './source/set-return-type'; +export {Asyncify} from './source/asyncify'; + +// Miscellaneous +export {PackageJson} from './source/package-json'; +export {TsConfigJson} from './source/tsconfig-json'; diff --git a/node_modules/type-fest/index.d.ts b/node_modules/type-fest/index.d.ts new file mode 100644 index 0000000..206261c --- /dev/null +++ b/node_modules/type-fest/index.d.ts @@ -0,0 +1,2 @@ +// These are all the basic types that's compatible with all supported TypeScript versions. +export * from './base'; diff --git a/node_modules/type-fest/license b/node_modules/type-fest/license new file mode 100644 index 0000000..3e4c85a --- /dev/null +++ b/node_modules/type-fest/license @@ -0,0 +1,9 @@ +MIT License + +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: + +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/type-fest/package.json b/node_modules/type-fest/package.json new file mode 100644 index 0000000..3ab9e4d --- /dev/null +++ b/node_modules/type-fest/package.json @@ -0,0 +1,58 @@ +{ + "name": "type-fest", + "version": "0.20.2", + "description": "A collection of essential TypeScript types", + "license": "(MIT OR CC0-1.0)", + "repository": "sindresorhus/type-fest", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "//test": "xo && tsd && tsc", + "test": "xo && tsc" + }, + "files": [ + "index.d.ts", + "base.d.ts", + "source", + "ts41" + ], + "keywords": [ + "typescript", + "ts", + "types", + "utility", + "util", + "utilities", + "omit", + "merge", + "json" + ], + "devDependencies": { + "@sindresorhus/tsconfig": "~0.7.0", + "tsd": "^0.13.1", + "typescript": "^4.1.2", + "xo": "^0.35.0" + }, + "types": "./index.d.ts", + "typesVersions": { + ">=4.1": { + "*": [ + "ts41/*" + ] + } + }, + "xo": { + "rules": { + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/indent": "off", + "node/no-unsupported-features/es-builtins": "off" + } + } +} diff --git a/node_modules/type-fest/readme.md b/node_modules/type-fest/readme.md new file mode 100644 index 0000000..714df78 --- /dev/null +++ b/node_modules/type-fest/readme.md @@ -0,0 +1,658 @@ +
+
+
+ type-fest +
+
+ A collection of essential TypeScript types +
+
+
+
+
+ +[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i) + + +Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 + +PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first. + +## Install + +``` +$ npm install type-fest +``` + +*Requires TypeScript >=3.4* + +## Usage + +```ts +import {Except} from 'type-fest'; + +type Foo = { + unicorn: string; + rainbow: boolean; +}; + +type FooWithoutRainbow = Except; +//=> {unicorn: string} +``` + +## API + +Click the type names for complete docs. + +### Basic + +- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +- [`JsonObject`](source/basic.d.ts) - Matches a JSON object. +- [`JsonArray`](source/basic.d.ts) - Matches a JSON array. +- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value. +- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). + +### Utilities + +- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). +- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly`. +- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. +- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys. +- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys. +- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more. +- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep. +- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep. +- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). +- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. +- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/). +- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional. +- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required. +- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from. +- [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`. +- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`. +- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type. +- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type. +- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type. +- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type. +- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type. +- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length. +- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator. +- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection. +- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection. +- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type. +- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type. + +### Template literal types + +*Note:* These require [TypeScript 4.1 or newer](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types). + +- [`CamelCase`](ts41/camel-case.d.ts) – Convert a string literal to camel-case (`fooBar`). +- [`KebabCase`](ts41/kebab-case.d.ts) – Convert a string literal to kebab-case (`foo-bar`). +- [`PascalCase`](ts41/pascal-case.d.ts) – Converts a string literal to pascal-case (`FooBar`) +- [`SnakeCase`](ts41/snake-case.d.ts) – Convert a string literal to snake-case (`foo_bar`). +- [`DelimiterCase`](ts41/delimiter-case.d.ts) – Convert a string literal to a custom string delimiter casing. + +### Miscellaneous + +- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). +- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7). + +## Declined types + +*If we decline a type addition, we will make sure to document the better solution here.* + +- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider. +- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary` vs `Record`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now. +- [`SubType`](https://github.com/sindresorhus/type-fest/issues/22) - The type is powerful, but lacks good use-cases and is prone to misuse. +- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies. + +## Tips + +### Built-in types + +There are many advanced types most users don't know about. + +- [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional. +
+ + Example + + + [Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA) + + ```ts + interface NodeConfig { + appName: string; + port: number; + } + + class NodeAppBuilder { + private configuration: NodeConfig = { + appName: 'NodeApp', + port: 3000 + }; + + private updateConfig(key: Key, value: NodeConfig[Key]) { + this.configuration[key] = value; + } + + config(config: Partial) { + type NodeConfigKey = keyof NodeConfig; + + for (const key of Object.keys(config) as NodeConfigKey[]) { + const updateValue = config[key]; + + if (updateValue === undefined) { + continue; + } + + this.updateConfig(key, updateValue); + } + + return this; + } + } + + // `Partial`` allows us to provide only a part of the + // NodeConfig interface. + new NodeAppBuilder().config({appName: 'ToDoApp'}); + ``` +
+ +- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA) + + ```ts + interface ContactForm { + email?: string; + message?: string; + } + + function submitContactForm(formData: Required) { + // Send the form data to the server. + } + + submitContactForm({ + email: 'ex@mple.com', + message: 'Hi! Could you tell me more about…', + }); + + // TypeScript error: missing property 'message' + submitContactForm({ + email: 'ex@mple.com', + }); + ``` +
+ +- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA) + + ```ts + enum LogLevel { + Off, + Debug, + Error, + Fatal + }; + + interface LoggerConfig { + name: string; + level: LogLevel; + } + + class Logger { + config: Readonly; + + constructor({name, level}: LoggerConfig) { + this.config = {name, level}; + Object.freeze(this.config); + } + } + + const config: LoggerConfig = { + name: 'MyApp', + level: LogLevel.Debug + }; + + const logger = new Logger(config); + + // TypeScript Error: cannot assign to read-only property. + logger.config.level = LogLevel.Error; + + // We are able to edit config variable as we please. + config.level = LogLevel.Error; + ``` +
+ +- [`Pick`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA) + + ```ts + interface Article { + title: string; + thumbnail: string; + content: string; + } + + // Creates new type out of the `Article` interface composed + // from the Articles' two properties: `title` and `thumbnail`. + // `ArticlePreview = {title: string; thumbnail: string}` + type ArticlePreview = Pick; + + // Render a list of articles using only title and description. + function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement { + const articles = document.createElement('div'); + + for (const preview of previews) { + // Append preview to the articles. + } + + return articles; + } + + const articles = renderArticlePreviews([ + { + title: 'TypeScript tutorial!', + thumbnail: '/assets/ts.jpg' + } + ]); + ``` +
+ +- [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA) + + ```ts + // Positions of employees in our company. + type MemberPosition = 'intern' | 'developer' | 'tech-lead'; + + // Interface describing properties of a single employee. + interface Employee { + firstName: string; + lastName: string; + yearsOfExperience: number; + } + + // Create an object that has all possible `MemberPosition` values set as keys. + // Those keys will store a collection of Employees of the same position. + const team: Record = { + intern: [], + developer: [], + 'tech-lead': [], + }; + + // Our team has decided to help John with his dream of becoming Software Developer. + team.intern.push({ + firstName: 'John', + lastName: 'Doe', + yearsOfExperience: 0 + }); + + // `Record` forces you to initialize all of the property keys. + // TypeScript Error: "tech-lead" property is missing + const teamEmpty: Record = { + intern: null, + developer: null, + }; + ``` +
+ +- [`Exclude`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA) + + ```ts + interface ServerConfig { + port: null | string | number; + } + + type RequestHandler = (request: Request, response: Response) => void; + + // Exclude `null` type from `null | string | number`. + // In case the port is equal to `null`, we will use default value. + function getPortValue(port: Exclude): number { + if (typeof port === 'string') { + return parseInt(port, 10); + } + + return port; + } + + function startServer(handler: RequestHandler, config: ServerConfig): void { + const server = require('http').createServer(handler); + + const port = config.port === null ? 3000 : getPortValue(config.port); + server.listen(port); + } + ``` +
+ +- [`Extract`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA) + + ```ts + declare function uniqueId(): number; + + const ID = Symbol('ID'); + + interface Person { + [ID]: number; + name: string; + age: number; + } + + // Allows changing the person data as long as the property key is of string type. + function changePersonData< + Obj extends Person, + Key extends Extract, + Value extends Obj[Key] + > (obj: Obj, key: Key, value: Value): void { + obj[key] = value; + } + + // Tiny Andrew was born. + const andrew = { + [ID]: uniqueId(), + name: 'Andrew', + age: 0, + }; + + // Cool, we're fine with that. + changePersonData(andrew, 'name', 'Pony'); + + // Goverment didn't like the fact that you wanted to change your identity. + changePersonData(andrew, ID, uniqueId()); + ``` +
+ +- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. +
+ + Example + + Works with strictNullChecks set to true. (Read more here) + + [Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA) + + ```ts + type PortNumber = string | number | null; + + /** Part of a class definition that is used to build a server */ + class ServerBuilder { + portNumber!: NonNullable; + + port(this: ServerBuilder, port: PortNumber): ServerBuilder { + if (port == null) { + this.portNumber = 8000; + } else { + this.portNumber = port; + } + + return this; + } + } + + const serverBuilder = new ServerBuilder(); + + serverBuilder + .port('8000') // portNumber = '8000' + .port(null) // portNumber = 8000 + .port(3000); // portNumber = 3000 + + // TypeScript error + serverBuilder.portNumber = null; + ``` +
+ +- [`Parameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA) + + ```ts + function shuffle(input: any[]): void { + // Mutate array randomly changing its' elements indexes. + } + + function callNTimes any> (func: Fn, callCount: number) { + // Type that represents the type of the received function parameters. + type FunctionParameters = Parameters; + + return function (...args: FunctionParameters) { + for (let i = 0; i < callCount; i++) { + func(...args); + } + } + } + + const shuffleTwice = callNTimes(shuffle, 2); + ``` +
+ +- [`ConstructorParameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA) + + ```ts + class ArticleModel { + title: string; + content?: string; + + constructor(title: string) { + this.title = title; + } + } + + class InstanceCache any)> { + private ClassConstructor: T; + private cache: Map> = new Map(); + + constructor (ctr: T) { + this.ClassConstructor = ctr; + } + + getInstance (...args: ConstructorParameters): InstanceType { + const hash = this.calculateArgumentsHash(...args); + + const existingInstance = this.cache.get(hash); + if (existingInstance !== undefined) { + return existingInstance; + } + + return new this.ClassConstructor(...args); + } + + private calculateArgumentsHash(...args: any[]): string { + // Calculate hash. + return 'hash'; + } + } + + const articleCache = new InstanceCache(ArticleModel); + const amazonArticle = articleCache.getInstance('Amazon forests burining!'); + ``` +
+ +- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + /** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */ + function mapIter< + Elem, + Func extends (elem: Elem) => any, + Ret extends ReturnType + >(iter: Iterable, callback: Func): Ret[] { + const mapped: Ret[] = []; + + for (const elem of iter) { + mapped.push(callback(elem)); + } + + return mapped; + } + + const setObject: Set = new Set(); + const mapObject: Map = new Map(); + + mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[] + + mapIter(mapObject, ([key, value]: [number, string]) => { + return key % 2 === 0 ? value : 'Odd'; + }); // string[] + ``` +
+ +- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + class IdleService { + doNothing (): void {} + } + + class News { + title: string; + content: string; + + constructor(title: string, content: string) { + this.title = title; + this.content = content; + } + } + + const instanceCounter: Map = new Map(); + + interface Constructor { + new(...args: any[]): any; + } + + // Keep track how many instances of `Constr` constructor have been created. + function getInstance< + Constr extends Constructor, + Args extends ConstructorParameters + >(constructor: Constr, ...args: Args): InstanceType { + let count = instanceCounter.get(constructor) || 0; + + const instance = new constructor(...args); + + instanceCounter.set(constructor, count + 1); + + console.log(`Created ${count + 1} instances of ${Constr.name} class`); + + return instance; + } + + + const idleService = getInstance(IdleService); + // Will log: `Created 1 instances of IdleService class` + const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...'); + // Will log: `Created 1 instances of News class` + ``` +
+ +- [`Omit`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA) + + ```ts + interface Animal { + imageUrl: string; + species: string; + images: string[]; + paragraphs: string[]; + } + + // Creates new type with all properties of the `Animal` interface + // except 'images' and 'paragraphs' properties. We can use this + // type to render small hover tooltip for a wiki entry list. + type AnimalShortInfo = Omit; + + function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement { + const container = document.createElement('div'); + // Internal implementation. + return container; + } + ``` +
+ +You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types). + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Jarek Radosz](https://github.com/CvX) +- [Dimitri Benin](https://github.com/BendingBender) +- [Pelle Wessman](https://github.com/voxpelli) + +## License + +(MIT OR CC0-1.0) + +--- + +
+ + 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/type-fest/source/async-return-type.d.ts b/node_modules/type-fest/source/async-return-type.d.ts new file mode 100644 index 0000000..79ec1e9 --- /dev/null +++ b/node_modules/type-fest/source/async-return-type.d.ts @@ -0,0 +1,23 @@ +import {PromiseValue} from './promise-value'; + +type AsyncFunction = (...args: any[]) => Promise; + +/** +Unwrap the return type of a function that returns a `Promise`. + +There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript. + +@example +```ts +import {AsyncReturnType} from 'type-fest'; +import {asyncFunction} from 'api'; + +// This type resolves to the unwrapped return type of `asyncFunction`. +type Value = AsyncReturnType; + +async function doSomething(value: Value) {} + +asyncFunction().then(value => doSomething(value)); +``` +*/ +export type AsyncReturnType = PromiseValue>; diff --git a/node_modules/type-fest/source/asyncify.d.ts b/node_modules/type-fest/source/asyncify.d.ts new file mode 100644 index 0000000..455f2eb --- /dev/null +++ b/node_modules/type-fest/source/asyncify.d.ts @@ -0,0 +1,31 @@ +import {PromiseValue} from './promise-value'; +import {SetReturnType} from './set-return-type'; + +/** +Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types. + +Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type. + +@example +``` +import {Asyncify} from 'type-fest'; + +// Synchronous function. +function getFooSync(someArg: SomeType): Foo { + // … +} + +type AsyncifiedFooGetter = Asyncify; +//=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise; + +// Same as `getFooSync` but asynchronous. +const getFooAsync: AsyncifiedFooGetter = (someArg) => { + // TypeScript now knows that `someArg` is `SomeType` automatically. + // It also knows that this function must return `Promise`. + // If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.". + + // … +} +``` +*/ +export type Asyncify any> = SetReturnType>>>; diff --git a/node_modules/type-fest/source/basic.d.ts b/node_modules/type-fest/source/basic.d.ts new file mode 100644 index 0000000..d380c8b --- /dev/null +++ b/node_modules/type-fest/source/basic.d.ts @@ -0,0 +1,67 @@ +/// + +// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out. +/** +Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +*/ +export type Primitive = + | null + | undefined + | string + | number + | boolean + | symbol + | bigint; + +// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default +/** +Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +*/ +export type Class = new(...arguments_: Arguments) => T; + +/** +Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +*/ +export type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array; + +/** +Matches a JSON object. + +This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. +*/ +export type JsonObject = {[Key in string]?: JsonValue}; + +/** +Matches a JSON array. +*/ +export interface JsonArray extends Array {} + +/** +Matches any valid JSON value. +*/ +export type JsonValue = string | number | boolean | null | JsonObject | JsonArray; + +declare global { + interface SymbolConstructor { + readonly observable: symbol; + } +} + +/** +Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). +*/ +export interface ObservableLike { + subscribe(observer: (value: unknown) => void): void; + [Symbol.observable](): ObservableLike; +} diff --git a/node_modules/type-fest/source/conditional-except.d.ts b/node_modules/type-fest/source/conditional-except.d.ts new file mode 100644 index 0000000..ac506cc --- /dev/null +++ b/node_modules/type-fest/source/conditional-except.d.ts @@ -0,0 +1,43 @@ +import {Except} from './except'; +import {ConditionalKeys} from './conditional-keys'; + +/** +Exclude keys from a shape that matches the given `Condition`. + +This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. + +@example +``` +import {Primitive, ConditionalExcept} from 'type-fest'; + +class Awesome { + name: string; + successes: number; + failures: bigint; + + run() {} +} + +type ExceptPrimitivesFromAwesome = ConditionalExcept; +//=> {run: () => void} +``` + +@example +``` +import {ConditionalExcept} from 'type-fest'; + +interface Example { + a: string; + b: string | number; + c: () => void; + d: {}; +} + +type NonStringKeysOnly = ConditionalExcept; +//=> {b: string | number; c: () => void; d: {}} +``` +*/ +export type ConditionalExcept = Except< + Base, + ConditionalKeys +>; diff --git a/node_modules/type-fest/source/conditional-keys.d.ts b/node_modules/type-fest/source/conditional-keys.d.ts new file mode 100644 index 0000000..eb074dc --- /dev/null +++ b/node_modules/type-fest/source/conditional-keys.d.ts @@ -0,0 +1,43 @@ +/** +Extract the keys from a type where the value type of the key extends the given `Condition`. + +Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. + +@example +``` +import {ConditionalKeys} from 'type-fest'; + +interface Example { + a: string; + b: string | number; + c?: string; + d: {}; +} + +type StringKeysOnly = ConditionalKeys; +//=> 'a' +``` + +To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. + +@example +``` +type StringKeysAndUndefined = ConditionalKeys; +//=> 'a' | 'c' +``` +*/ +export type ConditionalKeys = NonNullable< + // Wrap in `NonNullable` to strip away the `undefined` type from the produced union. + { + // Map through all the keys of the given base type. + [Key in keyof Base]: + // Pick only keys with types extending the given `Condition` type. + Base[Key] extends Condition + // Retain this key since the condition passes. + ? Key + // Discard this key since the condition fails. + : never; + + // Convert the produced object into a union type of the keys which passed the conditional test. + }[keyof Base] +>; diff --git a/node_modules/type-fest/source/conditional-pick.d.ts b/node_modules/type-fest/source/conditional-pick.d.ts new file mode 100644 index 0000000..cecc3df --- /dev/null +++ b/node_modules/type-fest/source/conditional-pick.d.ts @@ -0,0 +1,42 @@ +import {ConditionalKeys} from './conditional-keys'; + +/** +Pick keys from the shape that matches the given `Condition`. + +This is useful when you want to create a new type from a specific subset of an existing type. For example, you might want to pick all the primitive properties from a class and form a new automatically derived type. + +@example +``` +import {Primitive, ConditionalPick} from 'type-fest'; + +class Awesome { + name: string; + successes: number; + failures: bigint; + + run() {} +} + +type PickPrimitivesFromAwesome = ConditionalPick; +//=> {name: string; successes: number; failures: bigint} +``` + +@example +``` +import {ConditionalPick} from 'type-fest'; + +interface Example { + a: string; + b: string | number; + c: () => void; + d: {}; +} + +type StringKeysOnly = ConditionalPick; +//=> {a: string} +``` +*/ +export type ConditionalPick = Pick< + Base, + ConditionalKeys +>; diff --git a/node_modules/type-fest/source/entries.d.ts b/node_modules/type-fest/source/entries.d.ts new file mode 100644 index 0000000..e02237a --- /dev/null +++ b/node_modules/type-fest/source/entries.d.ts @@ -0,0 +1,57 @@ +import {ArrayEntry, MapEntry, ObjectEntry, SetEntry} from './entry'; + +type ArrayEntries = Array>; +type MapEntries = Array>; +type ObjectEntries = Array>; +type SetEntries> = Array>; + +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entries` type will return the type of that collection's entries. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entry` if you want to just access the type of a single entry. + +@example +``` +import {Entries} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntries = (examples: Entries) => examples.map(example => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed() +]); + +const example: Example = {someKey: 1}; +const entries = Object.entries(example) as Entries; +const output = manipulatesEntries(entries); + +// Objects +const objectExample = {a: 1}; +const objectEntries: Entries = [['a', 1]]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntries: Entries = [[0, 'a'], [1, 1]]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntries: Entries = [['a', 1]]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntries: Entries = [['a', 'a'], [1, 1]]; +``` +*/ +export type Entries = + BaseType extends Map ? MapEntries + : BaseType extends Set ? SetEntries + : BaseType extends unknown[] ? ArrayEntries + : BaseType extends object ? ObjectEntries + : never; diff --git a/node_modules/type-fest/source/entry.d.ts b/node_modules/type-fest/source/entry.d.ts new file mode 100644 index 0000000..41a13a9 --- /dev/null +++ b/node_modules/type-fest/source/entry.d.ts @@ -0,0 +1,60 @@ +type MapKey = BaseType extends Map ? KeyType : never; +type MapValue = BaseType extends Map ? ValueType : never; + +export type ArrayEntry = [number, BaseType[number]]; +export type MapEntry = [MapKey, MapValue]; +export type ObjectEntry = [keyof BaseType, BaseType[keyof BaseType]]; +export type SetEntry = BaseType extends Set ? [ItemType, ItemType] : never; + +/** +Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry. + +For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable. + +@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method). + +@example +``` +import {Entry} from 'type-fest'; + +interface Example { + someKey: number; +} + +const manipulatesEntry = (example: Entry) => [ + // Does some arbitrary processing on the key (with type information available) + example[0].toUpperCase(), + + // Does some arbitrary processing on the value (with type information available) + example[1].toFixed(), +]; + +const example: Example = {someKey: 1}; +const entry = Object.entries(example)[0] as Entry; +const output = manipulatesEntry(entry); + +// Objects +const objectExample = {a: 1}; +const objectEntry: Entry = ['a', 1]; + +// Arrays +const arrayExample = ['a', 1]; +const arrayEntryString: Entry = [0, 'a']; +const arrayEntryNumber: Entry = [1, 1]; + +// Maps +const mapExample = new Map([['a', 1]]); +const mapEntry: Entry = ['a', 1]; + +// Sets +const setExample = new Set(['a', 1]); +const setEntryString: Entry = ['a', 'a']; +const setEntryNumber: Entry = [1, 1]; +``` +*/ +export type Entry = + BaseType extends Map ? MapEntry + : BaseType extends Set ? SetEntry + : BaseType extends unknown[] ? ArrayEntry + : BaseType extends object ? ObjectEntry + : never; diff --git a/node_modules/type-fest/source/except.d.ts b/node_modules/type-fest/source/except.d.ts new file mode 100644 index 0000000..7dedbaa --- /dev/null +++ b/node_modules/type-fest/source/except.d.ts @@ -0,0 +1,22 @@ +/** +Create a type from an object type without certain keys. + +This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript. + +@example +``` +import {Except} from 'type-fest'; + +type Foo = { + a: number; + b: string; + c: boolean; +}; + +type FooWithoutA = Except; +//=> {b: string}; +``` +*/ +export type Except = Pick>; diff --git a/node_modules/type-fest/source/fixed-length-array.d.ts b/node_modules/type-fest/source/fixed-length-array.d.ts new file mode 100644 index 0000000..e3bc0f4 --- /dev/null +++ b/node_modules/type-fest/source/fixed-length-array.d.ts @@ -0,0 +1,38 @@ +/** +Methods to exclude. +*/ +type ArrayLengthMutationKeys = 'splice' | 'push' | 'pop' | 'shift' | 'unshift'; + +/** +Create a type that represents an array of the given type and length. The array's length and the `Array` prototype methods that manipulate its length are excluded in the resulting type. + +Please participate in [this issue](https://github.com/microsoft/TypeScript/issues/26223) if you want to have a similiar type built into TypeScript. + +Use-cases: +- Declaring fixed-length tuples or arrays with a large number of items. +- Creating a range union (for example, `0 | 1 | 2 | 3 | 4` from the keys of such a type) without having to resort to recursive types. +- Creating an array of coordinates with a static length, for example, length of 3 for a 3D vector. + +@example +``` +import {FixedLengthArray} from 'type-fest'; + +type FencingTeam = FixedLengthArray; + +const guestFencingTeam: FencingTeam = ['Josh', 'Michael', 'Robert']; + +const homeFencingTeam: FencingTeam = ['George', 'John']; +//=> error TS2322: Type string[] is not assignable to type 'FencingTeam' + +guestFencingTeam.push('Sam'); +//=> error TS2339: Property 'push' does not exist on type 'FencingTeam' +``` +*/ +export type FixedLengthArray = Pick< + ArrayPrototype, + Exclude +> & { + [index: number]: Element; + [Symbol.iterator]: () => IterableIterator; + readonly length: Length; +}; diff --git a/node_modules/type-fest/source/iterable-element.d.ts b/node_modules/type-fest/source/iterable-element.d.ts new file mode 100644 index 0000000..174cfbf --- /dev/null +++ b/node_modules/type-fest/source/iterable-element.d.ts @@ -0,0 +1,46 @@ +/** +Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator. + +This can be useful, for example, if you want to get the type that is yielded in a generator function. Often the return type of those functions are not specified. + +This type works with both `Iterable`s and `AsyncIterable`s, so it can be use with synchronous and asynchronous generators. + +Here is an example of `IterableElement` in action with a generator function: + +@example +``` +function * iAmGenerator() { + yield 1; + yield 2; +} + +type MeNumber = IterableElement> +``` + +And here is an example with an async generator: + +@example +``` +async function * iAmGeneratorAsync() { + yield 'hi'; + yield true; +} + +type MeStringOrBoolean = IterableElement> +``` + +Many types in JavaScript/TypeScript are iterables. This type works on all types that implement those interfaces. For example, `Array`, `Set`, `Map`, `stream.Readable`, etc. + +An example with an array of strings: + +@example +``` +type MeString = IterableElement +``` +*/ +export type IterableElement = + TargetIterable extends Iterable ? + ElementType : + TargetIterable extends AsyncIterable ? + ElementType : + never; diff --git a/node_modules/type-fest/source/literal-union.d.ts b/node_modules/type-fest/source/literal-union.d.ts new file mode 100644 index 0000000..8debd93 --- /dev/null +++ b/node_modules/type-fest/source/literal-union.d.ts @@ -0,0 +1,33 @@ +import {Primitive} from './basic'; + +/** +Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. + +Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals. + +This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore. + +@example +``` +import {LiteralUnion} from 'type-fest'; + +// Before + +type Pet = 'dog' | 'cat' | string; + +const pet: Pet = ''; +// Start typing in your TypeScript-enabled IDE. +// You **will not** get auto-completion for `dog` and `cat` literals. + +// After + +type Pet2 = LiteralUnion<'dog' | 'cat', string>; + +const pet: Pet2 = ''; +// You **will** get auto-completion for `dog` and `cat` literals. +``` + */ +export type LiteralUnion< + LiteralType, + BaseType extends Primitive +> = LiteralType | (BaseType & {_?: never}); diff --git a/node_modules/type-fest/source/merge-exclusive.d.ts b/node_modules/type-fest/source/merge-exclusive.d.ts new file mode 100644 index 0000000..059bd2c --- /dev/null +++ b/node_modules/type-fest/source/merge-exclusive.d.ts @@ -0,0 +1,39 @@ +// Helper type. Not useful on its own. +type Without = {[KeyType in Exclude]?: never}; + +/** +Create a type that has mutually exclusive keys. + +This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604). + +This type works with a helper type, called `Without`. `Without` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`. + +@example +``` +import {MergeExclusive} from 'type-fest'; + +interface ExclusiveVariation1 { + exclusive1: boolean; +} + +interface ExclusiveVariation2 { + exclusive2: string; +} + +type ExclusiveOptions = MergeExclusive; + +let exclusiveOptions: ExclusiveOptions; + +exclusiveOptions = {exclusive1: true}; +//=> Works +exclusiveOptions = {exclusive2: 'hi'}; +//=> Works +exclusiveOptions = {exclusive1: true, exclusive2: 'hi'}; +//=> Error +``` +*/ +export type MergeExclusive = + (FirstType | SecondType) extends object ? + (Without & SecondType) | (Without & FirstType) : + FirstType | SecondType; + diff --git a/node_modules/type-fest/source/merge.d.ts b/node_modules/type-fest/source/merge.d.ts new file mode 100644 index 0000000..4b3920b --- /dev/null +++ b/node_modules/type-fest/source/merge.d.ts @@ -0,0 +1,22 @@ +import {Except} from './except'; + +/** +Merge two types into a new type. Keys of the second type overrides keys of the first type. + +@example +``` +import {Merge} from 'type-fest'; + +type Foo = { + a: number; + b: string; +}; + +type Bar = { + b: number; +}; + +const ab: Merge = {a: 1, b: 2}; +``` +*/ +export type Merge = Except> & SecondType; diff --git a/node_modules/type-fest/source/mutable.d.ts b/node_modules/type-fest/source/mutable.d.ts new file mode 100644 index 0000000..03d0dda --- /dev/null +++ b/node_modules/type-fest/source/mutable.d.ts @@ -0,0 +1,22 @@ +/** +Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly`. + +This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509). + +@example +``` +import {Mutable} from 'type-fest'; + +type Foo = { + readonly a: number; + readonly b: string; +}; + +const mutableFoo: Mutable = {a: 1, b: '2'}; +mutableFoo.a = 3; +``` +*/ +export type Mutable = { + // For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key. + -readonly [KeyType in keyof ObjectType]: ObjectType[KeyType]; +}; diff --git a/node_modules/type-fest/source/opaque.d.ts b/node_modules/type-fest/source/opaque.d.ts new file mode 100644 index 0000000..20ab964 --- /dev/null +++ b/node_modules/type-fest/source/opaque.d.ts @@ -0,0 +1,65 @@ +/** +Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly. + +The generic type parameter can be anything. It doesn't have to be an object. + +[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/) + +There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward: + - [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408) + - [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807) + +@example +``` +import {Opaque} from 'type-fest'; + +type AccountNumber = Opaque; +type AccountBalance = Opaque; + +// The Token parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures: +type ThingOne = Opaque; +type ThingTwo = Opaque; + +// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`. +// To avoid this behaviour, you would instead pass the "Token" parameter, like so. +type NewThingOne = Opaque; +type NewThingTwo = Opaque; + +// Now they're completely separate types, so the following will fail to compile. +function createNewThingOne (): NewThingOne { + // As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa. + return 'new thing one' as NewThingOne; +} + +// This will fail to compile, as they are fundamentally different types. +const thingTwo = createNewThingOne() as NewThingTwo; + +// Here's another example of opaque typing. +function createAccountNumber(): AccountNumber { + return 2 as AccountNumber; +} + +function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance { + return 4 as AccountBalance; +} + +// This will compile successfully. +getMoneyForAccount(createAccountNumber()); + +// But this won't, because it has to be explicitly passed as an `AccountNumber` type. +getMoneyForAccount(2); + +// You can use opaque values like they aren't opaque too. +const accountNumber = createAccountNumber(); + +// This will not compile successfully. +const newAccountNumber = accountNumber + 2; + +// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type. +type Person = { + id: Opaque; + name: string; +}; +``` +*/ +export type Opaque = Type & {readonly __opaque__: Token}; diff --git a/node_modules/type-fest/source/package-json.d.ts b/node_modules/type-fest/source/package-json.d.ts new file mode 100644 index 0000000..cf355d0 --- /dev/null +++ b/node_modules/type-fest/source/package-json.d.ts @@ -0,0 +1,611 @@ +import {LiteralUnion} from './literal-union'; + +declare namespace PackageJson { + /** + A person who has been involved in creating or maintaining the package. + */ + export type Person = + | string + | { + name: string; + url?: string; + email?: string; + }; + + export type BugsLocation = + | string + | { + /** + The URL to the package's issue tracker. + */ + url?: string; + + /** + The email address to which issues should be reported. + */ + email?: string; + }; + + export interface DirectoryLocations { + [directoryType: string]: unknown; + + /** + Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder. + */ + bin?: string; + + /** + Location for Markdown files. + */ + doc?: string; + + /** + Location for example scripts. + */ + example?: string; + + /** + Location for the bulk of the library. + */ + lib?: string; + + /** + Location for man pages. Sugar to generate a `man` array by walking the folder. + */ + man?: string; + + /** + Location for test files. + */ + test?: string; + } + + export type Scripts = { + /** + Run **before** the package is published (Also run on local `npm install` without any arguments). + */ + prepublish?: string; + + /** + Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`. + */ + prepare?: string; + + /** + Run **before** the package is prepared and packed, **only** on `npm publish`. + */ + prepublishOnly?: string; + + /** + Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies). + */ + prepack?: string; + + /** + Run **after** the tarball has been generated and moved to its final destination. + */ + postpack?: string; + + /** + Run **after** the package is published. + */ + publish?: string; + + /** + Run **after** the package is published. + */ + postpublish?: string; + + /** + Run **before** the package is installed. + */ + preinstall?: string; + + /** + Run **after** the package is installed. + */ + install?: string; + + /** + Run **after** the package is installed and after `install`. + */ + postinstall?: string; + + /** + Run **before** the package is uninstalled and before `uninstall`. + */ + preuninstall?: string; + + /** + Run **before** the package is uninstalled. + */ + uninstall?: string; + + /** + Run **after** the package is uninstalled. + */ + postuninstall?: string; + + /** + Run **before** bump the package version and before `version`. + */ + preversion?: string; + + /** + Run **before** bump the package version. + */ + version?: string; + + /** + Run **after** bump the package version. + */ + postversion?: string; + + /** + Run with the `npm test` command, before `test`. + */ + pretest?: string; + + /** + Run with the `npm test` command. + */ + test?: string; + + /** + Run with the `npm test` command, after `test`. + */ + posttest?: string; + + /** + Run with the `npm stop` command, before `stop`. + */ + prestop?: string; + + /** + Run with the `npm stop` command. + */ + stop?: string; + + /** + Run with the `npm stop` command, after `stop`. + */ + poststop?: string; + + /** + Run with the `npm start` command, before `start`. + */ + prestart?: string; + + /** + Run with the `npm start` command. + */ + start?: string; + + /** + Run with the `npm start` command, after `start`. + */ + poststart?: string; + + /** + Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + prerestart?: string; + + /** + Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + restart?: string; + + /** + Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided. + */ + postrestart?: string; + } & Record; + + /** + Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL. + */ + export type Dependency = Record; + + /** + Conditions which provide a way to resolve a package entry point based on the environment. + */ + export type ExportCondition = LiteralUnion< + | 'import' + | 'require' + | 'node' + | 'deno' + | 'browser' + | 'electron' + | 'react-native' + | 'default', + string + >; + + /** + Entry points of a module, optionally with conditions and subpath exports. + */ + export type Exports = + | string + | {[key in ExportCondition]: Exports} + | {[key: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style + + export interface NonStandardEntryPoints { + /** + An ECMAScript module ID that is the primary entry point to the program. + */ + module?: string; + + /** + A module ID with untranspiled code that is the primary entry point to the program. + */ + esnext?: + | string + | { + [moduleName: string]: string | undefined; + main?: string; + browser?: string; + }; + + /** + A hint to JavaScript bundlers or component tools when packaging modules for client side use. + */ + browser?: + | string + | Record; + + /** + Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused. + + [Read more.](https://webpack.js.org/guides/tree-shaking/) + */ + sideEffects?: boolean | string[]; + } + + export interface TypeScriptConfiguration { + /** + Location of the bundled TypeScript declaration file. + */ + types?: string; + + /** + Location of the bundled TypeScript declaration file. Alias of `types`. + */ + typings?: string; + } + + /** + An alternative configuration for Yarn workspaces. + */ + export interface WorkspaceConfig { + /** + An array of workspace pattern strings which contain the workspace packages. + */ + packages?: WorkspacePattern[]; + + /** + Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns. + + [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) + */ + nohoist?: WorkspacePattern[]; + } + + /** + A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process. + + The patterns are handled with [minimatch](https://github.com/isaacs/minimatch). + + @example + `docs` → Include the docs directory and install its dependencies. + `packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`. + */ + type WorkspacePattern = string; + + export interface YarnConfiguration { + /** + Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/). + + Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass. + + Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces. + */ + workspaces?: WorkspacePattern[] | WorkspaceConfig; + + /** + If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`. + + Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line. + */ + flat?: boolean; + + /** + Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file. + */ + resolutions?: Dependency; + } + + export interface JSPMConfiguration { + /** + JSPM configuration. + */ + jspm?: PackageJson; + } + + /** + Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties. + */ + export interface PackageJsonStandard { + /** + The name of the package. + */ + name?: string; + + /** + Package version, parseable by [`node-semver`](https://github.com/npm/node-semver). + */ + version?: string; + + /** + Package description, listed in `npm search`. + */ + description?: string; + + /** + Keywords associated with package, listed in `npm search`. + */ + keywords?: string[]; + + /** + The URL to the package's homepage. + */ + homepage?: LiteralUnion<'.', string>; + + /** + The URL to the package's issue tracker and/or the email address to which issues should be reported. + */ + bugs?: BugsLocation; + + /** + The license for the package. + */ + license?: string; + + /** + The licenses for the package. + */ + licenses?: Array<{ + type?: string; + url?: string; + }>; + + author?: Person; + + /** + A list of people who contributed to the package. + */ + contributors?: Person[]; + + /** + A list of people who maintain the package. + */ + maintainers?: Person[]; + + /** + The files included in the package. + */ + files?: string[]; + + /** + Resolution algorithm for importing ".js" files from the package's scope. + + [Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field) + */ + type?: 'module' | 'commonjs'; + + /** + The module ID that is the primary entry point to the program. + */ + main?: string; + + /** + Standard entry points of the package, with enhanced support for ECMAScript Modules. + + [Read more.](https://nodejs.org/api/esm.html#esm_package_entry_points) + */ + exports?: Exports; + + /** + The executable files that should be installed into the `PATH`. + */ + bin?: + | string + | Record; + + /** + Filenames to put in place for the `man` program to find. + */ + man?: string | string[]; + + /** + Indicates the structure of the package. + */ + directories?: DirectoryLocations; + + /** + Location for the code repository. + */ + repository?: + | string + | { + type: string; + url: string; + + /** + Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo). + + [Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md) + */ + directory?: string; + }; + + /** + Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point. + */ + scripts?: Scripts; + + /** + Is used to set configuration parameters used in package scripts that persist across upgrades. + */ + config?: Record; + + /** + The dependencies of the package. + */ + dependencies?: Dependency; + + /** + Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling. + */ + devDependencies?: Dependency; + + /** + Dependencies that are skipped if they fail to install. + */ + optionalDependencies?: Dependency; + + /** + Dependencies that will usually be required by the package user directly or via another dependency. + */ + peerDependencies?: Dependency; + + /** + Indicate peer dependencies that are optional. + */ + peerDependenciesMeta?: Record; + + /** + Package names that are bundled when the package is published. + */ + bundledDependencies?: string[]; + + /** + Alias of `bundledDependencies`. + */ + bundleDependencies?: string[]; + + /** + Engines that this package runs on. + */ + engines?: { + [EngineName in 'npm' | 'node' | string]: string; + }; + + /** + @deprecated + */ + engineStrict?: boolean; + + /** + Operating systems the module runs on. + */ + os?: Array>; + + /** + CPU architectures the module runs on. + */ + cpu?: Array>; + + /** + If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally. + + @deprecated + */ + preferGlobal?: boolean; + + /** + If set to `true`, then npm will refuse to publish it. + */ + private?: boolean; + + /** + A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default. + */ + publishConfig?: Record; + + /** + Describes and notifies consumers of a package's monetary support information. + + [Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md) + */ + funding?: string | { + /** + The type of funding. + */ + type?: LiteralUnion< + | 'github' + | 'opencollective' + | 'patreon' + | 'individual' + | 'foundation' + | 'corporation', + string + >; + + /** + The URL to the funding page. + */ + url: string; + }; + } +} + +/** +Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn. +*/ +export type PackageJson = +PackageJson.PackageJsonStandard & +PackageJson.NonStandardEntryPoints & +PackageJson.TypeScriptConfiguration & +PackageJson.YarnConfiguration & +PackageJson.JSPMConfiguration; diff --git a/node_modules/type-fest/source/partial-deep.d.ts b/node_modules/type-fest/source/partial-deep.d.ts new file mode 100644 index 0000000..b962b84 --- /dev/null +++ b/node_modules/type-fest/source/partial-deep.d.ts @@ -0,0 +1,72 @@ +import {Primitive} from './basic'; + +/** +Create a type from another type with all keys and nested keys set to optional. + +Use-cases: +- Merging a default settings/config object with another object, the second object would be a deep partial of the default object. +- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test. + +@example +``` +import {PartialDeep} from 'type-fest'; + +const settings: Settings = { + textEditor: { + fontSize: 14; + fontColor: '#000000'; + fontWeight: 400; + } + autocomplete: false; + autosave: true; +}; + +const applySavedSettings = (savedSettings: PartialDeep) => { + return {...settings, ...savedSettings}; +} + +settings = applySavedSettings({textEditor: {fontWeight: 500}}); +``` +*/ +export type PartialDeep = T extends Primitive + ? Partial + : T extends Map + ? PartialMapDeep + : T extends Set + ? PartialSetDeep + : T extends ReadonlyMap + ? PartialReadonlyMapDeep + : T extends ReadonlySet + ? PartialReadonlySetDeep + : T extends ((...arguments: any[]) => unknown) + ? T | undefined + : T extends object + ? PartialObjectDeep + : unknown; + +/** +Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialMapDeep extends Map, PartialDeep> {} + +/** +Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialSetDeep extends Set> {} + +/** +Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialReadonlyMapDeep extends ReadonlyMap, PartialDeep> {} + +/** +Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`. +*/ +interface PartialReadonlySetDeep extends ReadonlySet> {} + +/** +Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`. +*/ +type PartialObjectDeep = { + [KeyType in keyof ObjectType]?: PartialDeep +}; diff --git a/node_modules/type-fest/source/promisable.d.ts b/node_modules/type-fest/source/promisable.d.ts new file mode 100644 index 0000000..71242a5 --- /dev/null +++ b/node_modules/type-fest/source/promisable.d.ts @@ -0,0 +1,23 @@ +/** +Create a type that represents either the value or the value wrapped in `PromiseLike`. + +Use-cases: +- A function accepts a callback that may either return a value synchronously or may return a promised value. +- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript. + +@example +``` +import {Promisable} from 'type-fest'; + +async function logger(getLogEntry: () => Promisable): Promise { + const entry = await getLogEntry(); + console.log(entry); +} + +logger(() => 'foo'); +logger(() => Promise.resolve('bar')); +``` +*/ +export type Promisable = T | PromiseLike; diff --git a/node_modules/type-fest/source/promise-value.d.ts b/node_modules/type-fest/source/promise-value.d.ts new file mode 100644 index 0000000..642ddeb --- /dev/null +++ b/node_modules/type-fest/source/promise-value.d.ts @@ -0,0 +1,27 @@ +/** +Returns the type that is wrapped inside a `Promise` type. +If the type is a nested Promise, it is unwrapped recursively until a non-Promise type is obtained. +If the type is not a `Promise`, the type itself is returned. + +@example +``` +import {PromiseValue} from 'type-fest'; + +type AsyncData = Promise; +let asyncData: PromiseValue = Promise.resolve('ABC'); + +type Data = PromiseValue; +let data: Data = await asyncData; + +// Here's an example that shows how this type reacts to non-Promise types. +type SyncData = PromiseValue; +let syncData: SyncData = getSyncData(); + +// Here's an example that shows how this type reacts to recursive Promise types. +type RecursiveAsyncData = Promise >; +let recursiveAsyncData: PromiseValue = Promise.resolve(Promise.resolve('ABC')); +``` +*/ +export type PromiseValue = PromiseType extends Promise + ? { 0: PromiseValue; 1: Value }[PromiseType extends Promise ? 0 : 1] + : Otherwise; diff --git a/node_modules/type-fest/source/readonly-deep.d.ts b/node_modules/type-fest/source/readonly-deep.d.ts new file mode 100644 index 0000000..b8c04de --- /dev/null +++ b/node_modules/type-fest/source/readonly-deep.d.ts @@ -0,0 +1,59 @@ +import {Primitive} from './basic'; + +/** +Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively. + +This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript. + +@example +``` +// data.json +{ + "foo": ["bar"] +} + +// main.ts +import {ReadonlyDeep} from 'type-fest'; +import dataJson = require('./data.json'); + +const data: ReadonlyDeep = dataJson; + +export default data; + +// test.ts +import data from './main'; + +data.foo.push('bar'); +//=> error TS2339: Property 'push' does not exist on type 'readonly string[]' +``` +*/ +export type ReadonlyDeep = T extends Primitive | ((...arguments: any[]) => unknown) + ? T + : T extends ReadonlyMap + ? ReadonlyMapDeep + : T extends ReadonlySet + ? ReadonlySetDeep + : T extends object + ? ReadonlyObjectDeep + : unknown; + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlyMapDeep + extends ReadonlyMap, ReadonlyDeep> {} + +/** +Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +interface ReadonlySetDeep + extends ReadonlySet> {} + +/** +Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`. +*/ +type ReadonlyObjectDeep = { + readonly [KeyType in keyof ObjectType]: ReadonlyDeep +}; diff --git a/node_modules/type-fest/source/require-at-least-one.d.ts b/node_modules/type-fest/source/require-at-least-one.d.ts new file mode 100644 index 0000000..b3b8719 --- /dev/null +++ b/node_modules/type-fest/source/require-at-least-one.d.ts @@ -0,0 +1,33 @@ +import {Except} from './except'; + +/** +Create a type that requires at least one of the given keys. The remaining keys are kept as is. + +@example +``` +import {RequireAtLeastOne} from 'type-fest'; + +type Responder = { + text?: () => string; + json?: () => string; + + secure?: boolean; +}; + +const responder: RequireAtLeastOne = { + json: () => '{"message": "ok"}', + secure: true +}; +``` +*/ +export type RequireAtLeastOne< + ObjectType, + KeysType extends keyof ObjectType = keyof ObjectType +> = { + // For each `Key` in `KeysType` make a mapped type: + [Key in KeysType]-?: Required> & // 1. Make `Key`'s type required + // 2. Make all other keys in `KeysType` optional + Partial>>; +}[KeysType] & + // 3. Add the remaining keys not in `KeysType` + Except; diff --git a/node_modules/type-fest/source/require-exactly-one.d.ts b/node_modules/type-fest/source/require-exactly-one.d.ts new file mode 100644 index 0000000..c3e7e7e --- /dev/null +++ b/node_modules/type-fest/source/require-exactly-one.d.ts @@ -0,0 +1,35 @@ +// TODO: Remove this when we target TypeScript >=3.5. +type _Omit = Pick>; + +/** +Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is. + +Use-cases: +- Creating interfaces for components that only need one of the keys to display properly. +- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`. + +The caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about. + +@example +``` +import {RequireExactlyOne} from 'type-fest'; + +type Responder = { + text: () => string; + json: () => string; + secure: boolean; +}; + +const responder: RequireExactlyOne = { + // Adding a `text` key here would cause a compile error. + + json: () => '{"message": "ok"}', + secure: true +}; +``` +*/ +export type RequireExactlyOne = + {[Key in KeysType]: ( + Required> & + Partial, never>> + )}[KeysType] & _Omit; diff --git a/node_modules/type-fest/source/set-optional.d.ts b/node_modules/type-fest/source/set-optional.d.ts new file mode 100644 index 0000000..3539899 --- /dev/null +++ b/node_modules/type-fest/source/set-optional.d.ts @@ -0,0 +1,34 @@ +import {Except} from './except'; + +/** +Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional. + +@example +``` +import {SetOptional} from 'type-fest'; + +type Foo = { + a: number; + b?: string; + c: boolean; +} + +type SomeOptional = SetOptional; +// type SomeOptional = { +// a: number; +// b?: string; // Was already optional and still is. +// c?: boolean; // Is now optional. +// } +``` +*/ +export type SetOptional = + // Pick just the keys that are not optional from the base type. + Except & + // Pick the keys that should be optional from the base type and make them optional. + Partial> extends + // If `InferredType` extends the previous, then for each key, use the inferred type key. + infer InferredType + ? {[KeyType in keyof InferredType]: InferredType[KeyType]} + : never; diff --git a/node_modules/type-fest/source/set-required.d.ts b/node_modules/type-fest/source/set-required.d.ts new file mode 100644 index 0000000..0a72330 --- /dev/null +++ b/node_modules/type-fest/source/set-required.d.ts @@ -0,0 +1,34 @@ +import {Except} from './except'; + +/** +Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type. + +Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required. + +@example +``` +import {SetRequired} from 'type-fest'; + +type Foo = { + a?: number; + b: string; + c?: boolean; +} + +type SomeRequired = SetRequired; +// type SomeRequired = { +// a?: number; +// b: string; // Was already required and still is. +// c: boolean; // Is now required. +// } +``` +*/ +export type SetRequired = + // Pick just the keys that are not required from the base type. + Except & + // Pick the keys that should be required from the base type and make them required. + Required> extends + // If `InferredType` extends the previous, then for each key, use the inferred type key. + infer InferredType + ? {[KeyType in keyof InferredType]: InferredType[KeyType]} + : never; diff --git a/node_modules/type-fest/source/set-return-type.d.ts b/node_modules/type-fest/source/set-return-type.d.ts new file mode 100644 index 0000000..98766b1 --- /dev/null +++ b/node_modules/type-fest/source/set-return-type.d.ts @@ -0,0 +1,29 @@ +type IsAny = 0 extends (1 & T) ? true : false; // https://stackoverflow.com/a/49928360/3406963 +type IsNever = [T] extends [never] ? true : false; +type IsUnknown = IsNever extends false ? T extends unknown ? unknown extends T ? IsAny extends false ? true : false : false : false : false; + +/** +Create a function type with a return type of your choice and the same parameters as the given function type. + +Use-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead. + +@example +``` +import {SetReturnType} from 'type-fest'; + +type MyFunctionThatCanThrow = (foo: SomeType, bar: unknown) => SomeOtherType; + +type MyWrappedFunction = SetReturnType; +//=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined; +``` +*/ +export type SetReturnType any, TypeToReturn> = + // Just using `Parameters` isn't ideal because it doesn't handle the `this` fake parameter. + Fn extends (this: infer ThisArg, ...args: infer Arguments) => any ? ( + // If a function did not specify the `this` fake parameter, it will be inferred to `unknown`. + // We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE. + IsUnknown extends true ? (...args: Arguments) => TypeToReturn : (this: ThisArg, ...args: Arguments) => TypeToReturn + ) : ( + // This part should be unreachable, but we make it meaningful just in case… + (...args: Parameters) => TypeToReturn + ); diff --git a/node_modules/type-fest/source/stringified.d.ts b/node_modules/type-fest/source/stringified.d.ts new file mode 100644 index 0000000..9688b67 --- /dev/null +++ b/node_modules/type-fest/source/stringified.d.ts @@ -0,0 +1,21 @@ +/** +Create a type with the keys of the given type changed to `string` type. + +Use-case: Changing interface values to strings in order to use them in a form model. + +@example +``` +import {Stringified} from 'type-fest'; + +type Car { + model: string; + speed: number; +} + +const carForm: Stringified = { + model: 'Foo', + speed: '101' +}; +``` +*/ +export type Stringified = {[KeyType in keyof ObjectType]: string}; diff --git a/node_modules/type-fest/source/tsconfig-json.d.ts b/node_modules/type-fest/source/tsconfig-json.d.ts new file mode 100644 index 0000000..89f6e9d --- /dev/null +++ b/node_modules/type-fest/source/tsconfig-json.d.ts @@ -0,0 +1,870 @@ +declare namespace TsConfigJson { + namespace CompilerOptions { + export type JSX = + | 'preserve' + | 'react' + | 'react-native'; + + export type Module = + | 'CommonJS' + | 'AMD' + | 'System' + | 'UMD' + | 'ES6' + | 'ES2015' + | 'ESNext' + | 'None' + // Lowercase alternatives + | 'commonjs' + | 'amd' + | 'system' + | 'umd' + | 'es6' + | 'es2015' + | 'esnext' + | 'none'; + + export type NewLine = + | 'CRLF' + | 'LF' + // Lowercase alternatives + | 'crlf' + | 'lf'; + + export type Target = + | 'ES3' + | 'ES5' + | 'ES6' + | 'ES2015' + | 'ES2016' + | 'ES2017' + | 'ES2018' + | 'ES2019' + | 'ES2020' + | 'ESNext' + // Lowercase alternatives + | 'es3' + | 'es5' + | 'es6' + | 'es2015' + | 'es2016' + | 'es2017' + | 'es2018' + | 'es2019' + | 'es2020' + | 'esnext'; + + export type Lib = + | 'ES5' + | 'ES6' + | 'ES7' + | 'ES2015' + | 'ES2015.Collection' + | 'ES2015.Core' + | 'ES2015.Generator' + | 'ES2015.Iterable' + | 'ES2015.Promise' + | 'ES2015.Proxy' + | 'ES2015.Reflect' + | 'ES2015.Symbol.WellKnown' + | 'ES2015.Symbol' + | 'ES2016' + | 'ES2016.Array.Include' + | 'ES2017' + | 'ES2017.Intl' + | 'ES2017.Object' + | 'ES2017.SharedMemory' + | 'ES2017.String' + | 'ES2017.TypedArrays' + | 'ES2018' + | 'ES2018.AsyncIterable' + | 'ES2018.Intl' + | 'ES2018.Promise' + | 'ES2018.Regexp' + | 'ES2019' + | 'ES2019.Array' + | 'ES2019.Object' + | 'ES2019.String' + | 'ES2019.Symbol' + | 'ES2020' + | 'ES2020.String' + | 'ES2020.Symbol.WellKnown' + | 'ESNext' + | 'ESNext.Array' + | 'ESNext.AsyncIterable' + | 'ESNext.BigInt' + | 'ESNext.Intl' + | 'ESNext.Symbol' + | 'DOM' + | 'DOM.Iterable' + | 'ScriptHost' + | 'WebWorker' + | 'WebWorker.ImportScripts' + // Lowercase alternatives + | 'es5' + | 'es6' + | 'es7' + | 'es2015' + | 'es2015.collection' + | 'es2015.core' + | 'es2015.generator' + | 'es2015.iterable' + | 'es2015.promise' + | 'es2015.proxy' + | 'es2015.reflect' + | 'es2015.symbol.wellknown' + | 'es2015.symbol' + | 'es2016' + | 'es2016.array.include' + | 'es2017' + | 'es2017.intl' + | 'es2017.object' + | 'es2017.sharedmemory' + | 'es2017.string' + | 'es2017.typedarrays' + | 'es2018' + | 'es2018.asynciterable' + | 'es2018.intl' + | 'es2018.promise' + | 'es2018.regexp' + | 'es2019' + | 'es2019.array' + | 'es2019.object' + | 'es2019.string' + | 'es2019.symbol' + | 'es2020' + | 'es2020.string' + | 'es2020.symbol.wellknown' + | 'esnext' + | 'esnext.array' + | 'esnext.asynciterable' + | 'esnext.bigint' + | 'esnext.intl' + | 'esnext.symbol' + | 'dom' + | 'dom.iterable' + | 'scripthost' + | 'webworker' + | 'webworker.importscripts'; + + export interface Plugin { + [key: string]: unknown; + /** + Plugin name. + */ + name?: string; + } + } + + export interface CompilerOptions { + /** + The character set of the input files. + + @default 'utf8' + */ + charset?: string; + + /** + Enables building for project references. + + @default true + */ + composite?: boolean; + + /** + Generates corresponding d.ts files. + + @default false + */ + declaration?: boolean; + + /** + Specify output directory for generated declaration files. + + Requires TypeScript version 2.0 or later. + */ + declarationDir?: string; + + /** + Show diagnostic information. + + @default false + */ + diagnostics?: boolean; + + /** + Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. + + @default false + */ + emitBOM?: boolean; + + /** + Only emit `.d.ts` declaration files. + + @default false + */ + emitDeclarationOnly?: boolean; + + /** + Enable incremental compilation. + + @default `composite` + */ + incremental?: boolean; + + /** + Specify file to store incremental compilation information. + + @default '.tsbuildinfo' + */ + tsBuildInfoFile?: string; + + /** + Emit a single file with source maps instead of having a separate file. + + @default false + */ + inlineSourceMap?: boolean; + + /** + Emit the source alongside the sourcemaps within a single file. + + Requires `--inlineSourceMap` to be set. + + @default false + */ + inlineSources?: boolean; + + /** + Specify JSX code generation: `'preserve'`, `'react'`, or `'react-native'`. + + @default 'preserve' + */ + jsx?: CompilerOptions.JSX; + + /** + Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit. + + @default 'React' + */ + reactNamespace?: string; + + /** + Print names of files part of the compilation. + + @default false + */ + listFiles?: boolean; + + /** + Specifies the location where debugger should locate map files instead of generated locations. + */ + mapRoot?: string; + + /** + Specify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with `--outFile`. 'ES6' and 'ES2015' values may be used when targeting 'ES5' or lower. + + @default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6' + */ + module?: CompilerOptions.Module; + + /** + Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix). + + Default: Platform specific + */ + newLine?: CompilerOptions.NewLine; + + /** + Do not emit output. + + @default false + */ + noEmit?: boolean; + + /** + Do not generate custom helper functions like `__extends` in compiled output. + + @default false + */ + noEmitHelpers?: boolean; + + /** + Do not emit outputs if any type checking errors were reported. + + @default false + */ + noEmitOnError?: boolean; + + /** + Warn on expressions and declarations with an implied 'any' type. + + @default false + */ + noImplicitAny?: boolean; + + /** + Raise error on 'this' expressions with an implied any type. + + @default false + */ + noImplicitThis?: boolean; + + /** + Report errors on unused locals. + + Requires TypeScript version 2.0 or later. + + @default false + */ + noUnusedLocals?: boolean; + + /** + Report errors on unused parameters. + + Requires TypeScript version 2.0 or later. + + @default false + */ + noUnusedParameters?: boolean; + + /** + Do not include the default library file (lib.d.ts). + + @default false + */ + noLib?: boolean; + + /** + Do not add triple-slash references or module import targets to the list of compiled files. + + @default false + */ + noResolve?: boolean; + + /** + Disable strict checking of generic signatures in function types. + + @default false + */ + noStrictGenericChecks?: boolean; + + /** + @deprecated use `skipLibCheck` instead. + */ + skipDefaultLibCheck?: boolean; + + /** + Skip type checking of declaration files. + + Requires TypeScript version 2.0 or later. + + @default false + */ + skipLibCheck?: boolean; + + /** + Concatenate and emit output to single file. + */ + outFile?: string; + + /** + Redirect output structure to the directory. + */ + outDir?: string; + + /** + Do not erase const enum declarations in generated code. + + @default false + */ + preserveConstEnums?: boolean; + + /** + Do not resolve symlinks to their real path; treat a symlinked file like a real one. + + @default false + */ + preserveSymlinks?: boolean; + + /** + Keep outdated console output in watch mode instead of clearing the screen. + + @default false + */ + preserveWatchOutput?: boolean; + + /** + Stylize errors and messages using color and context (experimental). + + @default true // Unless piping to another program or redirecting output to a file. + */ + pretty?: boolean; + + /** + Do not emit comments to output. + + @default false + */ + removeComments?: boolean; + + /** + Specifies the root directory of input files. + + Use to control the output directory structure with `--outDir`. + */ + rootDir?: string; + + /** + Unconditionally emit imports for unresolved files. + + @default false + */ + isolatedModules?: boolean; + + /** + Generates corresponding '.map' file. + + @default false + */ + sourceMap?: boolean; + + /** + Specifies the location where debugger should locate TypeScript files instead of source locations. + */ + sourceRoot?: string; + + /** + Suppress excess property checks for object literals. + + @default false + */ + suppressExcessPropertyErrors?: boolean; + + /** + Suppress noImplicitAny errors for indexing objects lacking index signatures. + + @default false + */ + suppressImplicitAnyIndexErrors?: boolean; + + /** + Do not emit declarations for code that has an `@internal` annotation. + */ + stripInternal?: boolean; + + /** + Specify ECMAScript target version. + + @default 'es3' + */ + target?: CompilerOptions.Target; + + /** + Watch input files. + + @default false + */ + watch?: boolean; + + /** + Enables experimental support for ES7 decorators. + + @default false + */ + experimentalDecorators?: boolean; + + /** + Emit design-type metadata for decorated declarations in source. + + @default false + */ + emitDecoratorMetadata?: boolean; + + /** + Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6). + + @default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node' + */ + moduleResolution?: 'classic' | 'node'; + + /** + Do not report errors on unused labels. + + @default false + */ + allowUnusedLabels?: boolean; + + /** + Report error when not all code paths in function return a value. + + @default false + */ + noImplicitReturns?: boolean; + + /** + Report errors for fallthrough cases in switch statement. + + @default false + */ + noFallthroughCasesInSwitch?: boolean; + + /** + Do not report errors on unreachable code. + + @default false + */ + allowUnreachableCode?: boolean; + + /** + Disallow inconsistently-cased references to the same file. + + @default false + */ + forceConsistentCasingInFileNames?: boolean; + + /** + Base directory to resolve non-relative module names. + */ + baseUrl?: string; + + /** + Specify path mapping to be computed relative to baseUrl option. + */ + paths?: Record; + + /** + List of TypeScript language server plugins to load. + + Requires TypeScript version 2.3 or later. + */ + plugins?: CompilerOptions.Plugin[]; + + /** + Specify list of root directories to be used when resolving modules. + */ + rootDirs?: string[]; + + /** + Specify list of directories for type definition files to be included. + + Requires TypeScript version 2.0 or later. + */ + typeRoots?: string[]; + + /** + Type declaration files to be included in compilation. + + Requires TypeScript version 2.0 or later. + */ + types?: string[]; + + /** + Enable tracing of the name resolution process. + + @default false + */ + traceResolution?: boolean; + + /** + Allow javascript files to be compiled. + + @default false + */ + allowJs?: boolean; + + /** + Do not truncate error messages. + + @default false + */ + noErrorTruncation?: boolean; + + /** + Allow default imports from modules with no default export. This does not affect code emit, just typechecking. + + @default module === 'system' || esModuleInterop + */ + allowSyntheticDefaultImports?: boolean; + + /** + Do not emit `'use strict'` directives in module output. + + @default false + */ + noImplicitUseStrict?: boolean; + + /** + Enable to list all emitted files. + + Requires TypeScript version 2.0 or later. + + @default false + */ + listEmittedFiles?: boolean; + + /** + Disable size limit for JavaScript project. + + Requires TypeScript version 2.0 or later. + + @default false + */ + disableSizeLimit?: boolean; + + /** + List of library files to be included in the compilation. + + Requires TypeScript version 2.0 or later. + */ + lib?: CompilerOptions.Lib[]; + + /** + Enable strict null checks. + + Requires TypeScript version 2.0 or later. + + @default false + */ + strictNullChecks?: boolean; + + /** + The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`. + + @default 0 + */ + maxNodeModuleJsDepth?: number; + + /** + Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib. + + Requires TypeScript version 2.1 or later. + + @default false + */ + importHelpers?: boolean; + + /** + Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`. + + Requires TypeScript version 2.1 or later. + + @default 'React.createElement' + */ + jsxFactory?: string; + + /** + Parse in strict mode and emit `'use strict'` for each source file. + + Requires TypeScript version 2.1 or later. + + @default false + */ + alwaysStrict?: boolean; + + /** + Enable all strict type checking options. + + Requires TypeScript version 2.3 or later. + + @default false + */ + strict?: boolean; + + /** + Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions. + + @default false + */ + strictBindCallApply?: boolean; + + /** + Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`. + + Requires TypeScript version 2.3 or later. + + @default false + */ + downlevelIteration?: boolean; + + /** + Report errors in `.js` files. + + Requires TypeScript version 2.3 or later. + + @default false + */ + checkJs?: boolean; + + /** + Disable bivariant parameter checking for function types. + + Requires TypeScript version 2.6 or later. + + @default false + */ + strictFunctionTypes?: boolean; + + /** + Ensure non-undefined class properties are initialized in the constructor. + + Requires TypeScript version 2.7 or later. + + @default false + */ + strictPropertyInitialization?: boolean; + + /** + Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility. + + Requires TypeScript version 2.7 or later. + + @default false + */ + esModuleInterop?: boolean; + + /** + Allow accessing UMD globals from modules. + + @default false + */ + allowUmdGlobalAccess?: boolean; + + /** + Resolve `keyof` to string valued property names only (no numbers or symbols). + + Requires TypeScript version 2.9 or later. + + @default false + */ + keyofStringsOnly?: boolean; + + /** + Emit ECMAScript standard class fields. + + Requires TypeScript version 3.7 or later. + + @default false + */ + useDefineForClassFields?: boolean; + + /** + Generates a sourcemap for each corresponding `.d.ts` file. + + Requires TypeScript version 2.9 or later. + + @default false + */ + declarationMap?: boolean; + + /** + Include modules imported with `.json` extension. + + Requires TypeScript version 2.9 or later. + + @default false + */ + resolveJsonModule?: boolean; + } + + /** + Auto type (.d.ts) acquisition options for this project. + + Requires TypeScript version 2.1 or later. + */ + export interface TypeAcquisition { + /** + Enable auto type acquisition. + */ + enable?: boolean; + + /** + Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`. + */ + include?: string[]; + + /** + Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`. + */ + exclude?: string[]; + } + + export interface References { + /** + A normalized path on disk. + */ + path: string; + + /** + The path as the user originally wrote it. + */ + originalPath?: string; + + /** + True if the output of this reference should be prepended to the output of this project. + + Only valid for `--outFile` compilations. + */ + prepend?: boolean; + + /** + True if it is intended that this reference form a circularity. + */ + circular?: boolean; + } +} + +export interface TsConfigJson { + /** + Instructs the TypeScript compiler how to compile `.ts` files. + */ + compilerOptions?: TsConfigJson.CompilerOptions; + + /** + Auto type (.d.ts) acquisition options for this project. + + Requires TypeScript version 2.1 or later. + */ + typeAcquisition?: TsConfigJson.TypeAcquisition; + + /** + Enable Compile-on-Save for this project. + */ + compileOnSave?: boolean; + + /** + Path to base configuration file to inherit from. + + Requires TypeScript version 2.1 or later. + */ + extends?: string; + + /** + If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included. + */ + files?: string[]; + + /** + Specifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property. + + Glob patterns require TypeScript version 2.0 or later. + */ + exclude?: string[]; + + /** + Specifies a list of glob patterns that match files to be included in compilation. + + If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. + + Requires TypeScript version 2.0 or later. + */ + include?: string[]; + + /** + Referenced projects. + + Requires TypeScript version 3.0 or later. + */ + references?: TsConfigJson.References[]; +} diff --git a/node_modules/type-fest/source/union-to-intersection.d.ts b/node_modules/type-fest/source/union-to-intersection.d.ts new file mode 100644 index 0000000..5f9837f --- /dev/null +++ b/node_modules/type-fest/source/union-to-intersection.d.ts @@ -0,0 +1,58 @@ +/** +Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). + +Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153). + +@example +``` +import {UnionToIntersection} from 'type-fest'; + +type Union = {the(): void} | {great(arg: string): void} | {escape: boolean}; + +type Intersection = UnionToIntersection; +//=> {the(): void; great(arg: string): void; escape: boolean}; +``` + +A more applicable example which could make its way into your library code follows. + +@example +``` +import {UnionToIntersection} from 'type-fest'; + +class CommandOne { + commands: { + a1: () => undefined, + b1: () => undefined, + } +} + +class CommandTwo { + commands: { + a2: (argA: string) => undefined, + b2: (argB: string) => undefined, + } +} + +const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands); +type Union = typeof union; +//=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void} + +type Intersection = UnionToIntersection; +//=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void} +``` +*/ +export type UnionToIntersection = ( + // `extends unknown` is always going to be the case and is used to convert the + // `Union` into a [distributive conditional + // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). + Union extends unknown + // The union type is used as the only argument to a function since the union + // of function arguments is an intersection. + ? (distributedUnion: Union) => void + // This won't happen. + : never + // Infer the `Intersection` type since TypeScript represents the positional + // arguments of unions of functions as an intersection of the union. + ) extends ((mergedIntersection: infer Intersection) => void) + ? Intersection + : never; diff --git a/node_modules/type-fest/source/utilities.d.ts b/node_modules/type-fest/source/utilities.d.ts new file mode 100644 index 0000000..0bd75e6 --- /dev/null +++ b/node_modules/type-fest/source/utilities.d.ts @@ -0,0 +1,3 @@ +export type UpperCaseCharacters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'; + +export type WordSeparators = '-' | '_' | ' '; diff --git a/node_modules/type-fest/source/value-of.d.ts b/node_modules/type-fest/source/value-of.d.ts new file mode 100644 index 0000000..1279373 --- /dev/null +++ b/node_modules/type-fest/source/value-of.d.ts @@ -0,0 +1,40 @@ +/** +Create a union of the given object's values, and optionally specify which keys to get the values from. + +Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31438) if you want to have this type as a built-in in TypeScript. + +@example +``` +// data.json +{ + 'foo': 1, + 'bar': 2, + 'biz': 3 +} + +// main.ts +import {ValueOf} from 'type-fest'; +import data = require('./data.json'); + +export function getData(name: string): ValueOf { + return data[name]; +} + +export function onlyBar(name: string): ValueOf { + return data[name]; +} + +// file.ts +import {getData, onlyBar} from './main'; + +getData('foo'); +//=> 1 + +onlyBar('foo'); +//=> TypeError ... + +onlyBar('bar'); +//=> 2 +``` +*/ +export type ValueOf = ObjectType[ValueType]; diff --git a/node_modules/type-fest/ts41/camel-case.d.ts b/node_modules/type-fest/ts41/camel-case.d.ts new file mode 100644 index 0000000..4476fd3 --- /dev/null +++ b/node_modules/type-fest/ts41/camel-case.d.ts @@ -0,0 +1,72 @@ +import {WordSeparators} from '../source/utilities'; + +/** +Recursively split a string literal into two parts on the first occurence of the given string, returning an array literal of all the separate parts. +*/ +export type Split = + string extends S ? string[] : + S extends '' ? [] : + S extends `${infer T}${D}${infer U}` ? [T, ...Split] : + [S]; + +/** +Step by step takes the first item in an array literal, formats it and adds it to a string literal, and then recursively appends the remainder. + +Only to be used by `CamelCaseStringArray<>`. + +@see CamelCaseStringArray +*/ +type InnerCamelCaseStringArray = + Parts extends [`${infer FirstPart}`, ...infer RemainingParts] + ? FirstPart extends undefined + ? '' + : FirstPart extends '' + ? InnerCamelCaseStringArray + : `${PreviousPart extends '' ? FirstPart : Capitalize}${InnerCamelCaseStringArray}` + : ''; + +/** +Starts fusing the output of `Split<>`, an array literal of strings, into a camel-cased string literal. + +It's separate from `InnerCamelCaseStringArray<>` to keep a clean API outwards to the rest of the code. + +@see Split +*/ +type CamelCaseStringArray = + Parts extends [`${infer FirstPart}`, ...infer RemainingParts] + ? Uncapitalize<`${FirstPart}${InnerCamelCaseStringArray}`> + : never; + +/** +Convert a string literal to camel-case. + +This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result. + +@example +``` +import {CamelCase} from 'type-fest'; + +// Simple + +const someVariable: CamelCase<'foo-bar'> = 'fooBar'; + +// Advanced + +type CamelCasedProps = { + [K in keyof T as CamelCase]: T[K] +}; + +interface RawOptions { + 'dry-run': boolean; + 'full_family_name': string; + foo: number; +} + +const dbResult: CamelCasedProps = { + dryRun: true, + fullFamilyName: 'bar.js', + foo: 123 +}; +``` +*/ +export type CamelCase = K extends string ? CamelCaseStringArray> : K; diff --git a/node_modules/type-fest/ts41/delimiter-case.d.ts b/node_modules/type-fest/ts41/delimiter-case.d.ts new file mode 100644 index 0000000..52f4eb9 --- /dev/null +++ b/node_modules/type-fest/ts41/delimiter-case.d.ts @@ -0,0 +1,85 @@ +import {UpperCaseCharacters, WordSeparators} from '../source/utilities'; + +/** +Unlike a simpler split, this one includes the delimiter splitted on in the resulting array literal. This is to enable splitting on, for example, upper-case characters. +*/ +export type SplitIncludingDelimiters = + Source extends '' ? [] : + Source extends `${infer FirstPart}${Delimiter}${infer SecondPart}` ? + ( + Source extends `${FirstPart}${infer UsedDelimiter}${SecondPart}` + ? UsedDelimiter extends Delimiter + ? Source extends `${infer FirstPart}${UsedDelimiter}${infer SecondPart}` + ? [...SplitIncludingDelimiters, UsedDelimiter, ...SplitIncludingDelimiters] + : never + : never + : never + ) : + [Source]; + +/** +Format a specific part of the splitted string literal that `StringArrayToDelimiterCase<>` fuses together, ensuring desired casing. + +@see StringArrayToDelimiterCase +*/ +type StringPartToDelimiterCase = + StringPart extends UsedWordSeparators ? Delimiter : + StringPart extends UsedUpperCaseCharacters ? `${Delimiter}${Lowercase}` : + StringPart; + +/** +Takes the result of a splitted string literal and recursively concatenates it together into the desired casing. + +It receives `UsedWordSeparators` and `UsedUpperCaseCharacters` as input to ensure it's fully encapsulated. + +@see SplitIncludingDelimiters +*/ +type StringArrayToDelimiterCase = + Parts extends [`${infer FirstPart}`, ...infer RemainingParts] + ? `${StringPartToDelimiterCase}${StringArrayToDelimiterCase}` + : ''; + +/** +Convert a string literal to a custom string delimiter casing. + +This can be useful when, for example, converting a camel-cased object property to an oddly cased one. + +@see KebabCase +@see SnakeCase + +@example +``` +import {DelimiterCase} from 'type-fest'; + +// Simple + +const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar'; + +// Advanced + +type OddlyCasedProps = { + [K in keyof T as DelimiterCase]: T[K] +}; + +interface SomeOptions { + dryRun: boolean; + includeFile: string; + foo: number; +} + +const rawCliOptions: OddlyCasedProps = { + 'dry#run': true, + 'include#file': 'bar.js', + foo: 123 +}; +``` +*/ + +export type DelimiterCase = Value extends string + ? StringArrayToDelimiterCase< + SplitIncludingDelimiters, + WordSeparators, + UpperCaseCharacters, + Delimiter + > + : Value; diff --git a/node_modules/type-fest/ts41/index.d.ts b/node_modules/type-fest/ts41/index.d.ts new file mode 100644 index 0000000..fbaec82 --- /dev/null +++ b/node_modules/type-fest/ts41/index.d.ts @@ -0,0 +1,9 @@ +// These are all the basic types that's compatible with all supported TypeScript versions. +export * from '../base'; + +// These are special types that require at least TypeScript 4.1. +export {CamelCase} from './camel-case'; +export {KebabCase} from './kebab-case'; +export {PascalCase} from './pascal-case'; +export {SnakeCase} from './snake-case'; +export {DelimiterCase} from './delimiter-case'; diff --git a/node_modules/type-fest/ts41/kebab-case.d.ts b/node_modules/type-fest/ts41/kebab-case.d.ts new file mode 100644 index 0000000..ba6a99d --- /dev/null +++ b/node_modules/type-fest/ts41/kebab-case.d.ts @@ -0,0 +1,36 @@ +import {DelimiterCase} from './delimiter-case'; + +/** +Convert a string literal to kebab-case. + +This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag. + +@example +``` +import {KebabCase} from 'type-fest'; + +// Simple + +const someVariable: KebabCase<'fooBar'> = 'foo-bar'; + +// Advanced + +type KebabCasedProps = { + [K in keyof T as KebabCase]: T[K] +}; + +interface CliOptions { + dryRun: boolean; + includeFile: string; + foo: number; +} + +const rawCliOptions: KebabCasedProps = { + 'dry-run': true, + 'include-file': 'bar.js', + foo: 123 +}; +``` +*/ + +export type KebabCase = DelimiterCase; diff --git a/node_modules/type-fest/ts41/pascal-case.d.ts b/node_modules/type-fest/ts41/pascal-case.d.ts new file mode 100644 index 0000000..bfb2a36 --- /dev/null +++ b/node_modules/type-fest/ts41/pascal-case.d.ts @@ -0,0 +1,36 @@ +import {CamelCase} from './camel-case'; + +/** +Converts a string literal to pascal-case. + +@example +``` +import {PascalCase} from 'type-fest'; + +// Simple + +const someVariable: PascalCase<'foo-bar'> = 'FooBar'; + +// Advanced + +type PascalCaseProps = { + [K in keyof T as PascalCase]: T[K] +}; + +interface RawOptions { + 'dry-run': boolean; + 'full_family_name': string; + foo: number; +} + +const dbResult: CamelCasedProps = { + DryRun: true, + FullFamilyName: 'bar.js', + Foo: 123 +}; +``` +*/ + +export type PascalCase = CamelCase extends string + ? Capitalize> + : CamelCase; diff --git a/node_modules/type-fest/ts41/snake-case.d.ts b/node_modules/type-fest/ts41/snake-case.d.ts new file mode 100644 index 0000000..272b3d3 --- /dev/null +++ b/node_modules/type-fest/ts41/snake-case.d.ts @@ -0,0 +1,35 @@ +import {DelimiterCase} from './delimiter-case'; + +/** +Convert a string literal to snake-case. + +This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name. + +@example +``` +import {SnakeCase} from 'type-fest'; + +// Simple + +const someVariable: SnakeCase<'fooBar'> = 'foo_bar'; + +// Advanced + +type SnakeCasedProps = { + [K in keyof T as SnakeCase]: T[K] +}; + +interface ModelProps { + isHappy: boolean; + fullFamilyName: string; + foo: number; +} + +const dbResult: SnakeCasedProps = { + 'is_happy': true, + 'full_family_name': 'Carla Smith', + foo: 123 +}; +``` +*/ +export type SnakeCase = DelimiterCase; diff --git a/node_modules/unbox-primitive/.editorconfig b/node_modules/unbox-primitive/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/unbox-primitive/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/unbox-primitive/.eslintrc b/node_modules/unbox-primitive/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/node_modules/unbox-primitive/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/unbox-primitive/.github/FUNDING.yml b/node_modules/unbox-primitive/.github/FUNDING.yml new file mode 100644 index 0000000..30cbba9 --- /dev/null +++ b/node_modules/unbox-primitive/.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/unbox-primitive +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/unbox-primitive/.nycrc b/node_modules/unbox-primitive/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/node_modules/unbox-primitive/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/unbox-primitive/CHANGELOG.md b/node_modules/unbox-primitive/CHANGELOG.md new file mode 100644 index 0000000..7f930e8 --- /dev/null +++ b/node_modules/unbox-primitive/CHANGELOG.md @@ -0,0 +1,60 @@ +# 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). + +## [v1.0.2](https://github.com/ljharb/unbox-primitive/compare/v1.0.1...v1.0.2) - 2022-04-24 + +### Commits + +- [actions] reuse common workflows [`e6420b9`](https://github.com/ljharb/unbox-primitive/commit/e6420b94eed3558ef3ecddbd3d85fe2f400d1db1) +- [actions] update codecov uploader [`b90aff2`](https://github.com/ljharb/unbox-primitive/commit/b90aff2b17b70c1a7200eb5faa3f9e64ebf055f9) +- [readme] add github actions/codecov badges; update URLs [`bcc39b9`](https://github.com/ljharb/unbox-primitive/commit/bcc39b9d6d101bad199c95604f94999f80d6da97) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`a704a32`](https://github.com/ljharb/unbox-primitive/commit/a704a32ec4af43cd0631317ae3a537012adc1610) +- [Refactor] use `call-bind` instead of `function-bind` [`0a609f1`](https://github.com/ljharb/unbox-primitive/commit/0a609f1be6269cbf501482aacd9a0a1bd8596108) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`6a45317`](https://github.com/ljharb/unbox-primitive/commit/6a4531757d74af97c9d0770b102f81ce6ff0a8dc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`795c76f`](https://github.com/ljharb/unbox-primitive/commit/795c76f14c4df3c7ae934f7b14a98c07951ea9c7) +- [Deps] update `has-bigints`, `has-symbols` [`257a065`](https://github.com/ljharb/unbox-primitive/commit/257a065496b4190c296d674bff342ea40cf8e176) + +## [v1.0.1](https://github.com/ljharb/unbox-primitive/compare/v1.0.0...v1.0.1) - 2021-03-25 + +### Commits + +- [Tests] use shared travis-ci configs [`f977e5f`](https://github.com/ljharb/unbox-primitive/commit/f977e5f8fa532dbc519bd78a48cf4b81c14720fe) +- [Tests] migrate tests to Github Actions [`b89def6`](https://github.com/ljharb/unbox-primitive/commit/b89def60908a236aa1b5c756426f7cc61cf458dd) +- [meta] do not publish github action workflow files [`325d1f1`](https://github.com/ljharb/unbox-primitive/commit/325d1f1836cecbe57ee148545de5aefcbe7a7dce) +- readme [`810cd70`](https://github.com/ljharb/unbox-primitive/commit/810cd70f7b3c670cd55eae64466c89595175ee2a) +- [Tests] run `nyc` on all tests; use `tape` runner [`2f5fb08`](https://github.com/ljharb/unbox-primitive/commit/2f5fb08930c8f8e5e069ac61891dc9bd76cb762b) +- [meta] add `auto-changelog` [`03ed375`](https://github.com/ljharb/unbox-primitive/commit/03ed3759284493f19323eb0500f726d0851fc085) +- [actions] add automatic rebasing / merge commit blocking [`6dec48d`](https://github.com/ljharb/unbox-primitive/commit/6dec48daa357fa79a5cac1add9ca33f7b56276cc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `object-is`, `tape` [`528ed88`](https://github.com/ljharb/unbox-primitive/commit/528ed8826664b67f7eaf1fe7e2031c063b2d315f) +- [actions] check out the entire repo [`5095b29`](https://github.com/ljharb/unbox-primitive/commit/5095b2981f44a78b3f9bfaa1a526f17a6823e383) +- [actions] add "Allow Edits" workflow [`5aa26d7`](https://github.com/ljharb/unbox-primitive/commit/5aa26d7f0c32e0e78ba4bf3e5f9abb5478fd97fa) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `object-is`, `safe-publish-latest`, `tape` [`afc18c6`](https://github.com/ljharb/unbox-primitive/commit/afc18c6cb59cbb6b514e0d8004c6fd264e2a27eb) +- [readme] remove travis badge [`a025899`](https://github.com/ljharb/unbox-primitive/commit/a0258997a21604e1266840e6d167f0a870966e9b) +- [Dev Deps] update `auto-changelog` [`9219a32`](https://github.com/ljharb/unbox-primitive/commit/9219a32844b2ce3ed0a7ea12a5910a3e92424e4e) +- [readme] Fix missing paren in example [`73f5a33`](https://github.com/ljharb/unbox-primitive/commit/73f5a3340ca1ab6c227ed4632117d816d5e35317) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`e450acc`](https://github.com/ljharb/unbox-primitive/commit/e450accb54ab452f240768a5f0a98e5887b0ba8c) +- [Deps] update `has-bigints`, `has-symbols`, `which-boxed-primitive` [`a4279b5`](https://github.com/ljharb/unbox-primitive/commit/a4279b504732002074e5dcb9c5509038d605f563) +- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`b351548`](https://github.com/ljharb/unbox-primitive/commit/b351548d31789c0d0af4c3bce55c2bdefe51b40f) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`f600382`](https://github.com/ljharb/unbox-primitive/commit/f600382db83025270969354ac52a72aadb0a7ffa) +- [readme] fix travis links [`4d02fa9`](https://github.com/ljharb/unbox-primitive/commit/4d02fa9a4990812b048f8aefe6e46be80b68beef) +- [Dev Deps] update `auto-changelog`; add `aud` [`07e74a3`](https://github.com/ljharb/unbox-primitive/commit/07e74a3ca90688122593095849757e3c05c46db0) +- [meta] add `funding` field [`7ca4bd7`](https://github.com/ljharb/unbox-primitive/commit/7ca4bd71196e90a2fc9c7cb0ef4e30f949d5a853) +- [Tests] only audit prod deps [`47d8d5f`](https://github.com/ljharb/unbox-primitive/commit/47d8d5fbd58bf472e7e83f79ccef7e8379d06b35) +- [Deps] update `has-symbols` [`c70c15e`](https://github.com/ljharb/unbox-primitive/commit/c70c15e924191d11a271cff25bde657b0c3c3016) + +## v1.0.0 - 2019-08-10 + +### Commits + +- [Tests] add `.travis.yml` [`8c9a5ef`](https://github.com/ljharb/unbox-primitive/commit/8c9a5efdb54be4866e2884bf32cbe830788b2c2a) +- Initial commit [`feaff15`](https://github.com/ljharb/unbox-primitive/commit/feaff159eb999adc8763ff3e51d2d3d56d6164f8) +- [Tests] add tests [`3dd18d6`](https://github.com/ljharb/unbox-primitive/commit/3dd18d65748efb4af9b8ca66f8d8c5521d8f2dec) +- implementation [`472fb41`](https://github.com/ljharb/unbox-primitive/commit/472fb41d049ddee80ebf3219a5837e639a6e9341) +- npm init [`e9e426f`](https://github.com/ljharb/unbox-primitive/commit/e9e426fc90b9a3f07ffc48db75f78c414f77bc2b) +- [Tests] add linting [`139e74b`](https://github.com/ljharb/unbox-primitive/commit/139e74b94cdfd187b43b24de76c6d84af21ee467) +- [meta] create FUNDING.yml [`a9509e1`](https://github.com/ljharb/unbox-primitive/commit/a9509e122163e2b9d98af421e5c0575df36e2310) +- Only apps should have lockfiles [`b3d0834`](https://github.com/ljharb/unbox-primitive/commit/b3d0834d69dcbf4cbc1e61ccfaef05acf96cf630) diff --git a/node_modules/unbox-primitive/LICENSE b/node_modules/unbox-primitive/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/node_modules/unbox-primitive/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +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/unbox-primitive/README.md b/node_modules/unbox-primitive/README.md new file mode 100644 index 0000000..1ce1cab --- /dev/null +++ b/node_modules/unbox-primitive/README.md @@ -0,0 +1,47 @@ +# unbox-primitive [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Unbox a boxed JS primitive value. This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and works despite ES6 Symbol.toStringTag. + +## Example + +```js +var unboxPrimitive = require('unbox-primitive'); +var assert = require('assert'); + +assert.equal(unboxPrimitive(new Boolean(false)), false); +assert.equal(unboxPrimitive(new String('f')), 'f'); +assert.equal(unboxPrimitive(new Number(42)), 42); +const s = Symbol(); +assert.equal(unboxPrimitive(Object(s)), s); +assert.equal(unboxPrimitive(new BigInt(42)), 42n); + +// any primitive, or non-boxed-primitive object, will throw +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/unbox-primitive +[npm-version-svg]: https://versionbadg.es/ljharb/unbox-primitive.svg +[deps-svg]: https://david-dm.org/ljharb/unbox-primitive.svg +[deps-url]: https://david-dm.org/ljharb/unbox-primitive +[dev-deps-svg]: https://david-dm.org/ljharb/unbox-primitive/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/unbox-primitive#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/unbox-primitive.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/unbox-primitive.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/unbox-primitive.svg +[downloads-url]: https://npm-stat.com/charts.html?package=unbox-primitive +[codecov-image]: https://codecov.io/gh/ljharb/unbox-primitive/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/unbox-primitive/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/unbox-primitive +[actions-url]: https://github.com/ljharb/unbox-primitive/actions diff --git a/node_modules/unbox-primitive/index.js b/node_modules/unbox-primitive/index.js new file mode 100644 index 0000000..5cde479 --- /dev/null +++ b/node_modules/unbox-primitive/index.js @@ -0,0 +1,39 @@ +'use strict'; + +var whichBoxedPrimitive = require('which-boxed-primitive'); +var callBound = require('call-bind/callBound'); +var hasSymbols = require('has-symbols')(); +var hasBigInts = require('has-bigints')(); + +var stringToString = callBound('String.prototype.toString'); +var numberValueOf = callBound('Number.prototype.valueOf'); +var booleanValueOf = callBound('Boolean.prototype.valueOf'); +var symbolValueOf = hasSymbols && callBound('Symbol.prototype.valueOf'); +var bigIntValueOf = hasBigInts && callBound('BigInt.prototype.valueOf'); + +module.exports = function unboxPrimitive(value) { + var which = whichBoxedPrimitive(value); + if (typeof which !== 'string') { + throw new TypeError(which === null ? 'value is an unboxed primitive' : 'value is a non-boxed-primitive object'); + } + + if (which === 'String') { + return stringToString(value); + } + if (which === 'Number') { + return numberValueOf(value); + } + if (which === 'Boolean') { + return booleanValueOf(value); + } + if (which === 'Symbol') { + if (!hasSymbols) { + throw new EvalError('somehow this environment does not have Symbols, but you have a boxed Symbol value. Please report this!'); + } + return symbolValueOf(value); + } + if (which === 'BigInt') { + return bigIntValueOf(value); + } + throw new RangeError('unknown boxed primitive found: ' + which); +}; diff --git a/node_modules/unbox-primitive/package.json b/node_modules/unbox-primitive/package.json new file mode 100644 index 0000000..1f040f6 --- /dev/null +++ b/node_modules/unbox-primitive/package.json @@ -0,0 +1,65 @@ +{ + "name": "unbox-primitive", + "version": "1.0.2", + "description": "Unbox a boxed JS primitive value.", + "main": "index.js", + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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/ljharb/unbox-primitive.git" + }, + "keywords": [ + "unbox", + "boxed", + "primitive", + "object", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/unbox-primitive/issues" + }, + "homepage": "https://github.com/ljharb/unbox-primitive#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "nyc": "^10.3.2", + "object-inspect": "^1.12.0", + "object-is": "^1.1.5", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.3" + }, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/unbox-primitive/test/index.js b/node_modules/unbox-primitive/test/index.js new file mode 100644 index 0000000..73688ac --- /dev/null +++ b/node_modules/unbox-primitive/test/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var is = require('object-is'); +var forEach = require('for-each'); +var hasSymbols = require('has-symbols')(); +var hasBigInts = require('has-bigints')(); + +var unboxPrimitive = require('..'); + +var debug = function (v, m) { return inspect(v) + ' ' + m; }; + +test('primitives', function (t) { + var primitives = [ + true, + false, + '', + 'foo', + 42, + NaN, + Infinity, + 0 + ]; + if (hasSymbols) { + primitives.push(Symbol(), Symbol.iterator, Symbol('f')); + } + if (hasBigInts) { + primitives.push(BigInt(42), BigInt(0)); + } + forEach(primitives, function (primitive) { + var obj = Object(primitive); + t.ok( + is(unboxPrimitive(obj), primitive), + debug(obj, 'unboxes to ' + inspect(primitive)) + ); + }); + + t.end(); +}); + +test('objects', function (t) { + var objects = [ + {}, + [], + function () {}, + /a/g, + new Date() + ]; + forEach(objects, function (object) { + t['throws']( + function () { unboxPrimitive(object); }, + TypeError, + debug(object, 'is not a primitive') + ); + }); + + t.end(); +}); diff --git a/node_modules/uri-js/LICENSE b/node_modules/uri-js/LICENSE new file mode 100755 index 0000000..9338bde --- /dev/null +++ b/node_modules/uri-js/LICENSE @@ -0,0 +1,11 @@ +Copyright 2011 Gary Court. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court. diff --git a/node_modules/uri-js/README.md b/node_modules/uri-js/README.md new file mode 100755 index 0000000..43e648b --- /dev/null +++ b/node_modules/uri-js/README.md @@ -0,0 +1,203 @@ +# URI.js + +URI.js is an [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) compliant, scheme extendable URI parsing/validating/resolving library for all JavaScript environments (browsers, Node.js, etc). +It is also compliant with the IRI ([RFC 3987](http://www.ietf.org/rfc/rfc3987.txt)), IDNA ([RFC 5890](http://www.ietf.org/rfc/rfc5890.txt)), IPv6 Address ([RFC 5952](http://www.ietf.org/rfc/rfc5952.txt)), IPv6 Zone Identifier ([RFC 6874](http://www.ietf.org/rfc/rfc6874.txt)) specifications. + +URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.4kb (gzipped, 17kb deflated). + +## API + +### Parsing + + URI.parse("uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body"); + //returns: + //{ + // scheme : "uri", + // userinfo : "user:pass", + // host : "example.com", + // port : 123, + // path : "/one/two.three", + // query : "q1=a1&q2=a2", + // fragment : "body" + //} + +### Serializing + + URI.serialize({scheme : "http", host : "example.com", fragment : "footer"}) === "http://example.com/#footer" + +### Resolving + + URI.resolve("uri://a/b/c/d?q", "../../g") === "uri://a/g" + +### Normalizing + + URI.normalize("HTTP://ABC.com:80/%7Esmith/home.html") === "http://abc.com/~smith/home.html" + +### Comparison + + URI.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d") === true + +### IP Support + + //IPv4 normalization + URI.normalize("//192.068.001.000") === "//192.68.1.0" + + //IPv6 normalization + URI.normalize("//[2001:0:0DB8::0:0001]") === "//[2001:0:db8::1]" + + //IPv6 zone identifier support + URI.parse("//[2001:db8::7%25en1]"); + //returns: + //{ + // host : "2001:db8::7%en1" + //} + +### IRI Support + + //convert IRI to URI + URI.serialize(URI.parse("http://examplé.org/rosé")) === "http://xn--exampl-gva.org/ros%C3%A9" + //convert URI to IRI + URI.serialize(URI.parse("http://xn--exampl-gva.org/ros%C3%A9"), {iri:true}) === "http://examplé.org/rosé" + +### Options + +All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties: + +* `scheme` (string) + + Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior. + +* `reference` (string) + + If set to `"suffix"`, it indicates that the URI is in the suffix format, and the validator will use the option's `scheme` property to determine the URI's scheme. + +* `tolerant` (boolean, false) + + If set to `true`, the parser will relax URI resolving rules. + +* `absolutePath` (boolean, false) + + If set to `true`, the serializer will not resolve a relative `path` component. + +* `iri` (boolean, false) + + If set to `true`, the serializer will unescape non-ASCII characters as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt). + +* `unicodeSupport` (boolean, false) + + If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt). + +* `domainHost` (boolean, false) + + If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt). + +## Scheme Extendable + +URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, URI.js has built in support for the following schemes: + +* http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\] +* https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\] +* ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\] +* wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\] +* mailto \[[RFC 6068](http://www.ietf.org/rfc/rfc6068.txt)\] +* urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\] +* urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\] + +### HTTP/HTTPS Support + + URI.equal("HTTP://ABC.COM:80", "http://abc.com/") === true + URI.equal("https://abc.com", "HTTPS://ABC.COM:443/") === true + +### WS/WSS Support + + URI.parse("wss://example.com/foo?bar=baz"); + //returns: + //{ + // scheme : "wss", + // host: "example.com", + // resourceName: "/foo?bar=baz", + // secure: true, + //} + + URI.equal("WS://ABC.COM:80/chat#one", "ws://abc.com/chat") === true + +### Mailto Support + + URI.parse("mailto:alpha@example.com,bravo@example.com?subject=SUBSCRIBE&body=Sign%20me%20up!"); + //returns: + //{ + // scheme : "mailto", + // to : ["alpha@example.com", "bravo@example.com"], + // subject : "SUBSCRIBE", + // body : "Sign me up!" + //} + + URI.serialize({ + scheme : "mailto", + to : ["alpha@example.com"], + subject : "REMOVE", + body : "Please remove me", + headers : { + cc : "charlie@example.com" + } + }) === "mailto:alpha@example.com?cc=charlie@example.com&subject=REMOVE&body=Please%20remove%20me" + +### URN Support + + URI.parse("urn:example:foo"); + //returns: + //{ + // scheme : "urn", + // nid : "example", + // nss : "foo", + //} + +#### URN UUID Support + + URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"); + //returns: + //{ + // scheme : "urn", + // nid : "uuid", + // uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", + //} + +## Usage + +To load in a browser, use the following tag: + + + +To load in a CommonJS/Module environment, first install with npm/yarn by running on the command line: + + npm install uri-js + # OR + yarn add uri-js + +Then, in your code, load it using: + + const URI = require("uri-js"); + +If you are writing your code in ES6+ (ESNEXT) or TypeScript, you would load it using: + + import * as URI from "uri-js"; + +Or you can load just what you need using named exports: + + import { parse, serialize, resolve, resolveComponents, normalize, equal, removeDotSegments, pctEncChar, pctDecChars, escapeComponent, unescapeComponent } from "uri-js"; + +## Breaking changes + +### Breaking changes from 3.x + +URN parsing has been completely changed to better align with the specification. Scheme is now always `urn`, but has two new properties: `nid` which contains the Namspace Identifier, and `nss` which contains the Namespace Specific String. The `nss` property will be removed by higher order scheme handlers, such as the UUID URN scheme handler. + +The UUID of a URN can now be found in the `uuid` property. + +### Breaking changes from 2.x + +URI validation has been removed as it was slow, exposed a vulnerabilty, and was generally not useful. + +### Breaking changes from 1.x + +The `errors` array on parsed components is now an `error` string. diff --git a/node_modules/uri-js/dist/es5/uri.all.d.ts b/node_modules/uri-js/dist/es5/uri.all.d.ts new file mode 100755 index 0000000..da51e23 --- /dev/null +++ b/node_modules/uri-js/dist/es5/uri.all.d.ts @@ -0,0 +1,59 @@ +export interface URIComponents { + scheme?: string; + userinfo?: string; + host?: string; + port?: number | string; + path?: string; + query?: string; + fragment?: string; + reference?: string; + error?: string; +} +export interface URIOptions { + scheme?: string; + reference?: string; + tolerant?: boolean; + absolutePath?: boolean; + iri?: boolean; + unicodeSupport?: boolean; + domainHost?: boolean; +} +export interface URISchemeHandler { + scheme: string; + parse(components: ParentComponents, options: Options): Components; + serialize(components: Components, options: Options): ParentComponents; + unicodeSupport?: boolean; + domainHost?: boolean; + absolutePath?: boolean; +} +export interface URIRegExps { + NOT_SCHEME: RegExp; + NOT_USERINFO: RegExp; + NOT_HOST: RegExp; + NOT_PATH: RegExp; + NOT_PATH_NOSCHEME: RegExp; + NOT_QUERY: RegExp; + NOT_FRAGMENT: RegExp; + ESCAPE: RegExp; + UNRESERVED: RegExp; + OTHER_CHARS: RegExp; + PCT_ENCODED: RegExp; + IPV4ADDRESS: RegExp; + IPV6ADDRESS: RegExp; +} +export declare const SCHEMES: { + [scheme: string]: URISchemeHandler; +}; +export declare function pctEncChar(chr: string): string; +export declare function pctDecChars(str: string): string; +export declare function parse(uriString: string, options?: URIOptions): URIComponents; +export declare function removeDotSegments(input: string): string; +export declare function serialize(components: URIComponents, options?: URIOptions): string; +export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents; +export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string; +export declare function normalize(uri: string, options?: URIOptions): string; +export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents; +export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean; +export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean; +export declare function escapeComponent(str: string, options?: URIOptions): string; +export declare function unescapeComponent(str: string, options?: URIOptions): string; diff --git a/node_modules/uri-js/dist/es5/uri.all.js b/node_modules/uri-js/dist/es5/uri.all.js new file mode 100755 index 0000000..0706116 --- /dev/null +++ b/node_modules/uri-js/dist/es5/uri.all.js @@ -0,0 +1,1443 @@ +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.URI = global.URI || {}))); +}(this, (function (exports) { 'use strict'; + +function merge() { + for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) { + sets[_key] = arguments[_key]; + } + + if (sets.length > 1) { + sets[0] = sets[0].slice(0, -1); + var xl = sets.length - 1; + for (var x = 1; x < xl; ++x) { + sets[x] = sets[x].slice(1, -1); + } + sets[xl] = sets[xl].slice(1); + return sets.join(''); + } else { + return sets[0]; + } +} +function subexp(str) { + return "(?:" + str + ")"; +} +function typeOf(o) { + return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); +} +function toUpperCase(str) { + return str.toUpperCase(); +} +function toArray(obj) { + return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; +} +function assign(target, source) { + var obj = target; + if (source) { + for (var key in source) { + obj[key] = source[key]; + } + } + return obj; +} + +function buildExps(isIRI) { + var ALPHA$$ = "[A-Za-z]", + CR$ = "[\\x0D]", + DIGIT$$ = "[0-9]", + DQUOTE$$ = "[\\x22]", + HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), + //case-insensitive + LF$$ = "[\\x0A]", + SP$$ = "[\\x20]", + PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), + //expanded + GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", + SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", + RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), + UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", + //subset, excludes bidi control characters + IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", + //subset + UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), + SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), + USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), + DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), + DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), + //relaxed parsing rules + IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), + H16$ = subexp(HEXDIG$$ + "{1,4}"), + LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), + IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), + // 6( h16 ":" ) ls32 + IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), + // "::" 5( h16 ":" ) ls32 + IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), + //[ h16 ] "::" 4( h16 ":" ) ls32 + IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), + //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), + //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), + //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), + //[ *4( h16 ":" ) h16 ] "::" ls32 + IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), + //[ *5( h16 ":" ) h16 ] "::" h16 + IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), + //[ *6( h16 ":" ) h16 ] "::" + IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), + ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), + //RFC 6874 + IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), + //RFC 6874 + IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), + //RFC 6874, with relaxed parsing rules + IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), + IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), + //RFC 6874 + REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), + HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), + PORT$ = subexp(DIGIT$$ + "*"), + AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), + PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), + SEGMENT$ = subexp(PCHAR$ + "*"), + SEGMENT_NZ$ = subexp(PCHAR$ + "+"), + SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), + PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), + PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), + //simplified + PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), + //simplified + PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), + //simplified + PATH_EMPTY$ = "(?!" + PCHAR$ + ")", + PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), + QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), + FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), + HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), + URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), + RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), + RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), + URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), + ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), + GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", + RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", + ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", + SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", + AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"; + return { + NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), + NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"), + UNRESERVED: new RegExp(UNRESERVED$$, "g"), + OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"), + PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"), + IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules + }; +} +var URI_PROTOCOL = buildExps(false); + +var IRI_PROTOCOL = buildExps(true); + +var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); + + + + + + + + + + + + + +var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } +}; + +/** Highest positive signed 32-bit float value */ + +var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 + +/** Bootstring parameters */ +var base = 36; +var tMin = 1; +var tMax = 26; +var skew = 38; +var damp = 700; +var initialBias = 72; +var initialN = 128; // 0x80 +var delimiter = '-'; // '\x2D' + +/** Regular expressions */ +var regexPunycode = /^xn--/; +var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars +var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators + +/** Error messages */ +var errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' +}; + +/** Convenience shortcuts */ +var baseMinusTMin = base - tMin; +var floor = Math.floor; +var stringFromCharCode = String.fromCharCode; + +/*--------------------------------------------------------------------------*/ + +/** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ +function error$1(type) { + throw new RangeError(errors[type]); +} + +/** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ +function map(array, fn) { + var result = []; + var length = array.length; + while (length--) { + result[length] = fn(array[length]); + } + return result; +} + +/** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ +function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; +} + +/** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ +function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + while (counter < length) { + var value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // It's a high surrogate, and there is a next character. + var extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { + // Low surrogate. + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // It's an unmatched surrogate; only append this code unit, in case the + // next code unit is the high surrogate of a surrogate pair. + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; +} + +/** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ +var ucs2encode = function ucs2encode(array) { + return String.fromCodePoint.apply(String, toConsumableArray(array)); +}; + +/** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ +var basicToDigit = function basicToDigit(codePoint) { + if (codePoint - 0x30 < 0x0A) { + return codePoint - 0x16; + } + if (codePoint - 0x41 < 0x1A) { + return codePoint - 0x41; + } + if (codePoint - 0x61 < 0x1A) { + return codePoint - 0x61; + } + return base; +}; + +/** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ +var digitToBasic = function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); +}; + +/** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ +var adapt = function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); +}; + +/** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ +var decode = function decode(input) { + // Don't use UCS-2. + var output = []; + var inputLength = input.length; + var i = 0; + var n = initialN; + var bias = initialBias; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + var basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (var j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error$1('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{ + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + var oldi = i; + for (var w = 1, k = base;; /* no condition */k += base) { + + if (index >= inputLength) { + error$1('invalid-input'); + } + + var digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error$1('overflow'); + } + + i += digit * w; + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + + if (digit < t) { + break; + } + + var baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error$1('overflow'); + } + + w *= baseMinusT; + } + + var out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error$1('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output. + output.splice(i++, 0, n); + } + + return String.fromCodePoint.apply(String, output); +}; + +/** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ +var encode = function encode(input) { + var output = []; + + // Convert the input in UCS-2 to an array of Unicode code points. + input = ucs2decode(input); + + // Cache the length. + var inputLength = input.length; + + // Initialize the state. + var n = initialN; + var delta = 0; + var bias = initialBias; + + // Handle the basic code points. + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _currentValue2 = _step.value; + + if (_currentValue2 < 0x80) { + output.push(stringFromCharCode(_currentValue2)); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + var basicLength = output.length; + var handledCPCount = basicLength; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string with a delimiter unless it's empty. + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + var m = maxInt; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var currentValue = _step2.value; + + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow. + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + var handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error$1('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var _currentValue = _step3.value; + + if (_currentValue < n && ++delta > maxInt) { + error$1('overflow'); + } + if (_currentValue == n) { + // Represent delta as a generalized variable-length integer. + var q = delta; + for (var k = base;; /* no condition */k += base) { + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (q < t) { + break; + } + var qMinusT = q - t; + var baseMinusT = base - t; + output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + ++delta; + ++n; + } + return output.join(''); +}; + +/** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ +var toUnicode = function toUnicode(input) { + return mapDomain(input, function (string) { + return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; + }); +}; + +/** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ +var toASCII = function toASCII(input) { + return mapDomain(input, function (string) { + return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; + }); +}; + +/*--------------------------------------------------------------------------*/ + +/** Define the public API */ +var punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '2.1.0', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode +}; + +/** + * URI.js + * + * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript. + * @author Gary Court + * @see http://github.com/garycourt/uri-js + */ +/** + * Copyright 2011 Gary Court. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Gary Court. + */ +var SCHEMES = {}; +function pctEncChar(chr) { + var c = chr.charCodeAt(0); + var e = void 0; + if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); + return e; +} +function pctDecChars(str) { + var newStr = ""; + var i = 0; + var il = str.length; + while (i < il) { + var c = parseInt(str.substr(i + 1, 2), 16); + if (c < 128) { + newStr += String.fromCharCode(c); + i += 3; + } else if (c >= 194 && c < 224) { + if (il - i >= 6) { + var c2 = parseInt(str.substr(i + 4, 2), 16); + newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); + } else { + newStr += str.substr(i, 6); + } + i += 6; + } else if (c >= 224) { + if (il - i >= 9) { + var _c = parseInt(str.substr(i + 4, 2), 16); + var c3 = parseInt(str.substr(i + 7, 2), 16); + newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); + } else { + newStr += str.substr(i, 9); + } + i += 9; + } else { + newStr += str.substr(i, 3); + i += 3; + } + } + return newStr; +} +function _normalizeComponentEncoding(components, protocol) { + function decodeUnreserved(str) { + var decStr = pctDecChars(str); + return !decStr.match(protocol.UNRESERVED) ? str : decStr; + } + if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, ""); + if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + return components; +} + +function _stripLeadingZeros(str) { + return str.replace(/^0*(.*)/, "$1") || "0"; +} +function _normalizeIPv4(host, protocol) { + var matches = host.match(protocol.IPV4ADDRESS) || []; + + var _matches = slicedToArray(matches, 2), + address = _matches[1]; + + if (address) { + return address.split(".").map(_stripLeadingZeros).join("."); + } else { + return host; + } +} +function _normalizeIPv6(host, protocol) { + var matches = host.match(protocol.IPV6ADDRESS) || []; + + var _matches2 = slicedToArray(matches, 3), + address = _matches2[1], + zone = _matches2[2]; + + if (address) { + var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(), + _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), + last = _address$toLowerCase$2[0], + first = _address$toLowerCase$2[1]; + + var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; + var lastFields = last.split(":").map(_stripLeadingZeros); + var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); + var fieldCount = isLastFieldIPv4Address ? 7 : 8; + var lastFieldsStart = lastFields.length - fieldCount; + var fields = Array(fieldCount); + for (var x = 0; x < fieldCount; ++x) { + fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ''; + } + if (isLastFieldIPv4Address) { + fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); + } + var allZeroFields = fields.reduce(function (acc, field, index) { + if (!field || field === "0") { + var lastLongest = acc[acc.length - 1]; + if (lastLongest && lastLongest.index + lastLongest.length === index) { + lastLongest.length++; + } else { + acc.push({ index: index, length: 1 }); + } + } + return acc; + }, []); + var longestZeroFields = allZeroFields.sort(function (a, b) { + return b.length - a.length; + })[0]; + var newHost = void 0; + if (longestZeroFields && longestZeroFields.length > 1) { + var newFirst = fields.slice(0, longestZeroFields.index); + var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); + newHost = newFirst.join(":") + "::" + newLast.join(":"); + } else { + newHost = fields.join(":"); + } + if (zone) { + newHost += "%" + zone; + } + return newHost; + } else { + return host; + } +} +var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; +var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined; +function parse(uriString) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var components = {}; + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; + var matches = uriString.match(URI_PARSE); + if (matches) { + if (NO_MATCH_IS_UNDEFINED) { + //store each component + components.scheme = matches[1]; + components.userinfo = matches[3]; + components.host = matches[4]; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = matches[7]; + components.fragment = matches[8]; + //fix port number + if (isNaN(components.port)) { + components.port = matches[5]; + } + } else { + //IE FIX for improper RegExp matching + //store each component + components.scheme = matches[1] || undefined; + components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined; + components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined; + components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined; + //fix port number + if (isNaN(components.port)) { + components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined; + } + } + if (components.host) { + //normalize IP hosts + components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); + } + //determine reference type + if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) { + components.reference = "same-document"; + } else if (components.scheme === undefined) { + components.reference = "relative"; + } else if (components.fragment === undefined) { + components.reference = "absolute"; + } else { + components.reference = "uri"; + } + //check for reference errors + if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { + components.error = components.error || "URI is not a " + options.reference + " reference."; + } + //find scheme handler + var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + //check if scheme can't handle IRIs + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { + //if host component is a domain name + if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { + //convert Unicode IDN -> ASCII IDN + try { + components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); + } catch (e) { + components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; + } + } + //convert IRI -> URI + _normalizeComponentEncoding(components, URI_PROTOCOL); + } else { + //normalize encodings + _normalizeComponentEncoding(components, protocol); + } + //perform scheme specific parsing + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(components, options); + } + } else { + components.error = components.error || "URI can not be parsed."; + } + return components; +} + +function _recomposeAuthority(components, options) { + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + if (components.userinfo !== undefined) { + uriTokens.push(components.userinfo); + uriTokens.push("@"); + } + if (components.host !== undefined) { + //normalize IP hosts, add brackets and escape zone separator for IPv6 + uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) { + return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; + })); + } + if (typeof components.port === "number" || typeof components.port === "string") { + uriTokens.push(":"); + uriTokens.push(String(components.port)); + } + return uriTokens.length ? uriTokens.join("") : undefined; +} + +var RDS1 = /^\.\.?\//; +var RDS2 = /^\/\.(\/|$)/; +var RDS3 = /^\/\.\.(\/|$)/; +var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; +function removeDotSegments(input) { + var output = []; + while (input.length) { + if (input.match(RDS1)) { + input = input.replace(RDS1, ""); + } else if (input.match(RDS2)) { + input = input.replace(RDS2, "/"); + } else if (input.match(RDS3)) { + input = input.replace(RDS3, "/"); + output.pop(); + } else if (input === "." || input === "..") { + input = ""; + } else { + var im = input.match(RDS5); + if (im) { + var s = im[0]; + input = input.slice(s.length); + output.push(s); + } else { + throw new Error("Unexpected dot segment condition"); + } + } + } + return output.join(""); +} + +function serialize(components) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + //find scheme handler + var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + //perform scheme specific serialization + if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); + if (components.host) { + //if host component is an IPv6 address + if (protocol.IPV6ADDRESS.test(components.host)) {} + //TODO: normalize IPv6 address as per RFC 5952 + + //if host component is a domain name + else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { + //convert IDN via punycode + try { + components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); + } catch (e) { + components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + } + } + //normalize encoding + _normalizeComponentEncoding(components, protocol); + if (options.reference !== "suffix" && components.scheme) { + uriTokens.push(components.scheme); + uriTokens.push(":"); + } + var authority = _recomposeAuthority(components, options); + if (authority !== undefined) { + if (options.reference !== "suffix") { + uriTokens.push("//"); + } + uriTokens.push(authority); + if (components.path && components.path.charAt(0) !== "/") { + uriTokens.push("/"); + } + } + if (components.path !== undefined) { + var s = components.path; + if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { + s = removeDotSegments(s); + } + if (authority === undefined) { + s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//" + } + uriTokens.push(s); + } + if (components.query !== undefined) { + uriTokens.push("?"); + uriTokens.push(components.query); + } + if (components.fragment !== undefined) { + uriTokens.push("#"); + uriTokens.push(components.fragment); + } + return uriTokens.join(""); //merge tokens into a string +} + +function resolveComponents(base, relative) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var skipNormalization = arguments[3]; + + var target = {}; + if (!skipNormalization) { + base = parse(serialize(base, options), options); //normalize base components + relative = parse(serialize(relative, options), options); //normalize relative components + } + options = options || {}; + if (!options.tolerant && relative.scheme) { + target.scheme = relative.scheme; + //target.authority = relative.authority; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } else { + if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { + //target.authority = relative.authority; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } else { + if (!relative.path) { + target.path = base.path; + if (relative.query !== undefined) { + target.query = relative.query; + } else { + target.query = base.query; + } + } else { + if (relative.path.charAt(0) === "/") { + target.path = removeDotSegments(relative.path); + } else { + if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { + target.path = "/" + relative.path; + } else if (!base.path) { + target.path = relative.path; + } else { + target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path; + } + target.path = removeDotSegments(target.path); + } + target.query = relative.query; + } + //target.authority = base.authority; + target.userinfo = base.userinfo; + target.host = base.host; + target.port = base.port; + } + target.scheme = base.scheme; + } + target.fragment = relative.fragment; + return target; +} + +function resolve(baseURI, relativeURI, options) { + var schemelessOptions = assign({ scheme: 'null' }, options); + return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); +} + +function normalize(uri, options) { + if (typeof uri === "string") { + uri = serialize(parse(uri, options), options); + } else if (typeOf(uri) === "object") { + uri = parse(serialize(uri, options), options); + } + return uri; +} + +function equal(uriA, uriB, options) { + if (typeof uriA === "string") { + uriA = serialize(parse(uriA, options), options); + } else if (typeOf(uriA) === "object") { + uriA = serialize(uriA, options); + } + if (typeof uriB === "string") { + uriB = serialize(parse(uriB, options), options); + } else if (typeOf(uriB) === "object") { + uriB = serialize(uriB, options); + } + return uriA === uriB; +} + +function escapeComponent(str, options) { + return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); +} + +function unescapeComponent(str, options) { + return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); +} + +var handler = { + scheme: "http", + domainHost: true, + parse: function parse(components, options) { + //report missing host + if (!components.host) { + components.error = components.error || "HTTP URIs must have a host."; + } + return components; + }, + serialize: function serialize(components, options) { + var secure = String(components.scheme).toLowerCase() === "https"; + //normalize the default port + if (components.port === (secure ? 443 : 80) || components.port === "") { + components.port = undefined; + } + //normalize the empty path + if (!components.path) { + components.path = "/"; + } + //NOTE: We do not parse query strings for HTTP URIs + //as WWW Form Url Encoded query strings are part of the HTML4+ spec, + //and not the HTTP spec. + return components; + } +}; + +var handler$1 = { + scheme: "https", + domainHost: handler.domainHost, + parse: handler.parse, + serialize: handler.serialize +}; + +function isSecure(wsComponents) { + return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; +} +//RFC 6455 +var handler$2 = { + scheme: "ws", + domainHost: true, + parse: function parse(components, options) { + var wsComponents = components; + //indicate if the secure flag is set + wsComponents.secure = isSecure(wsComponents); + //construct resouce name + wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); + wsComponents.path = undefined; + wsComponents.query = undefined; + return wsComponents; + }, + serialize: function serialize(wsComponents, options) { + //normalize the default port + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { + wsComponents.port = undefined; + } + //ensure scheme matches secure flag + if (typeof wsComponents.secure === 'boolean') { + wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; + wsComponents.secure = undefined; + } + //reconstruct path from resource name + if (wsComponents.resourceName) { + var _wsComponents$resourc = wsComponents.resourceName.split('?'), + _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), + path = _wsComponents$resourc2[0], + query = _wsComponents$resourc2[1]; + + wsComponents.path = path && path !== '/' ? path : undefined; + wsComponents.query = query; + wsComponents.resourceName = undefined; + } + //forbid fragment component + wsComponents.fragment = undefined; + return wsComponents; + } +}; + +var handler$3 = { + scheme: "wss", + domainHost: handler$2.domainHost, + parse: handler$2.parse, + serialize: handler$2.serialize +}; + +var O = {}; +var isIRI = true; +//RFC 3986 +var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]"; +var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive +var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded +//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; = +//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; +//const WSP$$ = "[\\x20\\x09]"; +//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127) +//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext +//const VCHAR$$ = "[\\x21-\\x7E]"; +//const WSP$$ = "[\\x20\\x09]"; +//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext +//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+"); +//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$); +//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"'); +var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; +var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; +var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]"); +var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; +var UNRESERVED = new RegExp(UNRESERVED$$, "g"); +var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); +var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); +var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); +var NOT_HFVALUE = NOT_HFNAME; +function decodeUnreserved(str) { + var decStr = pctDecChars(str); + return !decStr.match(UNRESERVED) ? str : decStr; +} +var handler$4 = { + scheme: "mailto", + parse: function parse$$1(components, options) { + var mailtoComponents = components; + var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; + mailtoComponents.path = undefined; + if (mailtoComponents.query) { + var unknownHeaders = false; + var headers = {}; + var hfields = mailtoComponents.query.split("&"); + for (var x = 0, xl = hfields.length; x < xl; ++x) { + var hfield = hfields[x].split("="); + switch (hfield[0]) { + case "to": + var toAddrs = hfield[1].split(","); + for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { + to.push(toAddrs[_x]); + } + break; + case "subject": + mailtoComponents.subject = unescapeComponent(hfield[1], options); + break; + case "body": + mailtoComponents.body = unescapeComponent(hfield[1], options); + break; + default: + unknownHeaders = true; + headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); + break; + } + } + if (unknownHeaders) mailtoComponents.headers = headers; + } + mailtoComponents.query = undefined; + for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { + var addr = to[_x2].split("@"); + addr[0] = unescapeComponent(addr[0]); + if (!options.unicodeSupport) { + //convert Unicode IDN -> ASCII IDN + try { + addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); + } catch (e) { + mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; + } + } else { + addr[1] = unescapeComponent(addr[1], options).toLowerCase(); + } + to[_x2] = addr.join("@"); + } + return mailtoComponents; + }, + serialize: function serialize$$1(mailtoComponents, options) { + var components = mailtoComponents; + var to = toArray(mailtoComponents.to); + if (to) { + for (var x = 0, xl = to.length; x < xl; ++x) { + var toAddr = String(to[x]); + var atIdx = toAddr.lastIndexOf("@"); + var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); + var domain = toAddr.slice(atIdx + 1); + //convert IDN via punycode + try { + domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); + } catch (e) { + components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + to[x] = localPart + "@" + domain; + } + components.path = to.join(","); + } + var headers = mailtoComponents.headers = mailtoComponents.headers || {}; + if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject; + if (mailtoComponents.body) headers["body"] = mailtoComponents.body; + var fields = []; + for (var name in headers) { + if (headers[name] !== O[name]) { + fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); + } + } + if (fields.length) { + components.query = fields.join("&"); + } + return components; + } +}; + +var URN_PARSE = /^([^\:]+)\:(.*)/; +//RFC 2141 +var handler$5 = { + scheme: "urn", + parse: function parse$$1(components, options) { + var matches = components.path && components.path.match(URN_PARSE); + var urnComponents = components; + if (matches) { + var scheme = options.scheme || urnComponents.scheme || "urn"; + var nid = matches[1].toLowerCase(); + var nss = matches[2]; + var urnScheme = scheme + ":" + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + urnComponents.nid = nid; + urnComponents.nss = nss; + urnComponents.path = undefined; + if (schemeHandler) { + urnComponents = schemeHandler.parse(urnComponents, options); + } + } else { + urnComponents.error = urnComponents.error || "URN can not be parsed."; + } + return urnComponents; + }, + serialize: function serialize$$1(urnComponents, options) { + var scheme = options.scheme || urnComponents.scheme || "urn"; + var nid = urnComponents.nid; + var urnScheme = scheme + ":" + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + if (schemeHandler) { + urnComponents = schemeHandler.serialize(urnComponents, options); + } + var uriComponents = urnComponents; + var nss = urnComponents.nss; + uriComponents.path = (nid || options.nid) + ":" + nss; + return uriComponents; + } +}; + +var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; +//RFC 4122 +var handler$6 = { + scheme: "urn:uuid", + parse: function parse(urnComponents, options) { + var uuidComponents = urnComponents; + uuidComponents.uuid = uuidComponents.nss; + uuidComponents.nss = undefined; + if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) { + uuidComponents.error = uuidComponents.error || "UUID is not valid."; + } + return uuidComponents; + }, + serialize: function serialize(uuidComponents, options) { + var urnComponents = uuidComponents; + //normalize UUID + urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); + return urnComponents; + } +}; + +SCHEMES[handler.scheme] = handler; +SCHEMES[handler$1.scheme] = handler$1; +SCHEMES[handler$2.scheme] = handler$2; +SCHEMES[handler$3.scheme] = handler$3; +SCHEMES[handler$4.scheme] = handler$4; +SCHEMES[handler$5.scheme] = handler$5; +SCHEMES[handler$6.scheme] = handler$6; + +exports.SCHEMES = SCHEMES; +exports.pctEncChar = pctEncChar; +exports.pctDecChars = pctDecChars; +exports.parse = parse; +exports.removeDotSegments = removeDotSegments; +exports.serialize = serialize; +exports.resolveComponents = resolveComponents; +exports.resolve = resolve; +exports.normalize = normalize; +exports.equal = equal; +exports.escapeComponent = escapeComponent; +exports.unescapeComponent = unescapeComponent; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=uri.all.js.map diff --git a/node_modules/uri-js/dist/es5/uri.all.js.map b/node_modules/uri-js/dist/es5/uri.all.js.map new file mode 100755 index 0000000..5b30c4e --- /dev/null +++ b/node_modules/uri-js/dist/es5/uri.all.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uri.all.js","sources":["../../src/index.ts","../../src/schemes/urn-uuid.ts","../../src/schemes/urn.ts","../../src/schemes/mailto.ts","../../src/schemes/wss.ts","../../src/schemes/ws.ts","../../src/schemes/https.ts","../../src/schemes/http.ts","../../src/uri.ts","../../node_modules/punycode/punycode.es6.js","../../src/regexps-iri.ts","../../src/regexps-uri.ts","../../src/util.ts"],"sourcesContent":["import { SCHEMES } from \"./uri\";\n\nimport http from \"./schemes/http\";\nSCHEMES[http.scheme] = http;\n\nimport https from \"./schemes/https\";\nSCHEMES[https.scheme] = https;\n\nimport ws from \"./schemes/ws\";\nSCHEMES[ws.scheme] = ws;\n\nimport wss from \"./schemes/wss\";\nSCHEMES[wss.scheme] = wss;\n\nimport mailto from \"./schemes/mailto\";\nSCHEMES[mailto.scheme] = mailto;\n\nimport urn from \"./schemes/urn\";\nSCHEMES[urn.scheme] = urn;\n\nimport uuid from \"./schemes/urn-uuid\";\nSCHEMES[uuid.scheme] = uuid;\n\nexport * from \"./uri\";\n","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { URNComponents } from \"./urn\";\nimport { SCHEMES } from \"../uri\";\n\nexport interface UUIDComponents extends URNComponents {\n\tuuid?: string;\n}\n\nconst UUID = /^[0-9A-Fa-f]{8}(?:\\-[0-9A-Fa-f]{4}){3}\\-[0-9A-Fa-f]{12}$/;\nconst UUID_PARSE = /^[0-9A-Fa-f\\-]{36}/;\n\n//RFC 4122\nconst handler:URISchemeHandler = {\n\tscheme : \"urn:uuid\",\n\n\tparse : function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {\n\t\tconst uuidComponents = urnComponents as UUIDComponents;\n\t\tuuidComponents.uuid = uuidComponents.nss;\n\t\tuuidComponents.nss = undefined;\n\n\t\tif (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {\n\t\t\tuuidComponents.error = uuidComponents.error || \"UUID is not valid.\";\n\t\t}\n\n\t\treturn uuidComponents;\n\t},\n\n\tserialize : function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {\n\t\tconst urnComponents = uuidComponents as URNComponents;\n\t\t//normalize UUID\n\t\turnComponents.nss = (uuidComponents.uuid || \"\").toLowerCase();\n\t\treturn urnComponents;\n\t},\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { pctEncChar, SCHEMES } from \"../uri\";\n\nexport interface URNComponents extends URIComponents {\n\tnid?:string;\n\tnss?:string;\n}\n\nexport interface URNOptions extends URIOptions {\n\tnid?:string;\n}\n\nconst NID$ = \"(?:[0-9A-Za-z][0-9A-Za-z\\\\-]{1,31})\";\nconst PCT_ENCODED$ = \"(?:\\\\%[0-9A-Fa-f]{2})\";\nconst TRANS$$ = \"[0-9A-Za-z\\\\(\\\\)\\\\+\\\\,\\\\-\\\\.\\\\:\\\\=\\\\@\\\\;\\\\$\\\\_\\\\!\\\\*\\\\'\\\\/\\\\?\\\\#]\";\nconst NSS$ = \"(?:(?:\" + PCT_ENCODED$ + \"|\" + TRANS$$ + \")+)\";\nconst URN_SCHEME = new RegExp(\"^urn\\\\:(\" + NID$ + \")$\");\nconst URN_PATH = new RegExp(\"^(\" + NID$ + \")\\\\:(\" + NSS$ + \")$\");\nconst URN_PARSE = /^([^\\:]+)\\:(.*)/;\nconst URN_EXCLUDED = /[\\x00-\\x20\\\\\\\"\\&\\<\\>\\[\\]\\^\\`\\{\\|\\}\\~\\x7F-\\xFF]/g;\n\n//RFC 2141\nconst handler:URISchemeHandler = {\n\tscheme : \"urn\",\n\n\tparse : function (components:URIComponents, options:URNOptions):URNComponents {\n\t\tconst matches = components.path && components.path.match(URN_PARSE);\n\t\tlet urnComponents = components as URNComponents;\n\n\t\tif (matches) {\n\t\t\tconst scheme = options.scheme || urnComponents.scheme || \"urn\";\n\t\t\tconst nid = matches[1].toLowerCase();\n\t\t\tconst nss = matches[2];\n\t\t\tconst urnScheme = `${scheme}:${options.nid || nid}`;\n\t\t\tconst schemeHandler = SCHEMES[urnScheme];\n\n\t\t\turnComponents.nid = nid;\n\t\t\turnComponents.nss = nss;\n\t\t\turnComponents.path = undefined;\n\n\t\t\tif (schemeHandler) {\n\t\t\t\turnComponents = schemeHandler.parse(urnComponents, options) as URNComponents;\n\t\t\t}\n\t\t} else {\n\t\t\turnComponents.error = urnComponents.error || \"URN can not be parsed.\";\n\t\t}\n\n\t\treturn urnComponents;\n\t},\n\n\tserialize : function (urnComponents:URNComponents, options:URNOptions):URIComponents {\n\t\tconst scheme = options.scheme || urnComponents.scheme || \"urn\";\n\t\tconst nid = urnComponents.nid;\n\t\tconst urnScheme = `${scheme}:${options.nid || nid}`;\n\t\tconst schemeHandler = SCHEMES[urnScheme];\n\n\t\tif (schemeHandler) {\n\t\t\turnComponents = schemeHandler.serialize(urnComponents, options) as URNComponents;\n\t\t}\n\n\t\tconst uriComponents = urnComponents as URIComponents;\n\t\tconst nss = urnComponents.nss;\n\t\turiComponents.path = `${nid || options.nid}:${nss}`;\n\n\t\treturn uriComponents;\n\t},\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { pctEncChar, pctDecChars, unescapeComponent } from \"../uri\";\nimport punycode from \"punycode\";\nimport { merge, subexp, toUpperCase, toArray } from \"../util\";\n\nexport interface MailtoHeaders {\n\t[hfname:string]:string\n}\n\nexport interface MailtoComponents extends URIComponents {\n\tto:Array,\n\theaders?:MailtoHeaders,\n\tsubject?:string,\n\tbody?:string\n}\n\nconst O:MailtoHeaders = {};\nconst isIRI = true;\n\n//RFC 3986\nconst UNRESERVED$$ = \"[A-Za-z0-9\\\\-\\\\.\\\\_\\\\~\" + (isIRI ? \"\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF\" : \"\") + \"]\";\nconst HEXDIG$$ = \"[0-9A-Fa-f]\"; //case-insensitive\nconst PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)); //expanded\n\n//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =\n//const ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\#\\\\$\\\\%\\\\&\\\\'\\\\*\\\\+\\\\-\\\\/\\\\=\\\\?\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QTEXT$$ = \"[\\\\x01-\\\\x08\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F]\"; //(%d1-8 / %d11-12 / %d14-31 / %d127)\n//const QTEXT$$ = merge(\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]\", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext\n//const VCHAR$$ = \"[\\\\x21-\\\\x7E]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QP$ = subexp(\"\\\\\\\\\" + merge(\"[\\\\x00\\\\x0D\\\\x0A]\", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext\n//const FWS$ = subexp(subexp(WSP$$ + \"*\" + \"\\\\x0D\\\\x0A\") + \"?\" + WSP$$ + \"+\");\n//const QUOTED_PAIR$ = subexp(subexp(\"\\\\\\\\\" + subexp(VCHAR$$ + \"|\" + WSP$$)) + \"|\" + OBS_QP$);\n//const QUOTED_STRING$ = subexp('\\\\\"' + subexp(FWS$ + \"?\" + QCONTENT$) + \"*\" + FWS$ + \"?\" + '\\\\\"');\nconst ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\$\\\\%\\\\'\\\\*\\\\+\\\\-\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\nconst QTEXT$$ = \"[\\\\!\\\\$\\\\%\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.0-9\\\\<\\\\>A-Z\\\\x5E-\\\\x7E]\";\nconst VCHAR$$ = merge(QTEXT$$, \"[\\\\\\\"\\\\\\\\]\");\nconst DOT_ATOM_TEXT$ = subexp(ATEXT$$ + \"+\" + subexp(\"\\\\.\" + ATEXT$$ + \"+\") + \"*\");\nconst QUOTED_PAIR$ = subexp(\"\\\\\\\\\" + VCHAR$$);\nconst QCONTENT$ = subexp(QTEXT$$ + \"|\" + QUOTED_PAIR$);\nconst QUOTED_STRING$ = subexp('\\\\\"' + QCONTENT$ + \"*\" + '\\\\\"');\n\n//RFC 6068\nconst DTEXT_NO_OBS$$ = \"[\\\\x21-\\\\x5A\\\\x5E-\\\\x7E]\"; //%d33-90 / %d94-126\nconst SOME_DELIMS$$ = \"[\\\\!\\\\$\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\:\\\\@]\";\nconst QCHAR$ = subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$ + \"|\" + SOME_DELIMS$$);\nconst DOMAIN$ = subexp(DOT_ATOM_TEXT$ + \"|\" + \"\\\\[\" + DTEXT_NO_OBS$$ + \"*\" + \"\\\\]\");\nconst LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + \"|\" + QUOTED_STRING$);\nconst ADDR_SPEC$ = subexp(LOCAL_PART$ + \"\\\\@\" + DOMAIN$);\nconst TO$ = subexp(ADDR_SPEC$ + subexp(\"\\\\,\" + ADDR_SPEC$) + \"*\");\nconst HFNAME$ = subexp(QCHAR$ + \"*\");\nconst HFVALUE$ = HFNAME$;\nconst HFIELD$ = subexp(HFNAME$ + \"\\\\=\" + HFVALUE$);\nconst HFIELDS2$ = subexp(HFIELD$ + subexp(\"\\\\&\" + HFIELD$) + \"*\");\nconst HFIELDS$ = subexp(\"\\\\?\" + HFIELDS2$);\nconst MAILTO_URI = new RegExp(\"^mailto\\\\:\" + TO$ + \"?\" + HFIELDS$ + \"?$\");\n\nconst UNRESERVED = new RegExp(UNRESERVED$$, \"g\");\nconst PCT_ENCODED = new RegExp(PCT_ENCODED$, \"g\");\nconst NOT_LOCAL_PART = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", '[\\\\\"]', VCHAR$$), \"g\");\nconst NOT_DOMAIN = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", \"[\\\\[]\", DTEXT_NO_OBS$$, \"[\\\\]]\"), \"g\");\nconst NOT_HFNAME = new RegExp(merge(\"[^]\", UNRESERVED$$, SOME_DELIMS$$), \"g\");\nconst NOT_HFVALUE = NOT_HFNAME;\nconst TO = new RegExp(\"^\" + TO$ + \"$\");\nconst HFIELDS = new RegExp(\"^\" + HFIELDS2$ + \"$\");\n\nfunction decodeUnreserved(str:string):string {\n\tconst decStr = pctDecChars(str);\n\treturn (!decStr.match(UNRESERVED) ? str : decStr);\n}\n\nconst handler:URISchemeHandler = {\n\tscheme : \"mailto\",\n\n\tparse : function (components:URIComponents, options:URIOptions):MailtoComponents {\n\t\tconst mailtoComponents = components as MailtoComponents;\n\t\tconst to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(\",\") : []);\n\t\tmailtoComponents.path = undefined;\n\n\t\tif (mailtoComponents.query) {\n\t\t\tlet unknownHeaders = false\n\t\t\tconst headers:MailtoHeaders = {};\n\t\t\tconst hfields = mailtoComponents.query.split(\"&\");\n\n\t\t\tfor (let x = 0, xl = hfields.length; x < xl; ++x) {\n\t\t\t\tconst hfield = hfields[x].split(\"=\");\n\n\t\t\t\tswitch (hfield[0]) {\n\t\t\t\t\tcase \"to\":\n\t\t\t\t\t\tconst toAddrs = hfield[1].split(\",\");\n\t\t\t\t\t\tfor (let x = 0, xl = toAddrs.length; x < xl; ++x) {\n\t\t\t\t\t\t\tto.push(toAddrs[x]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"subject\":\n\t\t\t\t\t\tmailtoComponents.subject = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"body\":\n\t\t\t\t\t\tmailtoComponents.body = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunknownHeaders = true;\n\t\t\t\t\t\theaders[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unknownHeaders) mailtoComponents.headers = headers;\n\t\t}\n\n\t\tmailtoComponents.query = undefined;\n\n\t\tfor (let x = 0, xl = to.length; x < xl; ++x) {\n\t\t\tconst addr = to[x].split(\"@\");\n\n\t\t\taddr[0] = unescapeComponent(addr[0]);\n\n\t\t\tif (!options.unicodeSupport) {\n\t\t\t\t//convert Unicode IDN -> ASCII IDN\n\t\t\t\ttry {\n\t\t\t\t\taddr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());\n\t\t\t\t} catch (e) {\n\t\t\t\t\tmailtoComponents.error = mailtoComponents.error || \"Email address's domain name can not be converted to ASCII via punycode: \" + e;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\taddr[1] = unescapeComponent(addr[1], options).toLowerCase();\n\t\t\t}\n\n\t\t\tto[x] = addr.join(\"@\");\n\t\t}\n\n\t\treturn mailtoComponents;\n\t},\n\n\tserialize : function (mailtoComponents:MailtoComponents, options:URIOptions):URIComponents {\n\t\tconst components = mailtoComponents as URIComponents;\n\t\tconst to = toArray(mailtoComponents.to);\n\t\tif (to) {\n\t\t\tfor (let x = 0, xl = to.length; x < xl; ++x) {\n\t\t\t\tconst toAddr = String(to[x]);\n\t\t\t\tconst atIdx = toAddr.lastIndexOf(\"@\");\n\t\t\t\tconst localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);\n\t\t\t\tlet domain = toAddr.slice(atIdx + 1);\n\n\t\t\t\t//convert IDN via punycode\n\t\t\t\ttry {\n\t\t\t\t\tdomain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcomponents.error = components.error || \"Email address's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n\t\t\t\t}\n\n\t\t\t\tto[x] = localPart + \"@\" + domain;\n\t\t\t}\n\n\t\t\tcomponents.path = to.join(\",\");\n\t\t}\n\n\t\tconst headers = mailtoComponents.headers = mailtoComponents.headers || {};\n\n\t\tif (mailtoComponents.subject) headers[\"subject\"] = mailtoComponents.subject;\n\t\tif (mailtoComponents.body) headers[\"body\"] = mailtoComponents.body;\n\n\t\tconst fields = [];\n\t\tfor (const name in headers) {\n\t\t\tif (headers[name] !== O[name]) {\n\t\t\t\tfields.push(\n\t\t\t\t\tname.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +\n\t\t\t\t\t\"=\" +\n\t\t\t\t\theaders[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (fields.length) {\n\t\t\tcomponents.query = fields.join(\"&\");\n\t\t}\n\n\t\treturn components;\n\t}\n}\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport ws from \"./ws\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"wss\",\n\tdomainHost : ws.domainHost,\n\tparse : ws.parse,\n\tserialize : ws.serialize\n}\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\n\nexport interface WSComponents extends URIComponents {\n\tresourceName?: string;\n\tsecure?: boolean;\n}\n\nfunction isSecure(wsComponents:WSComponents):boolean {\n\treturn typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === \"wss\";\n}\n\n//RFC 6455\nconst handler:URISchemeHandler = {\n\tscheme : \"ws\",\n\n\tdomainHost : true,\n\n\tparse : function (components:URIComponents, options:URIOptions):WSComponents {\n\t\tconst wsComponents = components as WSComponents;\n\n\t\t//indicate if the secure flag is set\n\t\twsComponents.secure = isSecure(wsComponents);\n\n\t\t//construct resouce name\n\t\twsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');\n\t\twsComponents.path = undefined;\n\t\twsComponents.query = undefined;\n\n\t\treturn wsComponents;\n\t},\n\n\tserialize : function (wsComponents:WSComponents, options:URIOptions):URIComponents {\n\t\t//normalize the default port\n\t\tif (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === \"\") {\n\t\t\twsComponents.port = undefined;\n\t\t}\n\n\t\t//ensure scheme matches secure flag\n\t\tif (typeof wsComponents.secure === 'boolean') {\n\t\t\twsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');\n\t\t\twsComponents.secure = undefined;\n\t\t}\n\n\t\t//reconstruct path from resource name\n\t\tif (wsComponents.resourceName) {\n\t\t\tconst [path, query] = wsComponents.resourceName.split('?');\n\t\t\twsComponents.path = (path && path !== '/' ? path : undefined);\n\t\t\twsComponents.query = query;\n\t\t\twsComponents.resourceName = undefined;\n\t\t}\n\n\t\t//forbid fragment component\n\t\twsComponents.fragment = undefined;\n\n\t\treturn wsComponents;\n\t}\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport http from \"./http\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"https\",\n\tdomainHost : http.domainHost,\n\tparse : http.parse,\n\tserialize : http.serialize\n}\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"http\",\n\n\tdomainHost : true,\n\n\tparse : function (components:URIComponents, options:URIOptions):URIComponents {\n\t\t//report missing host\n\t\tif (!components.host) {\n\t\t\tcomponents.error = components.error || \"HTTP URIs must have a host.\";\n\t\t}\n\n\t\treturn components;\n\t},\n\n\tserialize : function (components:URIComponents, options:URIOptions):URIComponents {\n\t\tconst secure = String(components.scheme).toLowerCase() === \"https\";\n\n\t\t//normalize the default port\n\t\tif (components.port === (secure ? 443 : 80) || components.port === \"\") {\n\t\t\tcomponents.port = undefined;\n\t\t}\n\t\t\n\t\t//normalize the empty path\n\t\tif (!components.path) {\n\t\t\tcomponents.path = \"/\";\n\t\t}\n\n\t\t//NOTE: We do not parse query strings for HTTP URIs\n\t\t//as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n\t\t//and not the HTTP spec.\n\n\t\treturn components;\n\t}\n};\n\nexport default handler;","/**\n * URI.js\n *\n * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.\n * @author Gary Court\n * @see http://github.com/garycourt/uri-js\n */\n\n/**\n * Copyright 2011 Gary Court. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are\n * permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list\n * of conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation are those of the\n * authors and should not be interpreted as representing official policies, either expressed\n * or implied, of Gary Court.\n */\n\nimport URI_PROTOCOL from \"./regexps-uri\";\nimport IRI_PROTOCOL from \"./regexps-iri\";\nimport punycode from \"punycode\";\nimport { toUpperCase, typeOf, assign } from \"./util\";\n\nexport interface URIComponents {\n\tscheme?:string;\n\tuserinfo?:string;\n\thost?:string;\n\tport?:number|string;\n\tpath?:string;\n\tquery?:string;\n\tfragment?:string;\n\treference?:string;\n\terror?:string;\n}\n\nexport interface URIOptions {\n\tscheme?:string;\n\treference?:string;\n\ttolerant?:boolean;\n\tabsolutePath?:boolean;\n\tiri?:boolean;\n\tunicodeSupport?:boolean;\n\tdomainHost?:boolean;\n}\n\nexport interface URISchemeHandler {\n\tscheme:string;\n\tparse(components:ParentComponents, options:Options):Components;\n\tserialize(components:Components, options:Options):ParentComponents;\n\tunicodeSupport?:boolean;\n\tdomainHost?:boolean;\n\tabsolutePath?:boolean;\n}\n\nexport interface URIRegExps {\n\tNOT_SCHEME : RegExp,\n\tNOT_USERINFO : RegExp,\n\tNOT_HOST : RegExp,\n\tNOT_PATH : RegExp,\n\tNOT_PATH_NOSCHEME : RegExp,\n\tNOT_QUERY : RegExp,\n\tNOT_FRAGMENT : RegExp,\n\tESCAPE : RegExp,\n\tUNRESERVED : RegExp,\n\tOTHER_CHARS : RegExp,\n\tPCT_ENCODED : RegExp,\n\tIPV4ADDRESS : RegExp,\n\tIPV6ADDRESS : RegExp,\n}\n\nexport const SCHEMES:{[scheme:string]:URISchemeHandler} = {};\n\nexport function pctEncChar(chr:string):string {\n\tconst c = chr.charCodeAt(0);\n\tlet e:string;\n\n\tif (c < 16) e = \"%0\" + c.toString(16).toUpperCase();\n\telse if (c < 128) e = \"%\" + c.toString(16).toUpperCase();\n\telse if (c < 2048) e = \"%\" + ((c >> 6) | 192).toString(16).toUpperCase() + \"%\" + ((c & 63) | 128).toString(16).toUpperCase();\n\telse e = \"%\" + ((c >> 12) | 224).toString(16).toUpperCase() + \"%\" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + \"%\" + ((c & 63) | 128).toString(16).toUpperCase();\n\n\treturn e;\n}\n\nexport function pctDecChars(str:string):string {\n\tlet newStr = \"\";\n\tlet i = 0;\n\tconst il = str.length;\n\n\twhile (i < il) {\n\t\tconst c = parseInt(str.substr(i + 1, 2), 16);\n\n\t\tif (c < 128) {\n\t\t\tnewStr += String.fromCharCode(c);\n\t\t\ti += 3;\n\t\t}\n\t\telse if (c >= 194 && c < 224) {\n\t\t\tif ((il - i) >= 6) {\n\t\t\t\tconst c2 = parseInt(str.substr(i + 4, 2), 16);\n\t\t\t\tnewStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n\t\t\t} else {\n\t\t\t\tnewStr += str.substr(i, 6);\n\t\t\t}\n\t\t\ti += 6;\n\t\t}\n\t\telse if (c >= 224) {\n\t\t\tif ((il - i) >= 9) {\n\t\t\t\tconst c2 = parseInt(str.substr(i + 4, 2), 16);\n\t\t\t\tconst c3 = parseInt(str.substr(i + 7, 2), 16);\n\t\t\t\tnewStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n\t\t\t} else {\n\t\t\t\tnewStr += str.substr(i, 9);\n\t\t\t}\n\t\t\ti += 9;\n\t\t}\n\t\telse {\n\t\t\tnewStr += str.substr(i, 3);\n\t\t\ti += 3;\n\t\t}\n\t}\n\n\treturn newStr;\n}\n\nfunction _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {\n\tfunction decodeUnreserved(str:string):string {\n\t\tconst decStr = pctDecChars(str);\n\t\treturn (!decStr.match(protocol.UNRESERVED) ? str : decStr);\n\t}\n\n\tif (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, \"\");\n\tif (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\n\treturn components;\n};\n\nfunction _stripLeadingZeros(str:string):string {\n\treturn str.replace(/^0*(.*)/, \"$1\") || \"0\";\n}\n\nfunction _normalizeIPv4(host:string, protocol:URIRegExps):string {\n\tconst matches = host.match(protocol.IPV4ADDRESS) || [];\n\tconst [, address] = matches;\n\t\n\tif (address) {\n\t\treturn address.split(\".\").map(_stripLeadingZeros).join(\".\");\n\t} else {\n\t\treturn host;\n\t}\n}\n\nfunction _normalizeIPv6(host:string, protocol:URIRegExps):string {\n\tconst matches = host.match(protocol.IPV6ADDRESS) || [];\n\tconst [, address, zone] = matches;\n\n\tif (address) {\n\t\tconst [last, first] = address.toLowerCase().split('::').reverse();\n\t\tconst firstFields = first ? first.split(\":\").map(_stripLeadingZeros) : [];\n\t\tconst lastFields = last.split(\":\").map(_stripLeadingZeros);\n\t\tconst isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);\n\t\tconst fieldCount = isLastFieldIPv4Address ? 7 : 8;\n\t\tconst lastFieldsStart = lastFields.length - fieldCount;\n\t\tconst fields = Array(fieldCount);\n\n\t\tfor (let x = 0; x < fieldCount; ++x) {\n\t\t\tfields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';\n\t\t}\n\n\t\tif (isLastFieldIPv4Address) {\n\t\t\tfields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);\n\t\t}\n\n\t\tconst allZeroFields = fields.reduce>((acc, field, index) => {\n\t\t\tif (!field || field === \"0\") {\n\t\t\t\tconst lastLongest = acc[acc.length - 1];\n\t\t\t\tif (lastLongest && lastLongest.index + lastLongest.length === index) {\n\t\t\t\t\tlastLongest.length++;\n\t\t\t\t} else {\n\t\t\t\t\tacc.push({ index, length : 1 });\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, []);\n\n\t\tconst longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];\n\n\t\tlet newHost:string;\n\t\tif (longestZeroFields && longestZeroFields.length > 1) {\n\t\t\tconst newFirst = fields.slice(0, longestZeroFields.index) ;\n\t\t\tconst newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);\n\t\t\tnewHost = newFirst.join(\":\") + \"::\" + newLast.join(\":\");\n\t\t} else {\n\t\t\tnewHost = fields.join(\":\");\n\t\t}\n\n\t\tif (zone) {\n\t\t\tnewHost += \"%\" + zone;\n\t\t}\n\n\t\treturn newHost;\n\t} else {\n\t\treturn host;\n\t}\n}\n\nconst URI_PARSE = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:([^\\/?#@]*)@)?(\\[[^\\/?#\\]]+\\]|[^\\/?#:]*)(?:\\:(\\d*))?))?([^?#]*)(?:\\?([^#]*))?(?:#((?:.|\\n|\\r)*))?/i;\nconst NO_MATCH_IS_UNDEFINED = ((\"\").match(/(){0}/))[1] === undefined;\n\nexport function parse(uriString:string, options:URIOptions = {}):URIComponents {\n\tconst components:URIComponents = {};\n\tconst protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);\n\n\tif (options.reference === \"suffix\") uriString = (options.scheme ? options.scheme + \":\" : \"\") + \"//\" + uriString;\n\n\tconst matches = uriString.match(URI_PARSE);\n\n\tif (matches) {\n\t\tif (NO_MATCH_IS_UNDEFINED) {\n\t\t\t//store each component\n\t\t\tcomponents.scheme = matches[1];\n\t\t\tcomponents.userinfo = matches[3];\n\t\t\tcomponents.host = matches[4];\n\t\t\tcomponents.port = parseInt(matches[5], 10);\n\t\t\tcomponents.path = matches[6] || \"\";\n\t\t\tcomponents.query = matches[7];\n\t\t\tcomponents.fragment = matches[8];\n\n\t\t\t//fix port number\n\t\t\tif (isNaN(components.port)) {\n\t\t\t\tcomponents.port = matches[5];\n\t\t\t}\n\t\t} else { //IE FIX for improper RegExp matching\n\t\t\t//store each component\n\t\t\tcomponents.scheme = matches[1] || undefined;\n\t\t\tcomponents.userinfo = (uriString.indexOf(\"@\") !== -1 ? matches[3] : undefined);\n\t\t\tcomponents.host = (uriString.indexOf(\"//\") !== -1 ? matches[4] : undefined);\n\t\t\tcomponents.port = parseInt(matches[5], 10);\n\t\t\tcomponents.path = matches[6] || \"\";\n\t\t\tcomponents.query = (uriString.indexOf(\"?\") !== -1 ? matches[7] : undefined);\n\t\t\tcomponents.fragment = (uriString.indexOf(\"#\") !== -1 ? matches[8] : undefined);\n\n\t\t\t//fix port number\n\t\t\tif (isNaN(components.port)) {\n\t\t\t\tcomponents.port = (uriString.match(/\\/\\/(?:.|\\n)*\\:(?:\\/|\\?|\\#|$)/) ? matches[4] : undefined);\n\t\t\t}\n\t\t}\n\n\t\tif (components.host) {\n\t\t\t//normalize IP hosts\n\t\t\tcomponents.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);\n\t\t}\n\n\t\t//determine reference type\n\t\tif (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {\n\t\t\tcomponents.reference = \"same-document\";\n\t\t} else if (components.scheme === undefined) {\n\t\t\tcomponents.reference = \"relative\";\n\t\t} else if (components.fragment === undefined) {\n\t\t\tcomponents.reference = \"absolute\";\n\t\t} else {\n\t\t\tcomponents.reference = \"uri\";\n\t\t}\n\n\t\t//check for reference errors\n\t\tif (options.reference && options.reference !== \"suffix\" && options.reference !== components.reference) {\n\t\t\tcomponents.error = components.error || \"URI is not a \" + options.reference + \" reference.\";\n\t\t}\n\n\t\t//find scheme handler\n\t\tconst schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n\n\t\t//check if scheme can't handle IRIs\n\t\tif (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n\t\t\t//if host component is a domain name\n\t\t\tif (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {\n\t\t\t\t//convert Unicode IDN -> ASCII IDN\n\t\t\t\ttry {\n\t\t\t\t\tcomponents.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcomponents.error = components.error || \"Host's domain name can not be converted to ASCII via punycode: \" + e;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//convert IRI -> URI\n\t\t\t_normalizeComponentEncoding(components, URI_PROTOCOL);\n\t\t} else {\n\t\t\t//normalize encodings\n\t\t\t_normalizeComponentEncoding(components, protocol);\n\t\t}\n\n\t\t//perform scheme specific parsing\n\t\tif (schemeHandler && schemeHandler.parse) {\n\t\t\tschemeHandler.parse(components, options);\n\t\t}\n\t} else {\n\t\tcomponents.error = components.error || \"URI can not be parsed.\";\n\t}\n\n\treturn components;\n};\n\nfunction _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {\n\tconst protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);\n\tconst uriTokens:Array = [];\n\n\tif (components.userinfo !== undefined) {\n\t\turiTokens.push(components.userinfo);\n\t\turiTokens.push(\"@\");\n\t}\n\n\tif (components.host !== undefined) {\n\t\t//normalize IP hosts, add brackets and escape zone separator for IPv6\n\t\turiTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => \"[\" + $1 + ($2 ? \"%25\" + $2 : \"\") + \"]\"));\n\t}\n\n\tif (typeof components.port === \"number\" || typeof components.port === \"string\") {\n\t\turiTokens.push(\":\");\n\t\turiTokens.push(String(components.port));\n\t}\n\n\treturn uriTokens.length ? uriTokens.join(\"\") : undefined;\n};\n\nconst RDS1 = /^\\.\\.?\\//;\nconst RDS2 = /^\\/\\.(\\/|$)/;\nconst RDS3 = /^\\/\\.\\.(\\/|$)/;\nconst RDS4 = /^\\.\\.?$/;\nconst RDS5 = /^\\/?(?:.|\\n)*?(?=\\/|$)/;\n\nexport function removeDotSegments(input:string):string {\n\tconst output:Array = [];\n\n\twhile (input.length) {\n\t\tif (input.match(RDS1)) {\n\t\t\tinput = input.replace(RDS1, \"\");\n\t\t} else if (input.match(RDS2)) {\n\t\t\tinput = input.replace(RDS2, \"/\");\n\t\t} else if (input.match(RDS3)) {\n\t\t\tinput = input.replace(RDS3, \"/\");\n\t\t\toutput.pop();\n\t\t} else if (input === \".\" || input === \"..\") {\n\t\t\tinput = \"\";\n\t\t} else {\n\t\t\tconst im = input.match(RDS5);\n\t\t\tif (im) {\n\t\t\t\tconst s = im[0];\n\t\t\t\tinput = input.slice(s.length);\n\t\t\t\toutput.push(s);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Unexpected dot segment condition\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn output.join(\"\");\n};\n\nexport function serialize(components:URIComponents, options:URIOptions = {}):string {\n\tconst protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);\n\tconst uriTokens:Array = [];\n\n\t//find scheme handler\n\tconst schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n\n\t//perform scheme specific serialization\n\tif (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);\n\n\tif (components.host) {\n\t\t//if host component is an IPv6 address\n\t\tif (protocol.IPV6ADDRESS.test(components.host)) {\n\t\t\t//TODO: normalize IPv6 address as per RFC 5952\n\t\t}\n\n\t\t//if host component is a domain name\n\t\telse if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {\n\t\t\t//convert IDN via punycode\n\t\t\ttry {\n\t\t\t\tcomponents.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));\n\t\t\t} catch (e) {\n\t\t\t\tcomponents.error = components.error || \"Host's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n\t\t\t}\n\t\t}\n\t}\n\n\t//normalize encoding\n\t_normalizeComponentEncoding(components, protocol);\n\n\tif (options.reference !== \"suffix\" && components.scheme) {\n\t\turiTokens.push(components.scheme);\n\t\turiTokens.push(\":\");\n\t}\n\n\tconst authority = _recomposeAuthority(components, options);\n\tif (authority !== undefined) {\n\t\tif (options.reference !== \"suffix\") {\n\t\t\turiTokens.push(\"//\");\n\t\t}\n\n\t\turiTokens.push(authority);\n\n\t\tif (components.path && components.path.charAt(0) !== \"/\") {\n\t\t\turiTokens.push(\"/\");\n\t\t}\n\t}\n\n\tif (components.path !== undefined) {\n\t\tlet s = components.path;\n\n\t\tif (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {\n\t\t\ts = removeDotSegments(s);\n\t\t}\n\n\t\tif (authority === undefined) {\n\t\t\ts = s.replace(/^\\/\\//, \"/%2F\"); //don't allow the path to start with \"//\"\n\t\t}\n\n\t\turiTokens.push(s);\n\t}\n\n\tif (components.query !== undefined) {\n\t\turiTokens.push(\"?\");\n\t\turiTokens.push(components.query);\n\t}\n\n\tif (components.fragment !== undefined) {\n\t\turiTokens.push(\"#\");\n\t\turiTokens.push(components.fragment);\n\t}\n\n\treturn uriTokens.join(\"\"); //merge tokens into a string\n};\n\nexport function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {\n\tconst target:URIComponents = {};\n\n\tif (!skipNormalization) {\n\t\tbase = parse(serialize(base, options), options); //normalize base components\n\t\trelative = parse(serialize(relative, options), options); //normalize relative components\n\t}\n\toptions = options || {};\n\n\tif (!options.tolerant && relative.scheme) {\n\t\ttarget.scheme = relative.scheme;\n\t\t//target.authority = relative.authority;\n\t\ttarget.userinfo = relative.userinfo;\n\t\ttarget.host = relative.host;\n\t\ttarget.port = relative.port;\n\t\ttarget.path = removeDotSegments(relative.path || \"\");\n\t\ttarget.query = relative.query;\n\t} else {\n\t\tif (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {\n\t\t\t//target.authority = relative.authority;\n\t\t\ttarget.userinfo = relative.userinfo;\n\t\t\ttarget.host = relative.host;\n\t\t\ttarget.port = relative.port;\n\t\t\ttarget.path = removeDotSegments(relative.path || \"\");\n\t\t\ttarget.query = relative.query;\n\t\t} else {\n\t\t\tif (!relative.path) {\n\t\t\t\ttarget.path = base.path;\n\t\t\t\tif (relative.query !== undefined) {\n\t\t\t\t\ttarget.query = relative.query;\n\t\t\t\t} else {\n\t\t\t\t\ttarget.query = base.query;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (relative.path.charAt(0) === \"/\") {\n\t\t\t\t\ttarget.path = removeDotSegments(relative.path);\n\t\t\t\t} else {\n\t\t\t\t\tif ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {\n\t\t\t\t\t\ttarget.path = \"/\" + relative.path;\n\t\t\t\t\t} else if (!base.path) {\n\t\t\t\t\t\ttarget.path = relative.path;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.path = base.path.slice(0, base.path.lastIndexOf(\"/\") + 1) + relative.path;\n\t\t\t\t\t}\n\t\t\t\t\ttarget.path = removeDotSegments(target.path);\n\t\t\t\t}\n\t\t\t\ttarget.query = relative.query;\n\t\t\t}\n\t\t\t//target.authority = base.authority;\n\t\t\ttarget.userinfo = base.userinfo;\n\t\t\ttarget.host = base.host;\n\t\t\ttarget.port = base.port;\n\t\t}\n\t\ttarget.scheme = base.scheme;\n\t}\n\n\ttarget.fragment = relative.fragment;\n\n\treturn target;\n};\n\nexport function resolve(baseURI:string, relativeURI:string, options?:URIOptions):string {\n\tconst schemelessOptions = assign({ scheme : 'null' }, options);\n\treturn serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);\n};\n\nexport function normalize(uri:string, options?:URIOptions):string;\nexport function normalize(uri:URIComponents, options?:URIOptions):URIComponents;\nexport function normalize(uri:any, options?:URIOptions):any {\n\tif (typeof uri === \"string\") {\n\t\turi = serialize(parse(uri, options), options);\n\t} else if (typeOf(uri) === \"object\") {\n\t\turi = parse(serialize(uri, options), options);\n\t}\n\n\treturn uri;\n};\n\nexport function equal(uriA:string, uriB:string, options?: URIOptions):boolean;\nexport function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean;\nexport function equal(uriA:any, uriB:any, options?:URIOptions):boolean {\n\tif (typeof uriA === \"string\") {\n\t\turiA = serialize(parse(uriA, options), options);\n\t} else if (typeOf(uriA) === \"object\") {\n\t\turiA = serialize(uriA, options);\n\t}\n\n\tif (typeof uriB === \"string\") {\n\t\turiB = serialize(parse(uriB, options), options);\n\t} else if (typeOf(uriB) === \"object\") {\n\t\turiB = serialize(uriB, options);\n\t}\n\n\treturn uriA === uriB;\n};\n\nexport function escapeComponent(str:string, options?:URIOptions):string {\n\treturn str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);\n};\n\nexport function unescapeComponent(str:string, options?:URIOptions):string {\n\treturn str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);\n};\n","'use strict';\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tconst result = [];\n\tlet length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tconst parts = string.split('@');\n\tlet result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tconst labels = string.split('.');\n\tconst encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tconst output = [];\n\tlet counter = 0;\n\tconst length = string.length;\n\twhile (counter < length) {\n\t\tconst value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tconst extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = array => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function(delta, numPoints, firstTime) {\n\tlet k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function(input) {\n\t// Don't use UCS-2.\n\tconst output = [];\n\tconst inputLength = input.length;\n\tlet i = 0;\n\tlet n = initialN;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tlet basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (let j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tlet oldi = i;\n\t\tfor (let w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror('invalid-input');\n\t\t\t}\n\n\t\t\tconst digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\n\t\t}\n\n\t\tconst out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\n\t}\n\n\treturn String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function(input) {\n\tconst output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tlet inputLength = input.length;\n\n\t// Initialize the state.\n\tlet n = initialN;\n\tlet delta = 0;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points.\n\tfor (const currentValue of input) {\n\t\tif (currentValue < 0x80) {\n\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t}\n\t}\n\n\tlet basicLength = output.length;\n\tlet handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tlet m = maxInt;\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\tm = currentValue;\n\t\t\t}\n\t\t}\n\n\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t// but guard against overflow.\n\t\tconst handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\t\t\tif (currentValue == n) {\n\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\tlet q = delta;\n\t\t\t\tfor (let k = base; /* no condition */; k += base) {\n\t\t\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tconst qMinusT = q - t;\n\t\t\t\t\tconst baseMinusT = base - t;\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t);\n\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t}\n\n\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\tdelta = 0;\n\t\t\t\t++handledCPCount;\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexPunycode.test(string)\n\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t: string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexNonASCII.test(string)\n\t\t\t? 'xn--' + encode(string)\n\t\t\t: string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nconst punycode = {\n\t/**\n\t * A string representing the current Punycode.js version number.\n\t * @memberOf punycode\n\t * @type String\n\t */\n\t'version': '2.1.0',\n\t/**\n\t * An object of methods to convert from JavaScript's internal character\n\t * representation (UCS-2) to Unicode code points, and back.\n\t * @see \n\t * @memberOf punycode\n\t * @type Object\n\t */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\nexport default punycode;\n","import { URIRegExps } from \"./uri\";\nimport { buildExps } from \"./regexps-uri\";\n\nexport default buildExps(true);\n","import { URIRegExps } from \"./uri\";\nimport { merge, subexp } from \"./util\";\n\nexport function buildExps(isIRI:boolean):URIRegExps {\n\tconst\n\t\tALPHA$$ = \"[A-Za-z]\",\n\t\tCR$ = \"[\\\\x0D]\",\n\t\tDIGIT$$ = \"[0-9]\",\n\t\tDQUOTE$$ = \"[\\\\x22]\",\n\t\tHEXDIG$$ = merge(DIGIT$$, \"[A-Fa-f]\"), //case-insensitive\n\t\tLF$$ = \"[\\\\x0A]\",\n\t\tSP$$ = \"[\\\\x20]\",\n\t\tPCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)), //expanded\n\t\tGEN_DELIMS$$ = \"[\\\\:\\\\/\\\\?\\\\#\\\\[\\\\]\\\\@]\",\n\t\tSUB_DELIMS$$ = \"[\\\\!\\\\$\\\\&\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\=]\",\n\t\tRESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),\n\t\tUCSCHAR$$ = isIRI ? \"[\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF]\" : \"[]\", //subset, excludes bidi control characters\n\t\tIPRIVATE$$ = isIRI ? \"[\\\\uE000-\\\\uF8FF]\" : \"[]\", //subset\n\t\tUNRESERVED$$ = merge(ALPHA$$, DIGIT$$, \"[\\\\-\\\\.\\\\_\\\\~]\", UCSCHAR$$),\n\t\tSCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\") + \"*\"),\n\t\tUSERINFO$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\")) + \"*\"),\n\t\tDEC_OCTET$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"[1-9]\" + DIGIT$$) + \"|\" + DIGIT$$),\n\t\tDEC_OCTET_RELAXED$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"0?[1-9]\" + DIGIT$$) + \"|0?0?\" + DIGIT$$), //relaxed parsing rules\n\t\tIPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$),\n\t\tH16$ = subexp(HEXDIG$$ + \"{1,4}\"),\n\t\tLS32$ = subexp(subexp(H16$ + \"\\\\:\" + H16$) + \"|\" + IPV4ADDRESS$),\n\t\tIPV6ADDRESS1$ = subexp( subexp(H16$ + \"\\\\:\") + \"{6}\" + LS32$), // 6( h16 \":\" ) ls32\n\t\tIPV6ADDRESS2$ = subexp( \"\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{5}\" + LS32$), // \"::\" 5( h16 \":\" ) ls32\n\t\tIPV6ADDRESS3$ = subexp(subexp( H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{4}\" + LS32$), //[ h16 ] \"::\" 4( h16 \":\" ) ls32\n\t\tIPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,1}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{3}\" + LS32$), //[ *1( h16 \":\" ) h16 ] \"::\" 3( h16 \":\" ) ls32\n\t\tIPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,2}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{2}\" + LS32$), //[ *2( h16 \":\" ) h16 ] \"::\" 2( h16 \":\" ) ls32\n\t\tIPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,3}\" + H16$) + \"?\\\\:\\\\:\" + H16$ + \"\\\\:\" + LS32$), //[ *3( h16 \":\" ) h16 ] \"::\" h16 \":\" ls32\n\t\tIPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,4}\" + H16$) + \"?\\\\:\\\\:\" + LS32$), //[ *4( h16 \":\" ) h16 ] \"::\" ls32\n\t\tIPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,5}\" + H16$) + \"?\\\\:\\\\:\" + H16$ ), //[ *5( h16 \":\" ) h16 ] \"::\" h16\n\t\tIPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,6}\" + H16$) + \"?\\\\:\\\\:\" ), //[ *6( h16 \":\" ) h16 ] \"::\"\n\t\tIPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join(\"|\")),\n\t\tZONEID$ = subexp(subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$) + \"+\"), //RFC 6874\n\t\tIPV6ADDRZ$ = subexp(IPV6ADDRESS$ + \"\\\\%25\" + ZONEID$), //RFC 6874\n\t\tIPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + ZONEID$), //RFC 6874, with relaxed parsing rules\n\t\tIPVFUTURE$ = subexp(\"[vV]\" + HEXDIG$$ + \"+\\\\.\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\") + \"+\"),\n\t\tIP_LITERAL$ = subexp(\"\\\\[\" + subexp(IPV6ADDRZ_RELAXED$ + \"|\" + IPV6ADDRESS$ + \"|\" + IPVFUTURE$) + \"\\\\]\"), //RFC 6874\n\t\tREG_NAME$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$)) + \"*\"),\n\t\tHOST$ = subexp(IP_LITERAL$ + \"|\" + IPV4ADDRESS$ + \"(?!\" + REG_NAME$ + \")\" + \"|\" + REG_NAME$),\n\t\tPORT$ = subexp(DIGIT$$ + \"*\"),\n\t\tAUTHORITY$ = subexp(subexp(USERINFO$ + \"@\") + \"?\" + HOST$ + subexp(\"\\\\:\" + PORT$) + \"?\"),\n\t\tPCHAR$ = subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@]\")),\n\t\tSEGMENT$ = subexp(PCHAR$ + \"*\"),\n\t\tSEGMENT_NZ$ = subexp(PCHAR$ + \"+\"),\n\t\tSEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\@]\")) + \"+\"),\n\t\tPATH_ABEMPTY$ = subexp(subexp(\"\\\\/\" + SEGMENT$) + \"*\"),\n\t\tPATH_ABSOLUTE$ = subexp(\"\\\\/\" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + \"?\"), //simplified\n\t\tPATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified\n\t\tPATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified\n\t\tPATH_EMPTY$ = \"(?!\" + PCHAR$ + \")\",\n\t\tPATH$ = subexp(PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n\t\tQUERY$ = subexp(subexp(PCHAR$ + \"|\" + merge(\"[\\\\/\\\\?]\", IPRIVATE$$)) + \"*\"),\n\t\tFRAGMENT$ = subexp(subexp(PCHAR$ + \"|[\\\\/\\\\?]\") + \"*\"),\n\t\tHIER_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n\t\tURI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n\t\tRELATIVE_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$),\n\t\tRELATIVE$ = subexp(RELATIVE_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n\t\tURI_REFERENCE$ = subexp(URI$ + \"|\" + RELATIVE$),\n\t\tABSOLUTE_URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\"),\n\n\t\tGENERIC_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tRELATIVE_REF$ = \"^(){0}\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tABSOLUTE_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?$\",\n\t\tSAMEDOC_REF$ = \"^\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tAUTHORITY_REF$ = \"^\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?$\"\n\t;\n\n\treturn {\n\t\tNOT_SCHEME : new RegExp(merge(\"[^]\", ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\"), \"g\"),\n\t\tNOT_USERINFO : new RegExp(merge(\"[^\\\\%\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_HOST : new RegExp(merge(\"[^\\\\%\\\\[\\\\]\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_PATH : new RegExp(merge(\"[^\\\\%\\\\/\\\\:\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_PATH_NOSCHEME : new RegExp(merge(\"[^\\\\%\\\\/\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_QUERY : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\", IPRIVATE$$), \"g\"),\n\t\tNOT_FRAGMENT : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\"), \"g\"),\n\t\tESCAPE : new RegExp(merge(\"[^]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tUNRESERVED : new RegExp(UNRESERVED$$, \"g\"),\n\t\tOTHER_CHARS : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, RESERVED$$), \"g\"),\n\t\tPCT_ENCODED : new RegExp(PCT_ENCODED$, \"g\"),\n\t\tIPV4ADDRESS : new RegExp(\"^(\" + IPV4ADDRESS$ + \")$\"),\n\t\tIPV6ADDRESS : new RegExp(\"^\\\\[?(\" + IPV6ADDRESS$ + \")\" + subexp(subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + \"(\" + ZONEID$ + \")\") + \"?\\\\]?$\") //RFC 6874, with relaxed parsing rules\n\t};\n}\n\nexport default buildExps(false);\n","export function merge(...sets:Array):string {\n\tif (sets.length > 1) {\n\t\tsets[0] = sets[0].slice(0, -1);\n\t\tconst xl = sets.length - 1;\n\t\tfor (let x = 1; x < xl; ++x) {\n\t\t\tsets[x] = sets[x].slice(1, -1);\n\t\t}\n\t\tsets[xl] = sets[xl].slice(1);\n\t\treturn sets.join('');\n\t} else {\n\t\treturn sets[0];\n\t}\n}\n\nexport function subexp(str:string):string {\n\treturn \"(?:\" + str + \")\";\n}\n\nexport function typeOf(o:any):string {\n\treturn o === undefined ? \"undefined\" : (o === null ? \"null\" : Object.prototype.toString.call(o).split(\" \").pop().split(\"]\").shift().toLowerCase());\n}\n\nexport function toUpperCase(str:string):string {\n\treturn str.toUpperCase();\n}\n\nexport function toArray(obj:any):Array {\n\treturn obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== \"number\" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];\n}\n\n\nexport function assign(target: object, source: any): any {\n\tconst obj = target as any;\n\tif (source) {\n\t\tfor (const key in source) {\n\t\t\tobj[key] = source[key];\n\t\t}\n\t}\n\treturn obj;\n}"],"names":["SCHEMES","uuid","scheme","urn","mailto","wss","ws","https","http","urnComponents","nss","uuidComponents","toLowerCase","options","error","tolerant","match","UUID","undefined","handler","uriComponents","path","nid","schemeHandler","serialize","urnScheme","parse","matches","components","URN_PARSE","query","fields","join","length","push","name","replace","PCT_ENCODED","decodeUnreserved","toUpperCase","NOT_HFNAME","pctEncChar","headers","NOT_HFVALUE","O","mailtoComponents","body","subject","to","x","localPart","domain","iri","e","punycode","toASCII","unescapeComponent","toUnicode","toAddr","slice","atIdx","NOT_LOCAL_PART","lastIndexOf","String","xl","toArray","addr","unicodeSupport","split","unknownHeaders","hfield","toAddrs","hfields","decStr","UNRESERVED","str","pctDecChars","RegExp","merge","UNRESERVED$$","SOME_DELIMS$$","ATEXT$$","VCHAR$$","PCT_ENCODED$","QTEXT$$","subexp","HEXDIG$$","isIRI","domainHost","wsComponents","fragment","resourceName","secure","port","isSecure","host","toString","URI_PROTOCOL","IRI_PROTOCOL","ESCAPE","escapeComponent","uriA","uriB","typeOf","equal","uri","normalize","resolveComponents","baseURI","schemelessOptions","relativeURI","assign","resolve","target","relative","base","userinfo","removeDotSegments","charAt","skipNormalization","uriTokens","s","authority","absolutePath","reference","_recomposeAuthority","protocol","IPV6ADDRESS","test","output","Error","input","im","RDS5","pop","RDS3","RDS2","RDS1","$1","$2","_normalizeIPv6","_normalizeIPv4","_","uriString","isNaN","indexOf","parseInt","NO_MATCH_IS_UNDEFINED","URI_PARSE","newHost","zone","newFirst","newLast","longestZeroFields","index","b","a","allZeroFields","sort","acc","lastLongest","field","reduce","fieldCount","isLastFieldIPv4Address","firstFields","lastFields","lastFieldsStart","Array","IPV4ADDRESS","last","map","_stripLeadingZeros","first","address","reverse","NOT_FRAGMENT","NOT_QUERY","NOT_PATH","NOT_PATH_NOSCHEME","NOT_HOST","NOT_USERINFO","NOT_SCHEME","_normalizeComponentEncoding","newStr","substr","i","fromCharCode","c","c2","c3","il","chr","charCodeAt","encode","decode","ucs2encode","ucs2decode","regexNonASCII","string","mapDomain","regexPunycode","n","delta","handledCPCount","adapt","handledCPCountPlusOne","basicLength","stringFromCharCode","digitToBasic","q","floor","qMinusT","baseMinusT","t","k","bias","tMin","tMax","currentValue","maxInt","m","inputLength","delimiter","initialBias","initialN","fromCodePoint","splice","out","oldi","w","digit","basicToDigit","basic","j","baseMinusTMin","skew","numPoints","firstTime","damp","flag","codePoint","array","value","extra","counter","result","encoded","labels","fn","regexSeparators","parts","RangeError","errors","type","Math","buildExps","IPV6ADDRESS$","ZONEID$","IPV4ADDRESS$","RESERVED$$","SUB_DELIMS$$","IPRIVATE$$","ALPHA$$","DIGIT$$","AUTHORITY_REF$","USERINFO$","HOST$","PORT$","SAMEDOC_REF$","FRAGMENT$","ABSOLUTE_REF$","SCHEME$","PATH_ABEMPTY$","PATH_ABSOLUTE$","PATH_ROOTLESS$","PATH_EMPTY$","QUERY$","RELATIVE_REF$","PATH_NOSCHEME$","GENERIC_REF$","ABSOLUTE_URI$","HIER_PART$","URI_REFERENCE$","URI$","RELATIVE$","RELATIVE_PART$","AUTHORITY$","PCHAR$","PATH$","SEGMENT_NZ$","SEGMENT_NZ_NC$","SEGMENT$","IP_LITERAL$","REG_NAME$","IPV6ADDRZ_RELAXED$","IPVFUTURE$","IPV6ADDRESS1$","IPV6ADDRESS2$","IPV6ADDRESS3$","IPV6ADDRESS4$","IPV6ADDRESS5$","IPV6ADDRESS6$","IPV6ADDRESS7$","IPV6ADDRESS8$","IPV6ADDRESS9$","H16$","LS32$","DEC_OCTET_RELAXED$","DEC_OCTET$","UCSCHAR$$","GEN_DELIMS$$","SP$$","DQUOTE$$","CR$","obj","key","source","setInterval","call","prototype","o","Object","shift","sets"],"mappings":";;;;;;;AYAA,SAAA8E,KAAA,GAAA;sCAAyBsP,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AuCI,OAAvC,EAAT;YACQF,iBAAiBF,aAAvB;uBACeR,IAAf,GAAsBU,eAAeD,GAArC;uBACeA,GAAf,GAAqBQ,SAArB;YAEI,CAACL,QAAQE,QAAT,KAAsB,CAACJ,eAAeV,IAAhB,IAAwB,CAACU,eAAeV,IAAf,CAAoBe,KAApB,CAA0BC,IAA1B,CAA/C,CAAJ,EAAqF;2BACrEH,KAAf,GAAuBH,eAAeG,KAAf,IAAwB,oBAA/C;;eAGMH,cAAP;KAZ0E;eAe/D,mBAAUA,cAAV,EAAyCE,OAAzC,EAAb;YACQJ,gBAAgBE,cAAtB;;sBAEcD,GAAd,GAAoB,CAACC,eAAeV,IAAf,IAAuB,EAAxB,EAA4BW,WAA5B,EAApB;eACOH,aAAP;;CAnBF,CAuBA;;ADhCAT,QAAQQ,QAAKN,MAAb,IAAuBM,OAAvB;AAEA,AACAR,QAAQO,UAAML,MAAd,IAAwBK,SAAxB;AAEA,AACAP,QAAQM,UAAGJ,MAAX,IAAqBI,SAArB;AAEA,AACAN,QAAQK,UAAIH,MAAZ,IAAsBG,SAAtB;AAEA,AACAL,QAAQI,UAAOF,MAAf,IAAyBE,SAAzB;AAEA,AACAJ,QAAQG,UAAID,MAAZ,IAAsBC,SAAtB;AAEA,AACAH,QAAQC,UAAKC,MAAb,IAAuBD,SAAvB,CAEA;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/es5/uri.all.min.d.ts b/node_modules/uri-js/dist/es5/uri.all.min.d.ts new file mode 100755 index 0000000..da51e23 --- /dev/null +++ b/node_modules/uri-js/dist/es5/uri.all.min.d.ts @@ -0,0 +1,59 @@ +export interface URIComponents { + scheme?: string; + userinfo?: string; + host?: string; + port?: number | string; + path?: string; + query?: string; + fragment?: string; + reference?: string; + error?: string; +} +export interface URIOptions { + scheme?: string; + reference?: string; + tolerant?: boolean; + absolutePath?: boolean; + iri?: boolean; + unicodeSupport?: boolean; + domainHost?: boolean; +} +export interface URISchemeHandler { + scheme: string; + parse(components: ParentComponents, options: Options): Components; + serialize(components: Components, options: Options): ParentComponents; + unicodeSupport?: boolean; + domainHost?: boolean; + absolutePath?: boolean; +} +export interface URIRegExps { + NOT_SCHEME: RegExp; + NOT_USERINFO: RegExp; + NOT_HOST: RegExp; + NOT_PATH: RegExp; + NOT_PATH_NOSCHEME: RegExp; + NOT_QUERY: RegExp; + NOT_FRAGMENT: RegExp; + ESCAPE: RegExp; + UNRESERVED: RegExp; + OTHER_CHARS: RegExp; + PCT_ENCODED: RegExp; + IPV4ADDRESS: RegExp; + IPV6ADDRESS: RegExp; +} +export declare const SCHEMES: { + [scheme: string]: URISchemeHandler; +}; +export declare function pctEncChar(chr: string): string; +export declare function pctDecChars(str: string): string; +export declare function parse(uriString: string, options?: URIOptions): URIComponents; +export declare function removeDotSegments(input: string): string; +export declare function serialize(components: URIComponents, options?: URIOptions): string; +export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents; +export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string; +export declare function normalize(uri: string, options?: URIOptions): string; +export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents; +export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean; +export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean; +export declare function escapeComponent(str: string, options?: URIOptions): string; +export declare function unescapeComponent(str: string, options?: URIOptions): string; diff --git a/node_modules/uri-js/dist/es5/uri.all.min.js b/node_modules/uri-js/dist/es5/uri.all.min.js new file mode 100755 index 0000000..fcd8458 --- /dev/null +++ b/node_modules/uri-js/dist/es5/uri.all.min.js @@ -0,0 +1,3 @@ +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.URI=e.URI||{})}(this,function(e){"use strict";function r(){for(var e=arguments.length,r=Array(e),n=0;n1){r[0]=r[0].slice(0,-1);for(var t=r.length-1,o=1;o1&&(t=n[0]+"@",e=n[1]),e=e.replace(j,"."),t+f(e.split("."),r).join(".")}function p(e){for(var r=[],n=0,t=e.length;n=55296&&o<=56319&&n>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function d(e){for(var r="",n=0,t=e.length;n=194&&o<224){if(t-n>=6){var a=parseInt(e.substr(n+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(n,6);n+=6}else if(o>=224){if(t-n>=9){var i=parseInt(e.substr(n+4,2),16),u=parseInt(e.substr(n+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&u)}else r+=e.substr(n,9);n+=9}else r+=e.substr(n,3),n+=3}return r}function l(e,r){function n(e){var n=d(e);return n.match(r.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,n).toLowerCase().replace(r.NOT_SCHEME,"")),e.userinfo!==undefined&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,n).replace(r.NOT_USERINFO,h).replace(r.PCT_ENCODED,o)),e.host!==undefined&&(e.host=String(e.host).replace(r.PCT_ENCODED,n).toLowerCase().replace(r.NOT_HOST,h).replace(r.PCT_ENCODED,o)),e.path!==undefined&&(e.path=String(e.path).replace(r.PCT_ENCODED,n).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,h).replace(r.PCT_ENCODED,o)),e.query!==undefined&&(e.query=String(e.query).replace(r.PCT_ENCODED,n).replace(r.NOT_QUERY,h).replace(r.PCT_ENCODED,o)),e.fragment!==undefined&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,n).replace(r.NOT_FRAGMENT,h).replace(r.PCT_ENCODED,o)),e}function m(e){return e.replace(/^0*(.*)/,"$1")||"0"}function g(e,r){var n=e.match(r.IPV4ADDRESS)||[],t=T(n,2),o=t[1];return o?o.split(".").map(m).join("."):e}function v(e,r){var n=e.match(r.IPV6ADDRESS)||[],t=T(n,3),o=t[1],a=t[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),u=T(i,2),s=u[0],f=u[1],c=f?f.split(":").map(m):[],p=s.split(":").map(m),h=r.IPV4ADDRESS.test(p[p.length-1]),d=h?7:8,l=p.length-d,v=Array(d),E=0;E1){var A=v.slice(0,y.index),D=v.slice(y.index+y.length);S=A.join(":")+"::"+D.join(":")}else S=v.join(":");return a&&(S+="%"+a),S}return e}function E(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n={},t=!1!==r.iri?R:F;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(K);if(o){W?(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5])):(n.scheme=o[1]||undefined,n.userinfo=-1!==e.indexOf("@")?o[3]:undefined,n.host=-1!==e.indexOf("//")?o[4]:undefined,n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=-1!==e.indexOf("?")?o[7]:undefined,n.fragment=-1!==e.indexOf("#")?o[8]:undefined,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:undefined)),n.host&&(n.host=v(g(n.host,t),t)),n.scheme!==undefined||n.userinfo!==undefined||n.host!==undefined||n.port!==undefined||n.path||n.query!==undefined?n.scheme===undefined?n.reference="relative":n.fragment===undefined?n.reference="absolute":n.reference="uri":n.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");var a=J[(r.scheme||n.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)l(n,t);else{if(n.host&&(r.domainHost||a&&a.domainHost))try{n.host=B.toASCII(n.host.replace(t.PCT_ENCODED,d).toLowerCase())}catch(i){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+i}l(n,F)}a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}function C(e,r){var n=!1!==r.iri?R:F,t=[];return e.userinfo!==undefined&&(t.push(e.userinfo),t.push("@")),e.host!==undefined&&t.push(v(g(String(e.host),n),n).replace(n.IPV6ADDRESS,function(e,r,n){return"["+r+(n?"%25"+n:"")+"]"})),"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):undefined}function y(e){for(var r=[];e.length;)if(e.match(X))e=e.replace(X,"");else if(e.match(ee))e=e.replace(ee,"/");else if(e.match(re))e=e.replace(re,"/"),r.pop();else if("."===e||".."===e)e="";else{var n=e.match(ne);if(!n)throw new Error("Unexpected dot segment condition");var t=n[0];e=e.slice(t.length),r.push(t)}return r.join("")}function S(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=r.iri?R:F,t=[],o=J[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(n.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?B.toUnicode(e.host):B.toASCII(e.host.replace(n.PCT_ENCODED,d).toLowerCase())}catch(u){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+u}l(e,n),"suffix"!==r.reference&&e.scheme&&(t.push(e.scheme),t.push(":"));var a=C(e,r);if(a!==undefined&&("suffix"!==r.reference&&t.push("//"),t.push(a),e.path&&"/"!==e.path.charAt(0)&&t.push("/")),e.path!==undefined){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=y(i)),a===undefined&&(i=i.replace(/^\/\//,"/%2F")),t.push(i)}return e.query!==undefined&&(t.push("?"),t.push(e.query)),e.fragment!==undefined&&(t.push("#"),t.push(e.fragment)),t.join("")}function A(e,r){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},t=arguments[3],o={};return t||(e=E(S(e,n),n),r=E(S(r,n),n)),n=n||{},!n.tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=y(r.path||""),o.query=r.query):(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=y(r.path||""),o.query=r.query):(r.path?("/"===r.path.charAt(0)?o.path=y(r.path):(e.userinfo===undefined&&e.host===undefined&&e.port===undefined||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=y(o.path)),o.query=r.query):(o.path=e.path,r.query!==undefined?o.query=r.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=r.fragment,o}function D(e,r,n){var t=i({scheme:"null"},n);return S(A(E(e,t),E(r,t),t,!0),t)}function w(e,r){return"string"==typeof e?e=S(E(e,r),r):"object"===t(e)&&(e=E(S(e,r),r)),e}function b(e,r,n){return"string"==typeof e?e=S(E(e,n),n):"object"===t(e)&&(e=S(e,n)),"string"==typeof r?r=S(E(r,n),n):"object"===t(r)&&(r=S(r,n)),e===r}function x(e,r){return e&&e.toString().replace(r&&r.iri?R.ESCAPE:F.ESCAPE,h)}function O(e,r){return e&&e.toString().replace(r&&r.iri?R.PCT_ENCODED:F.PCT_ENCODED,d)}function N(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function I(e){var r=d(e);return r.match(he)?r:e}var F=u(!1),R=u(!0),T=function(){function e(e,r){var n=[],t=!0,o=!1,a=undefined;try{for(var i,u=e[Symbol.iterator]();!(t=(i=u.next()).done)&&(n.push(i.value),!r||n.length!==r);t=!0);}catch(s){o=!0,a=s}finally{try{!t&&u["return"]&&u["return"]()}finally{if(o)throw a}}return n}return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_=function(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=Math.floor,L=String.fromCharCode,$=function(e){return String.fromCodePoint.apply(String,_(e))},M=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},V=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},k=function(e,r,n){var t=0;for(e=n?z(e/700):e>>1,e+=z(e/r);e>455;t+=36)e=z(e/35);return z(t+36*e/(e+38))},Z=function(e){var r=[],n=e.length,t=0,o=128,a=72,i=e.lastIndexOf("-");i<0&&(i=0);for(var u=0;u=128&&s("not-basic"),r.push(e.charCodeAt(u));for(var f=i>0?i+1:0;f=n&&s("invalid-input");var d=M(e.charCodeAt(f++));(d>=36||d>z((P-t)/p))&&s("overflow"),t+=d*p;var l=h<=a?1:h>=a+26?26:h-a;if(dz(P/m)&&s("overflow"),p*=m}var g=r.length+1;a=k(t-c,g,0==c),z(t/g)>P-o&&s("overflow"),o+=z(t/g),t%=g,r.splice(t++,0,o)}return String.fromCodePoint.apply(String,r)},G=function(e){var r=[];e=p(e);var n=e.length,t=128,o=0,a=72,i=!0,u=!1,f=undefined;try{for(var c,h=e[Symbol.iterator]();!(i=(c=h.next()).done);i=!0){var d=c.value;d<128&&r.push(L(d))}}catch(U){u=!0,f=U}finally{try{!i&&h["return"]&&h["return"]()}finally{if(u)throw f}}var l=r.length,m=l;for(l&&r.push("-");m=t&&Az((P-o)/D)&&s("overflow"),o+=(g-t)*D,t=g;var w=!0,b=!1,x=undefined;try{for(var O,N=e[Symbol.iterator]();!(w=(O=N.next()).done);w=!0){var I=O.value;if(IP&&s("overflow"),I==t){for(var F=o,R=36;;R+=36){var T=R<=a?1:R>=a+26?26:R-a;if(FA-Z\\x5E-\\x7E]",'[\\"\\\\]'),he=new RegExp(se,"g"),de=new RegExp(ce,"g"),le=new RegExp(r("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',pe),"g"),me=new RegExp(r("[^]",se,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ge=me,ve={scheme:"mailto",parse:function(e,r){var n=e,t=n.to=n.path?n.path.split(","):[];if(n.path=undefined,n.query){for(var o=!1,a={},i=n.query.split("&"),u=0,s=i.length;u):string {\n\tif (sets.length > 1) {\n\t\tsets[0] = sets[0].slice(0, -1);\n\t\tconst xl = sets.length - 1;\n\t\tfor (let x = 1; x < xl; ++x) {\n\t\t\tsets[x] = sets[x].slice(1, -1);\n\t\t}\n\t\tsets[xl] = sets[xl].slice(1);\n\t\treturn sets.join('');\n\t} else {\n\t\treturn sets[0];\n\t}\n}\n\nexport function subexp(str:string):string {\n\treturn \"(?:\" + str + \")\";\n}\n\nexport function typeOf(o:any):string {\n\treturn o === undefined ? \"undefined\" : (o === null ? \"null\" : Object.prototype.toString.call(o).split(\" \").pop().split(\"]\").shift().toLowerCase());\n}\n\nexport function toUpperCase(str:string):string {\n\treturn str.toUpperCase();\n}\n\nexport function toArray(obj:any):Array {\n\treturn obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== \"number\" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];\n}\n\n\nexport function assign(target: object, source: any): any {\n\tconst obj = target as any;\n\tif (source) {\n\t\tfor (const key in source) {\n\t\t\tobj[key] = source[key];\n\t\t}\n\t}\n\treturn obj;\n}","import { URIRegExps } from \"./uri\";\nimport { merge, subexp } from \"./util\";\n\nexport function buildExps(isIRI:boolean):URIRegExps {\n\tconst\n\t\tALPHA$$ = \"[A-Za-z]\",\n\t\tCR$ = \"[\\\\x0D]\",\n\t\tDIGIT$$ = \"[0-9]\",\n\t\tDQUOTE$$ = \"[\\\\x22]\",\n\t\tHEXDIG$$ = merge(DIGIT$$, \"[A-Fa-f]\"), //case-insensitive\n\t\tLF$$ = \"[\\\\x0A]\",\n\t\tSP$$ = \"[\\\\x20]\",\n\t\tPCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)), //expanded\n\t\tGEN_DELIMS$$ = \"[\\\\:\\\\/\\\\?\\\\#\\\\[\\\\]\\\\@]\",\n\t\tSUB_DELIMS$$ = \"[\\\\!\\\\$\\\\&\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\=]\",\n\t\tRESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),\n\t\tUCSCHAR$$ = isIRI ? \"[\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF]\" : \"[]\", //subset, excludes bidi control characters\n\t\tIPRIVATE$$ = isIRI ? \"[\\\\uE000-\\\\uF8FF]\" : \"[]\", //subset\n\t\tUNRESERVED$$ = merge(ALPHA$$, DIGIT$$, \"[\\\\-\\\\.\\\\_\\\\~]\", UCSCHAR$$),\n\t\tSCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\") + \"*\"),\n\t\tUSERINFO$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\")) + \"*\"),\n\t\tDEC_OCTET$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"[1-9]\" + DIGIT$$) + \"|\" + DIGIT$$),\n\t\tDEC_OCTET_RELAXED$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"0?[1-9]\" + DIGIT$$) + \"|0?0?\" + DIGIT$$), //relaxed parsing rules\n\t\tIPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$),\n\t\tH16$ = subexp(HEXDIG$$ + \"{1,4}\"),\n\t\tLS32$ = subexp(subexp(H16$ + \"\\\\:\" + H16$) + \"|\" + IPV4ADDRESS$),\n\t\tIPV6ADDRESS1$ = subexp( subexp(H16$ + \"\\\\:\") + \"{6}\" + LS32$), // 6( h16 \":\" ) ls32\n\t\tIPV6ADDRESS2$ = subexp( \"\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{5}\" + LS32$), // \"::\" 5( h16 \":\" ) ls32\n\t\tIPV6ADDRESS3$ = subexp(subexp( H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{4}\" + LS32$), //[ h16 ] \"::\" 4( h16 \":\" ) ls32\n\t\tIPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,1}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{3}\" + LS32$), //[ *1( h16 \":\" ) h16 ] \"::\" 3( h16 \":\" ) ls32\n\t\tIPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,2}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{2}\" + LS32$), //[ *2( h16 \":\" ) h16 ] \"::\" 2( h16 \":\" ) ls32\n\t\tIPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,3}\" + H16$) + \"?\\\\:\\\\:\" + H16$ + \"\\\\:\" + LS32$), //[ *3( h16 \":\" ) h16 ] \"::\" h16 \":\" ls32\n\t\tIPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,4}\" + H16$) + \"?\\\\:\\\\:\" + LS32$), //[ *4( h16 \":\" ) h16 ] \"::\" ls32\n\t\tIPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,5}\" + H16$) + \"?\\\\:\\\\:\" + H16$ ), //[ *5( h16 \":\" ) h16 ] \"::\" h16\n\t\tIPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,6}\" + H16$) + \"?\\\\:\\\\:\" ), //[ *6( h16 \":\" ) h16 ] \"::\"\n\t\tIPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join(\"|\")),\n\t\tZONEID$ = subexp(subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$) + \"+\"), //RFC 6874\n\t\tIPV6ADDRZ$ = subexp(IPV6ADDRESS$ + \"\\\\%25\" + ZONEID$), //RFC 6874\n\t\tIPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + ZONEID$), //RFC 6874, with relaxed parsing rules\n\t\tIPVFUTURE$ = subexp(\"[vV]\" + HEXDIG$$ + \"+\\\\.\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\") + \"+\"),\n\t\tIP_LITERAL$ = subexp(\"\\\\[\" + subexp(IPV6ADDRZ_RELAXED$ + \"|\" + IPV6ADDRESS$ + \"|\" + IPVFUTURE$) + \"\\\\]\"), //RFC 6874\n\t\tREG_NAME$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$)) + \"*\"),\n\t\tHOST$ = subexp(IP_LITERAL$ + \"|\" + IPV4ADDRESS$ + \"(?!\" + REG_NAME$ + \")\" + \"|\" + REG_NAME$),\n\t\tPORT$ = subexp(DIGIT$$ + \"*\"),\n\t\tAUTHORITY$ = subexp(subexp(USERINFO$ + \"@\") + \"?\" + HOST$ + subexp(\"\\\\:\" + PORT$) + \"?\"),\n\t\tPCHAR$ = subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@]\")),\n\t\tSEGMENT$ = subexp(PCHAR$ + \"*\"),\n\t\tSEGMENT_NZ$ = subexp(PCHAR$ + \"+\"),\n\t\tSEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\@]\")) + \"+\"),\n\t\tPATH_ABEMPTY$ = subexp(subexp(\"\\\\/\" + SEGMENT$) + \"*\"),\n\t\tPATH_ABSOLUTE$ = subexp(\"\\\\/\" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + \"?\"), //simplified\n\t\tPATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified\n\t\tPATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified\n\t\tPATH_EMPTY$ = \"(?!\" + PCHAR$ + \")\",\n\t\tPATH$ = subexp(PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n\t\tQUERY$ = subexp(subexp(PCHAR$ + \"|\" + merge(\"[\\\\/\\\\?]\", IPRIVATE$$)) + \"*\"),\n\t\tFRAGMENT$ = subexp(subexp(PCHAR$ + \"|[\\\\/\\\\?]\") + \"*\"),\n\t\tHIER_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n\t\tURI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n\t\tRELATIVE_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$),\n\t\tRELATIVE$ = subexp(RELATIVE_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n\t\tURI_REFERENCE$ = subexp(URI$ + \"|\" + RELATIVE$),\n\t\tABSOLUTE_URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\"),\n\n\t\tGENERIC_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tRELATIVE_REF$ = \"^(){0}\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tABSOLUTE_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?$\",\n\t\tSAMEDOC_REF$ = \"^\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n\t\tAUTHORITY_REF$ = \"^\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?$\"\n\t;\n\n\treturn {\n\t\tNOT_SCHEME : new RegExp(merge(\"[^]\", ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\"), \"g\"),\n\t\tNOT_USERINFO : new RegExp(merge(\"[^\\\\%\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_HOST : new RegExp(merge(\"[^\\\\%\\\\[\\\\]\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_PATH : new RegExp(merge(\"[^\\\\%\\\\/\\\\:\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_PATH_NOSCHEME : new RegExp(merge(\"[^\\\\%\\\\/\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tNOT_QUERY : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\", IPRIVATE$$), \"g\"),\n\t\tNOT_FRAGMENT : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\"), \"g\"),\n\t\tESCAPE : new RegExp(merge(\"[^]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n\t\tUNRESERVED : new RegExp(UNRESERVED$$, \"g\"),\n\t\tOTHER_CHARS : new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, RESERVED$$), \"g\"),\n\t\tPCT_ENCODED : new RegExp(PCT_ENCODED$, \"g\"),\n\t\tIPV4ADDRESS : new RegExp(\"^(\" + IPV4ADDRESS$ + \")$\"),\n\t\tIPV6ADDRESS : new RegExp(\"^\\\\[?(\" + IPV6ADDRESS$ + \")\" + subexp(subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + \"(\" + ZONEID$ + \")\") + \"?\\\\]?$\") //RFC 6874, with relaxed parsing rules\n\t};\n}\n\nexport default buildExps(false);\n","'use strict';\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tconst result = [];\n\tlet length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tconst parts = string.split('@');\n\tlet result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tconst labels = string.split('.');\n\tconst encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tconst output = [];\n\tlet counter = 0;\n\tconst length = string.length;\n\twhile (counter < length) {\n\t\tconst value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tconst extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = array => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function(delta, numPoints, firstTime) {\n\tlet k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function(input) {\n\t// Don't use UCS-2.\n\tconst output = [];\n\tconst inputLength = input.length;\n\tlet i = 0;\n\tlet n = initialN;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tlet basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (let j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tlet oldi = i;\n\t\tfor (let w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror('invalid-input');\n\t\t\t}\n\n\t\t\tconst digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\n\t\t}\n\n\t\tconst out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\n\t}\n\n\treturn String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function(input) {\n\tconst output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tlet inputLength = input.length;\n\n\t// Initialize the state.\n\tlet n = initialN;\n\tlet delta = 0;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points.\n\tfor (const currentValue of input) {\n\t\tif (currentValue < 0x80) {\n\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t}\n\t}\n\n\tlet basicLength = output.length;\n\tlet handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tlet m = maxInt;\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\tm = currentValue;\n\t\t\t}\n\t\t}\n\n\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t// but guard against overflow.\n\t\tconst handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\t\t\tif (currentValue == n) {\n\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\tlet q = delta;\n\t\t\t\tfor (let k = base; /* no condition */; k += base) {\n\t\t\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tconst qMinusT = q - t;\n\t\t\t\t\tconst baseMinusT = base - t;\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t);\n\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t}\n\n\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\tdelta = 0;\n\t\t\t\t++handledCPCount;\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexPunycode.test(string)\n\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t: string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexNonASCII.test(string)\n\t\t\t? 'xn--' + encode(string)\n\t\t\t: string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nconst punycode = {\n\t/**\n\t * A string representing the current Punycode.js version number.\n\t * @memberOf punycode\n\t * @type String\n\t */\n\t'version': '2.1.0',\n\t/**\n\t * An object of methods to convert from JavaScript's internal character\n\t * representation (UCS-2) to Unicode code points, and back.\n\t * @see \n\t * @memberOf punycode\n\t * @type Object\n\t */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\nexport default punycode;\n","/**\n * URI.js\n *\n * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.\n * @author Gary Court\n * @see http://github.com/garycourt/uri-js\n */\n\n/**\n * Copyright 2011 Gary Court. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are\n * permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list\n * of conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation are those of the\n * authors and should not be interpreted as representing official policies, either expressed\n * or implied, of Gary Court.\n */\n\nimport URI_PROTOCOL from \"./regexps-uri\";\nimport IRI_PROTOCOL from \"./regexps-iri\";\nimport punycode from \"punycode\";\nimport { toUpperCase, typeOf, assign } from \"./util\";\n\nexport interface URIComponents {\n\tscheme?:string;\n\tuserinfo?:string;\n\thost?:string;\n\tport?:number|string;\n\tpath?:string;\n\tquery?:string;\n\tfragment?:string;\n\treference?:string;\n\terror?:string;\n}\n\nexport interface URIOptions {\n\tscheme?:string;\n\treference?:string;\n\ttolerant?:boolean;\n\tabsolutePath?:boolean;\n\tiri?:boolean;\n\tunicodeSupport?:boolean;\n\tdomainHost?:boolean;\n}\n\nexport interface URISchemeHandler {\n\tscheme:string;\n\tparse(components:ParentComponents, options:Options):Components;\n\tserialize(components:Components, options:Options):ParentComponents;\n\tunicodeSupport?:boolean;\n\tdomainHost?:boolean;\n\tabsolutePath?:boolean;\n}\n\nexport interface URIRegExps {\n\tNOT_SCHEME : RegExp,\n\tNOT_USERINFO : RegExp,\n\tNOT_HOST : RegExp,\n\tNOT_PATH : RegExp,\n\tNOT_PATH_NOSCHEME : RegExp,\n\tNOT_QUERY : RegExp,\n\tNOT_FRAGMENT : RegExp,\n\tESCAPE : RegExp,\n\tUNRESERVED : RegExp,\n\tOTHER_CHARS : RegExp,\n\tPCT_ENCODED : RegExp,\n\tIPV4ADDRESS : RegExp,\n\tIPV6ADDRESS : RegExp,\n}\n\nexport const SCHEMES:{[scheme:string]:URISchemeHandler} = {};\n\nexport function pctEncChar(chr:string):string {\n\tconst c = chr.charCodeAt(0);\n\tlet e:string;\n\n\tif (c < 16) e = \"%0\" + c.toString(16).toUpperCase();\n\telse if (c < 128) e = \"%\" + c.toString(16).toUpperCase();\n\telse if (c < 2048) e = \"%\" + ((c >> 6) | 192).toString(16).toUpperCase() + \"%\" + ((c & 63) | 128).toString(16).toUpperCase();\n\telse e = \"%\" + ((c >> 12) | 224).toString(16).toUpperCase() + \"%\" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + \"%\" + ((c & 63) | 128).toString(16).toUpperCase();\n\n\treturn e;\n}\n\nexport function pctDecChars(str:string):string {\n\tlet newStr = \"\";\n\tlet i = 0;\n\tconst il = str.length;\n\n\twhile (i < il) {\n\t\tconst c = parseInt(str.substr(i + 1, 2), 16);\n\n\t\tif (c < 128) {\n\t\t\tnewStr += String.fromCharCode(c);\n\t\t\ti += 3;\n\t\t}\n\t\telse if (c >= 194 && c < 224) {\n\t\t\tif ((il - i) >= 6) {\n\t\t\t\tconst c2 = parseInt(str.substr(i + 4, 2), 16);\n\t\t\t\tnewStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n\t\t\t} else {\n\t\t\t\tnewStr += str.substr(i, 6);\n\t\t\t}\n\t\t\ti += 6;\n\t\t}\n\t\telse if (c >= 224) {\n\t\t\tif ((il - i) >= 9) {\n\t\t\t\tconst c2 = parseInt(str.substr(i + 4, 2), 16);\n\t\t\t\tconst c3 = parseInt(str.substr(i + 7, 2), 16);\n\t\t\t\tnewStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n\t\t\t} else {\n\t\t\t\tnewStr += str.substr(i, 9);\n\t\t\t}\n\t\t\ti += 9;\n\t\t}\n\t\telse {\n\t\t\tnewStr += str.substr(i, 3);\n\t\t\ti += 3;\n\t\t}\n\t}\n\n\treturn newStr;\n}\n\nfunction _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {\n\tfunction decodeUnreserved(str:string):string {\n\t\tconst decStr = pctDecChars(str);\n\t\treturn (!decStr.match(protocol.UNRESERVED) ? str : decStr);\n\t}\n\n\tif (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, \"\");\n\tif (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\tif (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n\n\treturn components;\n};\n\nfunction _stripLeadingZeros(str:string):string {\n\treturn str.replace(/^0*(.*)/, \"$1\") || \"0\";\n}\n\nfunction _normalizeIPv4(host:string, protocol:URIRegExps):string {\n\tconst matches = host.match(protocol.IPV4ADDRESS) || [];\n\tconst [, address] = matches;\n\t\n\tif (address) {\n\t\treturn address.split(\".\").map(_stripLeadingZeros).join(\".\");\n\t} else {\n\t\treturn host;\n\t}\n}\n\nfunction _normalizeIPv6(host:string, protocol:URIRegExps):string {\n\tconst matches = host.match(protocol.IPV6ADDRESS) || [];\n\tconst [, address, zone] = matches;\n\n\tif (address) {\n\t\tconst [last, first] = address.toLowerCase().split('::').reverse();\n\t\tconst firstFields = first ? first.split(\":\").map(_stripLeadingZeros) : [];\n\t\tconst lastFields = last.split(\":\").map(_stripLeadingZeros);\n\t\tconst isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);\n\t\tconst fieldCount = isLastFieldIPv4Address ? 7 : 8;\n\t\tconst lastFieldsStart = lastFields.length - fieldCount;\n\t\tconst fields = Array(fieldCount);\n\n\t\tfor (let x = 0; x < fieldCount; ++x) {\n\t\t\tfields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';\n\t\t}\n\n\t\tif (isLastFieldIPv4Address) {\n\t\t\tfields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);\n\t\t}\n\n\t\tconst allZeroFields = fields.reduce>((acc, field, index) => {\n\t\t\tif (!field || field === \"0\") {\n\t\t\t\tconst lastLongest = acc[acc.length - 1];\n\t\t\t\tif (lastLongest && lastLongest.index + lastLongest.length === index) {\n\t\t\t\t\tlastLongest.length++;\n\t\t\t\t} else {\n\t\t\t\t\tacc.push({ index, length : 1 });\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, []);\n\n\t\tconst longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];\n\n\t\tlet newHost:string;\n\t\tif (longestZeroFields && longestZeroFields.length > 1) {\n\t\t\tconst newFirst = fields.slice(0, longestZeroFields.index) ;\n\t\t\tconst newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);\n\t\t\tnewHost = newFirst.join(\":\") + \"::\" + newLast.join(\":\");\n\t\t} else {\n\t\t\tnewHost = fields.join(\":\");\n\t\t}\n\n\t\tif (zone) {\n\t\t\tnewHost += \"%\" + zone;\n\t\t}\n\n\t\treturn newHost;\n\t} else {\n\t\treturn host;\n\t}\n}\n\nconst URI_PARSE = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:([^\\/?#@]*)@)?(\\[[^\\/?#\\]]+\\]|[^\\/?#:]*)(?:\\:(\\d*))?))?([^?#]*)(?:\\?([^#]*))?(?:#((?:.|\\n|\\r)*))?/i;\nconst NO_MATCH_IS_UNDEFINED = ((\"\").match(/(){0}/))[1] === undefined;\n\nexport function parse(uriString:string, options:URIOptions = {}):URIComponents {\n\tconst components:URIComponents = {};\n\tconst protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);\n\n\tif (options.reference === \"suffix\") uriString = (options.scheme ? options.scheme + \":\" : \"\") + \"//\" + uriString;\n\n\tconst matches = uriString.match(URI_PARSE);\n\n\tif (matches) {\n\t\tif (NO_MATCH_IS_UNDEFINED) {\n\t\t\t//store each component\n\t\t\tcomponents.scheme = matches[1];\n\t\t\tcomponents.userinfo = matches[3];\n\t\t\tcomponents.host = matches[4];\n\t\t\tcomponents.port = parseInt(matches[5], 10);\n\t\t\tcomponents.path = matches[6] || \"\";\n\t\t\tcomponents.query = matches[7];\n\t\t\tcomponents.fragment = matches[8];\n\n\t\t\t//fix port number\n\t\t\tif (isNaN(components.port)) {\n\t\t\t\tcomponents.port = matches[5];\n\t\t\t}\n\t\t} else { //IE FIX for improper RegExp matching\n\t\t\t//store each component\n\t\t\tcomponents.scheme = matches[1] || undefined;\n\t\t\tcomponents.userinfo = (uriString.indexOf(\"@\") !== -1 ? matches[3] : undefined);\n\t\t\tcomponents.host = (uriString.indexOf(\"//\") !== -1 ? matches[4] : undefined);\n\t\t\tcomponents.port = parseInt(matches[5], 10);\n\t\t\tcomponents.path = matches[6] || \"\";\n\t\t\tcomponents.query = (uriString.indexOf(\"?\") !== -1 ? matches[7] : undefined);\n\t\t\tcomponents.fragment = (uriString.indexOf(\"#\") !== -1 ? matches[8] : undefined);\n\n\t\t\t//fix port number\n\t\t\tif (isNaN(components.port)) {\n\t\t\t\tcomponents.port = (uriString.match(/\\/\\/(?:.|\\n)*\\:(?:\\/|\\?|\\#|$)/) ? matches[4] : undefined);\n\t\t\t}\n\t\t}\n\n\t\tif (components.host) {\n\t\t\t//normalize IP hosts\n\t\t\tcomponents.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);\n\t\t}\n\n\t\t//determine reference type\n\t\tif (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {\n\t\t\tcomponents.reference = \"same-document\";\n\t\t} else if (components.scheme === undefined) {\n\t\t\tcomponents.reference = \"relative\";\n\t\t} else if (components.fragment === undefined) {\n\t\t\tcomponents.reference = \"absolute\";\n\t\t} else {\n\t\t\tcomponents.reference = \"uri\";\n\t\t}\n\n\t\t//check for reference errors\n\t\tif (options.reference && options.reference !== \"suffix\" && options.reference !== components.reference) {\n\t\t\tcomponents.error = components.error || \"URI is not a \" + options.reference + \" reference.\";\n\t\t}\n\n\t\t//find scheme handler\n\t\tconst schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n\n\t\t//check if scheme can't handle IRIs\n\t\tif (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n\t\t\t//if host component is a domain name\n\t\t\tif (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {\n\t\t\t\t//convert Unicode IDN -> ASCII IDN\n\t\t\t\ttry {\n\t\t\t\t\tcomponents.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcomponents.error = components.error || \"Host's domain name can not be converted to ASCII via punycode: \" + e;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//convert IRI -> URI\n\t\t\t_normalizeComponentEncoding(components, URI_PROTOCOL);\n\t\t} else {\n\t\t\t//normalize encodings\n\t\t\t_normalizeComponentEncoding(components, protocol);\n\t\t}\n\n\t\t//perform scheme specific parsing\n\t\tif (schemeHandler && schemeHandler.parse) {\n\t\t\tschemeHandler.parse(components, options);\n\t\t}\n\t} else {\n\t\tcomponents.error = components.error || \"URI can not be parsed.\";\n\t}\n\n\treturn components;\n};\n\nfunction _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {\n\tconst protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);\n\tconst uriTokens:Array = [];\n\n\tif (components.userinfo !== undefined) {\n\t\turiTokens.push(components.userinfo);\n\t\turiTokens.push(\"@\");\n\t}\n\n\tif (components.host !== undefined) {\n\t\t//normalize IP hosts, add brackets and escape zone separator for IPv6\n\t\turiTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => \"[\" + $1 + ($2 ? \"%25\" + $2 : \"\") + \"]\"));\n\t}\n\n\tif (typeof components.port === \"number\" || typeof components.port === \"string\") {\n\t\turiTokens.push(\":\");\n\t\turiTokens.push(String(components.port));\n\t}\n\n\treturn uriTokens.length ? uriTokens.join(\"\") : undefined;\n};\n\nconst RDS1 = /^\\.\\.?\\//;\nconst RDS2 = /^\\/\\.(\\/|$)/;\nconst RDS3 = /^\\/\\.\\.(\\/|$)/;\nconst RDS4 = /^\\.\\.?$/;\nconst RDS5 = /^\\/?(?:.|\\n)*?(?=\\/|$)/;\n\nexport function removeDotSegments(input:string):string {\n\tconst output:Array = [];\n\n\twhile (input.length) {\n\t\tif (input.match(RDS1)) {\n\t\t\tinput = input.replace(RDS1, \"\");\n\t\t} else if (input.match(RDS2)) {\n\t\t\tinput = input.replace(RDS2, \"/\");\n\t\t} else if (input.match(RDS3)) {\n\t\t\tinput = input.replace(RDS3, \"/\");\n\t\t\toutput.pop();\n\t\t} else if (input === \".\" || input === \"..\") {\n\t\t\tinput = \"\";\n\t\t} else {\n\t\t\tconst im = input.match(RDS5);\n\t\t\tif (im) {\n\t\t\t\tconst s = im[0];\n\t\t\t\tinput = input.slice(s.length);\n\t\t\t\toutput.push(s);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Unexpected dot segment condition\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn output.join(\"\");\n};\n\nexport function serialize(components:URIComponents, options:URIOptions = {}):string {\n\tconst protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);\n\tconst uriTokens:Array = [];\n\n\t//find scheme handler\n\tconst schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n\n\t//perform scheme specific serialization\n\tif (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);\n\n\tif (components.host) {\n\t\t//if host component is an IPv6 address\n\t\tif (protocol.IPV6ADDRESS.test(components.host)) {\n\t\t\t//TODO: normalize IPv6 address as per RFC 5952\n\t\t}\n\n\t\t//if host component is a domain name\n\t\telse if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {\n\t\t\t//convert IDN via punycode\n\t\t\ttry {\n\t\t\t\tcomponents.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));\n\t\t\t} catch (e) {\n\t\t\t\tcomponents.error = components.error || \"Host's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n\t\t\t}\n\t\t}\n\t}\n\n\t//normalize encoding\n\t_normalizeComponentEncoding(components, protocol);\n\n\tif (options.reference !== \"suffix\" && components.scheme) {\n\t\turiTokens.push(components.scheme);\n\t\turiTokens.push(\":\");\n\t}\n\n\tconst authority = _recomposeAuthority(components, options);\n\tif (authority !== undefined) {\n\t\tif (options.reference !== \"suffix\") {\n\t\t\turiTokens.push(\"//\");\n\t\t}\n\n\t\turiTokens.push(authority);\n\n\t\tif (components.path && components.path.charAt(0) !== \"/\") {\n\t\t\turiTokens.push(\"/\");\n\t\t}\n\t}\n\n\tif (components.path !== undefined) {\n\t\tlet s = components.path;\n\n\t\tif (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {\n\t\t\ts = removeDotSegments(s);\n\t\t}\n\n\t\tif (authority === undefined) {\n\t\t\ts = s.replace(/^\\/\\//, \"/%2F\"); //don't allow the path to start with \"//\"\n\t\t}\n\n\t\turiTokens.push(s);\n\t}\n\n\tif (components.query !== undefined) {\n\t\turiTokens.push(\"?\");\n\t\turiTokens.push(components.query);\n\t}\n\n\tif (components.fragment !== undefined) {\n\t\turiTokens.push(\"#\");\n\t\turiTokens.push(components.fragment);\n\t}\n\n\treturn uriTokens.join(\"\"); //merge tokens into a string\n};\n\nexport function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {\n\tconst target:URIComponents = {};\n\n\tif (!skipNormalization) {\n\t\tbase = parse(serialize(base, options), options); //normalize base components\n\t\trelative = parse(serialize(relative, options), options); //normalize relative components\n\t}\n\toptions = options || {};\n\n\tif (!options.tolerant && relative.scheme) {\n\t\ttarget.scheme = relative.scheme;\n\t\t//target.authority = relative.authority;\n\t\ttarget.userinfo = relative.userinfo;\n\t\ttarget.host = relative.host;\n\t\ttarget.port = relative.port;\n\t\ttarget.path = removeDotSegments(relative.path || \"\");\n\t\ttarget.query = relative.query;\n\t} else {\n\t\tif (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {\n\t\t\t//target.authority = relative.authority;\n\t\t\ttarget.userinfo = relative.userinfo;\n\t\t\ttarget.host = relative.host;\n\t\t\ttarget.port = relative.port;\n\t\t\ttarget.path = removeDotSegments(relative.path || \"\");\n\t\t\ttarget.query = relative.query;\n\t\t} else {\n\t\t\tif (!relative.path) {\n\t\t\t\ttarget.path = base.path;\n\t\t\t\tif (relative.query !== undefined) {\n\t\t\t\t\ttarget.query = relative.query;\n\t\t\t\t} else {\n\t\t\t\t\ttarget.query = base.query;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (relative.path.charAt(0) === \"/\") {\n\t\t\t\t\ttarget.path = removeDotSegments(relative.path);\n\t\t\t\t} else {\n\t\t\t\t\tif ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {\n\t\t\t\t\t\ttarget.path = \"/\" + relative.path;\n\t\t\t\t\t} else if (!base.path) {\n\t\t\t\t\t\ttarget.path = relative.path;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.path = base.path.slice(0, base.path.lastIndexOf(\"/\") + 1) + relative.path;\n\t\t\t\t\t}\n\t\t\t\t\ttarget.path = removeDotSegments(target.path);\n\t\t\t\t}\n\t\t\t\ttarget.query = relative.query;\n\t\t\t}\n\t\t\t//target.authority = base.authority;\n\t\t\ttarget.userinfo = base.userinfo;\n\t\t\ttarget.host = base.host;\n\t\t\ttarget.port = base.port;\n\t\t}\n\t\ttarget.scheme = base.scheme;\n\t}\n\n\ttarget.fragment = relative.fragment;\n\n\treturn target;\n};\n\nexport function resolve(baseURI:string, relativeURI:string, options?:URIOptions):string {\n\tconst schemelessOptions = assign({ scheme : 'null' }, options);\n\treturn serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);\n};\n\nexport function normalize(uri:string, options?:URIOptions):string;\nexport function normalize(uri:URIComponents, options?:URIOptions):URIComponents;\nexport function normalize(uri:any, options?:URIOptions):any {\n\tif (typeof uri === \"string\") {\n\t\turi = serialize(parse(uri, options), options);\n\t} else if (typeOf(uri) === \"object\") {\n\t\turi = parse(serialize(uri, options), options);\n\t}\n\n\treturn uri;\n};\n\nexport function equal(uriA:string, uriB:string, options?: URIOptions):boolean;\nexport function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean;\nexport function equal(uriA:any, uriB:any, options?:URIOptions):boolean {\n\tif (typeof uriA === \"string\") {\n\t\turiA = serialize(parse(uriA, options), options);\n\t} else if (typeOf(uriA) === \"object\") {\n\t\turiA = serialize(uriA, options);\n\t}\n\n\tif (typeof uriB === \"string\") {\n\t\turiB = serialize(parse(uriB, options), options);\n\t} else if (typeOf(uriB) === \"object\") {\n\t\turiB = serialize(uriB, options);\n\t}\n\n\treturn uriA === uriB;\n};\n\nexport function escapeComponent(str:string, options?:URIOptions):string {\n\treturn str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);\n};\n\nexport function unescapeComponent(str:string, options?:URIOptions):string {\n\treturn str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);\n};\n","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\n\nexport interface WSComponents extends URIComponents {\n\tresourceName?: string;\n\tsecure?: boolean;\n}\n\nfunction isSecure(wsComponents:WSComponents):boolean {\n\treturn typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === \"wss\";\n}\n\n//RFC 6455\nconst handler:URISchemeHandler = {\n\tscheme : \"ws\",\n\n\tdomainHost : true,\n\n\tparse : function (components:URIComponents, options:URIOptions):WSComponents {\n\t\tconst wsComponents = components as WSComponents;\n\n\t\t//indicate if the secure flag is set\n\t\twsComponents.secure = isSecure(wsComponents);\n\n\t\t//construct resouce name\n\t\twsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');\n\t\twsComponents.path = undefined;\n\t\twsComponents.query = undefined;\n\n\t\treturn wsComponents;\n\t},\n\n\tserialize : function (wsComponents:WSComponents, options:URIOptions):URIComponents {\n\t\t//normalize the default port\n\t\tif (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === \"\") {\n\t\t\twsComponents.port = undefined;\n\t\t}\n\n\t\t//ensure scheme matches secure flag\n\t\tif (typeof wsComponents.secure === 'boolean') {\n\t\t\twsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');\n\t\t\twsComponents.secure = undefined;\n\t\t}\n\n\t\t//reconstruct path from resource name\n\t\tif (wsComponents.resourceName) {\n\t\t\tconst [path, query] = wsComponents.resourceName.split('?');\n\t\t\twsComponents.path = (path && path !== '/' ? path : undefined);\n\t\t\twsComponents.query = query;\n\t\t\twsComponents.resourceName = undefined;\n\t\t}\n\n\t\t//forbid fragment component\n\t\twsComponents.fragment = undefined;\n\n\t\treturn wsComponents;\n\t}\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { pctEncChar, pctDecChars, unescapeComponent } from \"../uri\";\nimport punycode from \"punycode\";\nimport { merge, subexp, toUpperCase, toArray } from \"../util\";\n\nexport interface MailtoHeaders {\n\t[hfname:string]:string\n}\n\nexport interface MailtoComponents extends URIComponents {\n\tto:Array,\n\theaders?:MailtoHeaders,\n\tsubject?:string,\n\tbody?:string\n}\n\nconst O:MailtoHeaders = {};\nconst isIRI = true;\n\n//RFC 3986\nconst UNRESERVED$$ = \"[A-Za-z0-9\\\\-\\\\.\\\\_\\\\~\" + (isIRI ? \"\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF\" : \"\") + \"]\";\nconst HEXDIG$$ = \"[0-9A-Fa-f]\"; //case-insensitive\nconst PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)); //expanded\n\n//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =\n//const ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\#\\\\$\\\\%\\\\&\\\\'\\\\*\\\\+\\\\-\\\\/\\\\=\\\\?\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QTEXT$$ = \"[\\\\x01-\\\\x08\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F]\"; //(%d1-8 / %d11-12 / %d14-31 / %d127)\n//const QTEXT$$ = merge(\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]\", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext\n//const VCHAR$$ = \"[\\\\x21-\\\\x7E]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QP$ = subexp(\"\\\\\\\\\" + merge(\"[\\\\x00\\\\x0D\\\\x0A]\", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext\n//const FWS$ = subexp(subexp(WSP$$ + \"*\" + \"\\\\x0D\\\\x0A\") + \"?\" + WSP$$ + \"+\");\n//const QUOTED_PAIR$ = subexp(subexp(\"\\\\\\\\\" + subexp(VCHAR$$ + \"|\" + WSP$$)) + \"|\" + OBS_QP$);\n//const QUOTED_STRING$ = subexp('\\\\\"' + subexp(FWS$ + \"?\" + QCONTENT$) + \"*\" + FWS$ + \"?\" + '\\\\\"');\nconst ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\$\\\\%\\\\'\\\\*\\\\+\\\\-\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\nconst QTEXT$$ = \"[\\\\!\\\\$\\\\%\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.0-9\\\\<\\\\>A-Z\\\\x5E-\\\\x7E]\";\nconst VCHAR$$ = merge(QTEXT$$, \"[\\\\\\\"\\\\\\\\]\");\nconst DOT_ATOM_TEXT$ = subexp(ATEXT$$ + \"+\" + subexp(\"\\\\.\" + ATEXT$$ + \"+\") + \"*\");\nconst QUOTED_PAIR$ = subexp(\"\\\\\\\\\" + VCHAR$$);\nconst QCONTENT$ = subexp(QTEXT$$ + \"|\" + QUOTED_PAIR$);\nconst QUOTED_STRING$ = subexp('\\\\\"' + QCONTENT$ + \"*\" + '\\\\\"');\n\n//RFC 6068\nconst DTEXT_NO_OBS$$ = \"[\\\\x21-\\\\x5A\\\\x5E-\\\\x7E]\"; //%d33-90 / %d94-126\nconst SOME_DELIMS$$ = \"[\\\\!\\\\$\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\:\\\\@]\";\nconst QCHAR$ = subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$ + \"|\" + SOME_DELIMS$$);\nconst DOMAIN$ = subexp(DOT_ATOM_TEXT$ + \"|\" + \"\\\\[\" + DTEXT_NO_OBS$$ + \"*\" + \"\\\\]\");\nconst LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + \"|\" + QUOTED_STRING$);\nconst ADDR_SPEC$ = subexp(LOCAL_PART$ + \"\\\\@\" + DOMAIN$);\nconst TO$ = subexp(ADDR_SPEC$ + subexp(\"\\\\,\" + ADDR_SPEC$) + \"*\");\nconst HFNAME$ = subexp(QCHAR$ + \"*\");\nconst HFVALUE$ = HFNAME$;\nconst HFIELD$ = subexp(HFNAME$ + \"\\\\=\" + HFVALUE$);\nconst HFIELDS2$ = subexp(HFIELD$ + subexp(\"\\\\&\" + HFIELD$) + \"*\");\nconst HFIELDS$ = subexp(\"\\\\?\" + HFIELDS2$);\nconst MAILTO_URI = new RegExp(\"^mailto\\\\:\" + TO$ + \"?\" + HFIELDS$ + \"?$\");\n\nconst UNRESERVED = new RegExp(UNRESERVED$$, \"g\");\nconst PCT_ENCODED = new RegExp(PCT_ENCODED$, \"g\");\nconst NOT_LOCAL_PART = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", '[\\\\\"]', VCHAR$$), \"g\");\nconst NOT_DOMAIN = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", \"[\\\\[]\", DTEXT_NO_OBS$$, \"[\\\\]]\"), \"g\");\nconst NOT_HFNAME = new RegExp(merge(\"[^]\", UNRESERVED$$, SOME_DELIMS$$), \"g\");\nconst NOT_HFVALUE = NOT_HFNAME;\nconst TO = new RegExp(\"^\" + TO$ + \"$\");\nconst HFIELDS = new RegExp(\"^\" + HFIELDS2$ + \"$\");\n\nfunction decodeUnreserved(str:string):string {\n\tconst decStr = pctDecChars(str);\n\treturn (!decStr.match(UNRESERVED) ? str : decStr);\n}\n\nconst handler:URISchemeHandler = {\n\tscheme : \"mailto\",\n\n\tparse : function (components:URIComponents, options:URIOptions):MailtoComponents {\n\t\tconst mailtoComponents = components as MailtoComponents;\n\t\tconst to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(\",\") : []);\n\t\tmailtoComponents.path = undefined;\n\n\t\tif (mailtoComponents.query) {\n\t\t\tlet unknownHeaders = false\n\t\t\tconst headers:MailtoHeaders = {};\n\t\t\tconst hfields = mailtoComponents.query.split(\"&\");\n\n\t\t\tfor (let x = 0, xl = hfields.length; x < xl; ++x) {\n\t\t\t\tconst hfield = hfields[x].split(\"=\");\n\n\t\t\t\tswitch (hfield[0]) {\n\t\t\t\t\tcase \"to\":\n\t\t\t\t\t\tconst toAddrs = hfield[1].split(\",\");\n\t\t\t\t\t\tfor (let x = 0, xl = toAddrs.length; x < xl; ++x) {\n\t\t\t\t\t\t\tto.push(toAddrs[x]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"subject\":\n\t\t\t\t\t\tmailtoComponents.subject = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"body\":\n\t\t\t\t\t\tmailtoComponents.body = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunknownHeaders = true;\n\t\t\t\t\t\theaders[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unknownHeaders) mailtoComponents.headers = headers;\n\t\t}\n\n\t\tmailtoComponents.query = undefined;\n\n\t\tfor (let x = 0, xl = to.length; x < xl; ++x) {\n\t\t\tconst addr = to[x].split(\"@\");\n\n\t\t\taddr[0] = unescapeComponent(addr[0]);\n\n\t\t\tif (!options.unicodeSupport) {\n\t\t\t\t//convert Unicode IDN -> ASCII IDN\n\t\t\t\ttry {\n\t\t\t\t\taddr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());\n\t\t\t\t} catch (e) {\n\t\t\t\t\tmailtoComponents.error = mailtoComponents.error || \"Email address's domain name can not be converted to ASCII via punycode: \" + e;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\taddr[1] = unescapeComponent(addr[1], options).toLowerCase();\n\t\t\t}\n\n\t\t\tto[x] = addr.join(\"@\");\n\t\t}\n\n\t\treturn mailtoComponents;\n\t},\n\n\tserialize : function (mailtoComponents:MailtoComponents, options:URIOptions):URIComponents {\n\t\tconst components = mailtoComponents as URIComponents;\n\t\tconst to = toArray(mailtoComponents.to);\n\t\tif (to) {\n\t\t\tfor (let x = 0, xl = to.length; x < xl; ++x) {\n\t\t\t\tconst toAddr = String(to[x]);\n\t\t\t\tconst atIdx = toAddr.lastIndexOf(\"@\");\n\t\t\t\tconst localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);\n\t\t\t\tlet domain = toAddr.slice(atIdx + 1);\n\n\t\t\t\t//convert IDN via punycode\n\t\t\t\ttry {\n\t\t\t\t\tdomain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcomponents.error = components.error || \"Email address's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n\t\t\t\t}\n\n\t\t\t\tto[x] = localPart + \"@\" + domain;\n\t\t\t}\n\n\t\t\tcomponents.path = to.join(\",\");\n\t\t}\n\n\t\tconst headers = mailtoComponents.headers = mailtoComponents.headers || {};\n\n\t\tif (mailtoComponents.subject) headers[\"subject\"] = mailtoComponents.subject;\n\t\tif (mailtoComponents.body) headers[\"body\"] = mailtoComponents.body;\n\n\t\tconst fields = [];\n\t\tfor (const name in headers) {\n\t\t\tif (headers[name] !== O[name]) {\n\t\t\t\tfields.push(\n\t\t\t\t\tname.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +\n\t\t\t\t\t\"=\" +\n\t\t\t\t\theaders[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (fields.length) {\n\t\t\tcomponents.query = fields.join(\"&\");\n\t\t}\n\n\t\treturn components;\n\t}\n}\n\nexport default handler;","import { URIRegExps } from \"./uri\";\nimport { buildExps } from \"./regexps-uri\";\n\nexport default buildExps(true);\n","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"http\",\n\n\tdomainHost : true,\n\n\tparse : function (components:URIComponents, options:URIOptions):URIComponents {\n\t\t//report missing host\n\t\tif (!components.host) {\n\t\t\tcomponents.error = components.error || \"HTTP URIs must have a host.\";\n\t\t}\n\n\t\treturn components;\n\t},\n\n\tserialize : function (components:URIComponents, options:URIOptions):URIComponents {\n\t\tconst secure = String(components.scheme).toLowerCase() === \"https\";\n\n\t\t//normalize the default port\n\t\tif (components.port === (secure ? 443 : 80) || components.port === \"\") {\n\t\t\tcomponents.port = undefined;\n\t\t}\n\t\t\n\t\t//normalize the empty path\n\t\tif (!components.path) {\n\t\t\tcomponents.path = \"/\";\n\t\t}\n\n\t\t//NOTE: We do not parse query strings for HTTP URIs\n\t\t//as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n\t\t//and not the HTTP spec.\n\n\t\treturn components;\n\t}\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport http from \"./http\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"https\",\n\tdomainHost : http.domainHost,\n\tparse : http.parse,\n\tserialize : http.serialize\n}\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport ws from \"./ws\";\n\nconst handler:URISchemeHandler = {\n\tscheme : \"wss\",\n\tdomainHost : ws.domainHost,\n\tparse : ws.parse,\n\tserialize : ws.serialize\n}\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { pctEncChar, SCHEMES } from \"../uri\";\n\nexport interface URNComponents extends URIComponents {\n\tnid?:string;\n\tnss?:string;\n}\n\nexport interface URNOptions extends URIOptions {\n\tnid?:string;\n}\n\nconst NID$ = \"(?:[0-9A-Za-z][0-9A-Za-z\\\\-]{1,31})\";\nconst PCT_ENCODED$ = \"(?:\\\\%[0-9A-Fa-f]{2})\";\nconst TRANS$$ = \"[0-9A-Za-z\\\\(\\\\)\\\\+\\\\,\\\\-\\\\.\\\\:\\\\=\\\\@\\\\;\\\\$\\\\_\\\\!\\\\*\\\\'\\\\/\\\\?\\\\#]\";\nconst NSS$ = \"(?:(?:\" + PCT_ENCODED$ + \"|\" + TRANS$$ + \")+)\";\nconst URN_SCHEME = new RegExp(\"^urn\\\\:(\" + NID$ + \")$\");\nconst URN_PATH = new RegExp(\"^(\" + NID$ + \")\\\\:(\" + NSS$ + \")$\");\nconst URN_PARSE = /^([^\\:]+)\\:(.*)/;\nconst URN_EXCLUDED = /[\\x00-\\x20\\\\\\\"\\&\\<\\>\\[\\]\\^\\`\\{\\|\\}\\~\\x7F-\\xFF]/g;\n\n//RFC 2141\nconst handler:URISchemeHandler = {\n\tscheme : \"urn\",\n\n\tparse : function (components:URIComponents, options:URNOptions):URNComponents {\n\t\tconst matches = components.path && components.path.match(URN_PARSE);\n\t\tlet urnComponents = components as URNComponents;\n\n\t\tif (matches) {\n\t\t\tconst scheme = options.scheme || urnComponents.scheme || \"urn\";\n\t\t\tconst nid = matches[1].toLowerCase();\n\t\t\tconst nss = matches[2];\n\t\t\tconst urnScheme = `${scheme}:${options.nid || nid}`;\n\t\t\tconst schemeHandler = SCHEMES[urnScheme];\n\n\t\t\turnComponents.nid = nid;\n\t\t\turnComponents.nss = nss;\n\t\t\turnComponents.path = undefined;\n\n\t\t\tif (schemeHandler) {\n\t\t\t\turnComponents = schemeHandler.parse(urnComponents, options) as URNComponents;\n\t\t\t}\n\t\t} else {\n\t\t\turnComponents.error = urnComponents.error || \"URN can not be parsed.\";\n\t\t}\n\n\t\treturn urnComponents;\n\t},\n\n\tserialize : function (urnComponents:URNComponents, options:URNOptions):URIComponents {\n\t\tconst scheme = options.scheme || urnComponents.scheme || \"urn\";\n\t\tconst nid = urnComponents.nid;\n\t\tconst urnScheme = `${scheme}:${options.nid || nid}`;\n\t\tconst schemeHandler = SCHEMES[urnScheme];\n\n\t\tif (schemeHandler) {\n\t\t\turnComponents = schemeHandler.serialize(urnComponents, options) as URNComponents;\n\t\t}\n\n\t\tconst uriComponents = urnComponents as URIComponents;\n\t\tconst nss = urnComponents.nss;\n\t\turiComponents.path = `${nid || options.nid}:${nss}`;\n\n\t\treturn uriComponents;\n\t},\n};\n\nexport default handler;","import { URISchemeHandler, URIComponents, URIOptions } from \"../uri\";\nimport { URNComponents } from \"./urn\";\nimport { SCHEMES } from \"../uri\";\n\nexport interface UUIDComponents extends URNComponents {\n\tuuid?: string;\n}\n\nconst UUID = /^[0-9A-Fa-f]{8}(?:\\-[0-9A-Fa-f]{4}){3}\\-[0-9A-Fa-f]{12}$/;\nconst UUID_PARSE = /^[0-9A-Fa-f\\-]{36}/;\n\n//RFC 4122\nconst handler:URISchemeHandler = {\n\tscheme : \"urn:uuid\",\n\n\tparse : function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {\n\t\tconst uuidComponents = urnComponents as UUIDComponents;\n\t\tuuidComponents.uuid = uuidComponents.nss;\n\t\tuuidComponents.nss = undefined;\n\n\t\tif (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {\n\t\t\tuuidComponents.error = uuidComponents.error || \"UUID is not valid.\";\n\t\t}\n\n\t\treturn uuidComponents;\n\t},\n\n\tserialize : function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {\n\t\tconst urnComponents = uuidComponents as URNComponents;\n\t\t//normalize UUID\n\t\turnComponents.nss = (uuidComponents.uuid || \"\").toLowerCase();\n\t\treturn urnComponents;\n\t},\n};\n\nexport default handler;","import { SCHEMES } from \"./uri\";\n\nimport http from \"./schemes/http\";\nSCHEMES[http.scheme] = http;\n\nimport https from \"./schemes/https\";\nSCHEMES[https.scheme] = https;\n\nimport ws from \"./schemes/ws\";\nSCHEMES[ws.scheme] = ws;\n\nimport wss from \"./schemes/wss\";\nSCHEMES[wss.scheme] = wss;\n\nimport mailto from \"./schemes/mailto\";\nSCHEMES[mailto.scheme] = mailto;\n\nimport urn from \"./schemes/urn\";\nSCHEMES[urn.scheme] = urn;\n\nimport uuid from \"./schemes/urn-uuid\";\nSCHEMES[uuid.scheme] = uuid;\n\nexport * from \"./uri\";\n"]} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/index.d.ts b/node_modules/uri-js/dist/esnext/index.d.ts new file mode 100755 index 0000000..f6be760 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/index.d.ts @@ -0,0 +1 @@ +export * from "./uri"; diff --git a/node_modules/uri-js/dist/esnext/index.js b/node_modules/uri-js/dist/esnext/index.js new file mode 100755 index 0000000..e3531b5 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/index.js @@ -0,0 +1,17 @@ +import { SCHEMES } from "./uri"; +import http from "./schemes/http"; +SCHEMES[http.scheme] = http; +import https from "./schemes/https"; +SCHEMES[https.scheme] = https; +import ws from "./schemes/ws"; +SCHEMES[ws.scheme] = ws; +import wss from "./schemes/wss"; +SCHEMES[wss.scheme] = wss; +import mailto from "./schemes/mailto"; +SCHEMES[mailto.scheme] = mailto; +import urn from "./schemes/urn"; +SCHEMES[urn.scheme] = urn; +import uuid from "./schemes/urn-uuid"; +SCHEMES[uuid.scheme] = uuid; +export * from "./uri"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/index.js.map b/node_modules/uri-js/dist/esnext/index.js.map new file mode 100755 index 0000000..0971f6e --- /dev/null +++ b/node_modules/uri-js/dist/esnext/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE5B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAE9B,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9B,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;AAExB,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;AAE1B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAEhC,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;AAE1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE5B,cAAc,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/regexps-iri.d.ts b/node_modules/uri-js/dist/esnext/regexps-iri.d.ts new file mode 100755 index 0000000..c91cdac --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-iri.d.ts @@ -0,0 +1,3 @@ +import { URIRegExps } from "./uri"; +declare const _default: URIRegExps; +export default _default; diff --git a/node_modules/uri-js/dist/esnext/regexps-iri.js b/node_modules/uri-js/dist/esnext/regexps-iri.js new file mode 100755 index 0000000..34e7de9 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-iri.js @@ -0,0 +1,3 @@ +import { buildExps } from "./regexps-uri"; +export default buildExps(true); +//# sourceMappingURL=regexps-iri.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/regexps-iri.js.map b/node_modules/uri-js/dist/esnext/regexps-iri.js.map new file mode 100755 index 0000000..2269c58 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-iri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"regexps-iri.js","sourceRoot":"","sources":["../../src/regexps-iri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAe,SAAS,CAAC,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/regexps-uri.d.ts b/node_modules/uri-js/dist/esnext/regexps-uri.d.ts new file mode 100755 index 0000000..6096bda --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-uri.d.ts @@ -0,0 +1,4 @@ +import { URIRegExps } from "./uri"; +export declare function buildExps(isIRI: boolean): URIRegExps; +declare const _default: URIRegExps; +export default _default; diff --git a/node_modules/uri-js/dist/esnext/regexps-uri.js b/node_modules/uri-js/dist/esnext/regexps-uri.js new file mode 100755 index 0000000..1cc659f --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-uri.js @@ -0,0 +1,42 @@ +import { merge, subexp } from "./util"; +export function buildExps(isIRI) { + const ALPHA$$ = "[A-Za-z]", CR$ = "[\\x0D]", DIGIT$$ = "[0-9]", DQUOTE$$ = "[\\x22]", HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive + LF$$ = "[\\x0A]", SP$$ = "[\\x20]", PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded + GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters + IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset + UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), //relaxed parsing rules + IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$ + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32 + IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32 + IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32 + IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32 + IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), //[ *5( h16 ":" ) h16 ] "::" h16 + IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), //[ *6( h16 ":" ) h16 ] "::" + IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874 + IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874 + IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules + IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874 + REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), PORT$ = subexp(DIGIT$$ + "*"), AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), SEGMENT$ = subexp(PCHAR$ + "*"), SEGMENT_NZ$ = subexp(PCHAR$ + "+"), SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified + PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified + PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified + PATH_EMPTY$ = "(?!" + PCHAR$ + ")", PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"; + return { + NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), + NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), + NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"), + UNRESERVED: new RegExp(UNRESERVED$$, "g"), + OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"), + PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"), + IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules + }; +} +export default buildExps(false); +//# sourceMappingURL=regexps-uri.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/regexps-uri.js.map b/node_modules/uri-js/dist/esnext/regexps-uri.js.map new file mode 100755 index 0000000..cb028b8 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/regexps-uri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"regexps-uri.js","sourceRoot":"","sources":["../../src/regexps-uri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,oBAAoB,KAAa;IACtC,MACC,OAAO,GAAG,UAAU,EACpB,GAAG,GAAG,SAAS,EACf,OAAO,GAAG,OAAO,EACjB,QAAQ,GAAG,SAAS,EACpB,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,EAAG,kBAAkB;IAC1D,IAAI,GAAG,SAAS,EAChB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,aAAa,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,EAAG,UAAU;IACvO,YAAY,GAAG,yBAAyB,EACxC,YAAY,GAAG,qCAAqC,EACpD,UAAU,GAAG,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,EAC9C,SAAS,GAAG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C;QACxE,WAAW,EAAG,IAAI,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC;QAC3C,WAAW,EAAG,IAAI,MAAM,CAAC,IAAI,GAAG,YAAY,GAAG,IAAI,CAAC;QACpD,WAAW,EAAG,IAAI,MAAM,CAAC,QAAQ,GAAG,YAAY,GAAG,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAE,sCAAsC;KACrL,CAAC;AACH,CAAC;AAED,eAAe,SAAS,CAAC,KAAK,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/http.d.ts b/node_modules/uri-js/dist/esnext/schemes/http.d.ts new file mode 100755 index 0000000..fe5b2f3 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/http.d.ts @@ -0,0 +1,3 @@ +import { URISchemeHandler } from "../uri"; +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/http.js b/node_modules/uri-js/dist/esnext/schemes/http.js new file mode 100755 index 0000000..6abf0fe --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/http.js @@ -0,0 +1,28 @@ +const handler = { + scheme: "http", + domainHost: true, + parse: function (components, options) { + //report missing host + if (!components.host) { + components.error = components.error || "HTTP URIs must have a host."; + } + return components; + }, + serialize: function (components, options) { + const secure = String(components.scheme).toLowerCase() === "https"; + //normalize the default port + if (components.port === (secure ? 443 : 80) || components.port === "") { + components.port = undefined; + } + //normalize the empty path + if (!components.path) { + components.path = "/"; + } + //NOTE: We do not parse query strings for HTTP URIs + //as WWW Form Url Encoded query strings are part of the HTML4+ spec, + //and not the HTTP spec. + return components; + } +}; +export default handler; +//# sourceMappingURL=http.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/http.js.map b/node_modules/uri-js/dist/esnext/schemes/http.js.map new file mode 100755 index 0000000..8211897 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/http.js.map @@ -0,0 +1 @@ +{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;QAEnE,4BAA4B;QAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,EAAE;YACtE,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;SAC5B;QAED,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB;QAED,mDAAmD;QACnD,oEAAoE;QACpE,wBAAwB;QAExB,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/https.d.ts b/node_modules/uri-js/dist/esnext/schemes/https.d.ts new file mode 100755 index 0000000..fe5b2f3 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/https.d.ts @@ -0,0 +1,3 @@ +import { URISchemeHandler } from "../uri"; +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/https.js b/node_modules/uri-js/dist/esnext/schemes/https.js new file mode 100755 index 0000000..ec4b6e7 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/https.js @@ -0,0 +1,9 @@ +import http from "./http"; +const handler = { + scheme: "https", + domainHost: http.domainHost, + parse: http.parse, + serialize: http.serialize +}; +export default handler; +//# sourceMappingURL=https.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/https.js.map b/node_modules/uri-js/dist/esnext/schemes/https.js.map new file mode 100755 index 0000000..385b8ef --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/https.js.map @@ -0,0 +1 @@ +{"version":3,"file":"https.js","sourceRoot":"","sources":["../../../src/schemes/https.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,OAAO;IAChB,UAAU,EAAG,IAAI,CAAC,UAAU;IAC5B,KAAK,EAAG,IAAI,CAAC,KAAK;IAClB,SAAS,EAAG,IAAI,CAAC,SAAS;CAC1B,CAAA;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts b/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts new file mode 100755 index 0000000..e2aefc2 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts @@ -0,0 +1,12 @@ +import { URISchemeHandler, URIComponents } from "../uri"; +export interface MailtoHeaders { + [hfname: string]: string; +} +export interface MailtoComponents extends URIComponents { + to: Array; + headers?: MailtoHeaders; + subject?: string; + body?: string; +} +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/mailto.js b/node_modules/uri-js/dist/esnext/schemes/mailto.js new file mode 100755 index 0000000..2553713 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/mailto.js @@ -0,0 +1,148 @@ +import { pctEncChar, pctDecChars, unescapeComponent } from "../uri"; +import punycode from "punycode"; +import { merge, subexp, toUpperCase, toArray } from "../util"; +const O = {}; +const isIRI = true; +//RFC 3986 +const UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]"; +const HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive +const PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded +//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; = +//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; +//const WSP$$ = "[\\x20\\x09]"; +//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127) +//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext +//const VCHAR$$ = "[\\x21-\\x7E]"; +//const WSP$$ = "[\\x20\\x09]"; +//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext +//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+"); +//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$); +//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"'); +const ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; +const QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; +const VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]"); +const DOT_ATOM_TEXT$ = subexp(ATEXT$$ + "+" + subexp("\\." + ATEXT$$ + "+") + "*"); +const QUOTED_PAIR$ = subexp("\\\\" + VCHAR$$); +const QCONTENT$ = subexp(QTEXT$$ + "|" + QUOTED_PAIR$); +const QUOTED_STRING$ = subexp('\\"' + QCONTENT$ + "*" + '\\"'); +//RFC 6068 +const DTEXT_NO_OBS$$ = "[\\x21-\\x5A\\x5E-\\x7E]"; //%d33-90 / %d94-126 +const SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; +const QCHAR$ = subexp(UNRESERVED$$ + "|" + PCT_ENCODED$ + "|" + SOME_DELIMS$$); +const DOMAIN$ = subexp(DOT_ATOM_TEXT$ + "|" + "\\[" + DTEXT_NO_OBS$$ + "*" + "\\]"); +const LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + "|" + QUOTED_STRING$); +const ADDR_SPEC$ = subexp(LOCAL_PART$ + "\\@" + DOMAIN$); +const TO$ = subexp(ADDR_SPEC$ + subexp("\\," + ADDR_SPEC$) + "*"); +const HFNAME$ = subexp(QCHAR$ + "*"); +const HFVALUE$ = HFNAME$; +const HFIELD$ = subexp(HFNAME$ + "\\=" + HFVALUE$); +const HFIELDS2$ = subexp(HFIELD$ + subexp("\\&" + HFIELD$) + "*"); +const HFIELDS$ = subexp("\\?" + HFIELDS2$); +const MAILTO_URI = new RegExp("^mailto\\:" + TO$ + "?" + HFIELDS$ + "?$"); +const UNRESERVED = new RegExp(UNRESERVED$$, "g"); +const PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); +const NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); +const NOT_DOMAIN = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\[]", DTEXT_NO_OBS$$, "[\\]]"), "g"); +const NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); +const NOT_HFVALUE = NOT_HFNAME; +const TO = new RegExp("^" + TO$ + "$"); +const HFIELDS = new RegExp("^" + HFIELDS2$ + "$"); +function decodeUnreserved(str) { + const decStr = pctDecChars(str); + return (!decStr.match(UNRESERVED) ? str : decStr); +} +const handler = { + scheme: "mailto", + parse: function (components, options) { + const mailtoComponents = components; + const to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(",") : []); + mailtoComponents.path = undefined; + if (mailtoComponents.query) { + let unknownHeaders = false; + const headers = {}; + const hfields = mailtoComponents.query.split("&"); + for (let x = 0, xl = hfields.length; x < xl; ++x) { + const hfield = hfields[x].split("="); + switch (hfield[0]) { + case "to": + const toAddrs = hfield[1].split(","); + for (let x = 0, xl = toAddrs.length; x < xl; ++x) { + to.push(toAddrs[x]); + } + break; + case "subject": + mailtoComponents.subject = unescapeComponent(hfield[1], options); + break; + case "body": + mailtoComponents.body = unescapeComponent(hfield[1], options); + break; + default: + unknownHeaders = true; + headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); + break; + } + } + if (unknownHeaders) + mailtoComponents.headers = headers; + } + mailtoComponents.query = undefined; + for (let x = 0, xl = to.length; x < xl; ++x) { + const addr = to[x].split("@"); + addr[0] = unescapeComponent(addr[0]); + if (!options.unicodeSupport) { + //convert Unicode IDN -> ASCII IDN + try { + addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); + } + catch (e) { + mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; + } + } + else { + addr[1] = unescapeComponent(addr[1], options).toLowerCase(); + } + to[x] = addr.join("@"); + } + return mailtoComponents; + }, + serialize: function (mailtoComponents, options) { + const components = mailtoComponents; + const to = toArray(mailtoComponents.to); + if (to) { + for (let x = 0, xl = to.length; x < xl; ++x) { + const toAddr = String(to[x]); + const atIdx = toAddr.lastIndexOf("@"); + const localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); + let domain = toAddr.slice(atIdx + 1); + //convert IDN via punycode + try { + domain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain)); + } + catch (e) { + components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + to[x] = localPart + "@" + domain; + } + components.path = to.join(","); + } + const headers = mailtoComponents.headers = mailtoComponents.headers || {}; + if (mailtoComponents.subject) + headers["subject"] = mailtoComponents.subject; + if (mailtoComponents.body) + headers["body"] = mailtoComponents.body; + const fields = []; + for (const name in headers) { + if (headers[name] !== O[name]) { + fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + + "=" + + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); + } + } + if (fields.length) { + components.query = fields.join("&"); + } + return components; + } +}; +export default handler; +//# sourceMappingURL=mailto.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/mailto.js.map b/node_modules/uri-js/dist/esnext/schemes/mailto.js.map new file mode 100755 index 0000000..82dba9a --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/mailto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mailto.js","sourceRoot":"","sources":["../../../src/schemes/mailto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,QAAQ,MAAM,UAAU,CAAC;A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AO,GAAG,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC;QAE1E,IAAI,gBAAgB,CAAC,OAAO;YAAE,OAAO,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC;QAC5E,IAAI,gBAAgB,CAAC,IAAI;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC;QAEnE,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YAC3B,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;gBAC9B,MAAM,CAAC,IAAI,CACV,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC;oBAC7G,GAAG;oBACH,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CACvH,CAAC;aACF;SACD;QACD,IAAI,MAAM,CAAC,MAAM,EAAE;YAClB,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACpC;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAA;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts new file mode 100755 index 0000000..e75f2e7 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts @@ -0,0 +1,7 @@ +import { URISchemeHandler, URIOptions } from "../uri"; +import { URNComponents } from "./urn"; +export interface UUIDComponents extends URNComponents { + uuid?: string; +} +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js new file mode 100755 index 0000000..d1fce49 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js @@ -0,0 +1,23 @@ +const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; +const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/; +//RFC 4122 +const handler = { + scheme: "urn:uuid", + parse: function (urnComponents, options) { + const uuidComponents = urnComponents; + uuidComponents.uuid = uuidComponents.nss; + uuidComponents.nss = undefined; + if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) { + uuidComponents.error = uuidComponents.error || "UUID is not valid."; + } + return uuidComponents; + }, + serialize: function (uuidComponents, options) { + const urnComponents = uuidComponents; + //normalize UUID + urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); + return urnComponents; + }, +}; +export default handler; +//# sourceMappingURL=urn-uuid.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map new file mode 100755 index 0000000..3b7a8b3 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"urn-uuid.js","sourceRoot":"","sources":["../../../src/schemes/urn-uuid.ts"],"names":[],"mappings":"AAQA,MAAM,IAAI,GAAG,0DAA0D,CAAC;AACxE,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,UAAU;AACV,MAAM,OAAO,GAA+D;IAC3E,MAAM,EAAG,UAAU;IAEnB,KAAK,EAAG,UAAU,aAA2B,EAAE,OAAkB;QAChE,MAAM,cAAc,GAAG,aAA+B,CAAC;QACvD,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC;QACzC,cAAc,CAAC,GAAG,GAAG,SAAS,CAAC;QAE/B,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE;YACpF,cAAc,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,IAAI,oBAAoB,CAAC;SACpE;QAED,OAAO,cAAc,CAAC;IACvB,CAAC;IAED,SAAS,EAAG,UAAU,cAA6B,EAAE,OAAkB;QACtE,MAAM,aAAa,GAAG,cAA+B,CAAC;QACtD,gBAAgB;QAChB,aAAa,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/urn.d.ts b/node_modules/uri-js/dist/esnext/schemes/urn.d.ts new file mode 100755 index 0000000..7e0c2fb --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn.d.ts @@ -0,0 +1,10 @@ +import { URISchemeHandler, URIComponents, URIOptions } from "../uri"; +export interface URNComponents extends URIComponents { + nid?: string; + nss?: string; +} +export interface URNOptions extends URIOptions { + nid?: string; +} +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/urn.js b/node_modules/uri-js/dist/esnext/schemes/urn.js new file mode 100755 index 0000000..5d3f10a --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn.js @@ -0,0 +1,49 @@ +import { SCHEMES } from "../uri"; +const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})"; +const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})"; +const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]"; +const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)"; +const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$"); +const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$"); +const URN_PARSE = /^([^\:]+)\:(.*)/; +const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g; +//RFC 2141 +const handler = { + scheme: "urn", + parse: function (components, options) { + const matches = components.path && components.path.match(URN_PARSE); + let urnComponents = components; + if (matches) { + const scheme = options.scheme || urnComponents.scheme || "urn"; + const nid = matches[1].toLowerCase(); + const nss = matches[2]; + const urnScheme = `${scheme}:${options.nid || nid}`; + const schemeHandler = SCHEMES[urnScheme]; + urnComponents.nid = nid; + urnComponents.nss = nss; + urnComponents.path = undefined; + if (schemeHandler) { + urnComponents = schemeHandler.parse(urnComponents, options); + } + } + else { + urnComponents.error = urnComponents.error || "URN can not be parsed."; + } + return urnComponents; + }, + serialize: function (urnComponents, options) { + const scheme = options.scheme || urnComponents.scheme || "urn"; + const nid = urnComponents.nid; + const urnScheme = `${scheme}:${options.nid || nid}`; + const schemeHandler = SCHEMES[urnScheme]; + if (schemeHandler) { + urnComponents = schemeHandler.serialize(urnComponents, options); + } + const uriComponents = urnComponents; + const nss = urnComponents.nss; + uriComponents.path = `${nid || options.nid}:${nss}`; + return uriComponents; + }, +}; +export default handler; +//# sourceMappingURL=urn.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/urn.js.map b/node_modules/uri-js/dist/esnext/schemes/urn.js.map new file mode 100755 index 0000000..ea43b0b --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/urn.js.map @@ -0,0 +1 @@ +{"version":3,"file":"urn.js","sourceRoot":"","sources":["../../../src/schemes/urn.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,OAAO,EAAE,MAAM,QAAQ,CAAC;AAW7C,MAAM,IAAI,GAAG,qCAAqC,CAAC;AACnD,MAAM,YA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K,CAAC,aAAa,EAAE,OAAO,CAAkB,CAAC;aAC7E;SACD;aAAM;YACN,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,IAAI,wBAAwB,CAAC;SACtE;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;IAED,SAAS,EAAG,UAAU,aAA2B,EAAE,OAAkB;QACpE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,IAAI,KAAK,CAAC;QAC/D,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzC,IAAI,aAAa,EAAE;YAClB,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAkB,CAAC;SACjF;QAED,MAAM,aAAa,GAAG,aAA8B,CAAC;QACrD,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B,aAAa,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QAEpD,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/ws.d.ts b/node_modules/uri-js/dist/esnext/schemes/ws.d.ts new file mode 100755 index 0000000..47f4835 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/ws.d.ts @@ -0,0 +1,7 @@ +import { URISchemeHandler, URIComponents } from "../uri"; +export interface WSComponents extends URIComponents { + resourceName?: string; + secure?: boolean; +} +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/ws.js b/node_modules/uri-js/dist/esnext/schemes/ws.js new file mode 100755 index 0000000..9277f03 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/ws.js @@ -0,0 +1,41 @@ +function isSecure(wsComponents) { + return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; +} +//RFC 6455 +const handler = { + scheme: "ws", + domainHost: true, + parse: function (components, options) { + const wsComponents = components; + //indicate if the secure flag is set + wsComponents.secure = isSecure(wsComponents); + //construct resouce name + wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); + wsComponents.path = undefined; + wsComponents.query = undefined; + return wsComponents; + }, + serialize: function (wsComponents, options) { + //normalize the default port + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { + wsComponents.port = undefined; + } + //ensure scheme matches secure flag + if (typeof wsComponents.secure === 'boolean') { + wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws'); + wsComponents.secure = undefined; + } + //reconstruct path from resource name + if (wsComponents.resourceName) { + const [path, query] = wsComponents.resourceName.split('?'); + wsComponents.path = (path && path !== '/' ? path : undefined); + wsComponents.query = query; + wsComponents.resourceName = undefined; + } + //forbid fragment component + wsComponents.fragment = undefined; + return wsComponents; + } +}; +export default handler; +//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/ws.js.map b/node_modules/uri-js/dist/esnext/schemes/ws.js.map new file mode 100755 index 0000000..186818c --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/ws.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../../src/schemes/ws.ts"],"names":[],"mappings":"AAOA,kBAAkB,YAAyB;IAC1C,OAAO,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAC7H,CAAC;AAED,UAAU;AACV,MAAM,OAAO,GAAoB;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AAI,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC9D,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;YAC3B,YAAY,CAAC,YAAY,GAAG,SAAS,CAAC;SACtC;QAED,2BAA2B;QAC3B,YAAY,CAAC,QAAQ,GAAG,SAAS,CAAC;QAElC,OAAO,YAAY,CAAC;IACrB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/wss.d.ts b/node_modules/uri-js/dist/esnext/schemes/wss.d.ts new file mode 100755 index 0000000..fe5b2f3 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/wss.d.ts @@ -0,0 +1,3 @@ +import { URISchemeHandler } from "../uri"; +declare const handler: URISchemeHandler; +export default handler; diff --git a/node_modules/uri-js/dist/esnext/schemes/wss.js b/node_modules/uri-js/dist/esnext/schemes/wss.js new file mode 100755 index 0000000..d1e22cc --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/wss.js @@ -0,0 +1,9 @@ +import ws from "./ws"; +const handler = { + scheme: "wss", + domainHost: ws.domainHost, + parse: ws.parse, + serialize: ws.serialize +}; +export default handler; +//# sourceMappingURL=wss.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/schemes/wss.js.map b/node_modules/uri-js/dist/esnext/schemes/wss.js.map new file mode 100755 index 0000000..e19006d --- /dev/null +++ b/node_modules/uri-js/dist/esnext/schemes/wss.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wss.js","sourceRoot":"","sources":["../../../src/schemes/wss.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,KAAK;IACd,UAAU,EAAG,EAAE,CAAC,UAAU;IAC1B,KAAK,EAAG,EAAE,CAAC,KAAK;IAChB,SAAS,EAAG,EAAE,CAAC,SAAS;CACxB,CAAA;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/uri.d.ts b/node_modules/uri-js/dist/esnext/uri.d.ts new file mode 100755 index 0000000..da51e23 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/uri.d.ts @@ -0,0 +1,59 @@ +export interface URIComponents { + scheme?: string; + userinfo?: string; + host?: string; + port?: number | string; + path?: string; + query?: string; + fragment?: string; + reference?: string; + error?: string; +} +export interface URIOptions { + scheme?: string; + reference?: string; + tolerant?: boolean; + absolutePath?: boolean; + iri?: boolean; + unicodeSupport?: boolean; + domainHost?: boolean; +} +export interface URISchemeHandler { + scheme: string; + parse(components: ParentComponents, options: Options): Components; + serialize(components: Components, options: Options): ParentComponents; + unicodeSupport?: boolean; + domainHost?: boolean; + absolutePath?: boolean; +} +export interface URIRegExps { + NOT_SCHEME: RegExp; + NOT_USERINFO: RegExp; + NOT_HOST: RegExp; + NOT_PATH: RegExp; + NOT_PATH_NOSCHEME: RegExp; + NOT_QUERY: RegExp; + NOT_FRAGMENT: RegExp; + ESCAPE: RegExp; + UNRESERVED: RegExp; + OTHER_CHARS: RegExp; + PCT_ENCODED: RegExp; + IPV4ADDRESS: RegExp; + IPV6ADDRESS: RegExp; +} +export declare const SCHEMES: { + [scheme: string]: URISchemeHandler; +}; +export declare function pctEncChar(chr: string): string; +export declare function pctDecChars(str: string): string; +export declare function parse(uriString: string, options?: URIOptions): URIComponents; +export declare function removeDotSegments(input: string): string; +export declare function serialize(components: URIComponents, options?: URIOptions): string; +export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents; +export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string; +export declare function normalize(uri: string, options?: URIOptions): string; +export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents; +export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean; +export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean; +export declare function escapeComponent(str: string, options?: URIOptions): string; +export declare function unescapeComponent(str: string, options?: URIOptions): string; diff --git a/node_modules/uri-js/dist/esnext/uri.js b/node_modules/uri-js/dist/esnext/uri.js new file mode 100755 index 0000000..659ce26 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/uri.js @@ -0,0 +1,480 @@ +/** + * URI.js + * + * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript. + * @author Gary Court + * @see http://github.com/garycourt/uri-js + */ +/** + * Copyright 2011 Gary Court. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of Gary Court. + */ +import URI_PROTOCOL from "./regexps-uri"; +import IRI_PROTOCOL from "./regexps-iri"; +import punycode from "punycode"; +import { toUpperCase, typeOf, assign } from "./util"; +export const SCHEMES = {}; +export function pctEncChar(chr) { + const c = chr.charCodeAt(0); + let e; + if (c < 16) + e = "%0" + c.toString(16).toUpperCase(); + else if (c < 128) + e = "%" + c.toString(16).toUpperCase(); + else if (c < 2048) + e = "%" + ((c >> 6) | 192).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase(); + else + e = "%" + ((c >> 12) | 224).toString(16).toUpperCase() + "%" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase(); + return e; +} +export function pctDecChars(str) { + let newStr = ""; + let i = 0; + const il = str.length; + while (i < il) { + const c = parseInt(str.substr(i + 1, 2), 16); + if (c < 128) { + newStr += String.fromCharCode(c); + i += 3; + } + else if (c >= 194 && c < 224) { + if ((il - i) >= 6) { + const c2 = parseInt(str.substr(i + 4, 2), 16); + newStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + } + else { + newStr += str.substr(i, 6); + } + i += 6; + } + else if (c >= 224) { + if ((il - i) >= 9) { + const c2 = parseInt(str.substr(i + 4, 2), 16); + const c3 = parseInt(str.substr(i + 7, 2), 16); + newStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + } + else { + newStr += str.substr(i, 9); + } + i += 9; + } + else { + newStr += str.substr(i, 3); + i += 3; + } + } + return newStr; +} +function _normalizeComponentEncoding(components, protocol) { + function decodeUnreserved(str) { + const decStr = pctDecChars(str); + return (!decStr.match(protocol.UNRESERVED) ? str : decStr); + } + if (components.scheme) + components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, ""); + if (components.userinfo !== undefined) + components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.host !== undefined) + components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.path !== undefined) + components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.query !== undefined) + components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.fragment !== undefined) + components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + return components; +} +; +function _stripLeadingZeros(str) { + return str.replace(/^0*(.*)/, "$1") || "0"; +} +function _normalizeIPv4(host, protocol) { + const matches = host.match(protocol.IPV4ADDRESS) || []; + const [, address] = matches; + if (address) { + return address.split(".").map(_stripLeadingZeros).join("."); + } + else { + return host; + } +} +function _normalizeIPv6(host, protocol) { + const matches = host.match(protocol.IPV6ADDRESS) || []; + const [, address, zone] = matches; + if (address) { + const [last, first] = address.toLowerCase().split('::').reverse(); + const firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; + const lastFields = last.split(":").map(_stripLeadingZeros); + const isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); + const fieldCount = isLastFieldIPv4Address ? 7 : 8; + const lastFieldsStart = lastFields.length - fieldCount; + const fields = Array(fieldCount); + for (let x = 0; x < fieldCount; ++x) { + fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ''; + } + if (isLastFieldIPv4Address) { + fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); + } + const allZeroFields = fields.reduce((acc, field, index) => { + if (!field || field === "0") { + const lastLongest = acc[acc.length - 1]; + if (lastLongest && lastLongest.index + lastLongest.length === index) { + lastLongest.length++; + } + else { + acc.push({ index, length: 1 }); + } + } + return acc; + }, []); + const longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0]; + let newHost; + if (longestZeroFields && longestZeroFields.length > 1) { + const newFirst = fields.slice(0, longestZeroFields.index); + const newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); + newHost = newFirst.join(":") + "::" + newLast.join(":"); + } + else { + newHost = fields.join(":"); + } + if (zone) { + newHost += "%" + zone; + } + return newHost; + } + else { + return host; + } +} +const URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; +const NO_MATCH_IS_UNDEFINED = ("").match(/(){0}/)[1] === undefined; +export function parse(uriString, options = {}) { + const components = {}; + const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL); + if (options.reference === "suffix") + uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; + const matches = uriString.match(URI_PARSE); + if (matches) { + if (NO_MATCH_IS_UNDEFINED) { + //store each component + components.scheme = matches[1]; + components.userinfo = matches[3]; + components.host = matches[4]; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = matches[7]; + components.fragment = matches[8]; + //fix port number + if (isNaN(components.port)) { + components.port = matches[5]; + } + } + else { //IE FIX for improper RegExp matching + //store each component + components.scheme = matches[1] || undefined; + components.userinfo = (uriString.indexOf("@") !== -1 ? matches[3] : undefined); + components.host = (uriString.indexOf("//") !== -1 ? matches[4] : undefined); + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = (uriString.indexOf("?") !== -1 ? matches[7] : undefined); + components.fragment = (uriString.indexOf("#") !== -1 ? matches[8] : undefined); + //fix port number + if (isNaN(components.port)) { + components.port = (uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined); + } + } + if (components.host) { + //normalize IP hosts + components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); + } + //determine reference type + if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) { + components.reference = "same-document"; + } + else if (components.scheme === undefined) { + components.reference = "relative"; + } + else if (components.fragment === undefined) { + components.reference = "absolute"; + } + else { + components.reference = "uri"; + } + //check for reference errors + if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { + components.error = components.error || "URI is not a " + options.reference + " reference."; + } + //find scheme handler + const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + //check if scheme can't handle IRIs + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { + //if host component is a domain name + if (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) { + //convert Unicode IDN -> ASCII IDN + try { + components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); + } + catch (e) { + components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; + } + } + //convert IRI -> URI + _normalizeComponentEncoding(components, URI_PROTOCOL); + } + else { + //normalize encodings + _normalizeComponentEncoding(components, protocol); + } + //perform scheme specific parsing + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(components, options); + } + } + else { + components.error = components.error || "URI can not be parsed."; + } + return components; +} +; +function _recomposeAuthority(components, options) { + const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL); + const uriTokens = []; + if (components.userinfo !== undefined) { + uriTokens.push(components.userinfo); + uriTokens.push("@"); + } + if (components.host !== undefined) { + //normalize IP hosts, add brackets and escape zone separator for IPv6 + uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => "[" + $1 + ($2 ? "%25" + $2 : "") + "]")); + } + if (typeof components.port === "number" || typeof components.port === "string") { + uriTokens.push(":"); + uriTokens.push(String(components.port)); + } + return uriTokens.length ? uriTokens.join("") : undefined; +} +; +const RDS1 = /^\.\.?\//; +const RDS2 = /^\/\.(\/|$)/; +const RDS3 = /^\/\.\.(\/|$)/; +const RDS4 = /^\.\.?$/; +const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; +export function removeDotSegments(input) { + const output = []; + while (input.length) { + if (input.match(RDS1)) { + input = input.replace(RDS1, ""); + } + else if (input.match(RDS2)) { + input = input.replace(RDS2, "/"); + } + else if (input.match(RDS3)) { + input = input.replace(RDS3, "/"); + output.pop(); + } + else if (input === "." || input === "..") { + input = ""; + } + else { + const im = input.match(RDS5); + if (im) { + const s = im[0]; + input = input.slice(s.length); + output.push(s); + } + else { + throw new Error("Unexpected dot segment condition"); + } + } + } + return output.join(""); +} +; +export function serialize(components, options = {}) { + const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL); + const uriTokens = []; + //find scheme handler + const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + //perform scheme specific serialization + if (schemeHandler && schemeHandler.serialize) + schemeHandler.serialize(components, options); + if (components.host) { + //if host component is an IPv6 address + if (protocol.IPV6ADDRESS.test(components.host)) { + //TODO: normalize IPv6 address as per RFC 5952 + } + //if host component is a domain name + else if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) { + //convert IDN via punycode + try { + components.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host)); + } + catch (e) { + components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + } + } + //normalize encoding + _normalizeComponentEncoding(components, protocol); + if (options.reference !== "suffix" && components.scheme) { + uriTokens.push(components.scheme); + uriTokens.push(":"); + } + const authority = _recomposeAuthority(components, options); + if (authority !== undefined) { + if (options.reference !== "suffix") { + uriTokens.push("//"); + } + uriTokens.push(authority); + if (components.path && components.path.charAt(0) !== "/") { + uriTokens.push("/"); + } + } + if (components.path !== undefined) { + let s = components.path; + if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { + s = removeDotSegments(s); + } + if (authority === undefined) { + s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//" + } + uriTokens.push(s); + } + if (components.query !== undefined) { + uriTokens.push("?"); + uriTokens.push(components.query); + } + if (components.fragment !== undefined) { + uriTokens.push("#"); + uriTokens.push(components.fragment); + } + return uriTokens.join(""); //merge tokens into a string +} +; +export function resolveComponents(base, relative, options = {}, skipNormalization) { + const target = {}; + if (!skipNormalization) { + base = parse(serialize(base, options), options); //normalize base components + relative = parse(serialize(relative, options), options); //normalize relative components + } + options = options || {}; + if (!options.tolerant && relative.scheme) { + target.scheme = relative.scheme; + //target.authority = relative.authority; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } + else { + if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { + //target.authority = relative.authority; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } + else { + if (!relative.path) { + target.path = base.path; + if (relative.query !== undefined) { + target.query = relative.query; + } + else { + target.query = base.query; + } + } + else { + if (relative.path.charAt(0) === "/") { + target.path = removeDotSegments(relative.path); + } + else { + if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { + target.path = "/" + relative.path; + } + else if (!base.path) { + target.path = relative.path; + } + else { + target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path; + } + target.path = removeDotSegments(target.path); + } + target.query = relative.query; + } + //target.authority = base.authority; + target.userinfo = base.userinfo; + target.host = base.host; + target.port = base.port; + } + target.scheme = base.scheme; + } + target.fragment = relative.fragment; + return target; +} +; +export function resolve(baseURI, relativeURI, options) { + const schemelessOptions = assign({ scheme: 'null' }, options); + return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); +} +; +export function normalize(uri, options) { + if (typeof uri === "string") { + uri = serialize(parse(uri, options), options); + } + else if (typeOf(uri) === "object") { + uri = parse(serialize(uri, options), options); + } + return uri; +} +; +export function equal(uriA, uriB, options) { + if (typeof uriA === "string") { + uriA = serialize(parse(uriA, options), options); + } + else if (typeOf(uriA) === "object") { + uriA = serialize(uriA, options); + } + if (typeof uriB === "string") { + uriB = serialize(parse(uriB, options), options); + } + else if (typeOf(uriB) === "object") { + uriB = serialize(uriB, options); + } + return uriA === uriB; +} +; +export function escapeComponent(str, options) { + return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar); +} +; +export function unescapeComponent(str, options) { + return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars); +} +; +//# sourceMappingURL=uri.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/uri.js.map b/node_modules/uri-js/dist/esnext/uri.js.map new file mode 100755 index 0000000..2e72ab1 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/uri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../src/uri.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAiDrD,MAAM,CAAC,MAAM,OAAO,GAAsC,EAAE,CAAC;AAE7D,MAAM,qBAAqB,GAAU;IACpC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAQ,CAAC;IAEb,I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4B,GAAU,EAAE,OAAmB;IAChE,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC;AACrI,CAAC;AAAA,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/util.d.ts b/node_modules/uri-js/dist/esnext/util.d.ts new file mode 100755 index 0000000..7c12857 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/util.d.ts @@ -0,0 +1,6 @@ +export declare function merge(...sets: Array): string; +export declare function subexp(str: string): string; +export declare function typeOf(o: any): string; +export declare function toUpperCase(str: string): string; +export declare function toArray(obj: any): Array; +export declare function assign(target: object, source: any): any; diff --git a/node_modules/uri-js/dist/esnext/util.js b/node_modules/uri-js/dist/esnext/util.js new file mode 100755 index 0000000..072711e --- /dev/null +++ b/node_modules/uri-js/dist/esnext/util.js @@ -0,0 +1,36 @@ +export function merge(...sets) { + if (sets.length > 1) { + sets[0] = sets[0].slice(0, -1); + const xl = sets.length - 1; + for (let x = 1; x < xl; ++x) { + sets[x] = sets[x].slice(1, -1); + } + sets[xl] = sets[xl].slice(1); + return sets.join(''); + } + else { + return sets[0]; + } +} +export function subexp(str) { + return "(?:" + str + ")"; +} +export function typeOf(o) { + return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase()); +} +export function toUpperCase(str) { + return str.toUpperCase(); +} +export function toArray(obj) { + return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : []; +} +export function assign(target, source) { + const obj = target; + if (source) { + for (const key in source) { + obj[key] = source[key]; + } + } + return obj; +} +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/uri-js/dist/esnext/util.js.map b/node_modules/uri-js/dist/esnext/util.js.map new file mode 100755 index 0000000..05d9df0 --- /dev/null +++ b/node_modules/uri-js/dist/esnext/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,IAAkB;IAC1C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAC5B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACrB;SAAM;QACN,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;KACf;AACF,CAAC;AAED,MAAM,iBAAiB,GAAU;IAChC,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1B,CAAC;AAED,MAAM,iBAAiB,CAAK;IAC3B,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACpJ,CAAC;AAED,MAAM,sBAAsB,GAAU;IACrC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,kBAAkB,GAAO;IAC9B,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvM,CAAC;AAGD,MAAM,iBAAiB,MAAc,EAAE,MAAW;IACjD,MAAM,GAAG,GAAG,MAAa,CAAC;IAC1B,IAAI,MAAM,EAAE;QACX,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACzB,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;SACvB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/uri-js/package.json b/node_modules/uri-js/package.json new file mode 100755 index 0000000..de95d91 --- /dev/null +++ b/node_modules/uri-js/package.json @@ -0,0 +1,77 @@ +{ + "name": "uri-js", + "version": "4.4.1", + "description": "An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.", + "main": "dist/es5/uri.all.js", + "types": "dist/es5/uri.all.d.ts", + "directories": { + "test": "tests" + }, + "files": [ + "dist", + "package.json", + "yarn.lock", + "README.md", + "CHANGELOG", + "LICENSE" + ], + "scripts": { + "build:esnext": "tsc", + "build:es5": "rollup -c && cp dist/esnext/uri.d.ts dist/es5/uri.all.d.ts && npm run build:es5:fix-sourcemap", + "build:es5:fix-sourcemap": "sorcery -i dist/es5/uri.all.js", + "build:es5:min": "uglifyjs dist/es5/uri.all.js --support-ie8 --output dist/es5/uri.all.min.js --in-source-map dist/es5/uri.all.js.map --source-map uri.all.min.js.map --comments --compress --mangle --pure-funcs merge subexp && mv uri.all.min.js.map dist/es5/ && cp dist/es5/uri.all.d.ts dist/es5/uri.all.min.d.ts", + "build": "npm run build:esnext && npm run build:es5 && npm run build:es5:min", + "clean": "rm -rf dist", + "test": "mocha -u mocha-qunit-ui dist/es5/uri.all.js tests/tests.js" + }, + "repository": { + "type": "git", + "url": "http://github.com/garycourt/uri-js" + }, + "keywords": [ + "URI", + "IRI", + "IDN", + "URN", + "UUID", + "HTTP", + "HTTPS", + "WS", + "WSS", + "MAILTO", + "RFC3986", + "RFC3987", + "RFC5891", + "RFC2616", + "RFC2818", + "RFC2141", + "RFC4122", + "RFC4291", + "RFC5952", + "RFC6068", + "RFC6455", + "RFC6874" + ], + "author": "Gary Court ", + "license": "BSD-2-Clause", + "bugs": { + "url": "https://github.com/garycourt/uri-js/issues" + }, + "homepage": "https://github.com/garycourt/uri-js", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-plugin-external-helpers": "^6.22.0", + "babel-preset-latest": "^6.24.1", + "mocha": "^8.2.1", + "mocha-qunit-ui": "^0.1.3", + "rollup": "^0.41.6", + "rollup-plugin-babel": "^2.7.1", + "rollup-plugin-node-resolve": "^2.0.0", + "sorcery": "^0.10.0", + "typescript": "^2.8.1", + "uglify-js": "^2.8.14" + }, + "dependencies": { + "punycode": "^2.1.0" + } +} diff --git a/node_modules/uri-js/yarn.lock b/node_modules/uri-js/yarn.lock new file mode 100755 index 0000000..3c42ded --- /dev/null +++ b/node_modules/uri-js/yarn.lock @@ -0,0 +1,2558 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== + dependencies: + micromatch "^2.1.5" + normalize-path "^2.0.0" + +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= + dependencies: + arr-flatten "^1.0.1" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +async-each@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" + integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== + +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +babel-cli@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.26.0.tgz#502ab54874d7db88ad00b887a06383ce03d002f1" + integrity sha1-UCq1SHTX24itALiHoGODzgPQAvE= + dependencies: + babel-core "^6.26.0" + babel-polyfill "^6.26.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + commander "^2.11.0" + convert-source-map "^1.5.0" + fs-readdir-recursive "^1.0.0" + glob "^7.1.2" + lodash "^4.17.4" + output-file-sync "^1.1.2" + path-is-absolute "^1.0.1" + slash "^1.0.0" + source-map "^0.5.6" + v8flags "^2.1.1" + optionalDependencies: + chokidar "^1.6.1" + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-core@6: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.0" + debug "^2.6.8" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.7" + slash "^1.0.0" + source-map "^0.5.6" + +babel-core@^6.26.0: + version "6.26.3" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" + integrity sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA== + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.1" + debug "^2.6.9" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.8" + slash "^1.0.0" + source-map "^0.5.7" + +babel-generator@^6.26.0: + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.7" + trim-right "^1.0.1" + +babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz#cce4517ada356f4220bcae8a02c2b346f9a56664" + dependencies: + babel-helper-explode-assignable-expression "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-call-delegate@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d" + dependencies: + babel-helper-hoist-variables "^6.24.1" + babel-runtime "^6.22.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-define-map@^6.24.1: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz#a5f56dab41a25f97ecb498c7ebaca9819f95be5f" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + lodash "^4.17.4" + +babel-helper-explode-assignable-expression@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-function-name@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" + dependencies: + babel-helper-get-function-arity "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-get-function-arity@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-hoist-variables@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz#1ecb27689c9d25513eadbc9914a73f5408be7a76" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-optimise-call-expression@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-regex@^6.24.1: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz#325c59f902f82f24b74faceed0363954f6495e72" + dependencies: + babel-runtime "^6.26.0" + babel-types "^6.26.0" + lodash "^4.17.4" + +babel-helper-remap-async-to-generator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz#5ec581827ad723fecdd381f1c928390676e4551b" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-replace-supers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" + dependencies: + babel-helper-optimise-call-expression "^6.24.1" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + integrity sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI= + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-check-es2015-constants@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-external-helpers@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz#2285f48b02bd5dede85175caf8c62e86adccefa1" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-syntax-async-functions@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" + +babel-plugin-syntax-exponentiation-operator@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" + +babel-plugin-syntax-trailing-function-commas@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + +babel-plugin-transform-async-to-generator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" + dependencies: + babel-helper-remap-async-to-generator "^6.24.1" + babel-plugin-syntax-async-functions "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-arrow-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoping@^6.24.1: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz#d70f5299c1308d05c12f463813b0a09e73b1895f" + dependencies: + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + lodash "^4.17.4" + +babel-plugin-transform-es2015-classes@^6.24.1, babel-plugin-transform-es2015-classes@^6.9.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db" + dependencies: + babel-helper-define-map "^6.24.1" + babel-helper-function-name "^6.24.1" + babel-helper-optimise-call-expression "^6.24.1" + babel-helper-replace-supers "^6.24.1" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-computed-properties@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-destructuring@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-duplicate-keys@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-for-of@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-function-name@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-modules-amd@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz#3b3e54017239842d6d19c3011c4bd2f00a00d154" + dependencies: + babel-plugin-transform-es2015-modules-commonjs "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-modules-commonjs@^6.24.1: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz#0d8394029b7dc6abe1a97ef181e00758dd2e5d8a" + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-types "^6.26.0" + +babel-plugin-transform-es2015-modules-systemjs@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" + dependencies: + babel-helper-hoist-variables "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-modules-umd@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468" + dependencies: + babel-plugin-transform-es2015-modules-amd "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-object-super@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d" + dependencies: + babel-helper-replace-supers "^6.24.1" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-parameters@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b" + dependencies: + babel-helper-call-delegate "^6.24.1" + babel-helper-get-function-arity "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-shorthand-properties@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-spread@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-sticky-regex@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc" + dependencies: + babel-helper-regex "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-template-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-typeof-symbol@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-unicode-regex@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9" + dependencies: + babel-helper-regex "^6.24.1" + babel-runtime "^6.22.0" + regexpu-core "^2.0.0" + +babel-plugin-transform-exponentiation-operator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" + dependencies: + babel-helper-builder-binary-assignment-operator-visitor "^6.24.1" + babel-plugin-syntax-exponentiation-operator "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-regenerator@^6.24.1: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" + dependencies: + regenerator-transform "^0.10.0" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-polyfill@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + dependencies: + babel-runtime "^6.26.0" + core-js "^2.5.0" + regenerator-runtime "^0.10.5" + +babel-preset-es2015@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz#d44050d6bc2c9feea702aaf38d727a0210538939" + dependencies: + babel-plugin-check-es2015-constants "^6.22.0" + babel-plugin-transform-es2015-arrow-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoping "^6.24.1" + babel-plugin-transform-es2015-classes "^6.24.1" + babel-plugin-transform-es2015-computed-properties "^6.24.1" + babel-plugin-transform-es2015-destructuring "^6.22.0" + babel-plugin-transform-es2015-duplicate-keys "^6.24.1" + babel-plugin-transform-es2015-for-of "^6.22.0" + babel-plugin-transform-es2015-function-name "^6.24.1" + babel-plugin-transform-es2015-literals "^6.22.0" + babel-plugin-transform-es2015-modules-amd "^6.24.1" + babel-plugin-transform-es2015-modules-commonjs "^6.24.1" + babel-plugin-transform-es2015-modules-systemjs "^6.24.1" + babel-plugin-transform-es2015-modules-umd "^6.24.1" + babel-plugin-transform-es2015-object-super "^6.24.1" + babel-plugin-transform-es2015-parameters "^6.24.1" + babel-plugin-transform-es2015-shorthand-properties "^6.24.1" + babel-plugin-transform-es2015-spread "^6.22.0" + babel-plugin-transform-es2015-sticky-regex "^6.24.1" + babel-plugin-transform-es2015-template-literals "^6.22.0" + babel-plugin-transform-es2015-typeof-symbol "^6.22.0" + babel-plugin-transform-es2015-unicode-regex "^6.24.1" + babel-plugin-transform-regenerator "^6.24.1" + +babel-preset-es2016@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-es2016/-/babel-preset-es2016-6.24.1.tgz#f900bf93e2ebc0d276df9b8ab59724ebfd959f8b" + dependencies: + babel-plugin-transform-exponentiation-operator "^6.24.1" + +babel-preset-es2017@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-es2017/-/babel-preset-es2017-6.24.1.tgz#597beadfb9f7f208bcfd8a12e9b2b29b8b2f14d1" + dependencies: + babel-plugin-syntax-trailing-function-commas "^6.22.0" + babel-plugin-transform-async-to-generator "^6.24.1" + +babel-preset-latest@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-latest/-/babel-preset-latest-6.24.1.tgz#677de069154a7485c2d25c577c02f624b85b85e8" + dependencies: + babel-preset-es2015 "^6.24.1" + babel-preset-es2016 "^6.24.1" + babel-preset-es2017 "^6.24.1" + +babel-register@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + integrity sha1-btAhFz4vy0htestFxgCahW9kcHE= + dependencies: + babel-core "^6.26.0" + babel-runtime "^6.26.0" + core-js "^2.5.0" + home-or-tmp "^2.0.0" + lodash "^4.17.4" + mkdirp "^0.5.1" + source-map-support "^0.4.15" + +babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.24.1, babel-template@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.24.1, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +binary-extensions@^1.0.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + +binary-extensions@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" + integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== + +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browser-resolve@^1.11.0: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +buffer-crc32@^0.2.5: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + +builtin-modules@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" + integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chokidar@3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" + integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.1.2" + +chokidar@^1.6.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +commander@^2.11.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +convert-source-map@^1.5.0, convert-source-map@^1.5.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^2.4.0, core-js@^2.5.0: + version "2.6.12" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" + integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +debug@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +decamelize@^1.0.0, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= + dependencies: + repeating "^2.0.0" + +diff@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +es6-promise@^3.1.2: + version "3.3.1" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" + +escape-string-regexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +escape-string-regexp@^1.0.2: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +estree-walker@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= + dependencies: + is-posix-bracket "^0.1.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= + dependencies: + fill-range "^2.1.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= + dependencies: + is-extglob "^1.0.0" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs-readdir-recursive@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" + integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^1.0.0: + version "1.2.13" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38" + integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw== + dependencies: + bindings "^1.5.0" + nan "^2.12.1" + +fsevents@~2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + +glob-parent@~5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@7.1.6, glob@^7.1.2, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +graceful-fs@^4.1.11, graceful-fs@^4.1.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + +graceful-fs@^4.1.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +he@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + integrity sha1-42w/LSyufXRqhX440Y1fMqeILbg= + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= + dependencies: + binary-extensions "^1.0.0" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-finite@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3" + integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w== + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= + dependencies: + is-extglob "^1.0.0" + +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@3.14.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + +json5@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash@^4.17.4: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + +micromatch@^2.1.5: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.2.0, minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.1: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + +mocha-qunit-ui@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/mocha-qunit-ui/-/mocha-qunit-ui-0.1.3.tgz#e3e1ff1dac33222b10cef681efd7f82664141ea9" + +mocha@^8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.2.1.tgz#f2fa68817ed0e53343d989df65ccd358bc3a4b39" + integrity sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.4.3" + debug "4.2.0" + diff "4.0.2" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "3.14.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.2" + nanoid "3.1.12" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "7.2.0" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.0.2" + yargs "13.3.2" + yargs-parser "13.1.2" + yargs-unparser "2.0.0" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nan@^2.12.1: + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== + +nanoid@3.1.12: + version "3.1.12" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.12.tgz#6f7736c62e8d39421601e4a0c77623a97ea69654" + integrity sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +normalize-path@^2.0.0, normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-tmpdir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +output-file-sync@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76" + integrity sha1-0KM+7+YaIF+suQCS6CZZjVJFznY= + dependencies: + graceful-fs "^4.1.4" + mkdirp "^0.5.1" + object-assign "^4.1.0" + +p-limit@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= + +private@^0.1.6, private@^0.1.7, private@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +punycode@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" + +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +readable-stream@^2.0.2: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== + dependencies: + graceful-fs "^4.1.11" + micromatch "^3.1.10" + readable-stream "^2.0.2" + +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" + +regenerate@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" + +regenerator-runtime@^0.10.5: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regenerator-transform@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd" + dependencies: + babel-runtime "^6.18.0" + babel-types "^6.19.0" + private "^0.1.6" + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexpu-core@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" + dependencies: + regenerate "^1.2.1" + regjsgen "^0.2.0" + regjsparser "^0.1.4" + +regjsgen@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" + +regjsparser@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" + dependencies: + jsesc "~0.5.0" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.5.2, repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= + dependencies: + is-finite "^1.0.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6: + version "1.6.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.6.0.tgz#0fbd21278b27b4004481c395349e7aba60a9ff5c" + dependencies: + path-parse "^1.0.5" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@^2.5.2: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + dependencies: + glob "^7.1.3" + +rollup-plugin-babel@^2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-2.7.1.tgz#16528197b0f938a1536f44683c7a93d573182f57" + dependencies: + babel-core "6" + babel-plugin-transform-es2015-classes "^6.9.0" + object-assign "^4.1.0" + rollup-pluginutils "^1.5.0" + +rollup-plugin-node-resolve@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.1.tgz#cbb783b0d15b02794d58915350b2f0d902b8ddc8" + dependencies: + browser-resolve "^1.11.0" + builtin-modules "^1.1.0" + resolve "^1.1.6" + +rollup-pluginutils@^1.5.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" + dependencies: + estree-walker "^0.2.1" + minimatch "^3.0.2" + +rollup@^0.41.6: + version "0.41.6" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a" + dependencies: + source-map-support "^0.4.0" + +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +sander@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/sander/-/sander-0.5.1.tgz#741e245e231f07cafb6fdf0f133adfa216a502ad" + dependencies: + es6-promise "^3.1.2" + graceful-fs "^4.1.3" + mkdirp "^0.5.1" + rimraf "^2.5.2" + +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +sorcery@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/sorcery/-/sorcery-0.10.0.tgz#8ae90ad7d7cb05fc59f1ab0c637845d5c15a52b7" + dependencies: + buffer-crc32 "^0.2.5" + minimist "^1.2.0" + sander "^0.5.0" + sourcemap-codec "^1.3.0" + +source-map-resolve@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.4.0, source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + dependencies: + source-map "^0.5.6" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +sourcemap-codec@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.1.tgz#c8fd92d91889e902a07aee392bdd2c5863958ba2" + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-json-comments@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@7.2.0, supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= + +typescript@^2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624" + +uglify-js@^2.8.14: + version "2.8.29" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +user-home@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" + integrity sha1-K1viOjK2Onyd640PKNSFcko98ZA= + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +v8flags@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" + integrity sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ= + dependencies: + user-home "^1.1.1" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wide-align@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +workerpool@6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.2.tgz#e241b43d8d033f1beb52c7851069456039d1d438" + integrity sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q== + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +y18n@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" + integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== + +yargs-parser@13.1.2, yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@13.3.2: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/node_modules/v8-compile-cache/CHANGELOG.md b/node_modules/v8-compile-cache/CHANGELOG.md new file mode 100644 index 0000000..d4da256 --- /dev/null +++ b/node_modules/v8-compile-cache/CHANGELOG.md @@ -0,0 +1,53 @@ +# `v8-module-cache` Changelog + +## 2021-03-05, Version 2.3.0 + +* Fix use require.main instead of module.parent [#34](https://github.com/zertosh/v8-compile-cache/pull/34). + +## 2020-10-28, Version 2.2.0 + +* Added `V8_COMPILE_CACHE_CACHE_DIR` option [#23](https://github.com/zertosh/v8-compile-cache/pull/23). + +## 2020-05-30, Version 2.1.1 + +* Stop using process.umask() [#28](https://github.com/zertosh/v8-compile-cache/pull/28). + +## 2019-08-04, Version 2.1.0 + +* Fix Electron by calling the module wrapper with `Buffer` [#10](https://github.com/zertosh/v8-compile-cache/pull/10). + +## 2019-05-10, Version 2.0.3 + +* Add `LICENSE` file [#19](https://github.com/zertosh/v8-compile-cache/pull/19). +* Add "repository" to `package.json` (see [eea336e](https://github.com/zertosh/v8-compile-cache/commit/eea336eaa8360f9ded9342b8aa928e56ac6a7529)). +* Support `require.resolve.paths` (added in Node v8.9.0) [#20](https://github.com/zertosh/v8-compile-cache/pull/20)/[#22](https://github.com/zertosh/v8-compile-cache/pull/22). + +## 2018-08-06, Version 2.0.2 + +* Re-publish. + +## 2018-08-06, Version 2.0.1 + +* Support `require.resolve` options (added in Node v8.9.0). + +## 2018-04-30, Version 2.0.0 + +* Use `Buffer.alloc` instead of `new Buffer()`. +* Drop support for Node 5.x. + +## 2018-01-23, Version 1.1.2 + +* Instead of checking for `process.versions.v8`, check that `script.cachedDataProduced` is `true` (rather than `null`/`undefined`) for support to be considered existent. + +## 2018-01-23, Version 1.1.1 + +* Check for the existence of `process.versions.v8` before attaching hook (see [f8b0388](https://github.com/zertosh/v8-compile-cache/commit/f8b038848be94bc2c905880dd50447c73393f364)). + +## 2017-03-27, Version 1.1.0 + +* Safer cache directory creation (see [bcb3b12](https://github.com/zertosh/v8-compile-cache/commit/bcb3b12c819ab0927ec4408e70f612a6d50a9617)). + - The cache is now suffixed with the user's uid on POSIX systems (i.e. `/path/to/tmp/v8-compile-cache-1234`). + +## 2017-02-21, Version 1.0.0 + +* Initial release. diff --git a/node_modules/v8-compile-cache/LICENSE b/node_modules/v8-compile-cache/LICENSE new file mode 100644 index 0000000..b72b670 --- /dev/null +++ b/node_modules/v8-compile-cache/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Andres Suarez + +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/v8-compile-cache/README.md b/node_modules/v8-compile-cache/README.md new file mode 100644 index 0000000..6e0b99f --- /dev/null +++ b/node_modules/v8-compile-cache/README.md @@ -0,0 +1,55 @@ +# v8-compile-cache + +[![Build Status](https://travis-ci.org/zertosh/v8-compile-cache.svg?branch=master)](https://travis-ci.org/zertosh/v8-compile-cache) + +`v8-compile-cache` attaches a `require` hook to use [V8's code cache](https://v8project.blogspot.com/2015/07/code-caching.html) to speed up instantiation time. The "code cache" is the work of parsing and compiling done by V8. + +The ability to tap into V8 to produce/consume this cache was introduced in [Node v5.7.0](https://nodejs.org/en/blog/release/v5.7.0/). + +## Usage + +1. Add the dependency: + + ```sh + $ npm install --save v8-compile-cache + ``` + +2. Then, in your entry module add: + + ```js + require('v8-compile-cache'); + ``` + +**Requiring `v8-compile-cache` in Node <5.7.0 is a noop – but you need at least Node 4.0.0 to support the ES2015 syntax used by `v8-compile-cache`.** + +## Options + +Set the environment variable `DISABLE_V8_COMPILE_CACHE=1` to disable the cache. + +Cache directory is defined by environment variable `V8_COMPILE_CACHE_CACHE_DIR` or defaults to `/v8-compile-cache-`. + +## Internals + +Cache files are suffixed `.BLOB` and `.MAP` corresponding to the entry module that required `v8-compile-cache`. The cache is _entry module specific_ because it is faster to load the entire code cache into memory at once, than it is to read it from disk on a file-by-file basis. + +## Benchmarks + +See https://github.com/zertosh/v8-compile-cache/tree/master/bench. + +**Load Times:** + +| Module | Without Cache | With Cache | +| ---------------- | -------------:| ----------:| +| `babel-core` | `218ms` | `185ms` | +| `yarn` | `153ms` | `113ms` | +| `yarn` (bundled) | `228ms` | `105ms` | + +_^ Includes the overhead of loading the cache itself._ + +## Acknowledgements + +* `FileSystemBlobStore` and `NativeCompileCache` are based on Atom's implementation of their v8 compile cache: + - https://github.com/atom/atom/blob/b0d7a8a/src/file-system-blob-store.js + - https://github.com/atom/atom/blob/b0d7a8a/src/native-compile-cache.js +* `mkdirpSync` is based on: + - https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98 diff --git a/node_modules/v8-compile-cache/package.json b/node_modules/v8-compile-cache/package.json new file mode 100644 index 0000000..f878914 --- /dev/null +++ b/node_modules/v8-compile-cache/package.json @@ -0,0 +1,34 @@ +{ + "name": "v8-compile-cache", + "version": "2.3.0", + "description": "Require hook for automatic V8 compile cache persistence", + "main": "v8-compile-cache.js", + "scripts": { + "bench": "bench/run.sh", + "eslint": "eslint --max-warnings=0 .", + "tap": "tap test/*-test.js", + "test": "npm run tap", + "posttest": "npm run eslint" + }, + "author": "Andres Suarez ", + "repository": { + "type": "git", + "url": "https://github.com/zertosh/v8-compile-cache.git" + }, + "files": [ + "v8-compile-cache.js" + ], + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "babel-core": "6.26.3", + "eslint": "^7.12.1", + "flow-parser": "0.136.0", + "rimraf": "^2.5.4", + "rxjs": "6.6.3", + "semver": "^5.3.0", + "tap": "^9.0.0", + "temp": "^0.8.3", + "yarn": "1.22.10" + } +} diff --git a/node_modules/v8-compile-cache/v8-compile-cache.js b/node_modules/v8-compile-cache/v8-compile-cache.js new file mode 100644 index 0000000..f094da4 --- /dev/null +++ b/node_modules/v8-compile-cache/v8-compile-cache.js @@ -0,0 +1,371 @@ +'use strict'; + +const Module = require('module'); +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); +const vm = require('vm'); +const os = require('os'); + +const hasOwnProperty = Object.prototype.hasOwnProperty; + +//------------------------------------------------------------------------------ +// FileSystemBlobStore +//------------------------------------------------------------------------------ + +class FileSystemBlobStore { + constructor(directory, prefix) { + const name = prefix ? slashEscape(prefix + '.') : ''; + this._blobFilename = path.join(directory, name + 'BLOB'); + this._mapFilename = path.join(directory, name + 'MAP'); + this._lockFilename = path.join(directory, name + 'LOCK'); + this._directory = directory; + this._load(); + } + + has(key, invalidationKey) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + return this._invalidationKeys[key] === invalidationKey; + } else if (hasOwnProperty.call(this._storedMap, key)) { + return this._storedMap[key][0] === invalidationKey; + } + return false; + } + + get(key, invalidationKey) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + if (this._invalidationKeys[key] === invalidationKey) { + return this._memoryBlobs[key]; + } + } else if (hasOwnProperty.call(this._storedMap, key)) { + const mapping = this._storedMap[key]; + if (mapping[0] === invalidationKey) { + return this._storedBlob.slice(mapping[1], mapping[2]); + } + } + } + + set(key, invalidationKey, buffer) { + this._invalidationKeys[key] = invalidationKey; + this._memoryBlobs[key] = buffer; + this._dirty = true; + } + + delete(key) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + this._dirty = true; + delete this._memoryBlobs[key]; + } + if (hasOwnProperty.call(this._invalidationKeys, key)) { + this._dirty = true; + delete this._invalidationKeys[key]; + } + if (hasOwnProperty.call(this._storedMap, key)) { + this._dirty = true; + delete this._storedMap[key]; + } + } + + isDirty() { + return this._dirty; + } + + save() { + const dump = this._getDump(); + const blobToStore = Buffer.concat(dump[0]); + const mapToStore = JSON.stringify(dump[1]); + + try { + mkdirpSync(this._directory); + fs.writeFileSync(this._lockFilename, 'LOCK', {flag: 'wx'}); + } catch (error) { + // Swallow the exception if we fail to acquire the lock. + return false; + } + + try { + fs.writeFileSync(this._blobFilename, blobToStore); + fs.writeFileSync(this._mapFilename, mapToStore); + } finally { + fs.unlinkSync(this._lockFilename); + } + + return true; + } + + _load() { + try { + this._storedBlob = fs.readFileSync(this._blobFilename); + this._storedMap = JSON.parse(fs.readFileSync(this._mapFilename)); + } catch (e) { + this._storedBlob = Buffer.alloc(0); + this._storedMap = {}; + } + this._dirty = false; + this._memoryBlobs = {}; + this._invalidationKeys = {}; + } + + _getDump() { + const buffers = []; + const newMap = {}; + let offset = 0; + + function push(key, invalidationKey, buffer) { + buffers.push(buffer); + newMap[key] = [invalidationKey, offset, offset + buffer.length]; + offset += buffer.length; + } + + for (const key of Object.keys(this._memoryBlobs)) { + const buffer = this._memoryBlobs[key]; + const invalidationKey = this._invalidationKeys[key]; + push(key, invalidationKey, buffer); + } + + for (const key of Object.keys(this._storedMap)) { + if (hasOwnProperty.call(newMap, key)) continue; + const mapping = this._storedMap[key]; + const buffer = this._storedBlob.slice(mapping[1], mapping[2]); + push(key, mapping[0], buffer); + } + + return [buffers, newMap]; + } +} + +//------------------------------------------------------------------------------ +// NativeCompileCache +//------------------------------------------------------------------------------ + +class NativeCompileCache { + constructor() { + this._cacheStore = null; + this._previousModuleCompile = null; + } + + setCacheStore(cacheStore) { + this._cacheStore = cacheStore; + } + + install() { + const self = this; + const hasRequireResolvePaths = typeof require.resolve.paths === 'function'; + this._previousModuleCompile = Module.prototype._compile; + Module.prototype._compile = function(content, filename) { + const mod = this; + + function require(id) { + return mod.require(id); + } + + // https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L28 + function resolve(request, options) { + return Module._resolveFilename(request, mod, false, options); + } + require.resolve = resolve; + + // https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L37 + // resolve.resolve.paths was added in v8.9.0 + if (hasRequireResolvePaths) { + resolve.paths = function paths(request) { + return Module._resolveLookupPaths(request, mod, true); + }; + } + + require.main = process.mainModule; + + // Enable support to add extra extension types + require.extensions = Module._extensions; + require.cache = Module._cache; + + const dirname = path.dirname(filename); + + const compiledWrapper = self._moduleCompile(filename, content); + + // We skip the debugger setup because by the time we run, node has already + // done that itself. + + // `Buffer` is included for Electron. + // See https://github.com/zertosh/v8-compile-cache/pull/10#issuecomment-518042543 + const args = [mod.exports, require, mod, filename, dirname, process, global, Buffer]; + return compiledWrapper.apply(mod.exports, args); + }; + } + + uninstall() { + Module.prototype._compile = this._previousModuleCompile; + } + + _moduleCompile(filename, content) { + // https://github.com/nodejs/node/blob/v7.5.0/lib/module.js#L511 + + // Remove shebang + var contLen = content.length; + if (contLen >= 2) { + if (content.charCodeAt(0) === 35/*#*/ && + content.charCodeAt(1) === 33/*!*/) { + if (contLen === 2) { + // Exact match + content = ''; + } else { + // Find end of shebang line and slice it off + var i = 2; + for (; i < contLen; ++i) { + var code = content.charCodeAt(i); + if (code === 10/*\n*/ || code === 13/*\r*/) break; + } + if (i === contLen) { + content = ''; + } else { + // Note that this actually includes the newline character(s) in the + // new output. This duplicates the behavior of the regular + // expression that was previously used to replace the shebang line + content = content.slice(i); + } + } + } + } + + // create wrapper function + var wrapper = Module.wrap(content); + + var invalidationKey = crypto + .createHash('sha1') + .update(content, 'utf8') + .digest('hex'); + + var buffer = this._cacheStore.get(filename, invalidationKey); + + var script = new vm.Script(wrapper, { + filename: filename, + lineOffset: 0, + displayErrors: true, + cachedData: buffer, + produceCachedData: true, + }); + + if (script.cachedDataProduced) { + this._cacheStore.set(filename, invalidationKey, script.cachedData); + } else if (script.cachedDataRejected) { + this._cacheStore.delete(filename); + } + + var compiledWrapper = script.runInThisContext({ + filename: filename, + lineOffset: 0, + columnOffset: 0, + displayErrors: true, + }); + + return compiledWrapper; + } +} + +//------------------------------------------------------------------------------ +// utilities +// +// https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98 +// https://github.com/zertosh/slash-escape/blob/e7ebb99/slash-escape.js +//------------------------------------------------------------------------------ + +function mkdirpSync(p_) { + _mkdirpSync(path.resolve(p_), 0o777); +} + +function _mkdirpSync(p, mode) { + try { + fs.mkdirSync(p, mode); + } catch (err0) { + if (err0.code === 'ENOENT') { + _mkdirpSync(path.dirname(p)); + _mkdirpSync(p); + } else { + try { + const stat = fs.statSync(p); + if (!stat.isDirectory()) { throw err0; } + } catch (err1) { + throw err0; + } + } + } +} + +function slashEscape(str) { + const ESCAPE_LOOKUP = { + '\\': 'zB', + ':': 'zC', + '/': 'zS', + '\x00': 'z0', + 'z': 'zZ', + }; + const ESCAPE_REGEX = /[\\:/\x00z]/g; // eslint-disable-line no-control-regex + return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); +} + +function supportsCachedData() { + const script = new vm.Script('""', {produceCachedData: true}); + // chakracore, as of v1.7.1.0, returns `false`. + return script.cachedDataProduced === true; +} + +function getCacheDir() { + const v8_compile_cache_cache_dir = process.env.V8_COMPILE_CACHE_CACHE_DIR; + if (v8_compile_cache_cache_dir) { + return v8_compile_cache_cache_dir; + } + + // Avoid cache ownership issues on POSIX systems. + const dirname = typeof process.getuid === 'function' + ? 'v8-compile-cache-' + process.getuid() + : 'v8-compile-cache'; + const version = typeof process.versions.v8 === 'string' + ? process.versions.v8 + : typeof process.versions.chakracore === 'string' + ? 'chakracore-' + process.versions.chakracore + : 'node-' + process.version; + const cacheDir = path.join(os.tmpdir(), dirname, version); + return cacheDir; +} + +function getMainName() { + // `require.main.filename` is undefined or null when: + // * node -e 'require("v8-compile-cache")' + // * node -r 'v8-compile-cache' + // * Or, requiring from the REPL. + const mainName = require.main && typeof require.main.filename === 'string' + ? require.main.filename + : process.cwd(); + return mainName; +} + +//------------------------------------------------------------------------------ +// main +//------------------------------------------------------------------------------ + +if (!process.env.DISABLE_V8_COMPILE_CACHE && supportsCachedData()) { + const cacheDir = getCacheDir(); + const prefix = getMainName(); + const blobStore = new FileSystemBlobStore(cacheDir, prefix); + + const nativeCompileCache = new NativeCompileCache(); + nativeCompileCache.setCacheStore(blobStore); + nativeCompileCache.install(); + + process.once('exit', () => { + if (blobStore.isDirty()) { + blobStore.save(); + } + nativeCompileCache.uninstall(); + }); +} + +module.exports.__TEST__ = { + FileSystemBlobStore, + NativeCompileCache, + mkdirpSync, + slashEscape, + supportsCachedData, + getCacheDir, + getMainName, +}; diff --git a/node_modules/which-boxed-primitive/.editorconfig b/node_modules/which-boxed-primitive/.editorconfig new file mode 100644 index 0000000..bc228f8 --- /dev/null +++ b/node_modules/which-boxed-primitive/.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 = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/which-boxed-primitive/.eslintignore b/node_modules/which-boxed-primitive/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/node_modules/which-boxed-primitive/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/node_modules/which-boxed-primitive/.eslintrc b/node_modules/which-boxed-primitive/.eslintrc new file mode 100644 index 0000000..bfa96d1 --- /dev/null +++ b/node_modules/which-boxed-primitive/.eslintrc @@ -0,0 +1,9 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements": [2, 12], + }, +} diff --git a/node_modules/which-boxed-primitive/.github/FUNDING.yml b/node_modules/which-boxed-primitive/.github/FUNDING.yml new file mode 100644 index 0000000..0cdbbd8 --- /dev/null +++ b/node_modules/which-boxed-primitive/.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/which-boxed-primitive +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/which-boxed-primitive/.nycrc b/node_modules/which-boxed-primitive/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/node_modules/which-boxed-primitive/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/which-boxed-primitive/CHANGELOG.md b/node_modules/which-boxed-primitive/CHANGELOG.md new file mode 100644 index 0000000..23e5422 --- /dev/null +++ b/node_modules/which-boxed-primitive/CHANGELOG.md @@ -0,0 +1,54 @@ +# 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). + +## [v1.0.2](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.1...v1.0.2) - 2020-12-14 + +### Commits + +- [Tests] use shared travis-ci configs [`8674582`](https://github.com/inspect-js/which-boxed-primitive/commit/86745829b6a92cff2cfb0d3c0414ec9afdc2a087) +- [Tests] migrate tests to Github Actions [`dff6643`](https://github.com/inspect-js/which-boxed-primitive/commit/dff6643405ba4d6dc6694a25904c8f72f273ece8) +- [meta] do not publish github action workflow files [`b26112a`](https://github.com/inspect-js/which-boxed-primitive/commit/b26112a4e4ac6beec8f54c734135dbf9e9ba16f9) +- [meta] make `auto-changelog` config consistent [`8d10175`](https://github.com/inspect-js/which-boxed-primitive/commit/8d10175171154cd6c8f8a016aa7fb71b5044acf6) +- [readme] fix repo URLs, remove defunct badges [`ab8db24`](https://github.com/inspect-js/which-boxed-primitive/commit/ab8db247573723dbcda68469118d08c7c2692c67) +- [Tests] run `nyc` on all tests; use `tape` runner [`7d084df`](https://github.com/inspect-js/which-boxed-primitive/commit/7d084dfc5251230e9399a81782c0b9d7ae5d1901) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`576f6f3`](https://github.com/inspect-js/which-boxed-primitive/commit/576f6f308aed35ef1d3392bb9472def59482ed13) +- [actions] add automatic rebasing / merge commit blocking [`97efa53`](https://github.com/inspect-js/which-boxed-primitive/commit/97efa53a307678323e63f576c07db9ff84846fd3) +- [actions] add "Allow Edits" workflow [`fb1b4f7`](https://github.com/inspect-js/which-boxed-primitive/commit/fb1b4f7cd753fcced74ac054b20c8b2bfafe7953) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols`, `object-inspect`, `safe-publish-latest` [`1e03c61`](https://github.com/inspect-js/which-boxed-primitive/commit/1e03c6153693d385833acc15178f675e6ce5ddd0) +- [Deps] update `is-boolean-object`, `is-number-object`, `is-string`, `is-symbol` [`13673df`](https://github.com/inspect-js/which-boxed-primitive/commit/13673dff6e43f0a915377c3e5740ec24e86d6bb7) +- [Dev Deps] update `auto-changelog`, `in-publish`, `tape` [`65a0e15`](https://github.com/inspect-js/which-boxed-primitive/commit/65a0e155fc46a9237692233a51ec9573621135d2) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`f8a0afe`](https://github.com/inspect-js/which-boxed-primitive/commit/f8a0afea82938d64f3d2d240268afbd346d0c4da) +- [Deps] update `is-bigint`, `is-boolean-object` [`e7a1ce2`](https://github.com/inspect-js/which-boxed-primitive/commit/e7a1ce25371c00ee726f1c0cc5b6acf10d51ec50) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`e46f193`](https://github.com/inspect-js/which-boxed-primitive/commit/e46f193298b158db5c8aba889803513e4ee38957) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`df3da14`](https://github.com/inspect-js/which-boxed-primitive/commit/df3da1424552a5d22e203a0abf1710106bfd4ae2) +- [Dev Deps] update `auto-changelog`; add `aud` [`e2e8a12`](https://github.com/inspect-js/which-boxed-primitive/commit/e2e8a12c6fbf8c48e760ea1d1ccd5e8d2d6fbf24) +- [meta] add `funding` field [`7df404b`](https://github.com/inspect-js/which-boxed-primitive/commit/7df404b20cd50b2b87e6645b130fefa8ee98810e) +- [Dev Deps] update `auto-changelog` [`0d6b76d`](https://github.com/inspect-js/which-boxed-primitive/commit/0d6b76dbbe760581fa86a0c3f254988fe5d27770) +- [Tests] only audit prod deps [`246151c`](https://github.com/inspect-js/which-boxed-primitive/commit/246151cc1407b3b1ef42014db993f62670bd82ff) +- [meta] fix changelog [`c2d1685`](https://github.com/inspect-js/which-boxed-primitive/commit/c2d16856deffbf86e0b5029e69b65d8aa758ec3d) +- [readme] Fix spelling error [`25fb2b5`](https://github.com/inspect-js/which-boxed-primitive/commit/25fb2b56e1f708c6364923e4bae384f818ecf57f) + +## [v1.0.1](https://github.com/inspect-js/which-boxed-primitive/compare/v1.0.0...v1.0.1) - 2019-08-10 + +### Commits + +- [meta] avoid running `safe-publish-latest` when not publishing [`df44b27`](https://github.com/inspect-js/which-boxed-primitive/commit/df44b27875a8f5c3c596663ecb4a063f9fc7bde3) + +## v1.0.0 - 2019-08-10 + +### Commits + +- [Tests] add `.travis.yml` [`764b0cf`](https://github.com/inspect-js/which-boxed-primitive/commit/764b0cf75f8d2b3a0ad2056de5f4ad85d5d1b765) +- Initial commit [`da7d068`](https://github.com/inspect-js/which-boxed-primitive/commit/da7d068913d591294bf155db5d438f7804d71b9a) +- readme [`1395bb2`](https://github.com/inspect-js/which-boxed-primitive/commit/1395bb27b72137ac01e48ee398a0f54e93fd87f5) +- [Tests] add tests [`0ff580f`](https://github.com/inspect-js/which-boxed-primitive/commit/0ff580f99579cd4424af7b814bd76fcb69a2b04e) +- implementation [`8811c32`](https://github.com/inspect-js/which-boxed-primitive/commit/8811c3262a57963634cdc83ceb5bb2c5e9ae4e7e) +- npm init [`cffdea9`](https://github.com/inspect-js/which-boxed-primitive/commit/cffdea9755eabfa2f9ec62a6fcbce0c28f04495b) +- [Tests] add `npm run lint` [`a8be993`](https://github.com/inspect-js/which-boxed-primitive/commit/a8be9933fec1b21267acd847df77f6438e07e3b9) +- [meta] add FUNDING.yml [`941258c`](https://github.com/inspect-js/which-boxed-primitive/commit/941258c70c9a397466e05b614126cb8c7be77b99) +- Only apps should have lockfiles [`6857316`](https://github.com/inspect-js/which-boxed-primitive/commit/68573165d8ce842cdf15d94af82f8cccb961b8cf) +- [Tests] use `npx aud` in `posttest` [`ee48a91`](https://github.com/inspect-js/which-boxed-primitive/commit/ee48a9144bea23bde5cc47788a54d5aa7969d489) diff --git a/node_modules/which-boxed-primitive/LICENSE b/node_modules/which-boxed-primitive/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/node_modules/which-boxed-primitive/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +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/which-boxed-primitive/README.md b/node_modules/which-boxed-primitive/README.md new file mode 100644 index 0000000..e08f26a --- /dev/null +++ b/node_modules/which-boxed-primitive/README.md @@ -0,0 +1,73 @@ +# which-boxed-primitive [![Version Badge][2]][1] + +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Which kind of boxed JS primitive is this? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and works despite ES6 Symbol.toStringTag. + +## Example + +```js +var whichBoxedPrimitive = require('which-boxed-primitive'); +var assert = require('assert'); + +// unboxed primitives return `null` +// boxed primitives return the builtin constructor name + +assert.equal(whichBoxedPrimitive(undefined), null); +assert.equal(whichBoxedPrimitive(null), null); + +assert.equal(whichBoxedPrimitive(false), null); +assert.equal(whichBoxedPrimitive(true), null); +assert.equal(whichBoxedPrimitive(new Boolean(false)), 'Boolean'); +assert.equal(whichBoxedPrimitive(new Boolean(true)), 'Boolean'); + +assert.equal(whichBoxedPrimitive(42), null); +assert.equal(whichBoxedPrimitive(NaN), null); +assert.equal(whichBoxedPrimitive(Infinity), null); +assert.equal(whichBoxedPrimitive(new Number(42)), 'Number'); +assert.equal(whichBoxedPrimitive(new Number(NaN)), 'Number'); +assert.equal(whichBoxedPrimitive(new Number(Infinity)), 'Number'); + +assert.equal(whichBoxedPrimitive(''), null); +assert.equal(whichBoxedPrimitive('foo'), null); +assert.equal(whichBoxedPrimitive(new String('')), 'String'); +assert.equal(whichBoxedPrimitive(new String('foo')), 'String'); + +assert.equal(whichBoxedPrimitive(Symbol()), null); +assert.equal(whichBoxedPrimitive(Object(Symbol()), 'Symbol'); + +assert.equal(whichBoxedPrimitive(42n), null); +assert.equal(whichBoxedPrimitive(Object(42n), 'BigInt'); + +// non-boxed-primitive objects return `undefined` +assert.equal(whichBoxedPrimitive([]), undefined); +assert.equal(whichBoxedPrimitive({}), undefined); +assert.equal(whichBoxedPrimitive(/a/g), undefined); +assert.equal(whichBoxedPrimitive(new RegExp('a', 'g')), undefined); +assert.equal(whichBoxedPrimitive(new Date()), undefined); +assert.equal(whichBoxedPrimitive(function () {}), undefined); +assert.equal(whichBoxedPrimitive(function* () {}), undefined); +assert.equal(whichBoxedPrimitive(x => x * x), undefined); +assert.equal(whichBoxedPrimitive([]), undefined); + +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/which-boxed-primitive +[2]: https://versionbadg.es/inspect-js/which-boxed-primitive.svg +[5]: https://david-dm.org/inspect-js/which-boxed-primitive.svg +[6]: https://david-dm.org/inspect-js/which-boxed-primitive +[7]: https://david-dm.org/inspect-js/which-boxed-primitive/dev-status.svg +[8]: https://david-dm.org/inspect-js/which-boxed-primitive#info=devDependencies +[11]: https://nodei.co/npm/which-boxed-primitive.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/which-boxed-primitive.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/which-boxed-primitive.svg +[downloads-url]: https://npm-stat.com/charts.html?package=which-boxed-primitive diff --git a/node_modules/which-boxed-primitive/index.js b/node_modules/which-boxed-primitive/index.js new file mode 100644 index 0000000..f8ea564 --- /dev/null +++ b/node_modules/which-boxed-primitive/index.js @@ -0,0 +1,30 @@ +'use strict'; + +var isString = require('is-string'); +var isNumber = require('is-number-object'); +var isBoolean = require('is-boolean-object'); +var isSymbol = require('is-symbol'); +var isBigInt = require('is-bigint'); + +// eslint-disable-next-line consistent-return +module.exports = function whichBoxedPrimitive(value) { + // eslint-disable-next-line eqeqeq + if (value == null || (typeof value !== 'object' && typeof value !== 'function')) { + return null; + } + if (isString(value)) { + return 'String'; + } + if (isNumber(value)) { + return 'Number'; + } + if (isBoolean(value)) { + return 'Boolean'; + } + if (isSymbol(value)) { + return 'Symbol'; + } + if (isBigInt(value)) { + return 'BigInt'; + } +}; diff --git a/node_modules/which-boxed-primitive/package.json b/node_modules/which-boxed-primitive/package.json new file mode 100644 index 0000000..0ef53eb --- /dev/null +++ b/node_modules/which-boxed-primitive/package.json @@ -0,0 +1,65 @@ +{ + "name": "which-boxed-primitive", + "version": "1.0.2", + "description": "Which kind of boxed JS primitive is this?", + "main": "index.js", + "scripts": { + "preversion": "auto-changelog", + "prepublish": "not-in-publish || safe-publish-latest", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "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/which-boxed-primitive.git" + }, + "keywords": [ + "boxed", + "primitive", + "object", + "ecmascript", + "javascript", + "which" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/which-boxed-primitive/issues" + }, + "homepage": "https://github.com/inspect-js/which-boxed-primitive#readme", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.3.0", + "aud": "^1.1.3", + "auto-changelog": "^2.2.1", + "eslint": "^7.15.0", + "has-symbols": "^1.0.1", + "in-publish": "^2.0.1", + "nyc": "^10.3.2", + "object-inspect": "^1.9.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.0.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/node_modules/which-boxed-primitive/test/index.js b/node_modules/which-boxed-primitive/test/index.js new file mode 100644 index 0000000..f9ea998 --- /dev/null +++ b/node_modules/which-boxed-primitive/test/index.js @@ -0,0 +1,66 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var whichBoxedPrimitive = require('..'); + +var debug = function (v, m) { return inspect(v) + ' ' + m; }; + +var forEach = function (arr, func) { + var i; + for (i = 0; i < arr.length; ++i) { + func(arr[i], i, arr); + } +}; + +var hasSymbols = require('has-symbols')(); +var hasBigInts = typeof BigInt === 'function'; + +var primitives = [ + true, + false, + 42, + NaN, + Infinity, + '', + 'foo' +].concat( + hasSymbols ? [Symbol(), Symbol.iterator] : [], + hasBigInts ? BigInt(42) : [] +); + +var objects = [ + /a/g, + new Date(), + function () {}, + [], + {} +]; + +test('isBoxedPrimitive', function (t) { + t.test('unboxed primitives', function (st) { + forEach([null, undefined].concat(primitives), function (primitive) { + st.equal(null, whichBoxedPrimitive(primitive), debug(primitive, 'is a primitive, but not a boxed primitive')); + }); + st.end(); + }); + + t.test('boxed primitives', function (st) { + forEach(primitives, function (primitive) { + var boxed = Object(primitive); + var expected = boxed.constructor.name; + st.equal(typeof expected, 'string', 'expected is string'); + st.equal(whichBoxedPrimitive(boxed), expected, debug(boxed, 'is a boxed primitive: ' + expected)); + }); + st.end(); + }); + + t.test('non-primitive objects', function (st) { + forEach(objects, function (object) { + st.equal(undefined, whichBoxedPrimitive(object), debug(object, 'is not a primitive, boxed or otherwise')); + }); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/which/CHANGELOG.md b/node_modules/which/CHANGELOG.md new file mode 100644 index 0000000..7fb1f20 --- /dev/null +++ b/node_modules/which/CHANGELOG.md @@ -0,0 +1,166 @@ +# Changes + + +## 2.0.2 + +* Rename bin to `node-which` + +## 2.0.1 + +* generate changelog and publish on version bump +* enforce 100% test coverage +* Promise interface + +## 2.0.0 + +* Parallel tests, modern JavaScript, and drop support for node < 8 + +## 1.3.1 + +* update deps +* update travis + +## v1.3.0 + +* Add nothrow option to which.sync +* update tap + +## v1.2.14 + +* appveyor: drop node 5 and 0.x +* travis-ci: add node 6, drop 0.x + +## v1.2.13 + +* test: Pass missing option to pass on windows +* update tap +* update isexe to 2.0.0 +* neveragain.tech pledge request + +## v1.2.12 + +* Removed unused require + +## v1.2.11 + +* Prevent changelog script from being included in package + +## v1.2.10 + +* Use env.PATH only, not env.Path + +## v1.2.9 + +* fix for paths starting with ../ +* Remove unused `is-absolute` module + +## v1.2.8 + +* bullet items in changelog that contain (but don't start with) # + +## v1.2.7 + +* strip 'update changelog' changelog entries out of changelog + +## v1.2.6 + +* make the changelog bulleted + +## v1.2.5 + +* make a changelog, and keep it up to date +* don't include tests in package +* Properly handle relative-path executables +* appveyor +* Attach error code to Not Found error +* Make tests pass on Windows + +## v1.2.4 + +* Fix typo + +## v1.2.3 + +* update isexe, fix regression in pathExt handling + +## v1.2.2 + +* update deps, use isexe module, test windows + +## v1.2.1 + +* Sometimes windows PATH entries are quoted +* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode. +* doc cli + +## v1.2.0 + +* Add support for opt.all and -as cli flags +* test the bin +* update travis +* Allow checking for multiple programs in bin/which +* tap 2 + +## v1.1.2 + +* travis +* Refactored and fixed undefined error on Windows +* Support strict mode + +## v1.1.1 + +* test +g exes against secondary groups, if available +* Use windows exe semantics on cygwin & msys +* cwd should be first in path on win32, not last +* Handle lower-case 'env.Path' on Windows +* Update docs +* use single-quotes + +## v1.1.0 + +* Add tests, depend on is-absolute + +## v1.0.9 + +* which.js: root is allowed to execute files owned by anyone + +## v1.0.8 + +* don't use graceful-fs + +## v1.0.7 + +* add license to package.json + +## v1.0.6 + +* isc license + +## 1.0.5 + +* Awful typo + +## 1.0.4 + +* Test for path absoluteness properly +* win: Allow '' as a pathext if cmd has a . in it + +## 1.0.3 + +* Remove references to execPath +* Make `which.sync()` work on Windows by honoring the PATHEXT variable. +* Make `isExe()` always return true on Windows. +* MIT + +## 1.0.2 + +* Only files can be exes + +## 1.0.1 + +* Respect the PATHEXT env for win32 support +* should 0755 the bin +* binary +* guts +* package +* 1st diff --git a/node_modules/which/LICENSE b/node_modules/which/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/which/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/which/README.md b/node_modules/which/README.md new file mode 100644 index 0000000..cd83350 --- /dev/null +++ b/node_modules/which/README.md @@ -0,0 +1,54 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// or promise +which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... }) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +resolved = which.sync('node', {nothrow: true}) + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## CLI USAGE + +Same as the BSD `which(1)` binary. + +``` +usage: which [-as] program ... +``` + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/node_modules/which/bin/node-which b/node_modules/which/bin/node-which new file mode 100755 index 0000000..7cee372 --- /dev/null +++ b/node_modules/which/bin/node-which @@ -0,0 +1,52 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) + usage() + +function usage () { + console.error('usage: which [-as] program ...') + process.exit(1) +} + +var all = false +var silent = false +var dashdash = false +var args = process.argv.slice(2).filter(function (arg) { + if (dashdash || !/^-/.test(arg)) + return true + + if (arg === '--') { + dashdash = true + return false + } + + var flags = arg.substr(1).split('') + for (var f = 0; f < flags.length; f++) { + var flag = flags[f] + switch (flag) { + case 's': + silent = true + break + case 'a': + all = true + break + default: + console.error('which: illegal option -- ' + flag) + usage() + } + } + return false +}) + +process.exit(args.reduce(function (pv, current) { + try { + var f = which.sync(current, { all: all }) + if (all) + f = f.join('\n') + if (!silent) + console.log(f) + return pv; + } catch (e) { + return 1; + } +}, 0)) diff --git a/node_modules/which/package.json b/node_modules/which/package.json new file mode 100644 index 0000000..97ad7fb --- /dev/null +++ b/node_modules/which/package.json @@ -0,0 +1,43 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "2.0.2", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": { + "node-which": "./bin/node-which" + }, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.6.2", + "tap": "^14.6.9" + }, + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublish": "npm run changelog", + "prechangelog": "bash gen-changelog.sh", + "changelog": "git add CHANGELOG.md", + "postchangelog": "git commit -m 'update changelog - '${npm_package_version}", + "postpublish": "git push origin --follow-tags" + }, + "files": [ + "which.js", + "bin/node-which" + ], + "tap": { + "check-coverage": true + }, + "engines": { + "node": ">= 8" + } +} diff --git a/node_modules/which/which.js b/node_modules/which/which.js new file mode 100644 index 0000000..82afffd --- /dev/null +++ b/node_modules/which/which.js @@ -0,0 +1,125 @@ +const isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +const path = require('path') +const COLON = isWindows ? ';' : ':' +const isexe = require('isexe') + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] + : ( + [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(opt.path || process.env.PATH || + /* istanbul ignore next: very unusual */ '').split(colon), + ] + ) + const pathExtExe = isWindows + ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' + : '' + const pathExt = isWindows ? pathExtExe.split(colon) : [''] + + if (isWindows) { + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + return { + pathEnv, + pathExt, + pathExtExe, + } +} + +const which = (cmd, opt, cb) => { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + if (!opt) + opt = {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + const step = i => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) + : reject(getNotFoundError(cmd)) + + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + resolve(subStep(p, i, 0)) + }) + + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)) + const ext = pathExt[ii] + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return resolve(p + ext) + } + return resolve(subStep(p, i, ii + 1)) + }) + }) + + return cb ? step(0).then(res => cb(null, res), cb) : step(0) +} + +const whichSync = (cmd, opt) => { + opt = opt || {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (let i = 0; i < pathEnv.length; i ++) { + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + for (let j = 0; j < pathExt.length; j ++) { + const cur = p + pathExt[j] + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync diff --git a/node_modules/word-wrap/LICENSE b/node_modules/word-wrap/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/word-wrap/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert + +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/word-wrap/README.md b/node_modules/word-wrap/README.md new file mode 100644 index 0000000..88b9684 --- /dev/null +++ b/node_modules/word-wrap/README.md @@ -0,0 +1,182 @@ +# word-wrap [![NPM version](https://img.shields.io/npm/v/word-wrap.svg?style=flat)](https://www.npmjs.com/package/word-wrap) [![NPM monthly downloads](https://img.shields.io/npm/dm/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![NPM total downloads](https://img.shields.io/npm/dt/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/word-wrap.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/word-wrap) + +> Wrap words to a specified length. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save word-wrap +``` + +## Usage + +```js +var wrap = require('word-wrap'); + +wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); +``` + +Results in: + +``` + Lorem ipsum dolor sit amet, consectetur adipiscing + elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. +``` + +## Options + +![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png) + +### options.width + +Type: `Number` + +Default: `50` + +The width of the text before wrapping to a new line. + +**Example:** + +```js +wrap(str, {width: 60}); +``` + +### options.indent + +Type: `String` + +Default: `` (two spaces) + +The string to use at the beginning of each line. + +**Example:** + +```js +wrap(str, {indent: ' '}); +``` + +### options.newline + +Type: `String` + +Default: `\n` + +The string to use at the end of each line. + +**Example:** + +```js +wrap(str, {newline: '\n\n'}); +``` + +### options.escape + +Type: `function` + +Default: `function(str){return str;}` + +An escape function to run on each line after splitting them. + +**Example:** + +```js +var xmlescape = require('xml-escape'); +wrap(str, { + escape: function(string){ + return xmlescape(string); + } +}); +``` + +### options.trim + +Type: `Boolean` + +Default: `false` + +Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line. + +**Example:** + +```js +wrap(str, {trim: true}); +``` + +### options.cut + +Type: `Boolean` + +Default: `false` + +Break a word between any two letters when the word is longer than the specified width. + +**Example:** + +```js +wrap(str, {cut: true}); +``` + +## About + +### Related projects + +* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.") +* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.") +* [unique-words](https://www.npmjs.com/package/unique-words): Return the unique words in a string or array. | [homepage](https://github.com/jonschlinkert/unique-words "Return the unique words in a string or array.") +* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 43 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [lordvlad](https://github.com/lordvlad) | +| 2 | [hildjj](https://github.com/hildjj) | +| 1 | [danilosampaio](https://github.com/danilosampaio) | +| 1 | [2fd](https://github.com/2fd) | +| 1 | [toddself](https://github.com/toddself) | +| 1 | [wolfgang42](https://github.com/wolfgang42) | +| 1 | [zachhale](https://github.com/zachhale) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._ \ No newline at end of file diff --git a/node_modules/word-wrap/index.d.ts b/node_modules/word-wrap/index.d.ts new file mode 100644 index 0000000..54ee5f2 --- /dev/null +++ b/node_modules/word-wrap/index.d.ts @@ -0,0 +1,50 @@ +/** + * Wrap words to a specified length. + */ +export = wrap; + +declare function wrap(str: string, options?: wrap.IOptions): string; + +declare namespace wrap { + export interface IOptions { + + /** + * The width of the text before wrapping to a new line. + * @default ´50´ + */ + width?: number; + + /** + * The string to use at the beginning of each line. + * @default ´ ´ (two spaces) + */ + indent?: string; + + /** + * The string to use at the end of each line. + * @default ´\n´ + */ + newline?: string; + + /** + * An escape function to run on each line after splitting them. + * @default (str: string) => string; + */ + escape?: (str: string) => string; + + /** + * Trim trailing whitespace from the returned string. + * This option is included since .trim() would also strip + * the leading indentation from the first line. + * @default true + */ + trim?: boolean; + + /** + * Break a word between any two letters when the word is longer + * than the specified width. + * @default false + */ + cut?: boolean; + } +} \ No newline at end of file diff --git a/node_modules/word-wrap/index.js b/node_modules/word-wrap/index.js new file mode 100644 index 0000000..45373c6 --- /dev/null +++ b/node_modules/word-wrap/index.js @@ -0,0 +1,46 @@ +/*! + * word-wrap + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +module.exports = function(str, options) { + options = options || {}; + if (str == null) { + return str; + } + + var width = options.width || 50; + var indent = (typeof options.indent === 'string') + ? options.indent + : ' '; + + var newline = options.newline || '\n' + indent; + var escape = typeof options.escape === 'function' + ? options.escape + : identity; + + var regexString = '.{1,' + width + '}'; + if (options.cut !== true) { + regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)'; + } + + var re = new RegExp(regexString, 'g'); + var lines = str.match(re) || []; + var result = indent + lines.map(function(line) { + if (line.slice(-1) === '\n') { + line = line.slice(0, line.length - 1); + } + return escape(line); + }).join(newline); + + if (options.trim === true) { + result = result.replace(/[ \t]*$/gm, ''); + } + return result; +}; + +function identity(str) { + return str; +} diff --git a/node_modules/word-wrap/package.json b/node_modules/word-wrap/package.json new file mode 100644 index 0000000..6f8f633 --- /dev/null +++ b/node_modules/word-wrap/package.json @@ -0,0 +1,77 @@ +{ + "name": "word-wrap", + "description": "Wrap words to a specified length.", + "version": "1.2.3", + "homepage": "https://github.com/jonschlinkert/word-wrap", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Danilo Sampaio (localhost:8080)", + "Fede Ramirez (https://2fd.github.io)", + "Joe Hildebrand (https://twitter.com/hildjj)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Todd Kennedy (https://tck.io)", + "Waldemar Reusch (https://github.com/lordvlad)", + "Wolfgang Faust (http://www.linestarve.com)", + "Zach Hale (http://zachhale.com)" + ], + "repository": "jonschlinkert/word-wrap", + "bugs": { + "url": "https://github.com/jonschlinkert/word-wrap/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "index.d.ts" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.2.0" + }, + "keywords": [ + "break", + "carriage", + "line", + "new-line", + "newline", + "return", + "soft", + "text", + "word", + "word-wrap", + "words", + "wrap" + ], + "typings": "index.d.ts", + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "common-words", + "shuffle-words", + "unique-words", + "wordcount" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + } +} diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/wrappy/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/wrappy/README.md b/node_modules/wrappy/README.md new file mode 100644 index 0000000..98eab25 --- /dev/null +++ b/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json new file mode 100644 index 0000000..1307520 --- /dev/null +++ b/node_modules/wrappy/package.json @@ -0,0 +1,29 @@ +{ + "name": "wrappy", + "version": "1.0.2", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "files": [ + "wrappy.js" + ], + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^2.3.1" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy" +} diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js new file mode 100644 index 0000000..bb7e7d6 --- /dev/null +++ b/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/yallist/LICENSE b/node_modules/yallist/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/yallist/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/yallist/README.md b/node_modules/yallist/README.md new file mode 100644 index 0000000..f586101 --- /dev/null +++ b/node_modules/yallist/README.md @@ -0,0 +1,204 @@ +# yallist + +Yet Another Linked List + +There are many doubly-linked list implementations like it, but this +one is mine. + +For when an array would be too big, and a Map can't be iterated in +reverse order. + + +[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) + +## basic usage + +```javascript +var yallist = require('yallist') +var myList = yallist.create([1, 2, 3]) +myList.push('foo') +myList.unshift('bar') +// of course pop() and shift() are there, too +console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] +myList.forEach(function (k) { + // walk the list head to tail +}) +myList.forEachReverse(function (k, index, list) { + // walk the list tail to head +}) +var myDoubledList = myList.map(function (k) { + return k + k +}) +// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] +// mapReverse is also a thing +var myDoubledListReverse = myList.mapReverse(function (k) { + return k + k +}) // ['foofoo', 6, 4, 2, 'barbar'] + +var reduced = myList.reduce(function (set, entry) { + set += entry + return set +}, 'start') +console.log(reduced) // 'startfoo123bar' +``` + +## api + +The whole API is considered "public". + +Functions with the same name as an Array method work more or less the +same way. + +There's reverse versions of most things because that's the point. + +### Yallist + +Default export, the class that holds and manages a list. + +Call it with either a forEach-able (like an array) or a set of +arguments, to initialize the list. + +The Array-ish methods all act like you'd expect. No magic length, +though, so if you change that it won't automatically prune or add +empty spots. + +### Yallist.create(..) + +Alias for Yallist function. Some people like factories. + +#### yallist.head + +The first node in the list + +#### yallist.tail + +The last node in the list + +#### yallist.length + +The number of nodes in the list. (Change this at your peril. It is +not magic like Array length.) + +#### yallist.toArray() + +Convert the list to an array. + +#### yallist.forEach(fn, [thisp]) + +Call a function on each item in the list. + +#### yallist.forEachReverse(fn, [thisp]) + +Call a function on each item in the list, in reverse order. + +#### yallist.get(n) + +Get the data at position `n` in the list. If you use this a lot, +probably better off just using an Array. + +#### yallist.getReverse(n) + +Get the data at position `n`, counting from the tail. + +#### yallist.map(fn, thisp) + +Create a new Yallist with the result of calling the function on each +item. + +#### yallist.mapReverse(fn, thisp) + +Same as `map`, but in reverse. + +#### yallist.pop() + +Get the data from the list tail, and remove the tail from the list. + +#### yallist.push(item, ...) + +Insert one or more items to the tail of the list. + +#### yallist.reduce(fn, initialValue) + +Like Array.reduce. + +#### yallist.reduceReverse + +Like Array.reduce, but in reverse. + +#### yallist.reverse + +Reverse the list in place. + +#### yallist.shift() + +Get the data from the list head, and remove the head from the list. + +#### yallist.slice([from], [to]) + +Just like Array.slice, but returns a new Yallist. + +#### yallist.sliceReverse([from], [to]) + +Just like yallist.slice, but the result is returned in reverse. + +#### yallist.toArray() + +Create an array representation of the list. + +#### yallist.toArrayReverse() + +Create a reversed array representation of the list. + +#### yallist.unshift(item, ...) + +Insert one or more items to the head of the list. + +#### yallist.unshiftNode(node) + +Move a Node object to the front of the list. (That is, pull it out of +wherever it lives, and make it the new head.) + +If the node belongs to a different list, then that list will remove it +first. + +#### yallist.pushNode(node) + +Move a Node object to the end of the list. (That is, pull it out of +wherever it lives, and make it the new tail.) + +If the node belongs to a list already, then that list will remove it +first. + +#### yallist.removeNode(node) + +Remove a node from the list, preserving referential integrity of head +and tail and other nodes. + +Will throw an error if you try to have a list remove a node that +doesn't belong to it. + +### Yallist.Node + +The class that holds the data and is actually the list. + +Call with `var n = new Node(value, previousNode, nextNode)` + +Note that if you do direct operations on Nodes themselves, it's very +easy to get into weird states where the list is broken. Be careful :) + +#### node.next + +The next node in the list. + +#### node.prev + +The previous node in the list. + +#### node.value + +The data the node contains. + +#### node.list + +The list to which this node belongs. (Null if it does not belong to +any list.) diff --git a/node_modules/yallist/iterator.js b/node_modules/yallist/iterator.js new file mode 100644 index 0000000..d41c97a --- /dev/null +++ b/node_modules/yallist/iterator.js @@ -0,0 +1,8 @@ +'use strict' +module.exports = function (Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } + } +} diff --git a/node_modules/yallist/package.json b/node_modules/yallist/package.json new file mode 100644 index 0000000..8a08386 --- /dev/null +++ b/node_modules/yallist/package.json @@ -0,0 +1,29 @@ +{ + "name": "yallist", + "version": "4.0.0", + "description": "Yet Another Linked List", + "main": "yallist.js", + "directories": { + "test": "test" + }, + "files": [ + "yallist.js", + "iterator.js" + ], + "dependencies": {}, + "devDependencies": { + "tap": "^12.1.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/node_modules/yallist/yallist.js b/node_modules/yallist/yallist.js new file mode 100644 index 0000000..4e83ab1 --- /dev/null +++ b/node_modules/yallist/yallist.js @@ -0,0 +1,426 @@ +'use strict' +module.exports = Yallist + +Yallist.Node = Node +Yallist.create = Yallist + +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } + + self.tail = null + self.head = null + self.length = 0 + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) + } + } + + return self +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next + var prev = node.prev + + if (next) { + next.prev = prev + } + + if (prev) { + prev.next = next + } + + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } + + node.list.length-- + node.next = null + node.prev = null + node.list = null + + return next +} + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } + + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } + + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null + } + this.length-- + return res +} + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null + } + this.length-- + return res +} + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next + } +} + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev + } +} + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev + } + return res +} + +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } + + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } + + return acc +} + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev + } + return arr +} + +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1 + } + if (start < 0) { + start = this.length + start; + } + + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next + } + + var ret = [] + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value) + walker = this.removeNode(walker) + } + if (walker === null) { + walker = this.tail + } + + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev + } + + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]) + } + return ret; +} + +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p + } + this.head = tail + this.tail = head + return this +} + +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self) + + if (inserted.next === null) { + self.tail = inserted + } + if (inserted.prev === null) { + self.head = inserted + } + + self.length++ + + return inserted +} + +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail + } + self.length++ +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list + this.value = value + + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null + } + + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} + +try { + // add if support for Symbol.iterator is present + require('./iterator.js')(Yallist) +} catch (er) {} diff --git a/package-lock.json b/package-lock.json index 109e7e8..8bbe059 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,107 @@ "express": "^4.18.1", "marked": "^4.0.17", "node-fetch": "^2.6.7" + }, + "devDependencies": { + "eslint": "^8.18.0", + "eslint-config-standard": "^17.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.2.3", + "eslint-plugin-promise": "^6.0.0" } }, + "node_modules/@eslint/eslintrc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", + "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.2", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -27,6 +126,52 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -41,11 +186,54 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/array-includes": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -88,6 +276,15 @@ "concat-map": "0.0.1" } }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -108,6 +305,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -176,6 +382,20 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -184,6 +404,28 @@ "ms": "2.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dev": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -201,6 +443,18 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -228,11 +482,464 @@ "node": ">= 0.8" } }, + "node_modules/es-abstract": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", + "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.3.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.2", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-standard": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peerDependencies": { + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-module-utils": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-n": { + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz", + "integrity": "sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw==", + "dev": true, + "dependencies": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-promise": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", + "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/espree": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "dev": true, + "dependencies": { + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -282,6 +989,36 @@ "node": ">= 0.10.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -326,6 +1063,37 @@ "node": ">= 0.8" } }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -342,11 +1110,50 @@ "node": ">= 0.6" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-intrinsic": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", @@ -360,6 +1167,69 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -371,6 +1241,15 @@ "node": ">= 0.4.0" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -379,6 +1258,18 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -390,6 +1281,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -416,11 +1322,69 @@ "node": ">=0.10.0" } }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -429,6 +1393,197 @@ "node": ">= 0.10" } }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/jake": { "version": "10.8.5", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", @@ -446,6 +1601,86 @@ "node": ">=10" } }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/marked": { "version": "4.0.17", "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz", @@ -519,11 +1754,23 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -559,6 +1806,50 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -570,6 +1861,77 @@ "node": ">= 0.8" } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -578,11 +1940,53 @@ "node": ">= 0.8" } }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -595,6 +1999,15 @@ "node": ">= 0.10" } }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", @@ -631,6 +2044,76 @@ "node": ">= 0.8" } }, + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -655,6 +2138,21 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -702,6 +2200,27 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -723,6 +2242,67 @@ "node": ">= 0.8" } }, + "node_modules/string.prototype.trimend": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -734,6 +2314,24 @@ "node": ">=8" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -747,6 +2345,42 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/tsconfig-paths": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -759,6 +2393,21 @@ "node": ">= 0.6" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -767,6 +2416,15 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -775,6 +2433,12 @@ "node": ">= 0.4.0" } }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -796,9 +2460,135 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } }, "dependencies": { + "@eslint/eslintrc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", + "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.2", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -808,6 +2598,37 @@ "negotiator": "0.6.3" } }, + "acorn": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -816,11 +2637,42 @@ "color-convert": "^2.0.1" } }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "array-includes": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", + "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } + }, + "array.prototype.flat": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", + "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.2", + "es-shim-unscopables": "^1.0.0" + } + }, "async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -859,6 +2711,15 @@ "concat-map": "0.0.1" } }, + "builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "requires": { + "semver": "^7.0.0" + } + }, "bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -873,6 +2734,12 @@ "get-intrinsic": "^1.0.2" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -923,6 +2790,17 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -931,6 +2809,22 @@ "ms": "2.0.0" } }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dev": true, + "requires": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -941,6 +2835,15 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -959,11 +2862,345 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, + "es-abstract": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + } + }, + "es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", + "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.3.0", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.2", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "eslint-config-standard": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", + "dev": true, + "requires": {} + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", + "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "find-up": "^2.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" + }, + "dependencies": { + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + } + } + }, + "eslint-plugin-n": { + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz", + "integrity": "sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw==", + "dev": true, + "requires": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + } + }, + "eslint-plugin-promise": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", + "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "dev": true, + "requires": {} + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "dev": true, + "requires": { + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -1007,6 +3244,33 @@ "vary": "~1.1.2" } }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -1047,6 +3311,31 @@ "unpipe": "~1.0.0" } }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1057,11 +3346,41 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "get-intrinsic": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", @@ -1072,6 +3391,48 @@ "has-symbols": "^1.0.3" } }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", + "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1080,16 +3441,40 @@ "function-bind": "^1.1.1" } }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.1" + } + }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -1110,16 +3495,184 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true + }, + "is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "jake": { "version": "10.8.5", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", @@ -1131,6 +3684,71 @@ "minimatch": "^3.0.4" } }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "marked": { "version": "4.0.17", "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz", @@ -1177,11 +3795,23 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -1200,6 +3830,35 @@ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, "on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -1208,16 +3867,102 @@ "ee-first": "1.1.1" } }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1227,6 +3972,12 @@ "ipaddr.js": "1.9.1" } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", @@ -1251,6 +4002,49 @@ "unpipe": "1.0.0" } }, + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1261,6 +4055,15 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -1304,6 +4107,21 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, "side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -1319,6 +4137,49 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" }, + "string.prototype.trimend": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -1327,6 +4188,18 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -1337,6 +4210,33 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "tsconfig-paths": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", + "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1346,16 +4246,43 @@ "mime-types": "~2.1.24" } }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -1374,6 +4301,46 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/package.json b/package.json index 1549c95..b66b130 100644 --- a/package.json +++ b/package.json @@ -22,5 +22,12 @@ "express": "^4.18.1", "marked": "^4.0.17", "node-fetch": "^2.6.7" + }, + "devDependencies": { + "eslint": "^8.18.0", + "eslint-config-standard": "^17.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.2.3", + "eslint-plugin-promise": "^6.0.0" } }